mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
This commit is contained in:
parent
95275c2fee
commit
a00d2b846e
10 changed files with 37 additions and 53 deletions
|
@ -7,7 +7,7 @@
|
|||
import { uiModules } from 'ui/modules';
|
||||
import { InitAfterBindingsWorkaround } from 'ui/compat';
|
||||
import moment from 'moment-timezone';
|
||||
import { Notifier, toastNotifications } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import 'ui/config';
|
||||
import 'ui/url';
|
||||
import 'ui/table_info';
|
||||
|
@ -48,8 +48,6 @@ app.directive('watchDetail', function ($injector) {
|
|||
controllerAs: 'watchDetail',
|
||||
controller: class WatchDetailController extends InitAfterBindingsWorkaround {
|
||||
initAfterBindings($scope) {
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
// history settings
|
||||
this.isHistoryLoading = false;
|
||||
this.historyRange = this.initialHistoryRange;
|
||||
|
@ -82,7 +80,7 @@ app.directive('watchDetail', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -122,7 +120,7 @@ app.directive('watchDetail', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -137,7 +135,7 @@ app.directive('watchDetail', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -148,7 +146,7 @@ app.directive('watchDetail', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -169,7 +167,7 @@ app.directive('watchDetail', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import 'ui/filters/moment';
|
||||
import { uiModules } from 'ui/modules';
|
||||
import { Notifier } from 'ui/notify';
|
||||
import 'ui/pager_control';
|
||||
import 'ui/pager';
|
||||
import 'ui/table_info';
|
||||
|
@ -48,7 +47,6 @@ app.directive('watchHistory', function ($injector) {
|
|||
this.pageOfHistoryItems = [];
|
||||
|
||||
this.historyRange = this.initialRange;
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
this.pager = pagerFactory.create(this.historyItems.length, PAGINATION.PAGE_SIZE, 1);
|
||||
|
||||
// react to data and UI changes
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import routes from 'ui/routes';
|
||||
import 'ui/url';
|
||||
import { Notifier } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import template from './watch_detail_route.html';
|
||||
import 'plugins/watcher/services/watch';
|
||||
import './components/watch_detail';
|
||||
|
@ -36,14 +36,12 @@ routes
|
|||
const watchService = $injector.get('xpackWatcherWatchService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
const watchId = $route.current.params.id;
|
||||
|
||||
return watchService.loadWatch(watchId)
|
||||
.catch(err => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect('/management/elasticsearch/watcher/watches');
|
||||
|
@ -55,14 +53,12 @@ routes
|
|||
const watchService = $injector.get('xpackWatcherWatchService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
const watchId = $route.current.params.id;
|
||||
|
||||
return watchService.loadWatchHistory(watchId, WATCH_HISTORY.INITIAL_RANGE)
|
||||
.catch(err => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect('/management/elasticsearch/watcher/watches');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { uiModules } from 'ui/modules';
|
||||
import { InitAfterBindingsWorkaround } from 'ui/compat';
|
||||
import { Notifier, toastNotifications } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import 'ui/dirty_prompt';
|
||||
import template from './json_watch_edit.html';
|
||||
import 'plugins/watcher/components/kbn_tabs';
|
||||
|
@ -38,7 +38,6 @@ app.directive('jsonWatchEdit', function ($injector) {
|
|||
controllerAs: 'jsonWatchEdit',
|
||||
controller: class JsonWatchEditController extends InitAfterBindingsWorkaround {
|
||||
initAfterBindings() {
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
this.selectedTabId = 'edit-watch';
|
||||
this.simulateResults = null;
|
||||
this.originalWatch = {
|
||||
|
@ -96,7 +95,7 @@ app.directive('jsonWatchEdit', function ($injector) {
|
|||
this.onTabSelect('simulate-results');
|
||||
})
|
||||
.catch(e => {
|
||||
this.notifier.error(e);
|
||||
toastNotifications.addDanger(e);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ app.directive('jsonWatchEdit', function ($injector) {
|
|||
const message = `Watch with ID "${this.watch.id}"${watchNameMessageFragment} already exists. Do you want to overwrite it?`;
|
||||
return confirmModal(message, confirmModalOptions);
|
||||
})
|
||||
.catch(err => this.notifier.error(err));
|
||||
.catch(err => toastNotifications.addDanger(err));
|
||||
}
|
||||
|
||||
isExistingWatch = () => {
|
||||
|
@ -148,7 +147,7 @@ app.directive('jsonWatchEdit', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -169,7 +168,7 @@ app.directive('jsonWatchEdit', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import 'plugins/watcher/services/interval';
|
|||
import 'plugins/watcher/services/action_defaults';
|
||||
|
||||
import dateMath from '@kbn/datemath';
|
||||
import { Notifier, toastNotifications } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import { VisualizeOptions } from 'plugins/watcher/models/visualize_options';
|
||||
import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants';
|
||||
|
||||
|
@ -53,7 +53,6 @@ app.directive('thresholdWatchEdit', function ($injector) {
|
|||
controller: class ThresholdWatchEditController extends InitAfterBindingsWorkaround {
|
||||
initAfterBindings($scope) {
|
||||
this.index = undefined;
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
this.originalWatch = {
|
||||
...this.watch
|
||||
};
|
||||
|
@ -141,13 +140,13 @@ app.directive('thresholdWatchEdit', function ($injector) {
|
|||
|
||||
if (actionStatus.lastExecutionSuccessful === false) {
|
||||
const message = actionStatus.lastExecutionReason || action.simulateFailMessage;
|
||||
this.notifier.error(message);
|
||||
toastNotifications.addDanger(message);
|
||||
} else {
|
||||
toastNotifications.addSuccess(action.simulateMessage);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.notifier.error(err);
|
||||
toastNotifications.addDanger(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -197,7 +196,7 @@ app.directive('thresholdWatchEdit', function ($injector) {
|
|||
this.restartRefreshWatchVisualizationTimer();
|
||||
})
|
||||
.catch(e => {
|
||||
this.notifier.error(e);
|
||||
toastNotifications.addDanger(e);
|
||||
this.stopRefreshWatchVisualizationTimer();
|
||||
});
|
||||
}, 500);
|
||||
|
@ -270,7 +269,7 @@ app.directive('thresholdWatchEdit', function ($injector) {
|
|||
const message = `Watch with ID "${this.watch.id}"${watchNameMessageFragment} already exists. Do you want to overwrite it?`;
|
||||
return confirmModal(message, confirmModalOptions);
|
||||
})
|
||||
.catch(err => this.notifier.error(err));
|
||||
.catch(err => toastNotifications.addDanger(err));
|
||||
}
|
||||
|
||||
isExistingWatch = () => {
|
||||
|
@ -298,7 +297,7 @@ app.directive('thresholdWatchEdit', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import routes from 'ui/routes';
|
||||
import 'ui/url';
|
||||
import { Notifier } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import template from './watch_edit_route.html';
|
||||
import 'plugins/watcher/services/watch';
|
||||
import './components/json_watch_edit';
|
||||
|
@ -40,8 +40,6 @@ routes
|
|||
const licenseService = $injector.get('xpackWatcherLicenseService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
const watchId = $route.current.params.id;
|
||||
const watchType = $route.current.params.watchType;
|
||||
|
||||
|
@ -54,7 +52,7 @@ routes
|
|||
return licenseService.checkValidity()
|
||||
.then(() => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect('/management/elasticsearch/watcher/watches');
|
||||
|
@ -68,7 +66,7 @@ routes
|
|||
return licenseService.checkValidity()
|
||||
.then(() => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect('/management/elasticsearch/watcher/watches');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import routes from 'ui/routes';
|
||||
import 'ui/url';
|
||||
import { Notifier } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import template from './watch_history_item_route.html';
|
||||
import 'plugins/watcher/services/watch';
|
||||
import 'plugins/watcher/services/watch_history';
|
||||
|
@ -22,14 +22,12 @@ routes
|
|||
const watchService = $injector.get('xpackWatcherWatchService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
const watchId = $route.current.params.watchId;
|
||||
|
||||
return watchService.loadWatch(watchId)
|
||||
.catch(err => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect('/management/elasticsearch/watcher/watches');
|
||||
|
@ -43,8 +41,6 @@ routes
|
|||
const watchHistoryService = $injector.get('xpackWatcherWatchHistoryService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
const watchId = $route.current.params.watchId;
|
||||
const watchHistoryItemId = $route.current.params.watchHistoryItemId;
|
||||
|
||||
|
@ -57,7 +53,7 @@ routes
|
|||
})
|
||||
.catch(err => {
|
||||
if (err.status !== 403) {
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
|
||||
kbnUrl.redirect(`/management/elasticsearch/watcher/watches/watch/${watchId}/status`);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import pluralize from 'pluralize';
|
||||
import { uiModules } from 'ui/modules';
|
||||
import { InitAfterBindingsWorkaround } from 'ui/compat';
|
||||
import { Notifier, toastNotifications } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import template from './watch_list.html';
|
||||
import '../watch_table';
|
||||
import { PAGINATION, REFRESH_INTERVALS, WATCH_TYPES } from 'plugins/watcher/../common/constants';
|
||||
|
@ -58,7 +58,6 @@ app.directive('watchList', function ($injector) {
|
|||
this.sortField = 'id';
|
||||
this.sortReverse = false;
|
||||
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
this.pager = pagerFactory.create(this.watches.length, PAGINATION.PAGE_SIZE, 1);
|
||||
|
||||
// Reload watches periodically
|
||||
|
@ -95,7 +94,7 @@ app.directive('watchList', function ($injector) {
|
|||
if (err.status === 403) {
|
||||
this.forbidden = true;
|
||||
} else {
|
||||
this.notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -176,7 +175,7 @@ app.directive('watchList', function ($injector) {
|
|||
})
|
||||
.catch(err => {
|
||||
return licenseService.checkValidity()
|
||||
.then(() => this.notifier.error(err));
|
||||
.then(() => toastNotifications.addDanger(err.data.message));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import routes from 'ui/routes';
|
||||
import { management } from 'ui/management';
|
||||
import { Notifier } from 'ui/notify';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import template from './watch_list_route.html';
|
||||
import './components/watch_list';
|
||||
import 'plugins/watcher/services/license';
|
||||
|
@ -31,7 +31,6 @@ routes
|
|||
const watchesService = $injector.get('xpackWatcherWatchesService');
|
||||
const licenseService = $injector.get('xpackWatcherLicenseService');
|
||||
const kbnUrl = $injector.get('kbnUrl');
|
||||
const notifier = new Notifier({ location: 'Watcher' });
|
||||
|
||||
return watchesService.getWatchList()
|
||||
.catch(err => {
|
||||
|
@ -41,7 +40,7 @@ routes
|
|||
return null;
|
||||
}
|
||||
|
||||
notifier.error(err);
|
||||
toastNotifications.addDanger(err.data.message);
|
||||
kbnUrl.redirect('/management');
|
||||
return Promise.reject();
|
||||
});
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import { MarkdownSimple } from 'ui/markdown';
|
||||
import chrome from 'ui/chrome';
|
||||
import { PLUGIN, ROUTES } from '../../../common/constants';
|
||||
import { Notifier } from 'ui/notify';
|
||||
|
||||
export class LicenseService {
|
||||
constructor(xpackInfoService, kbnUrlService, $timeout, $http) {
|
||||
|
@ -15,8 +17,6 @@ export class LicenseService {
|
|||
this.kbnUrlService = kbnUrlService;
|
||||
this.$timeout = $timeout;
|
||||
this.basePath = chrome.addBasePath(ROUTES.API_ROOT);
|
||||
|
||||
this.notifier = new Notifier({ location: 'Watcher' });
|
||||
}
|
||||
|
||||
get showLinks() {
|
||||
|
@ -36,7 +36,9 @@ export class LicenseService {
|
|||
}
|
||||
|
||||
notifyAndRedirect() {
|
||||
this.notifier.error(this.xpackInfoService.get(`features.${PLUGIN.ID}.message`));
|
||||
toastNotifications.addDanger({
|
||||
title: <MarkdownSimple>{this.xpackInfoService.get(`features.${PLUGIN.ID}.message`)}</MarkdownSimple>,
|
||||
});
|
||||
this.kbnUrlService.redirect('/management');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue