Skip to content

Commit 88ea0c6

Browse files
committed
[OS-Assistant] example of usage of palantir component
Uses content added here opensearch-project/dashboards-assistant#53 Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
1 parent 59ea0e3 commit 88ea0c6

File tree

3 files changed

+42
-9
lines changed

3 files changed

+42
-9
lines changed

opensearch_dashboards.json

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
"visAugmenter",
1717
"opensearchDashboardsUtils"
1818
],
19+
"optionalPlugins": [
20+
"assistantDashboards"
21+
],
22+
"requiredEnginePlugins": {
23+
"opensearch-alerting": "*"
24+
},
25+
"requiredBundles": [
26+
"assistantDashboards"
27+
],
1928
"server": true,
2029
"ui": true
2130
}

public/pages/Monitors/containers/Monitors/utils/tableUtils.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import moment from 'moment';
99
import { DEFAULT_EMPTY_DATA, MONITOR_TYPE } from '../../../../../utils/constants';
1010
import { PLUGIN_NAME } from '../../../../../../utils/constants';
1111
import { getItemLevelType } from './helpers';
12+
import { PalantirComponent } from '../../../../../../../../plugins/dashboards-assistant/public';
1213

1314
const renderTime = (time) => {
1415
const momentTime = moment(time);
@@ -22,14 +23,25 @@ export const columns = [
2223
name: 'Monitor name',
2324
sortable: true,
2425
textOnly: true,
25-
render: (name, item) => (
26-
<EuiLink
27-
data-test-subj={name}
28-
href={`${PLUGIN_NAME}#/monitors/${item.id}?type=${item.monitor.type}`}
29-
>
30-
{name}
31-
</EuiLink>
32-
),
26+
render: (name, item) =>
27+
PalantirComponent ? (
28+
<PalantirComponent>
29+
<EuiLink
30+
key={`${item.item_type}`}
31+
data-test-subj={name}
32+
href={`${PLUGIN_NAME}#/monitors/${item.id}?type=${item.monitor.type}`}
33+
>
34+
{name}
35+
</EuiLink>
36+
</PalantirComponent>
37+
) : (
38+
<EuiLink
39+
data-test-subj={name}
40+
href={`${PLUGIN_NAME}#/monitors/${item.id}?type=${item.monitor.type}`}
41+
>
42+
{name}
43+
</EuiLink>
44+
),
3345
},
3446
{
3547
field: 'enabled',

public/plugin.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { overlayAlertsFunction } from './expressions/overlay_alerts';
1919
import { setClient, setEmbeddable, setNotifications, setOverlays, setSavedAugmentVisLoader, setUISettings, setQueryService } from './services';
2020
import { VisAugmenterStart } from '../../../src/plugins/vis_augmenter/public';
2121
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
22+
import { AssistantPublicPluginSetup } from './../../../plugins/dashboards-assistant/public';
2223

2324
declare module '../../../src/plugins/ui_actions/public' {
2425
export interface ActionContextMapping {
@@ -33,6 +34,7 @@ export interface AlertingStart {}
3334
export interface AlertingSetupDeps {
3435
expressions: ExpressionsSetup;
3536
uiActions: UiActionsSetup;
37+
assistantDashboards?: AssistantPublicPluginSetup;
3638
}
3739

3840
export interface AlertingStartDeps {
@@ -42,7 +44,7 @@ export interface AlertingStartDeps {
4244
}
4345

4446
export class AlertingPlugin implements Plugin<AlertingSetup, AlertingStart, AlertingSetupDeps, AlertingStartDeps> {
45-
public setup(core: CoreSetup<AlertingStartDeps, AlertingStart>, { expressions, uiActions }: AlertingSetupDeps): AlertingSetup {
47+
public setup(core: CoreSetup<AlertingStartDeps, AlertingStart>, { expressions, uiActions, assistantDashboards }: AlertingSetupDeps): AlertingSetup {
4648
core.application.register({
4749
id: PLUGIN_NAME,
4850
title: 'Alerting',
@@ -60,6 +62,16 @@ export class AlertingPlugin implements Plugin<AlertingSetup, AlertingStart, Aler
6062
},
6163
});
6264

65+
if (assistantDashboards) {
66+
assistantDashboards.registerPalantir([
67+
{
68+
key: 'query_level_monitor',
69+
description: 'Monitoring on the query level',
70+
suggestion: 'How to better configure my monitor?',
71+
},
72+
]);
73+
}
74+
6375
setUISettings(core.uiSettings);
6476

6577
// Set the HTTP client so it can be pulled into expression fns to make

0 commit comments

Comments
 (0)