From 6d66d9f42d68f8d6d5ea9aaa5b595c33f447bf89 Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 29 Apr 2016 14:35:58 +0200 Subject: [PATCH] feat(alerting): adds fearture toogle for alerting --- conf/defaults.ini | 5 +++++ pkg/api/frontendsettings.go | 1 + pkg/setting/setting.go | 6 ++++++ public/app/plugins/panel/graph/module.ts | 5 ++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index 6f63891d1ee..60647273b23 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -332,3 +332,8 @@ global_api_key = -1 # global limit on number of logged in users. global_session = -1 + + +#################################### Alerting ###################################### +[alerting] +enabled = true diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index dd84f7827eb..650b82308b9 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -143,6 +143,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro "latestVersion": plugins.GrafanaLatestVersion, "hasUpdate": plugins.GrafanaHasUpdate, }, + "alertingEnabled": setting.AlertingEnabled, } return jsonObj, nil diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 2d1bad945eb..71fc6840798 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -137,6 +137,9 @@ var ( // QUOTA Quota QuotaSettings + + // Alerting + AlertingEnabled bool ) type CommandLineArgs struct { @@ -484,6 +487,9 @@ func NewConfigContext(args *CommandLineArgs) error { LdapEnabled = ldapSec.Key("enabled").MustBool(false) LdapConfigFile = ldapSec.Key("config_file").String() + alerting := Cfg.Section("alerting") + AlertingEnabled = alerting.Key("enabled").MustBool(false) + readSessionConfig() readSmtpSettings() readQuotaSettings() diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index d20c50405bc..60373bcfb3f 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -10,6 +10,7 @@ import moment from 'moment'; import kbn from 'app/core/utils/kbn'; import _ from 'lodash'; import TimeSeries from 'app/core/time_series2'; +import config from 'app/core/config'; import * as fileExport from 'app/core/utils/file_export'; import {MetricsPanelCtrl} from 'app/plugins/sdk'; import {graphAlertEditor} from './alert_tab_ctrl'; @@ -130,7 +131,9 @@ class GraphCtrl extends MetricsPanelCtrl { this.addEditorTab('Axes', 'public/app/plugins/panel/graph/tab_axes.html', 2); this.addEditorTab('Legend', 'public/app/plugins/panel/graph/tab_legend.html', 3); this.addEditorTab('Display', 'public/app/plugins/panel/graph/tab_display.html', 4); - this.addEditorTab('Alerting', graphAlertEditor, 5); + if (config.alertingEnabled) { + this.addEditorTab('Alerting', graphAlertEditor, 5); + } this.logScales = { 'linear': 1,