minor ds init refactor

This commit is contained in:
Alexander Zobnin
2017-10-22 12:24:25 +03:00
parent df64c190e2
commit dacc3f3576
4 changed files with 37 additions and 31 deletions

View File

@@ -220,26 +220,28 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
this.basicAuth = instanceSettings.basicAuth;
this.withCredentials = instanceSettings.withCredentials;
var jsonData = instanceSettings.jsonData;
// Zabbix API credentials
this.username = instanceSettings.jsonData.username;
this.password = instanceSettings.jsonData.password;
this.username = jsonData.username;
this.password = jsonData.password;
// Use trends instead history since specified time
this.trends = instanceSettings.jsonData.trends;
this.trendsFrom = instanceSettings.jsonData.trendsFrom || '7d';
this.trendsRange = instanceSettings.jsonData.trendsRange || '4d';
this.trends = jsonData.trends;
this.trendsFrom = jsonData.trendsFrom || '7d';
this.trendsRange = jsonData.trendsRange || '4d';
// Set cache update interval
var ttl = instanceSettings.jsonData.cacheTTL || '1h';
var ttl = jsonData.cacheTTL || '1h';
this.cacheTTL = utils.parseInterval(ttl);
// Alerting options
this.alertingEnabled = instanceSettings.jsonData.alerting;
this.addThresholds = instanceSettings.jsonData.addThresholds;
this.alertingMinSeverity = instanceSettings.jsonData.alertingMinSeverity || c.SEV_WARNING;
this.alertingEnabled = jsonData.alerting;
this.addThresholds = jsonData.addThresholds;
this.alertingMinSeverity = jsonData.alertingMinSeverity || c.SEV_WARNING;
// Direct DB Connection options
var dbConnectionOptions = instanceSettings.jsonData.dbConnection || {};
var dbConnectionOptions = jsonData.dbConnection || {};
this.enableDirectDBConnection = dbConnectionOptions.enable;
this.sqlDatasourceId = dbConnectionOptions.datasourceId;

File diff suppressed because one or more lines are too long