Skip to content

Commit

Permalink
Merge featureAnywhere branch into main (#539)
Browse files Browse the repository at this point in the history
* Add branch constants in CI workflow (#345)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump decode-uri-component (#359)

Signed-off-by: Tyler Ohlsen <[email protected]>

* removed duplicate popout icon and ran prettier (#382)

Signed-off-by: Amit Galitzky <[email protected]>

* Change detector out of time range modal warning into a callout warning (#384)

Signed-off-by: Jackie Han <[email protected]>

Signed-off-by: Jackie Han <[email protected]>

* Fix undefined entity list when heatmap is empty (#383)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format. (#388)

Signed-off-by: dblock <[email protected]>

* Add windows env to integration test workflow (#390)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump json5 to 2.2.3 (#393)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Add 2.5 release notes (#395)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Update cold start message (#398)

Signed-off-by: Kaituo Li <[email protected]>

* upgrade filter bug (#402)

Previously, we didn't actually add filter type when loading old detector. This PR fixed that.

Testing done:
1. added a unit tes
2. verified e2et

Signed-off-by: Kaituo Li <[email protected]>

* Changed required minimum intervals in cold start message (#411)

Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message.

Testing done:
1. verified changing shingle size will change the message.

Signed-off-by: Kaituo Li <[email protected]>

* Bump @sideway/formula to 3.0.1 (#418)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Remove auto_expand_replicas override in sample data indices (#423)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Created untriaged issue workflow. (#422)

Signed-off-by: dblock <[email protected]>

* Add 2.6 release notes (#429)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Fix Node.js and Yarn installation in CI (#433)

Signed-off-by: Miki <[email protected]>

* run prettier command against all files

Signed-off-by: Jackie Han <[email protected]>

* Adding expression function to retrieve anomalies  (#448)

* adding an AD expression function

Signed-off-by: Amit Galitzky <[email protected]>

* making expression fn changes only to plugin.ts

Signed-off-by: Amit Galitzky <[email protected]>

* addressing comments, changed a few constants

Signed-off-by: Amit Galitzky <[email protected]>

* moving getDetectorName into try catch

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* Register AD as dashboard context menu option (#482)

* Register AD as dashboard context menu option

Signed-off-by: Jackie Han <[email protected]>

* addressing comments

Signed-off-by: Jackie Han <[email protected]>

* add getActions props

Signed-off-by: Jackie Han <[email protected]>

* add EmbeddableStart

Signed-off-by: Jackie Han <[email protected]>

* remove spread operator

Signed-off-by: Jackie Han <[email protected]>

* clenaup

Signed-off-by: Jackie Han <[email protected]>

* add overlay getter and setter

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>

* Associated detectors flyout through UI actions (#449)

* working js manage detectors

Signed-off-by: Amit Galitzky <[email protected]>

* adding associated detectors page

Signed-off-by: Amit Galitzky <[email protected]>

* adding unlink modal confirmation

Signed-off-by: Amit Galitzky <[email protected]>

* prettier formating and merge conflicts

Signed-off-by: Amit Galitzky <[email protected]>

* add unlinking capability

Signed-off-by: Amit Galitzky <[email protected]>

* adding message for no search results

Signed-off-by: Amit Galitzky <[email protected]>

* clean up files

Signed-off-by: Amit Galitzky <[email protected]>

* more cleanup

Signed-off-by: Amit Galitzky <[email protected]>

* making changes based on new upper container

Signed-off-by: Amit Galitzky <[email protected]>

* ran prettier

Signed-off-by: Amit Galitzky <[email protected]>

* fix notification and clean up associated detectors

Signed-off-by: Amit Galitzky <[email protected]>

* addressing comments

Signed-off-by: Amit Galitzky <[email protected]>

* renaming some files and adding index.ts

Signed-off-by: Amit Galitzky <[email protected]>

* Added license to new files

Signed-off-by: Amit Galitzky <[email protected]>

* clean up after rebase

Signed-off-by: Amit Galitzky <[email protected]>

* addressed more comments

Signed-off-by: Amit Galitzky <[email protected]>

* added notifications service as a getter-setter

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* Feature anywhere create detector flyout page (#487)

* Add create detector flyout page

Signed-off-by: Jackie Han <[email protected]>

* cleanup

Signed-off-by: Jackie Han <[email protected]>

* run prettier

Signed-off-by: Jackie Han <[email protected]>

* remove enzyme usage

Signed-off-by: Jackie Han <[email protected]>

* reuse existing helper function when creating detector

Signed-off-by: Jackie Han <[email protected]>

* cleanup

Signed-off-by: Jackie Han <[email protected]>

* rebase with associated detector change

Signed-off-by: Jackie Han <[email protected]>

* move helper functions to helper file

Signed-off-by: Jackie Han <[email protected]>

* use VisLayerTypes for VisLayerExpressionFn

Signed-off-by: Jackie Han <[email protected]>

* address comments

Signed-off-by: Jackie Han <[email protected]>

* use OVERLAY_ANOMALIES constant

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: Jackie Han <[email protected]>

* Adding functionality to associate existing detector with a visualization (#484)

* Adding associate existing

Signed-off-by: Amit Galitzky <[email protected]>

* removed usememo, addressed other comments

Signed-off-by: Amit Galitzky <[email protected]>

* merge cleanup

Signed-off-by: Amit Galitzky <[email protected]>

* added integration to call on alerting

Signed-off-by: Amit Galitzky <[email protected]>

* cleaned up files and added changes to check if detector is deleted in expr fn

Signed-off-by: Amit Galitzky <[email protected]>

* fixing dependency and notifcations issues

Signed-off-by: Amit Galitzky <[email protected]>

* removed long toast life time

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* switched argument order (#494)

Signed-off-by: Amit Galitzky <[email protected]>

* add jest transform config (#497)

* add jest transform config

Signed-off-by: Jackie Han <[email protected]>

* add license header

Signed-off-by: Jackie Han <[email protected]>

* update file as .ts file

Signed-off-by: Jackie Han <[email protected]>

* add comment on jest config file

Signed-off-by: Jackie Han <[email protected]>

* add more comments

Signed-off-by: Jackie Han <[email protected]>

* cleanup

Signed-off-by: Jackie Han <[email protected]>

* update file export

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>

* Merging main branch into featureAnywhere (#499)

* Add branch constants in CI workflow (#345)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump decode-uri-component (#359)

Signed-off-by: Tyler Ohlsen <[email protected]>

* removed duplicate popout icon and ran prettier (#382)

Signed-off-by: Amit Galitzky <[email protected]>

* Change detector out of time range modal warning into a callout warning (#384)

Signed-off-by: Jackie Han <[email protected]>

Signed-off-by: Jackie Han <[email protected]>

* Fix undefined entity list when heatmap is empty (#383)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format. (#388)

Signed-off-by: dblock <[email protected]>

* Add windows env to integration test workflow (#390)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump json5 to 2.2.3 (#393)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Add 2.5 release notes (#395)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Update cold start message (#398)

Signed-off-by: Kaituo Li <[email protected]>

* upgrade filter bug (#402)

Previously, we didn't actually add filter type when loading old detector. This PR fixed that.

Testing done:
1. added a unit tes
2. verified e2et

Signed-off-by: Kaituo Li <[email protected]>

* Changed required minimum intervals in cold start message (#411)

Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message.

Testing done:
1. verified changing shingle size will change the message.

Signed-off-by: Kaituo Li <[email protected]>

* Bump @sideway/formula to 3.0.1 (#418)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Remove auto_expand_replicas override in sample data indices (#423)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Created untriaged issue workflow. (#422)

Signed-off-by: dblock <[email protected]>

* Add 2.6 release notes (#429)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Fix Node.js and Yarn installation in CI (#433)

Signed-off-by: Miki <[email protected]>

* run prettier command against all files (#444)

Signed-off-by: Jackie Han <[email protected]>

* Add 2.7 release notes (#456)

Signed-off-by: Jackie Han <[email protected]>

* updating maintainers and code owners (#476)

Signed-off-by: Amit Galitzky <[email protected]>

* fixing test to pass with node 18 (#491)

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Miki <[email protected]>
Co-authored-by: Tyler Ohlsen <[email protected]>
Co-authored-by: Jackie Han <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Kaituo Li <[email protected]>
Co-authored-by: Miki <[email protected]>

* Unit tests for expression function and additional components (#503)

* adding UT for expression function and some components

Signed-off-by: Amit Galitzky <[email protected]>

* moved helper functions to separate files, cleaned up other tests

Signed-off-by: Amit Galitzky <[email protected]>

* custom result bug fix along with a few others

Signed-off-by: Amit Galitzky <[email protected]>

* revert historical boolean

Signed-off-by: Amit Galitzky <[email protected]>

* add pluginEventType when no error

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* Fix various bugs (#504)

* fix bug bash bugs

Signed-off-by: Jackie Han <[email protected]>

* bug fix

Signed-off-by: Jackie Han <[email protected]>

* yarn prettier

Signed-off-by: Jackie Han <[email protected]>

* bug fix

Signed-off-by: Jackie Han <[email protected]>

* bug fixes

Signed-off-by: Jackie Han <[email protected]>

* clean up code

Signed-off-by: Jackie Han <[email protected]>

* removed unused snapshot

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: Jackie Han <[email protected]>

* Various bug fixes and unit tests for AssociatedDetectors (#505)

* associated detectors unit tests

Signed-off-by: Amit Galitzky <[email protected]>

* fixed some bugs and added unit tests for associated detectors

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* make feature anywhere formatted detector name an assgiend value (#506)

* make feature anywhere formatted detector name an assgiend value to return

Signed-off-by: Jackie Han <[email protected]>

* update feature anywhere documentation link

Signed-off-by: Jackie Han <[email protected]>

* correct type

Signed-off-by: Jackie Han <[email protected]>

* correct typo

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>

* various bug fixes for anywhere features (#507)

Signed-off-by: Amit Galitzky <[email protected]>

* add group category and order for context menu (#495)

Signed-off-by: David Sinclair <[email protected]>

* Update Advanced configuration accordion title (#513)

Signed-off-by: Jackie Han <[email protected]>

* update categorical field text on Feature Anywhere flyout (#516)

* update categorical field text on Feature Anywhere flyout

Signed-off-by: Jackie Han <[email protected]>

* Use non-breaking space character to prevent removing needed empty space by yarn prettier

Signed-off-by: Jackie Han <[email protected]>

* Fix the max width of associate detector flyout to 740px

Signed-off-by: Jackie Han <[email protected]>

---------

Signed-off-by: Jackie Han <[email protected]>

* fixing vis eligibility (#519)

Signed-off-by: Amit Galitzky <[email protected]>

* render embeddable by using vis embeddable (#521)

Signed-off-by: Jackie Han <[email protected]>

* Change to anomaly start time; add test ids (#522)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Adding a callout on flyout when association limit has been reached (#524)

* adding a callout when association limit has been reached

Signed-off-by: Amit Galitzky <[email protected]>

* fixed limit check and ran prettier

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>

* Merge main into featureAnywhere (#525)

* Add branch constants in CI workflow (#345)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump decode-uri-component (#359)

Signed-off-by: Tyler Ohlsen <[email protected]>

* removed duplicate popout icon and ran prettier (#382)

Signed-off-by: Amit Galitzky <[email protected]>

* Change detector out of time range modal warning into a callout warning (#384)

Signed-off-by: Jackie Han <[email protected]>

Signed-off-by: Jackie Han <[email protected]>

* Fix undefined entity list when heatmap is empty (#383)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format. (#388)

Signed-off-by: dblock <[email protected]>

* Add windows env to integration test workflow (#390)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump json5 to 2.2.3 (#393)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Add 2.5 release notes (#395)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Update cold start message (#398)

Signed-off-by: Kaituo Li <[email protected]>

* upgrade filter bug (#402)

Previously, we didn't actually add filter type when loading old detector. This PR fixed that.

Testing done:
1. added a unit tes
2. verified e2et

Signed-off-by: Kaituo Li <[email protected]>

* Changed required minimum intervals in cold start message (#411)

Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message.

Testing done:
1. verified changing shingle size will change the message.

Signed-off-by: Kaituo Li <[email protected]>

* Bump @sideway/formula to 3.0.1 (#418)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Remove auto_expand_replicas override in sample data indices (#423)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Created untriaged issue workflow. (#422)

Signed-off-by: dblock <[email protected]>

* Add 2.6 release notes (#429)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Fix Node.js and Yarn installation in CI (#433)

Signed-off-by: Miki <[email protected]>

* run prettier command against all files (#444)

Signed-off-by: Jackie Han <[email protected]>

* Add 2.7 release notes (#456)

Signed-off-by: Jackie Han <[email protected]>

* updating maintainers and code owners (#476)

Signed-off-by: Amit Galitzky <[email protected]>

* fixing test to pass with node 18 (#491)

Signed-off-by: Amit Galitzky <[email protected]>

* add 2.8.0 release notes (#500)

Signed-off-by: Kaituo Li <[email protected]>

* Remove invalid link (#470)

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>

* Remove global OUI style override (#511)

Signed-off-by: Matt Provost <[email protected]>

---------

Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Matt Provost <[email protected]>
Co-authored-by: Tyler Ohlsen <[email protected]>
Co-authored-by: Jackie Han <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Kaituo Li <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
Co-authored-by: Matt Provost <[email protected]>

* Merging main into featureAnywhere with conflicts resolved (#527)

* Add branch constants in CI workflow (#345)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump decode-uri-component (#359)

Signed-off-by: Tyler Ohlsen <[email protected]>

* removed duplicate popout icon and ran prettier (#382)

Signed-off-by: Amit Galitzky <[email protected]>

* Change detector out of time range modal warning into a callout warning (#384)

Signed-off-by: Jackie Han <[email protected]>

Signed-off-by: Jackie Han <[email protected]>

* Fix undefined entity list when heatmap is empty (#383)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format. (#388)

Signed-off-by: dblock <[email protected]>

* Add windows env to integration test workflow (#390)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump json5 to 2.2.3 (#393)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Add 2.5 release notes (#395)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Update cold start message (#398)

Signed-off-by: Kaituo Li <[email protected]>

* upgrade filter bug (#402)

Previously, we didn't actually add filter type when loading old detector. This PR fixed that.

Testing done:
1. added a unit tes
2. verified e2et

Signed-off-by: Kaituo Li <[email protected]>

* Changed required minimum intervals in cold start message (#411)

Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message.

Testing done:
1. verified changing shingle size will change the message.

Signed-off-by: Kaituo Li <[email protected]>

* Bump @sideway/formula to 3.0.1 (#418)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Remove auto_expand_replicas override in sample data indices (#423)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Created untriaged issue workflow. (#422)

Signed-off-by: dblock <[email protected]>

* Add 2.6 release notes (#429)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Fix Node.js and Yarn installation in CI (#433)

Signed-off-by: Miki <[email protected]>

* run prettier command against all files (#444)

Signed-off-by: Jackie Han <[email protected]>

* Add 2.7 release notes (#456)

Signed-off-by: Jackie Han <[email protected]>

* updating maintainers and code owners (#476)

Signed-off-by: Amit Galitzky <[email protected]>

* fixing test to pass with node 18 (#491)

Signed-off-by: Amit Galitzky <[email protected]>

* add 2.8.0 release notes (#500)

Signed-off-by: Kaituo Li <[email protected]>

* Remove invalid link (#470)

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>

* Remove global OUI style override (#511)

Signed-off-by: Matt Provost <[email protected]>

---------

Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Matt Provost <[email protected]>
Co-authored-by: Tyler Ohlsen <[email protected]>
Co-authored-by: Jackie Han <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Kaituo Li <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
Co-authored-by: Matt Provost <[email protected]>

* copy files from main to resolve conflicts (#533)

Signed-off-by: Jackie Han <[email protected]>

* copy files to resolve conflicts (#538)

Signed-off-by: Jackie Han <[email protected]>

* Feature anywhere (#540)

* Add branch constants in CI workflow (#345)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump decode-uri-component (#359)

Signed-off-by: Tyler Ohlsen <[email protected]>

* removed duplicate popout icon and ran prettier (#382)

Signed-off-by: Amit Galitzky <[email protected]>

* Change detector out of time range modal warning into a callout warning (#384)

Signed-off-by: Jackie Han <[email protected]>

Signed-off-by: Jackie Han <[email protected]>

* Fix undefined entity list when heatmap is empty (#383)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format. (#388)

Signed-off-by: dblock <[email protected]>

* Add windows env to integration test workflow (#390)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Bump json5 to 2.2.3 (#393)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Add 2.5 release notes (#395)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Update cold start message (#398)

Signed-off-by: Kaituo Li <[email protected]>

* upgrade filter bug (#402)

Previously, we didn't actually add filter type when loading old detector. This PR fixed that.

Testing done:
1. added a unit tes
2. verified e2et

Signed-off-by: Kaituo Li <[email protected]>

* Changed required minimum intervals in cold start message (#411)

Required minimum intervals to finish cold start is related to shingle size. This PR adds the shingle size in the computation and puts the result in the cold start message.

Testing done:
1. verified changing shingle size will change the message.

Signed-off-by: Kaituo Li <[email protected]>

* Bump @sideway/formula to 3.0.1 (#418)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Remove auto_expand_replicas override in sample data indices (#423)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Created untriaged issue workflow. (#422)

Signed-off-by: dblock <[email protected]>

* Add 2.6 release notes (#429)

Signed-off-by: Tyler Ohlsen <[email protected]>

* Fix Node.js and Yarn installation in CI (#433)

Signed-off-by: Miki <[email protected]>

* run prettier command against all files (#444)

Signed-off-by: Jackie Han <[email protected]>

* Add 2.7 release notes (#456)

Signed-off-by: Jackie Han <[email protected]>

* updating maintainers and code owners (#476)

Signed-off-by: Amit Galitzky <[email protected]>

* fixing test to pass with node 18 (#491)

Signed-off-by: Amit Galitzky <[email protected]>

* add 2.8.0 release notes (#500)

Signed-off-by: Kaituo Li <[email protected]>

* Remove invalid link (#470)

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>

* Remove global OUI style override (#511)

Signed-off-by: Matt Provost <[email protected]>

---------

Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Matt Provost <[email protected]>
Co-authored-by: Tyler Ohlsen <[email protected]>
Co-authored-by: Amit Galitzky <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Kaituo Li <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
Co-authored-by: Matt Provost <[email protected]>

---------

Signed-off-by: Tyler Ohlsen <[email protected]>
Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Kaituo Li <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Jackie Han <[email protected]>
Signed-off-by: David Sinclair <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Matt Provost <[email protected]>
Co-authored-by: Tyler Ohlsen <[email protected]>
Co-authored-by: Amit Galitzky <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Kaituo Li <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: David Sinclair <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
Co-authored-by: Matt Provost <[email protected]>
(cherry picked from commit 1e0d783)
  • Loading branch information
jackiehanyang authored and amitgalitz committed Jul 11, 2023
1 parent 815b79f commit 3eb4fcf
Show file tree
Hide file tree
Showing 48 changed files with 3,999 additions and 44 deletions.
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": "2.9.0.0",
"opensearchDashboardsVersion": "2.9.0",
"configPath": ["anomaly_detection_dashboards"],
"requiredPlugins": ["navigation"],
"optionalPlugins": [],
"requiredPlugins": [
"opensearchDashboardsUtils",
"expressions",
"data",
"visAugmenter",
"uiActions",
"dashboard",
"embeddable",
"opensearchDashboardsReact",
"savedObjects",
"visAugmenter",
"opensearchDashboardsUtils"
],
"server": true,
"ui": true
}
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;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

//created: Flyout for creating a new anomaly detector from a visualization
//associated: Flyout for listing all the associated detectors to the given visualization
//existing: Flyout for associating existing detectors with the current visualizations
export enum FLYOUT_MODES {
create = 'create',
associated = 'associated',
existing = 'existing',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import AnywhereParentFlyout from './AnywhereParentFlyout';

export default AnywhereParentFlyout;
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useState } from 'react';
import {
EuiText,
EuiOverlayMask,
EuiButton,
EuiButtonEmpty,
EuiModal,
EuiModalHeader,
EuiModalFooter,
EuiModalBody,
EuiModalHeaderTitle,
} from '@elastic/eui';
import { DetectorListItem } from '../../../../../models/interfaces';
import { EuiSpacer } from '@elastic/eui';

interface ConfirmUnlinkDetectorModalProps {
detector: DetectorListItem;
onUnlinkDetector(): void;
onHide(): void;
onConfirm(): void;
isListLoading: boolean;
}

export const ConfirmUnlinkDetectorModal = (
props: ConfirmUnlinkDetectorModalProps
) => {
const [isModalLoading, setIsModalLoading] = useState<boolean>(false);
const isLoading = isModalLoading || props.isListLoading;
return (
<EuiOverlayMask>
<EuiModal
data-test-subj="unlinkDetectorsModal"
onClose={props.onHide}
maxWidth={450}
>
<EuiModalHeader>
<EuiModalHeaderTitle>{'Remove association?'}</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiText>
Removing association unlinks {props.detector.name} detector from the
visualization but does not delete it. The detector association can
be restored.
</EuiText>
<EuiSpacer size="s" />
</EuiModalBody>
<EuiModalFooter>
{isLoading ? null : (
<EuiButtonEmpty
data-test-subj="cancelUnlinkButton"
onClick={props.onHide}
>
Cancel
</EuiButtonEmpty>
)}
<EuiButton
data-test-subj="confirmUnlinkButton"
color="primary"
fill
isLoading={isLoading}
onClick={async () => {
setIsModalLoading(true);
props.onUnlinkDetector();
props.onConfirm();
}}
>
{'Remove association'}
</EuiButton>
</EuiModalFooter>
</EuiModal>
</EuiOverlayMask>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiEmptyPrompt, EuiText } from '@elastic/eui';
import React from 'react';

const FILTER_TEXT = 'There are no detectors matching your search';

interface EmptyDetectorProps {
isFilterApplied: boolean;
embeddableTitle: string;
}

export const EmptyAssociatedDetectorMessage = (props: EmptyDetectorProps) => (
<EuiEmptyPrompt
title={<h3>No anomaly detectors to display</h3>}
titleSize="s"
data-test-subj="emptyAssociatedDetectorFlyoutMessage"
style={{ maxWidth: '45em' }}
body={
<EuiText>
<p>
{props.isFilterApplied
? FILTER_TEXT
: `There are no anomaly detectors associated with ${props.embeddableTitle} visualization.`}
</p>
</EuiText>
}
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { findAllByTestId, render, waitFor } from '@testing-library/react';
import { ConfirmUnlinkDetectorModal } from '../index';
import { getRandomDetector } from '../../../../../../public/redux/reducers/__tests__/utils';
import { DetectorListItem } from '../../../../../../public/models/interfaces';
import userEvent from '@testing-library/user-event';

describe('ConfirmUnlinkDetectorModal spec', () => {
beforeEach(() => {
jest.clearAllMocks();
});

const testDetectors = [
{
id: 'detectorId1',
name: 'test-detector-1',
},
{
id: 'detectorId2',
name: 'test-detector-2',
},
] as DetectorListItem[];

const ConfirmUnlinkDetectorModalProps = {
detector: testDetectors[0],
onHide: jest.fn(),
onConfirm: jest.fn(),
onUnlinkDetector: jest.fn(),
isListLoading: false,
};

test('renders the component correctly', () => {
const { container, getByText } = render(
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} />
);
getByText('Remove association?');
getByText(
'Removing association unlinks test-detector-1 detector from the visualization but does not delete it. The detector association can be restored.'
);
});
test('should call onConfirm() when closing', async () => {
const { container, getByText, getByTestId } = render(
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} />
);
getByText('Remove association?');
userEvent.click(getByTestId('confirmUnlinkButton'));
expect(ConfirmUnlinkDetectorModalProps.onConfirm).toHaveBeenCalled();
});
test('should call onConfirm() when closing', async () => {
const { container, getByText, getByTestId } = render(
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} />
);
getByText('Remove association?');
userEvent.click(getByTestId('confirmUnlinkButton'));
expect(ConfirmUnlinkDetectorModalProps.onConfirm).toHaveBeenCalled();
});
test('should call onHide() when closing', async () => {
const { getByTestId } = render(
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} />
);
userEvent.click(getByTestId('cancelUnlinkButton'));
expect(ConfirmUnlinkDetectorModalProps.onHide).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { findAllByTestId, render, waitFor } from '@testing-library/react';
import { EmptyAssociatedDetectorMessage } from '../index';
import { getRandomDetector } from '../../../../../../public/redux/reducers/__tests__/utils';
import { DetectorListItem } from '../../../../../../public/models/interfaces';
import userEvent from '@testing-library/user-event';

describe('ConfirmUnlinkDetectorModal spec', () => {
beforeEach(() => {
jest.clearAllMocks();
});

test('renders the component with filter applied', () => {
const { container, getByText } = render(
<EmptyAssociatedDetectorMessage
isFilterApplied={true}
embeddableTitle="test-title"
/>
);
getByText('There are no detectors matching your search');
expect(container).toMatchSnapshot();
});
test('renders the component with filter applied', () => {
const { container, getByText } = render(
<EmptyAssociatedDetectorMessage
isFilterApplied={false}
embeddableTitle="test-title"
/>
);
getByText(
'There are no anomaly detectors associated with test-title visualization.'
);
expect(container).toMatchSnapshot();
});
});
Loading

0 comments on commit 3eb4fcf

Please sign in to comment.