diff --git a/public/pages/MonitorDetails/containers/Triggers/Triggers.js b/public/pages/MonitorDetails/containers/Triggers/Triggers.js
index 801dfb6fe..0f86251e5 100644
--- a/public/pages/MonitorDetails/containers/Triggers/Triggers.js
+++ b/public/pages/MonitorDetails/containers/Triggers/Triggers.js
@@ -78,7 +78,6 @@ export default class Triggers extends Component {
};
this.onDelete = this.onDelete.bind(this);
- this.onEdit = this.onEdit.bind(this);
this.onSelectionChange = this.onSelectionChange.bind(this);
this.onTableChange = this.onTableChange.bind(this);
this.monitorsById = {};
@@ -151,11 +150,6 @@ export default class Triggers extends Component {
updateMonitor({ triggers: updatedTriggers });
}
- onEdit() {
- const { monitor } = this.props;
- this.props.onEditTrigger(monitor.triggers);
- }
-
onSelectionChange(selectedItems) {
this.setState({ selectedItems });
}
@@ -230,6 +224,4 @@ Triggers.propTypes = {
monitor: PropTypes.object.isRequired,
httpClient: PropTypes.object.isRequired,
updateMonitor: PropTypes.func.isRequired,
- onEditTrigger: PropTypes.func.isRequired,
- onCreateTrigger: PropTypes.func.isRequired,
};
diff --git a/public/pages/MonitorDetails/containers/Triggers/Triggers.test.js b/public/pages/MonitorDetails/containers/Triggers/Triggers.test.js
index 5b6227565..1ff79c4cf 100644
--- a/public/pages/MonitorDetails/containers/Triggers/Triggers.test.js
+++ b/public/pages/MonitorDetails/containers/Triggers/Triggers.test.js
@@ -16,8 +16,6 @@ const props = {
},
delegateMonitors: [],
updateMonitor: jest.fn(),
- onEditTrigger: jest.fn(),
- onCreateTrigger: jest.fn(),
};
jest.mock('uuid/v4', () => {
@@ -50,14 +48,6 @@ describe('Triggers', () => {
expect(tableKey).not.toBe(diffTableKey);
});
- test('onEdit calls onEditTrigger', () => {
- const onEdit = jest.spyOn(Triggers.prototype, 'onEdit');
- const wrapper = getShallowWrapper();
- wrapper.instance().onEdit();
- expect(onEdit).toHaveBeenCalled();
- expect(props.onEditTrigger).toHaveBeenCalled();
- });
-
test('onDelete calls updateMonitor with triggers to keep', () => {
const onDelete = jest.spyOn(Triggers.prototype, 'onDelete');
const monitor = {
diff --git a/public/pages/Monitors/components/MonitorActions/MonitorActions.js b/public/pages/Monitors/components/MonitorActions/MonitorActions.js
index 489450fb8..11d41090f 100644
--- a/public/pages/Monitors/components/MonitorActions/MonitorActions.js
+++ b/public/pages/Monitors/components/MonitorActions/MonitorActions.js
@@ -14,7 +14,7 @@ import {
} from '@elastic/eui';
import { APP_PATH } from '../../../../utils/constants';
-import { PLUGIN_NAME } from '../../../../../utils/constants';
+import { PageHeader } from '../../../../components/PageHeader/PageHeader';
export default class MonitorActions extends Component {
state = {
@@ -83,8 +83,14 @@ export default class MonitorActions extends Component {
render() {
const { isActionsOpen } = this.state;
const { isEditDisabled, onClickEdit } = this.props;
+ const createMonitorControl = (
+
+ Create monitor
+
+ );
+
return (
-
+
-
-
- Create monitor
-
-
+
+ {createMonitorControl}
+
);
}
diff --git a/public/pages/Monitors/components/MonitorActions/MonitorActions.test.js b/public/pages/Monitors/components/MonitorActions/MonitorActions.test.js
index 94fb381b3..f96948b1e 100644
--- a/public/pages/Monitors/components/MonitorActions/MonitorActions.test.js
+++ b/public/pages/Monitors/components/MonitorActions/MonitorActions.test.js
@@ -7,6 +7,7 @@ import React from 'react';
import { render, shallow, mount } from 'enzyme';
import MonitorActions from './MonitorActions';
+import { setupCoreStart } from '../../../../../test/utils/helpers';
const getProps = () => ({
onBulkAcknowledge: jest.fn(),
@@ -17,6 +18,10 @@ const getProps = () => ({
onClickEdit: jest.fn(),
});
+beforeAll(() => {
+ setupCoreStart();
+});
+
describe('MonitorActions', () => {
test('renders', () => {
const component = ;
diff --git a/public/pages/Monitors/components/MonitorActions/__snapshots__/MonitorActions.test.js.snap b/public/pages/Monitors/components/MonitorActions/__snapshots__/MonitorActions.test.js.snap
index 503c10aeb..28675fe19 100644
--- a/public/pages/Monitors/components/MonitorActions/__snapshots__/MonitorActions.test.js.snap
+++ b/public/pages/Monitors/components/MonitorActions/__snapshots__/MonitorActions.test.js.snap
@@ -2,7 +2,7 @@
exports[`MonitorActions renders 1`] = `
(
-
+
+ {monitorActions && {monitorActions}}
diff --git a/public/pages/Monitors/components/MonitorEmptyPrompt/MonitorEmptyPrompt.js b/public/pages/Monitors/components/MonitorEmptyPrompt/MonitorEmptyPrompt.js
index f227f5229..88194f359 100644
--- a/public/pages/Monitors/components/MonitorEmptyPrompt/MonitorEmptyPrompt.js
+++ b/public/pages/Monitors/components/MonitorEmptyPrompt/MonitorEmptyPrompt.js
@@ -7,7 +7,6 @@ import React from 'react';
import { EuiSmallButton, EuiEmptyPrompt, EuiText } from '@elastic/eui';
import { APP_PATH } from '../../../../utils/constants';
-import { PLUGIN_NAME } from '../../../../../utils/constants';
const filterText =
'There are no monitors matching your applied filters. Reset your filters to view your monitors.';
@@ -15,7 +14,7 @@ const emptyMonitorText =
'There are no existing monitors. Create a monitor to add triggers and actions.';
const loadingText = 'Loading monitors...';
const createMonitorButton = (
-
+
Create monitor
);
diff --git a/public/pages/Monitors/components/MonitorEmptyPrompt/__snapshots__/MonitorEmptyPrompt.test.js.snap b/public/pages/Monitors/components/MonitorEmptyPrompt/__snapshots__/MonitorEmptyPrompt.test.js.snap
index bf4e38330..2d9bae91c 100644
--- a/public/pages/Monitors/components/MonitorEmptyPrompt/__snapshots__/MonitorEmptyPrompt.test.js.snap
+++ b/public/pages/Monitors/components/MonitorEmptyPrompt/__snapshots__/MonitorEmptyPrompt.test.js.snap
@@ -25,7 +25,7 @@ exports[`MonitorEmptyPrompt renders 1`] = `
/>
(selectable ? undefined : undefined),
};
+ const useUpdatedUx = getUseUpdatedUx();
+ const monitorActions = (
+
+ );
+
return (
<>
- }
+ actions={useUpdatedUx ? undefined : monitorActions}
bodyStyles={{ padding: 'initial' }}
- title="Monitors"
+ title={useUpdatedUx ? undefined : 'Monitors'}
+ panelOptions={{ hideTitleBorder: useUpdatedUx }}
>
diff --git a/public/pages/Monitors/containers/Monitors/Monitors.test.js b/public/pages/Monitors/containers/Monitors/Monitors.test.js
index c5655e8d0..8e195f85b 100644
--- a/public/pages/Monitors/containers/Monitors/Monitors.test.js
+++ b/public/pages/Monitors/containers/Monitors/Monitors.test.js
@@ -9,7 +9,7 @@ import _ from 'lodash';
import Monitors from './Monitors';
import { historyMock, httpClientMock } from '../../../../../test/mocks';
-import AlertingFakes from '../../../../../test/utils/helpers';
+import { AlertingFakes, setupCoreStart } from '../../../../../test/utils/helpers';
const alertingFakes = new AlertingFakes('random seed');
@@ -41,6 +41,10 @@ function getMountWrapper(customProps = {}) {
);
}
+beforeAll(() => {
+ setupCoreStart();
+});
+
describe('Monitors', () => {
beforeEach(() => {
jest.clearAllMocks();
diff --git a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap
index a1b75778a..28233c7c4 100644
--- a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap
+++ b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap
@@ -19,10 +19,16 @@ exports[`Monitors renders 1`] = `
"padding": "initial",
}
}
+ panelOptions={
+ Object {
+ "hideTitleBorder": undefined,
+ }
+ }
title="Monitors"
>
{
@@ -23,10 +22,7 @@ export const columns = [
sortable: true,
textOnly: true,
render: (name, item) => (
-
+
{name}
),
diff --git a/public/pages/utils/helpers.js b/public/pages/utils/helpers.js
index d990da842..4acc59d10 100644
--- a/public/pages/utils/helpers.js
+++ b/public/pages/utils/helpers.js
@@ -42,7 +42,7 @@ export function parseQueryStringAndGetDataSource(queryString) {
const pair = param.split('=');
params[pair[0]] = pair[1];
}
- return params['dataSourceId'];
+ return params.hasOwnProperty('dataSourceId') ? params['dataSourceId'] || '' : undefined;
}
export function constructUrlFromDataSource(url) {
diff --git a/public/plugin.tsx b/public/plugin.tsx
index e4be048aa..06ca8a2bc 100644
--- a/public/plugin.tsx
+++ b/public/plugin.tsx
@@ -20,11 +20,12 @@ import { alertingTriggerAd } from './utils/contextMenu/triggers';
import { ExpressionsSetup } from '../../../src/plugins/expressions/public';
import { UiActionsSetup } from '../../../src/plugins/ui_actions/public';
import { overlayAlertsFunction } from './expressions/overlay_alerts';
-import { setClient, setEmbeddable, setNotifications, setOverlays, setSavedAugmentVisLoader, setUISettings, setQueryService, setSavedObjectsClient, setDataSourceEnabled, setDataSourceManagementPlugin } from './services';
+import { setClient, setEmbeddable, setNotifications, setOverlays, setSavedAugmentVisLoader, setUISettings, setQueryService, setSavedObjectsClient, setDataSourceEnabled, setDataSourceManagementPlugin, setNavigationUI, setApplication } from './services';
import { VisAugmenterStart } from '../../../src/plugins/vis_augmenter/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public';
import { DataSourcePluginSetup } from '../../../src/plugins/data_source/public';
+import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
declare module '../../../src/plugins/ui_actions/public' {
export interface ActionContextMapping {
@@ -47,6 +48,7 @@ export interface AlertingStartDeps {
visAugmenter: VisAugmenterStart;
embeddable: EmbeddableStart;
data: DataPublicPluginStart;
+ navigation: NavigationPublicPluginStart;
}
export class AlertingPlugin implements Plugin {
@@ -86,6 +88,14 @@ export class AlertingPlugin implements Plugin(null);
@@ -56,3 +57,11 @@ export const [getDataSourceReadOnly, setDataSourceReadOnly] =
export const [getNotifications, setNotifications] =
createGetterSetter('Notifications');
+
+export const [getNavigationUI, setNavigationUI] = createGetterSetter('navigation');
+
+export const [getApplication, setApplication] = createGetterSetter('application');
+
+export const getUseUpdatedUx = () => {
+ return getUISettings().get('home:useNewHomePage', false);
+};
diff --git a/public/utils/helpers.js b/public/utils/helpers.js
index 4394ee92a..3806b9d9f 100644
--- a/public/utils/helpers.js
+++ b/public/utils/helpers.js
@@ -12,6 +12,7 @@ import {
} from '../pages/Dashboard/utils/helpers';
import _ from 'lodash';
import { getDataSourceQueryObj } from '../pages/utils/helpers';
+import { getUseUpdatedUx } from '../services';
export const makeId = htmlIdGenerator();
@@ -142,13 +143,21 @@ export const titleTemplate = (title, subTitle) => (
);
// This is updated to include the server.basepath during plugin's first render inside app.js using `initManageChannelsUrl` function
-export let MANAGE_CHANNELS_URL = '/app/notifications-dashboards#/channels';
+export let MANAGE_CHANNELS_URL = undefined;
+// export const manageChannelsRelativePath = `/app/notifications-dashboards#/channels`;
export function initManageChannelsUrl(httpClient) {
- const manageChannelsRelativePath = `/app/notifications-dashboards#/channels`;
- MANAGE_CHANNELS_URL = httpClient.basePath.prepend(manageChannelsRelativePath);
+ if (!MANAGE_CHANNELS_URL) {
+ const relativePath = `/app/${
+ getUseUpdatedUx() ? 'channels' : 'notifications-dashboards'
+ }#/channels`;
+ MANAGE_CHANNELS_URL = httpClient.basePath.prepend(relativePath);
+ }
}
export function getManageChannelsUrl() {
- return MANAGE_CHANNELS_URL;
+ const relativePath = `/app/${
+ getUseUpdatedUx() ? 'channels' : 'notifications-dashboards'
+ }#/channels`;
+ return MANAGE_CHANNELS_URL || relativePath;
}
diff --git a/server/services/CrossClusterService.js b/server/services/CrossClusterService.js
index 948421a75..f1216af08 100644
--- a/server/services/CrossClusterService.js
+++ b/server/services/CrossClusterService.js
@@ -8,6 +8,7 @@ export default class CrossClusterService extends MDSEnabledClientService {
getRemoteIndexes = async (context, req, res) => {
try {
const client = this.getClientBasedOnDataSource(context, req);
+ delete req.query['dataSourceId'];
const response = await client('alerting.getRemoteIndexes', req.query);
return res.ok({
diff --git a/test/utils/helpers.js b/test/utils/helpers.js
index b869dfbcd..662461bef 100644
--- a/test/utils/helpers.js
+++ b/test/utils/helpers.js
@@ -4,10 +4,19 @@
*/
import { TRIGGER_TYPE } from '../../public/pages/CreateTrigger/containers/CreateTrigger/utils/constants';
+import { navigationPluginMock } from '../../../../src/plugins/navigation/public/mocks';
+import { applicationServiceMock } from '../../../../src/core/public/application/application_service.mock';
+import { uiSettingsServiceMock } from '../../../../src/core/public/ui_settings/ui_settings_service.mock';
+import { setApplication, setNavigationUI, setUISettings } from '../../public/services';
+import { Chance } from 'chance';
+
+export function setupCoreStart() {
+ setNavigationUI(navigationPluginMock.createStartContract().ui);
+ setApplication(applicationServiceMock.createStartContract());
+ setUISettings(uiSettingsServiceMock.createStartContract());
+}
-const Chance = require('chance');
-
-class AlertingFakes {
+export class AlertingFakes {
constructor(seed = 'seed') {
this.chance = new Chance(seed);
@@ -188,5 +197,3 @@ class AlertingFakes {
return this.chance.timestamp();
}
}
-
-module.exports = AlertingFakes;