-
Notifications
You must be signed in to change notification settings - Fork 71
Associated detectors flyout through UI actions #449
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
Merged
amitgalitz
merged 17 commits into
opensearch-project:featureAnywhere
from
amitgalitz:associated-detectors-1
May 22, 2023
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d5d9551
working js manage detectors
amitgalitz e4fff52
adding associated detectors page
amitgalitz c244b57
adding unlink modal confirmation
amitgalitz 8df6be7
prettier formating and merge conflicts
amitgalitz 9a91b75
add unlinking capability
amitgalitz 12561bd
adding message for no search results
amitgalitz e51f050
clean up files
amitgalitz 60ebd32
more cleanup
amitgalitz 2e15ffe
making changes based on new upper container
amitgalitz de163a4
ran prettier
amitgalitz 467c710
fix notification and clean up associated detectors
amitgalitz c92ac94
addressing comments
amitgalitz 7a27a5f
renaming some files and adding index.ts
amitgalitz 9c0719d
Added license to new files
amitgalitz 3d9a4eb
clean up after rebase
amitgalitz e62cea8
addressed more comments
amitgalitz f187620
added notifications service as a getter-setter
amitgalitz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
.../AssociatedDetectors/components/ConfirmUnlinkDetectorModal/ConfirmUnlinkDetectorModal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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="startDetectorsModal" | ||
| 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="cancelButton" | ||
| onClick={props.onHide} | ||
| > | ||
| Cancel | ||
| </EuiButtonEmpty> | ||
| )} | ||
|
ohltyler marked this conversation as resolved.
|
||
| <EuiButton | ||
| data-test-subj="confirmButton" | ||
| color="primary" | ||
| fill | ||
| isLoading={isLoading} | ||
| onClick={async () => { | ||
| setIsModalLoading(true); | ||
| props.onUnlinkDetector(); | ||
| props.onConfirm(); | ||
| }} | ||
| > | ||
| {'Remove association'} | ||
| </EuiButton> | ||
| </EuiModalFooter> | ||
| </EuiModal> | ||
| </EuiOverlayMask> | ||
| ); | ||
| }; | ||
32 changes: 32 additions & 0 deletions
32
...tedDetectors/components/EmptyAssociatedDetectorMessage/EmptyAssociatedDetectorMessage.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| } | ||
| /> | ||
| ); |
7 changes: 7 additions & 0 deletions
7
public/components/FeatureAnywhereContextMenu/AssociatedDetectors/components/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| export { ConfirmUnlinkDetectorModal } from './ConfirmUnlinkDetectorModal/ConfirmUnlinkDetectorModal'; | ||
| export { EmptyAssociatedDetectorMessage } from './EmptyAssociatedDetectorMessage/EmptyAssociatedDetectorMessage'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.