Skip to content

Commit 9050115

Browse files
authored
Migrate plugin to be compatible with OpenSearch Dashboards (opensearch-project#1)
1 parent 19d7f9a commit 9050115

File tree

86 files changed

+629
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+629
-635
lines changed

.cypress/integration/ad/dashboard/ad_dashboard.spec.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,13 @@ context('AD Dashboard', () => {
3131
cy.contains('h2', 'You have no detectors');
3232
});
3333

34-
it('AD dashboard - single stopped detector', () => {
35-
cy.mockGetDetectorOnAction('single_stopped_detector_response.json', () => {
34+
it('AD dashboard - single running detector', () => {
35+
cy.mockGetDetectorOnAction('single_running_detector_response.json', () => {
3636
cy.visit(buildAdAppUrl(DASHBOARD));
3737
});
3838

3939
cy.contains('h3', 'Live anomalies');
40-
cy.contains(
41-
'p',
42-
'All matching detectors are under initialization or stopped for the last 30 minutes. Please adjust filters or come back later.'
43-
);
40+
cy.contains('a', 'running-detector');
4441
});
4542

4643
it('AD dashboard - redirect to create detector', () => {

.cypress/support/commands.ts

+18-22
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Cypress.Commands.add('mockGetDetectorOnAction', function (
5050
funcMockedOn: VoidFunction
5151
) {
5252
cy.server();
53-
cy.route2(buildAdApiUrl(DETECTORS + '*'), {fixture: fixtureFileName}).as(
53+
cy.route2(buildAdApiUrl(DETECTORS + '*'), { fixture: fixtureFileName }).as(
5454
'getDetectors'
5555
);
5656

@@ -64,7 +64,7 @@ Cypress.Commands.add('mockCreateDetectorOnAction', function (
6464
funcMockedOn: VoidFunction
6565
) {
6666
cy.server();
67-
cy.route2(buildAdApiUrl(DETECTORS + '*'), {fixture: fixtureFileName}).as(
67+
cy.route2(buildAdApiUrl(DETECTORS + '*'), { fixture: fixtureFileName }).as(
6868
'createDetector'
6969
);
7070

@@ -78,7 +78,7 @@ Cypress.Commands.add('mockSearchIndexOnAction', function (
7878
funcMockedOn: VoidFunction
7979
) {
8080
cy.server();
81-
cy.route2(buildAdApiUrl(INDICES_PATH + '*'), {fixture: fixtureFileName}).as(
81+
cy.route2(buildAdApiUrl(INDICES_PATH + '*'), { fixture: fixtureFileName }).as(
8282
'getIndices'
8383
);
8484

@@ -92,24 +92,23 @@ Cypress.Commands.add('mockSearchOnAction', function (
9292
funcMockedOn: VoidFunction
9393
) {
9494
cy.server();
95-
cy.route2(buildAdApiUrl(SEARCH_PATH), {fixture: fixtureFileName}).as(
96-
'searchES'
95+
cy.route2(buildAdApiUrl(SEARCH_PATH), { fixture: fixtureFileName }).as(
96+
'searchOpenSearch'
9797
);
9898

9999
funcMockedOn();
100100

101-
cy.wait('@searchES');
101+
cy.wait('@searchOpenSearch');
102102
});
103103

104104
Cypress.Commands.add('mockGetIndexMappingsOnAction', function (
105105
fixtureFileName: string,
106106
funcMockedOn: VoidFunction
107107
) {
108108
cy.server();
109-
cy.route2(
110-
buildAdApiUrl(MAPPINGS_PATH + '*'),
111-
{fixture: fixtureFileName}
112-
).as('getMappings');
109+
cy.route2(buildAdApiUrl(MAPPINGS_PATH + '*'), {
110+
fixture: fixtureFileName,
111+
}).as('getMappings');
113112

114113
funcMockedOn();
115114

@@ -122,10 +121,9 @@ Cypress.Commands.add('mockStartDetectorOnAction', function (
122121
funcMockedOn: VoidFunction
123122
) {
124123
cy.server();
125-
cy.route2(
126-
buildAdApiUrl([DETECTORS, detectorId, START_PATH].join(SLASH)),
127-
{fixture: fixtureFileName}
128-
).as('startDetector');
124+
cy.route2(buildAdApiUrl([DETECTORS, detectorId, START_PATH].join(SLASH)), {
125+
fixture: fixtureFileName,
126+
}).as('startDetector');
129127

130128
funcMockedOn();
131129

@@ -138,10 +136,9 @@ Cypress.Commands.add('mockStopDetectorOnAction', function (
138136
funcMockedOn: VoidFunction
139137
) {
140138
cy.server();
141-
cy.route2(
142-
buildAdApiUrl([DETECTORS, detectorId, STOP_PATH].join(SLASH)),
143-
{fixture: fixtureFileName}
144-
).as('stopDetector');
139+
cy.route2(buildAdApiUrl([DETECTORS, detectorId, STOP_PATH].join(SLASH)), {
140+
fixture: fixtureFileName,
141+
}).as('stopDetector');
145142

146143
funcMockedOn();
147144

@@ -154,10 +151,9 @@ Cypress.Commands.add('mockDeleteDetectorOnAction', function (
154151
funcMockedOn: VoidFunction
155152
) {
156153
cy.server();
157-
cy.route2(
158-
buildAdApiUrl([DETECTORS, detectorId].join(SLASH)),
159-
{fixture: fixtureFileName}
160-
).as('deleteDetector');
154+
cy.route2(buildAdApiUrl([DETECTORS, detectorId].join(SLASH)), {
155+
fixture: fixtureFileName,
156+
}).as('deleteDetector');
161157

162158
funcMockedOn();
163159

.cypress/utils/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
export const AD_URL = 'opendistro-anomaly-detection-kibana#';
16+
export const AD_URL = 'anomaly-detection-dashboards#';
1717
export const APP_URL_PREFIX = 'app';
1818
export const API_URL_PREFIX = 'api';
1919
export const AD_PATH = 'anomaly_detectors';

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ extends: "@elastic/kibana"
44
settings:
55
import/resolver:
66
'@elastic/eslint-import-resolver-kibana':
7-
rootPackageName: 'opendistro-anomaly-detection-kibana'
7+
rootPackageName: 'anomaly-detection-dashboards'
+18-18
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
version: '3'
22
services:
3-
odfe-node1:
4-
image: odfe-ad:test
5-
container_name: odfe-node1
3+
opensearch-node1:
4+
image: opensearch-ad:test
5+
container_name: opensearch-node1
66
environment:
7-
- cluster.name=odfe-cluster
8-
- node.name=odfe-node1
9-
- discovery.seed_hosts=odfe-node1
10-
- cluster.initial_master_nodes=odfe-node1
7+
- cluster.name=opensearch-cluster
8+
- node.name=opensearch-node1
9+
- discovery.seed_hosts=opensearch-node1
10+
- cluster.initial_master_nodes=opensearch-node1
1111
- bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
1212
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m' # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
1313
ulimits:
1414
memlock:
1515
soft: -1
1616
hard: -1
1717
nofile:
18-
soft: 65536 # maximum number of open files for the Elasticsearch user, set to at least 65536 on modern systems
18+
soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
1919
hard: 65536
2020
volumes:
21-
- odfe-data1:/usr/share/elasticsearch/data
21+
- opensearch-data1:/usr/share/opensearch/data
2222
ports:
2323
- 9200:9200
2424
- 9600:9600 # required for Performance Analyzer
2525
expose:
2626
- '9200'
2727
networks:
28-
- odfe-net
29-
kibana:
30-
image: odfe-ad-kibana:test
31-
container_name: odfe-kibana
28+
- opensearch-net
29+
dashboards:
30+
image: opensearch-ad-dashboards:test
31+
container_name: opensearch-dashboards
3232
ports:
3333
- 5601:5601
3434
expose:
3535
- '5601'
3636
environment:
37-
ELASTICSEARCH_URL: https://odfe-node1:9200
38-
ELASTICSEARCH_HOSTS: https://odfe-node1:9200
37+
OPENSEARCH_URL: https://opensearch-node1:9200
38+
OPENSEARCH_HOSTS: https://opensearch-node1:9200
3939
networks:
40-
- odfe-net
40+
- opensearch-net
4141

4242
volumes:
43-
odfe-data1:
43+
opensearch-data1:
4444

4545
networks:
46-
odfe-net:
46+
opensearch-net:

.github/draft-release-notes-config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The overall template of the release notes
22
template: |
3-
Compatible with Kibana (**set version here**).
3+
Compatible with OpenSearch Dashboards (**set version here**).
44
$CHANGES
55
66
# Setting the formatting and sorting for the release notes body
@@ -12,7 +12,7 @@ replacers:
1212
- search: '##'
1313
replace: '###'
1414

15-
# Organizing the tagged PRs into unified ODFE categories
15+
# Organizing the tagged PRs into unified OpenSearch categories
1616
categories:
1717
- title: 'Breaking changes'
1818
labels:
@@ -39,7 +39,7 @@ categories:
3939
- title: 'Maintenance'
4040
labels:
4141
- 'version upgrade'
42-
- 'odfe release'
42+
- 'opensearch release'
4343
- title: 'Refactoring'
4444
labels:
4545
- 'refactor'

.github/workflows/CD.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- v*
66

77
env:
8-
KIBANA_VERSION: 7.10.2
8+
OPENSEARCH_DASHBOARDS_VERSION: 7.10.2
99
jobs:
1010
Build-and-upload:
1111
name: Build and upload artifacts
@@ -18,50 +18,50 @@ jobs:
1818
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
1919
aws-region: us-east-1
2020

21-
- name: Checkout Kibana
21+
- name: Checkout OpenSearch Dashboards
2222
uses: actions/checkout@v2
2323
with:
24-
repository: opendistro-for-elasticsearch/kibana-oss
25-
ref: ${{ env.KIBANA_VERSION }}
26-
token: ${{ secrets.KIBANA_OSS_ACCESS }}
27-
path: kibana
24+
repository: opensearch-project/OpenSearch-Dashboards
25+
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
26+
token: ${{ secrets.OPENSEARCH_DASHBOARDS_OSS_ACCESS }}
27+
path: opensearch-dashboards
2828

2929
- name: Get node and yarn versions
3030
id: versions_step
3131
run: |
32-
echo "::set-output name=node_version::$(node -p "(require('./kibana/package.json').engines.node).match(/[.0-9]+/)[0]")"
33-
echo "::set-output name=yarn_version::$(node -p "(require('./kibana/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
32+
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
33+
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
3434
3535
- name: Setup node
3636
uses: actions/setup-node@v1
3737
with:
3838
node-version: ${{ steps.versions_step.outputs.node_version }}
3939
registry-url: 'https://registry.npmjs.org'
4040

41-
- name: Install correct yarn version for Kibana
41+
- name: Install correct yarn version for OpenSearch Dashboards
4242
run: |
4343
npm uninstall -g yarn
4444
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
4545
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
4646
47-
- name: Checkout Anomaly Detection Kibana plugin
47+
- name: Checkout Anomaly Detection OpenSearch Dashboards plugin
4848
uses: actions/checkout@v2
4949
with:
50-
path: kibana/plugins/anomaly-detection-kibana-plugin
50+
path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
5151

5252
- name: Bootstrap the plugin
5353
run: |
54-
cd kibana/plugins/anomaly-detection-kibana-plugin
55-
yarn kbn bootstrap
54+
cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
55+
yarn osd bootstrap
5656
5757
- name: Build the artifact
5858
run: |
59-
cd kibana/plugins/anomaly-detection-kibana-plugin
59+
cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
6060
yarn build
6161
6262
- name: Upload to S3
6363
run: |
64-
cd kibana/plugins/anomaly-detection-kibana-plugin
64+
cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
6565
zip=`ls build/*.zip`
6666
6767
# Inject the build number before the suffix

0 commit comments

Comments
 (0)