>>;
+ enabledRules?: RuleItem[];
+ allRules?: RuleItem[];
+ }
> {
detectorService: DetectorsService;
notifications: NotificationsStart;
+ savedObjectsService: ISavedObjectsService;
}
export interface DetectorDetailsState {
@@ -47,6 +60,7 @@ export interface DetectorDetailsState {
detectorId: string;
tabs: any[];
loading: boolean;
+ dashboardId?: string;
}
enum TabId {
@@ -105,6 +119,7 @@ export class DetectorDetails extends React.Component
@@ -152,6 +167,35 @@ export class DetectorDetails extends React.Component
{
+ if (savedObject && savedObject.ok) {
+ this.setState({ dashboardId: savedObject.response.id });
+ this.getTabs();
+ }
+ delete pendingDashboardCreations[this.state.detectorId];
+ });
+ } else {
+ const dashboards = await this.props.savedObjectsService.getDashboards();
+ let detectorDashboardId;
+ dashboards.some((dashboard) => {
+ if (
+ dashboard.references.findIndex((reference) => reference.id === this.state.detectorId) > -1
+ ) {
+ detectorDashboardId = dashboard.id;
+ return true;
+ }
+
+ return false;
+ });
+
+ if (detectorDashboardId) {
+ this.setState({ dashboardId: detectorDashboardId });
+ this.getTabs();
+ }
+ }
}
getDetector = async () => {
@@ -242,15 +286,8 @@ export class DetectorDetails extends React.Component (
- {action.name}
- )),
{
- this.closeActionsPopover();
- this.onDelete();
- }}
- data-test-subj={'editButton'}
+ onClick={this.onViewAlertsClick}
+ data-test-subj={'viewAlertsButton'}
>
- Delete
+ View Alerts
,
+
+ View Findings
+ ,
+ <>
+ {this.state.dashboardId ? (
+
+ window.open(`dashboards#/view/${this.state.dashboardId}`, '_blank')
+ }
+ data-test-subj={'viewDashboard'}
+ >
+ View detector dashboard
+
+ ) : null}
+ >,
+ ,
{`${this.detectorHit._source.enabled ? 'Stop' : 'Start'} detector`}
,
+ {
+ this.closeActionsPopover();
+ this.onDelete();
+ }}
+ data-test-subj={'editButton'}
+ >
+ Delete
+ ,
]}
/>
,
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 ccb8ab9ab..3de85c0a3 100644
--- a/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap
+++ b/public/pages/Detectors/containers/Detector/__snapshots__/DetectorDetails.test.tsx.snap
@@ -220,6 +220,19 @@ exports[` spec renders the component 1`] = `
},
}
}
+ savedObjectsService={
+ SavedObjectService {
+ "getDashboards": [Function],
+ "indexService": undefined,
+ "savedObjectsClient": Object {
+ "delete": [MockFunction],
+ "get": [MockFunction],
+ "head": [MockFunction],
+ "post": [MockFunction],
+ "put": [MockFunction],
+ },
+ }
+ }
>
spec renders the component 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
spec renders the component 1`] = `
},
}
}
+ savedObjectsService={
+ SavedObjectService {
+ "getDashboards": [Function],
+ "indexService": undefined,
+ "savedObjectsClient": Object {
+ "delete": [MockFunction],
+ "get": [MockFunction],
+ "head": [MockFunction],
+ "post": [MockFunction],
+ "put": [MockFunction],
+ },
+ }
+ }
>
spec renders the component 1`] = `
}
}
onEditClicked={[Function]}
+ savedObjectsService={
+ SavedObjectService {
+ "getDashboards": [Function],
+ "indexService": undefined,
+ "savedObjectsClient": Object {
+ "delete": [MockFunction],
+ "get": [MockFunction],
+ "head": [MockFunction],
+ "post": [MockFunction],
+ "put": [MockFunction],
+ },
+ }
+ }
>
spec renders the component 1`] = `
+