From 7c5aa225f629ba8b278e7e36240029a77ca28dc9 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Tue, 11 Apr 2023 19:50:13 +0200 Subject: [PATCH 1/8] Update detector details component #504 Signed-off-by: Jovan Cvetkovic --- .../rule/create_network_rule.json | 26 +++++++++++++ .../sample_network_index_settings.json | 39 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 cypress/fixtures/integration_tests/rule/create_network_rule.json create mode 100644 cypress/fixtures/sample_network_index_settings.json diff --git a/cypress/fixtures/integration_tests/rule/create_network_rule.json b/cypress/fixtures/integration_tests/rule/create_network_rule.json new file mode 100644 index 000000000..43e69cff4 --- /dev/null +++ b/cypress/fixtures/integration_tests/rule/create_network_rule.json @@ -0,0 +1,26 @@ +{ + "id": "25b9c01c-350d-4b95-bed1-836d04a4f326", + "category": "network", + "title": "Cypress Network Rule", + "description": "Detects network changes", + "status": "experimental", + "author": "Cypress Tests", + "references": [ + { + "value": "" + } + ], + "tags": [ + { + "value": "network.low" + } + ], + "log_source": "", + "detection": "selection:\n keywords:\n - erase\n - delete\n - YXC\ncondition: selection", + "level": "low", + "false_positives": [ + { + "value": "" + } + ] +} diff --git a/cypress/fixtures/sample_network_index_settings.json b/cypress/fixtures/sample_network_index_settings.json new file mode 100644 index 000000000..c1451abf3 --- /dev/null +++ b/cypress/fixtures/sample_network_index_settings.json @@ -0,0 +1,39 @@ +{ + "mappings": { + "properties": { + "name": { + "type": "text" + }, + "path": { + "type": "text" + }, + "keywords": { + "type": "text" + }, + "operation": { + "type": "text" + }, + "action": { + "type": "text" + }, + "dst_port": { + "type": "integer" + }, + "timeframe": { + "type": "text" + }, + "user_agent": { + "type": "text" + }, + "method": { + "type": "text" + } + } + }, + "settings": { + "index": { + "number_of_shards": "1", + "number_of_replicas": "1" + } + } +} From 3ecdd08fad9bdd4e56941b74d8999e4b63e7b5da Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 16:23:10 +0200 Subject: [PATCH 2/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../AlertTriggerView/AlertTriggerView.tsx | 22 +++++-------- .../DetectorBasicDetailsView.tsx | 19 +++++------ .../containers/Detector/DetectorDetails.tsx | 26 ++++++++++++++- public/pages/Main/Main.tsx | 1 + public/services/IndexPatternsService.ts | 31 +++++++++++++++++ public/services/SavedObjectService.ts | 33 ++++++++++++++++++- public/store/DetectorsStore.tsx | 19 ++++++----- types/services/ISavedObjectsService.ts | 5 +++ 8 files changed, 120 insertions(+), 36 deletions(-) diff --git a/public/pages/Detectors/components/AlertTriggerView/AlertTriggerView.tsx b/public/pages/Detectors/components/AlertTriggerView/AlertTriggerView.tsx index 97d4ace6c..e0de40736 100644 --- a/public/pages/Detectors/components/AlertTriggerView/AlertTriggerView.tsx +++ b/public/pages/Detectors/components/AlertTriggerView/AlertTriggerView.tsx @@ -64,20 +64,14 @@ export const AlertTriggerView: React.FC = ({
If any detection rule matches
- {createTextDetailsGroup( - [ - { label: 'Log type', content: `${types[0]}` || DEFAULT_EMPTY_DATA }, - { label: 'Rule names', content: conditionRuleNames.join('\n') || DEFAULT_EMPTY_DATA }, - ], - 3 - )} - {createTextDetailsGroup( - [ - { label: 'Rule severities', content: sev_levels.join('\n') || DEFAULT_EMPTY_DATA }, - { label: 'Tags', content: tags.join('\n') || DEFAULT_EMPTY_DATA }, - ], - 3 - )} + {createTextDetailsGroup([ + { label: 'Log type', content: `${types[0]}` || DEFAULT_EMPTY_DATA }, + { label: 'Rule names', content: conditionRuleNames.join('\n') || DEFAULT_EMPTY_DATA }, + ])} + {createTextDetailsGroup([ + { label: 'Rule severities', content: sev_levels.join('\n') || DEFAULT_EMPTY_DATA }, + { label: 'Tags', content: tags.join('\n') || DEFAULT_EMPTY_DATA }, + ])} diff --git a/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx b/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx index a8eb24151..caa456869 100644 --- a/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx +++ b/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx @@ -49,7 +49,7 @@ export const DetectorBasicDetailsView: React.FC = ) : ( - 'Not available for this log type' + '-' )) as any, }, ]; @@ -68,16 +68,13 @@ export const DetectorBasicDetailsView: React.FC = } > - {createTextDetailsGroup(firstTextDetailsGroupEntries, 4)} - {createTextDetailsGroup( - [ - { label: 'Description', content: inputs[0].detector_input.description }, - { label: 'Detector schedule', content: detectorSchedule }, - { label: 'Created at', content: createdAt || DEFAULT_EMPTY_DATA }, - { label: 'Last updated time', content: lastUpdated || DEFAULT_EMPTY_DATA }, - ], - 4 - )} + {createTextDetailsGroup(firstTextDetailsGroupEntries)} + {createTextDetailsGroup([ + { label: 'Description', content: inputs[0].detector_input.description }, + { label: 'Detector schedule', content: detectorSchedule }, + { label: 'Created at', content: createdAt || DEFAULT_EMPTY_DATA }, + { label: 'Last updated time', content: lastUpdated || DEFAULT_EMPTY_DATA }, + ])} {rulesCanFold ? children : null} ); diff --git a/public/pages/Detectors/containers/Detector/DetectorDetails.tsx b/public/pages/Detectors/containers/Detector/DetectorDetails.tsx index c423817b6..e8f908645 100644 --- a/public/pages/Detectors/containers/Detector/DetectorDetails.tsx +++ b/public/pages/Detectors/containers/Detector/DetectorDetails.tsx @@ -26,7 +26,7 @@ import { DetectorDetailsView } from '../DetectorDetailsView/DetectorDetailsView' import { FieldMappingsView } from '../../components/FieldMappingsView/FieldMappingsView'; import { AlertTriggersView } from '../AlertTriggersView/AlertTriggersView'; import { RuleItem } from '../../../CreateDetector/components/DefineDetector/components/DetectionRules/types/interfaces'; -import { DetectorsService } from '../../../../services'; +import { DetectorsService, IndexPatternsService } from '../../../../services'; import { errorNotificationToast } from '../../../../utils/helpers'; import { NotificationsStart, SimpleSavedObject } from 'opensearch-dashboards/public'; import { ISavedObjectsService, ServerResponse } from '../../../../../types'; @@ -47,6 +47,7 @@ export interface DetectorDetailsProps detectorService: DetectorsService; notifications: NotificationsStart; savedObjectsService: ISavedObjectsService; + indexPatternsService: IndexPatternsService; } export interface DetectorDetailsState { @@ -257,6 +258,11 @@ export class DetectorDetails extends React.Component { + if (ref.type === 'visualization') { + await this.props.savedObjectsService.deleteVisualization(ref.id); + } + }); + await this.props.savedObjectsService.deleteDashboard(dashboard.id); + } + + const index = await this.props.indexPatternsService.getIndexPattern(detectorId); + if (index) { + await this.props.indexPatternsService.deleteIndexPattern(index.id); + } + const deleteRes = await detectorService.deleteDetector(detectorId); if (!deleteRes.ok) { errorNotificationToast(notifications, 'delete', 'detector', deleteRes.error); } else { + DataStore.detectors.deleteState(); + DataStore.detectors.clearNotifications(); this.props.history.push(ROUTES.DETECTORS); } } catch (e: any) { diff --git a/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index 3590d214f..02a627e28 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -386,6 +386,7 @@ export default class Main extends Component { diff --git a/public/services/IndexPatternsService.ts b/public/services/IndexPatternsService.ts index 309f8fd16..69796a37e 100644 --- a/public/services/IndexPatternsService.ts +++ b/public/services/IndexPatternsService.ts @@ -8,6 +8,8 @@ import { IndexPatternSpec, IndexPatternsService as CoreIndexPatternsService, } from '../../../../src/plugins/data/common/index_patterns'; +import { IndexPatternSavedObjectAttrs } from '../../../../src/plugins/data/common/index_patterns/index_patterns'; +import { SavedObject } from '../../../../src/plugins/data/common'; export default class IndexPatternsService { constructor(private coreIndexPatternsService: CoreIndexPatternsService) {} @@ -19,4 +21,33 @@ export default class IndexPatternsService { async createAndSave(spec: IndexPatternSpec, override = false, skipFetchFields = false) { return this.coreIndexPatternsService.createAndSave(spec, override, skipFetchFields); } + + public getIndexPatterns = async (): Promise< + SavedObject[] | null | undefined + > => { + const indexPatterns = await this.coreIndexPatternsService.getCache(); + + return Promise.resolve(indexPatterns); + }; + + public getIndexPattern = async ( + detectorId: string + ): Promise> | Promise> => { + let indexPattern; + const indexPatterns = await this.getIndexPatterns(); + console.log('indexPatterns', indexPatterns); + indexPatterns?.some((indexRef) => { + if (indexRef.references.findIndex((reference) => reference.id === detectorId) > -1) { + indexPattern = indexRef; + return true; + } + + return false; + }); + + return indexPattern; + }; + + public deleteIndexPattern = async (indexPatternId: string) => + await this.coreIndexPatternsService.delete(indexPatternId); } diff --git a/public/services/SavedObjectService.ts b/public/services/SavedObjectService.ts index 6dd6d91e9..040a823cd 100644 --- a/public/services/SavedObjectService.ts +++ b/public/services/SavedObjectService.ts @@ -39,10 +39,17 @@ export default class SavedObjectService implements ISavedObjectsService { }, }; }); - const createAliasRes = await this.indexService.updateAliases({ + await this.indexService.updateAliases({ actions: indexActions, }); + const detectorReferences = [ + { + id: detectorId, + name: name, + type: 'detector-SA', + }, + ]; const indexPattern = await this.savedObjectsClient.create( savedObjectConfig['index-pattern'].type, { @@ -51,6 +58,7 @@ export default class SavedObjectService implements ISavedObjectsService { }, { ...savedObjectConfig['index-pattern'], + references: detectorReferences, } ); @@ -130,6 +138,23 @@ export default class SavedObjectService implements ISavedObjectsService { return Promise.resolve(dashboards); }; + public getDashboard = async ( + detectorId: string + ): Promise> | Promise> => { + let dashboard; + const dashboards = await this.getDashboards(); + dashboards?.some((dashRef) => { + if (dashRef.references.findIndex((reference) => reference.id === detectorId) > -1) { + dashboard = dashRef; + return true; + } + + return false; + }); + + return dashboard; + }; + public async getIndexPatterns(): Promise[]> { const indexPatterns = await this.savedObjectsClient .find<{ title: string }>({ @@ -141,4 +166,10 @@ export default class SavedObjectService implements ISavedObjectsService { return Promise.resolve(indexPatterns); } + + public deleteDashboard = async (dashboardId: string) => + await this.savedObjectsClient.delete('dashboard', dashboardId); + + public deleteVisualization = async (visualizationId: string) => + await this.savedObjectsClient.delete('visualization', visualizationId); } diff --git a/public/store/DetectorsStore.tsx b/public/store/DetectorsStore.tsx index 9377d06d7..666e7c589 100644 --- a/public/store/DetectorsStore.tsx +++ b/public/store/DetectorsStore.tsx @@ -132,6 +132,12 @@ export class DetectorsStore implements IDetectorsStore { delete this.state; }; + public clearNotifications = (): void => { + this.hideCallout(); + this.toasts = []; + this.showToastCallback([]); + }; + private showNotification = ( title: string, message?: string, @@ -258,15 +264,10 @@ export class DetectorsStore implements IDetectorsStore { if (dashboardResponse && dashboardResponse.ok) { dashboardId = dashboardResponse.response.id; } else { - const dashboards = await this.savedObjectsService.getDashboards(); - dashboards.some((dashboard) => { - if (dashboard.references.findIndex((reference) => reference.id === detectorId) > -1) { - dashboardId = dashboard.id; - return true; - } - - return false; - }); + const dashboard = await this.savedObjectsService.getDashboard(detectorId); + if (dashboard) { + dashboardId = dashboard.id; + } } } diff --git a/types/services/ISavedObjectsService.ts b/types/services/ISavedObjectsService.ts index 92902be38..f42c713b4 100644 --- a/types/services/ISavedObjectsService.ts +++ b/types/services/ISavedObjectsService.ts @@ -16,4 +16,9 @@ export interface ISavedObjectsService { getDashboards(): Promise< SimpleSavedObject<{ references: SavedObjectReference[]; id?: string }>[] >; + getDashboard( + detectorId: string + ): Promise> | Promise>; + deleteDashboard(detectorId: string): Promise; + deleteVisualization(detectorId: string): Promise; } From d49a99654dc6fd94792dc56afeea7ab5f38de343 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 16:24:25 +0200 Subject: [PATCH 3/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../DetectorBasicDetailsView.test.tsx.snap | 4 ++-- .../__snapshots__/DetectorDetails.test.tsx.snap | 14 +++++++++++++- .../DetectorDetailsView.test.tsx.snap | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap b/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap index a8558fe23..226817e71 100644 --- a/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap +++ b/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap @@ -209,7 +209,7 @@ Object { data-test-subj="text-details-group-content-detector-dashboard" id="some_html_id" > - Not available for this log type + - @@ -586,7 +586,7 @@ Object { data-test-subj="text-details-group-content-detector-dashboard" id="some_html_id" > - Not available for this log type + - diff --git a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap index 4842f2334..9746fa83d 100644 --- a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap +++ b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap @@ -216,6 +216,9 @@ exports[` spec renders the component 1`] = ` } savedObjectsService={ SavedObjectService { + "deleteDashboard": [Function], + "deleteVisualization": [Function], + "getDashboard": [Function], "getDashboards": [Function], "indexService": undefined, "savedObjectsClient": Object { @@ -914,6 +917,9 @@ exports[` spec renders the component 1`] = ` } savedObjectsService={ SavedObjectService { + "deleteDashboard": [Function], + "deleteVisualization": [Function], + "getDashboard": [Function], "getDashboards": [Function], "indexService": undefined, "savedObjectsClient": Object { @@ -1325,6 +1331,9 @@ exports[` spec renders the component 1`] = ` onEditClicked={[Function]} savedObjectsService={ SavedObjectService { + "deleteDashboard": [Function], + "deleteVisualization": [Function], + "getDashboard": [Function], "getDashboards": [Function], "indexService": undefined, "savedObjectsClient": Object { @@ -1830,7 +1839,7 @@ exports[` spec renders the component 1`] = ` onBlur={[Function]} onFocus={[Function]} > - Not available for this log type + - @@ -2602,6 +2611,9 @@ exports[` spec renders the component 1`] = ` onEditClicked={[Function]} savedObjectsService={ SavedObjectService { + "deleteDashboard": [Function], + "deleteVisualization": [Function], + "getDashboard": [Function], "getDashboards": [Function], "indexService": undefined, "savedObjectsClient": Object { diff --git a/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap b/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap index ec19212d1..747365da8 100644 --- a/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap +++ b/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap @@ -882,7 +882,7 @@ exports[` spec renders the component 1`] = ` onBlur={[Function]} onFocus={[Function]} > - Not available for this log type + - From 520074dad181c21b07b74cea9ba9b8994ac98bc7 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 16:31:23 +0200 Subject: [PATCH 4/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../DetectorBasicDetailsView/DetectorBasicDetailsView.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx b/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx index caa456869..5054cb97d 100644 --- a/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx +++ b/public/pages/Detectors/components/DetectorBasicDetailsView/DetectorBasicDetailsView.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ContentPanel } from '../../../../components/ContentPanel'; import { createTextDetailsGroup, parseSchedule } from '../../../../utils/helpers'; import moment from 'moment'; -import { DEFAULT_EMPTY_DATA } from '../../../../utils/constants'; +import { DEFAULT_EMPTY_DATA, logTypesWithDashboards } from '../../../../utils/constants'; import { Detector } from '../../../../../types'; export interface DetectorBasicDetailsViewProps { @@ -48,6 +48,8 @@ export const DetectorBasicDetailsView: React.FC = {`${name} summary`} + ) : !logTypesWithDashboards.has(detector_type) ? ( + 'Not available for this log type' ) : ( '-' )) as any, From 6c713728d9f43f1eb2bd0600807085f4fa058523 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 20:59:48 +0200 Subject: [PATCH 5/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- public/store/DetectorsStore.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/public/store/DetectorsStore.tsx b/public/store/DetectorsStore.tsx index 666e7c589..40c388f7f 100644 --- a/public/store/DetectorsStore.tsx +++ b/public/store/DetectorsStore.tsx @@ -25,6 +25,7 @@ export interface IDetectorsStore { setState: (state: IDetectorsState, history: RouteComponentProps['history']) => void; getState: () => IDetectorsState | undefined; deleteState: () => void; + clearNotifications: () => void; resolvePendingCreationRequest: () => Promise<{ detectorId?: string; dashboardId?: string; From 4a14039a0bf967588d9c26a7c08df0d8d48e83f0 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 21:03:27 +0200 Subject: [PATCH 6/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../__snapshots__/DetectorBasicDetailsView.test.tsx.snap | 4 ++-- .../Detector/__snapshots__/DetectorDetails.test.tsx.snap | 2 +- .../__snapshots__/DetectorDetailsView.test.tsx.snap | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap b/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap index 226817e71..a8558fe23 100644 --- a/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap +++ b/public/pages/Detectors/components/DetectorBasicDetailsView/__snapshots__/DetectorBasicDetailsView.test.tsx.snap @@ -209,7 +209,7 @@ Object { data-test-subj="text-details-group-content-detector-dashboard" id="some_html_id" > - - + Not available for this log type @@ -586,7 +586,7 @@ Object { data-test-subj="text-details-group-content-detector-dashboard" id="some_html_id" > - - + Not available for this log type diff --git a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap index 9746fa83d..aa903b86b 100644 --- a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap +++ b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap @@ -1839,7 +1839,7 @@ exports[` spec renders the component 1`] = ` onBlur={[Function]} onFocus={[Function]} > - - + Not available for this log type diff --git a/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap b/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap index 747365da8..ec19212d1 100644 --- a/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap +++ b/public/pages/Detectors/containers/DetectorDetailsView/__snapshots__/DetectorDetailsView.test.tsx.snap @@ -882,7 +882,7 @@ exports[` spec renders the component 1`] = ` onBlur={[Function]} onFocus={[Function]} > - - + Not available for this log type From 128154d90f5bc9ac4d0195a926da89ef5430d6fb Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 21:18:00 +0200 Subject: [PATCH 7/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../DetectorDetailsView.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/public/pages/Detectors/containers/DetectorDetailsView/DetectorDetailsView.tsx b/public/pages/Detectors/containers/DetectorDetailsView/DetectorDetailsView.tsx index cbafe7f7d..f3e7ea60e 100644 --- a/public/pages/Detectors/containers/DetectorDetailsView/DetectorDetailsView.tsx +++ b/public/pages/Detectors/containers/DetectorDetailsView/DetectorDetailsView.tsx @@ -9,6 +9,7 @@ import { DetectorRulesView } from '../../components/DetectorRulesView/DetectorRu import { RuleItem } from '../../../CreateDetector/components/DefineDetector/components/DetectionRules/types/interfaces'; import { NotificationsStart } from 'opensearch-dashboards/public'; import { Detector } from '../../../../../types'; +import { EuiSpacer } from '@elastic/eui'; export interface DetectorDetailsViewProps { detector: Detector; @@ -40,13 +41,16 @@ export class DetectorDetailsView extends React.Component< isEditable = true, } = this.props; const detectorRules = ( - + <> + + + ); return ( From 966b713a7bc6fd62e1d41c9e73832e898331caa2 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 12 Apr 2023 21:23:16 +0200 Subject: [PATCH 8/8] [FEATURE] Deleting detectors should delete all related dashboards (including index-patterns and visualisations) #509 Signed-off-by: Jovan Cvetkovic --- .../Detector/__snapshots__/DetectorDetails.test.tsx.snap | 7 +++++++ .../__snapshots__/DetectorDetailsView.test.tsx.snap | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap index 74e74e97d..9da8535cf 100644 --- a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap +++ b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap @@ -2317,6 +2317,13 @@ exports[` spec renders the component 1`] = ` + +
+ spec renders the component 1`] = ` + +
+