Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge featureAnywhere branch into main #539

Merged
merged 43 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4c56d6d
Add branch constants in CI workflow (#345)
ohltyler Dec 1, 2022
4928c50
Bump decode-uri-component (#359)
ohltyler Dec 16, 2022
45b7e6f
removed duplicate popout icon and ran prettier (#382)
amitgalitz Dec 22, 2022
d57e09e
Change detector out of time range modal warning into a callout warnin…
jackiehanyang Jan 4, 2023
5487605
Fix undefined entity list when heatmap is empty (#383)
ohltyler Jan 4, 2023
00aaaba
Updated MAINTAINERS.md to match recommended opensearch-project format…
dblock Jan 5, 2023
6de242a
Add windows env to integration test workflow (#390)
ohltyler Jan 6, 2023
104ae4d
Bump json5 to 2.2.3 (#393)
ohltyler Jan 6, 2023
9e253ed
Add 2.5 release notes (#395)
ohltyler Jan 10, 2023
e797f2b
Update cold start message (#398)
kaituo Jan 19, 2023
aec5339
upgrade filter bug (#402)
kaituo Jan 30, 2023
4847d12
Changed required minimum intervals in cold start message (#411)
kaituo Feb 9, 2023
ed47e94
Bump @sideway/formula to 3.0.1 (#418)
ohltyler Feb 14, 2023
ec57b1d
Remove auto_expand_replicas override in sample data indices (#423)
ohltyler Feb 15, 2023
071f836
Created untriaged issue workflow. (#422)
dblock Feb 20, 2023
e2f1238
Add 2.6 release notes (#429)
ohltyler Feb 20, 2023
553cbdd
Fix Node.js and Yarn installation in CI (#433)
AMoo-Miki Feb 22, 2023
e9f8eac
run prettier command against all files
jackiehanyang Mar 27, 2023
23c8142
Adding expression function to retrieve anomalies (#448)
amitgalitz May 4, 2023
efef2e2
Register AD as dashboard context menu option (#482)
jackiehanyang May 19, 2023
172f947
Associated detectors flyout through UI actions (#449)
amitgalitz May 22, 2023
cb349ce
Feature anywhere create detector flyout page (#487)
jackiehanyang May 24, 2023
59c2a60
Adding functionality to associate existing detector with a visualizat…
amitgalitz May 26, 2023
5e76e44
switched argument order (#494)
amitgalitz May 26, 2023
9308a4c
add jest transform config (#497)
jackiehanyang May 30, 2023
db4e039
Merging main branch into featureAnywhere (#499)
amitgalitz May 31, 2023
7cd38cf
Unit tests for expression function and additional components (#503)
amitgalitz Jun 8, 2023
6567649
Fix various bugs (#504)
jackiehanyang Jun 8, 2023
b4de09a
Various bug fixes and unit tests for AssociatedDetectors (#505)
amitgalitz Jun 8, 2023
7d24544
make feature anywhere formatted detector name an assgiend value (#506)
jackiehanyang Jun 9, 2023
261df11
various bug fixes for anywhere features (#507)
amitgalitz Jun 12, 2023
c286b8c
add group category and order for context menu (#495)
sikhote Jun 19, 2023
c1a4846
Update Advanced configuration accordion title (#513)
jackiehanyang Jun 20, 2023
01883d2
update categorical field text on Feature Anywhere flyout (#516)
jackiehanyang Jun 27, 2023
bb80536
fixing vis eligibility (#519)
amitgalitz Jun 29, 2023
8e905d1
render embeddable by using vis embeddable (#521)
jackiehanyang Jul 3, 2023
39894dd
Change to anomaly start time; add test ids (#522)
ohltyler Jul 3, 2023
334e163
Adding a callout on flyout when association limit has been reached (#…
amitgalitz Jul 7, 2023
3d78992
Merge main into featureAnywhere (#525)
amitgalitz Jul 7, 2023
3dfda67
Merging main into featureAnywhere with conflicts resolved (#527)
amitgalitz Jul 10, 2023
9d20563
copy files from main to resolve conflicts (#533)
jackiehanyang Jul 10, 2023
8e1fe67
copy files to resolve conflicts (#538)
jackiehanyang Jul 11, 2023
d5c2def
Feature anywhere (#540)
jackiehanyang Jul 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/anomaly-detection
* @ohltyler @kaituo @jackiehanyang @amitgalitz @sean-zheng-amazon
19 changes: 19 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Apply 'untriaged' label during issue lifecycle

on:
issues:
types: [opened, reopened, transferred]

jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
})
77 changes: 59 additions & 18 deletions .github/workflows/remote-integ-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,124 @@ on:
env:
OPENSEARCH_DASHBOARDS_VERSION: 'main'
OPENSEARCH_VERSION: '3.0.0-SNAPSHOT'
OPENSEARCH_DASHBOARDS_FTREPO_VERSION: 'main'
ANOMALY_DETECTION_PLUGIN_VERSION: 'main'
jobs:
test-without-security:
name: Run integ tests without security
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
java: [11]
include:
- os: windows-latest
cypress_cache_folder: ~/AppData/Local/Cypress/Cache
- os: ubuntu-latest
cypress_cache_folder: ~/.cache/Cypress
runs-on: ${{ matrix.os }}
steps:
- name: Set up Java 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'

- name: Enable longer filenames
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true

- name: Checkout Anomaly-Detection
uses: actions/checkout@v2
with:
path: anomaly-detection
repository: opensearch-project/anomaly-detection
ref: 'main'
- name: Run Opensearch with plugin
ref: ${{ env.ANOMALY_DETECTION_PLUGIN_VERSION }}

- name: Run OpenSearch with plugin
run: |
cd anomaly-detection
./gradlew run -Dopensearch.version=${{ env.OPENSEARCH_VERSION }} &
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
shell: bash

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
path: OpenSearch-Dashboards

- name: Checkout Anomaly Detection OpenSearch Dashboards plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
- name: Get node and yarn versions
id: versions_step
run: |
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install correct yarn version for OpenSearch Dashboards
- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION

- run: node -v
- run: yarn -v

- name: Bootstrap the plugin
run: |
cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
yarn osd bootstrap

- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
yarn start --no-base-path --no-watch &
sleep 300
shell: bash

# Window is slow so wait longer
- name: Sleep until OSD server starts - windows
if: ${{ matrix.os == 'windows-latest' }}
run: Start-Sleep -s 400
shell: powershell

- name: Sleep until OSD server starts - non-windows
if: ${{ matrix.os != 'windows-latest' }}
run: sleep 300
shell: bash

- name: Checkout opensearch-dashboards-functional-test
uses: actions/checkout@v2
with:
path: opensearch-dashboards-functional-test
repository: opensearch-project/opensearch-dashboards-functional-test
ref: 'main' # TODO: change to a branch when the branching strategy in that repo has been established
ref: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }}

- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"

- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
path: ${{ matrix.cypress_cache_folder }}
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
env:
CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }}
- run: npx cypress cache list
- run: npx cypress cache path

- name: Run AD cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: opensearch-dashboards-functional-test
command: yarn run cypress run --env SECURITY_ENABLED=false --spec cypress/integration/plugins/anomaly-detection-dashboards-plugin/*.js
env:
CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }}
23 changes: 11 additions & 12 deletions .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@ jobs:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
path: OpenSearch-Dashboards
- name: Get node and yarn versions
id: versions_step
run: |
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Install correct yarn version for OpenSearch Dashboards
- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION
- run: node -v
- run: yarn -v
- name: Checkout Anomaly Detection OpenSearch Dashboards plugin
uses: actions/checkout@v2
with:
Expand Down
25 changes: 17 additions & 8 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# OpenSearch Anomaly Detection Dashboards Maintainers
## Overview

## Maintainers
This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md).

| Maintainer | GitHub ID | Affiliation |
| ----------------------- | ------------------------------------------------------- | ----------- |
| Tyler Ohlsen | [ohltyler](https://github.com/ohltyler) | Amazon |
## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ----------------------- | -------------------------------------------------------- | ----------- |
| Tyler Ohlsen | [ohltyler](https://github.com/ohltyler) | Amazon |
| Kaituo Li | [kaituo](https://github.com/kaituo) | Amazon |
| Jackie Han | [jackiehanyang](https://github.com/jackiehanyang) | Amazon |
| Amit Galitzky | [amitgalitz](https://github.com/amitgalitz) | Amazon |
| Sean Zheng | [sean-zheng-amazon](https://github.com/sean-zheng-amazon)| Amazon |

## Emeritus Maintainers

| Maintainer | GitHub ID | Affiliation |
| ----------------- | ------------------------------------------------------- | ----------- |
| Yaliang | [ylwu-amzn](https://github.com/ylwu-amzn) | Amazon |
| Yizhe Liu | [yizheliu-amazon](https://github.com/yizheliu-amazon) | Amazon |
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
| Sarat Vemulapalli | [saratvemulapalli](https://github.com/saratvemulapalli) | Amazon |

[This document](https://github.com/opensearch-project/.github/blob/main/MAINTAINERS.md) explains what maintainers do in this repo, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
| Sarat Vemulapalli | [saratvemulapalli](https://github.com/saratvemulapalli) | Amazon |
4 changes: 2 additions & 2 deletions global-setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default () => {
process.env.TZ = 'UTC';
}
process.env.TZ = 'UTC';
};
15 changes: 13 additions & 2 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@
"version": "3.0.0.0",
"opensearchDashboardsVersion": "3.0.0",
"configPath": ["anomaly_detection_dashboards"],
"requiredPlugins": ["navigation"],
"optionalPlugins": [],
"requiredPlugins": [
"opensearchDashboardsUtils",
"expressions",
"data",
"visAugmenter",
"uiActions",
"dashboard",
"embeddable",
"opensearchDashboardsReact",
"savedObjects",
"visAugmenter",
"opensearchDashboardsUtils"
],
"server": true,
"ui": true
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
"**/ansi-regex": "^5.0.1",
"**/glob-parent": "^6.0.0",
"**/loader-utils": "^2.0.4",
"**/terser": "^4.8.1"
"**/terser": "^4.8.1",
"decode-uri-component": "^0.2.1",
"json5": "^2.2.3",
"@sideway/formula": "^3.0.1"
}
}
78 changes: 78 additions & 0 deletions public/action/ad_dashboard_action.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { IEmbeddable } from '../../../../src/plugins/dashboard/public/embeddable_plugin';
import {
DASHBOARD_CONTAINER_TYPE,
DashboardContainer,
} from '../../../../src/plugins/dashboard/public';
import {
IncompatibleActionError,
createAction,
Action,
} from '../../../../src/plugins/ui_actions/public';
import { isReferenceOrValueEmbeddable } from '../../../../src/plugins/embeddable/public';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import { VisualizeEmbeddable } from '../../../../src/plugins/visualizations/public';
import { isEligibleForVisLayers } from '../../../../src/plugins/vis_augmenter/public';
import { getUISettings } from '../services';

export const ACTION_AD = 'ad';

function isDashboard(
embeddable: IEmbeddable
): embeddable is DashboardContainer {
return embeddable.type === DASHBOARD_CONTAINER_TYPE;
}

export interface ActionContext {
embeddable: IEmbeddable;
}

export interface CreateOptions {
grouping: Action['grouping'];
title: string;
icon: EuiIconType;
id: string;
order: number;
onClick: Function;
}

export const createADAction = ({
grouping,
title,
icon,
id,
order,
onClick,
}: CreateOptions) =>
createAction({
id,
order,
getDisplayName: ({ embeddable }: ActionContext) => {
if (!embeddable.parent || !isDashboard(embeddable.parent)) {
throw new IncompatibleActionError();
}
return title;
},
getIconType: () => icon,
type: ACTION_AD,
grouping,
isCompatible: async ({ embeddable }: ActionContext) => {
const vis = (embeddable as VisualizeEmbeddable).vis;
return Boolean(
embeddable.parent &&
embeddable.getInput()?.viewMode === 'view' &&
isDashboard(embeddable.parent) &&
vis !== undefined &&
isEligibleForVisLayers(vis, getUISettings())
);
},
execute: async ({ embeddable }: ActionContext) => {
if (!isReferenceOrValueEmbeddable(embeddable)) {
throw new IncompatibleActionError();
}
onClick({ embeddable });
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import React, { useState } from 'react';
import { get } from 'lodash';
import AssociatedDetectors from '../AssociatedDetectors/containers/AssociatedDetectors';
import { getEmbeddable } from '../../../../public/services';
import AddAnomalyDetector from '../CreateAnomalyDetector';
import { FLYOUT_MODES } from './constants';

const AnywhereParentFlyout = ({ startingFlyout, ...props }) => {
const embeddable = getEmbeddable().getEmbeddableFactory;
const indices: { label: string }[] = [
{ label: get(embeddable, 'vis.data.indexPattern.title', '') },
];

const [mode, setMode] = useState(startingFlyout);
const [selectedDetector, setSelectedDetector] = useState(undefined);

const AnywhereFlyout = {
[FLYOUT_MODES.create]: AddAnomalyDetector,
[FLYOUT_MODES.associated]: AssociatedDetectors,
[FLYOUT_MODES.existing]: AddAnomalyDetector,
}[mode];

return (
<AnywhereFlyout
{...{
...props,
setMode,
mode,
indices,
selectedDetector,
setSelectedDetector,
}}
/>
);
};

export default AnywhereParentFlyout;
Loading