66
77import { i18n } from '@kbn/i18n' ;
88import { resolve } from 'path' ;
9- import { MONITORING_CONFIG_ALERTING_EMAIL_ADDRESS } from './common/constants' ;
9+ import {
10+ MONITORING_CONFIG_ALERTING_EMAIL_ADDRESS ,
11+ KIBANA_ALERTING_ENABLED ,
12+ } from './common/constants' ;
1013import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils' ;
1114
1215/**
@@ -15,32 +18,10 @@ import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
1518 * app (injectDefaultVars and hacks)
1619 * @return {Object } data per Kibana plugin uiExport schema
1720 */
18- export const getUiExports = ( ) => ( {
19- app : {
20- title : i18n . translate ( 'xpack.monitoring.stackMonitoringTitle' , {
21- defaultMessage : 'Stack Monitoring' ,
22- } ) ,
23- order : 9002 ,
24- description : i18n . translate ( 'xpack.monitoring.uiExportsDescription' , {
25- defaultMessage : 'Monitoring for Elastic Stack' ,
26- } ) ,
27- icon : 'plugins/monitoring/icons/monitoring.svg' ,
28- euiIconType : 'monitoringApp' ,
29- linkToLastSubUrl : false ,
30- main : 'plugins/monitoring/monitoring' ,
31- category : DEFAULT_APP_CATEGORIES . management ,
32- } ,
33- injectDefaultVars ( server ) {
34- const config = server . config ( ) ;
35- return {
36- monitoringUiEnabled : config . get ( 'xpack.monitoring.ui.enabled' ) ,
37- monitoringLegacyEmailAddress : config . get (
38- 'xpack.monitoring.cluster_alerts.email_notifications.email_address'
39- ) ,
40- } ;
41- } ,
42- uiSettingDefaults : {
43- [ MONITORING_CONFIG_ALERTING_EMAIL_ADDRESS ] : {
21+ export const getUiExports = ( ) => {
22+ const uiSettingDefaults = { } ;
23+ if ( KIBANA_ALERTING_ENABLED ) {
24+ uiSettingDefaults [ MONITORING_CONFIG_ALERTING_EMAIL_ADDRESS ] = {
4425 name : i18n . translate ( 'xpack.monitoring.alertingEmailAddress.name' , {
4526 defaultMessage : 'Alerting email address' ,
4627 } ) ,
@@ -49,9 +30,36 @@ export const getUiExports = () => ({
4930 defaultMessage : `The default email address to receive alerts from Stack Monitoring` ,
5031 } ) ,
5132 category : [ 'monitoring' ] ,
33+ } ;
34+ }
35+
36+ return {
37+ app : {
38+ title : i18n . translate ( 'xpack.monitoring.stackMonitoringTitle' , {
39+ defaultMessage : 'Stack Monitoring' ,
40+ } ) ,
41+ order : 9002 ,
42+ description : i18n . translate ( 'xpack.monitoring.uiExportsDescription' , {
43+ defaultMessage : 'Monitoring for Elastic Stack' ,
44+ } ) ,
45+ icon : 'plugins/monitoring/icons/monitoring.svg' ,
46+ euiIconType : 'monitoringApp' ,
47+ linkToLastSubUrl : false ,
48+ main : 'plugins/monitoring/monitoring' ,
49+ category : DEFAULT_APP_CATEGORIES . management ,
50+ } ,
51+ injectDefaultVars ( server ) {
52+ const config = server . config ( ) ;
53+ return {
54+ monitoringUiEnabled : config . get ( 'xpack.monitoring.ui.enabled' ) ,
55+ monitoringLegacyEmailAddress : config . get (
56+ 'xpack.monitoring.cluster_alerts.email_notifications.email_address'
57+ ) ,
58+ } ;
5259 } ,
53- } ,
54- hacks : [ 'plugins/monitoring/hacks/toggle_app_link_in_nav' ] ,
55- home : [ 'plugins/monitoring/register_feature' ] ,
56- styleSheetPaths : resolve ( __dirname , 'public/index.scss' ) ,
57- } ) ;
60+ uiSettingDefaults,
61+ hacks : [ 'plugins/monitoring/hacks/toggle_app_link_in_nav' ] ,
62+ home : [ 'plugins/monitoring/register_feature' ] ,
63+ styleSheetPaths : resolve ( __dirname , 'public/index.scss' ) ,
64+ } ;
65+ } ;
0 commit comments