add migrations for datasource config

This commit is contained in:
Alexander Zobnin
2018-08-28 20:37:10 +03:00
parent ed5cc05c13
commit 07c7e4fc9e
5 changed files with 76 additions and 7 deletions

View File

@@ -1,11 +1,16 @@
import _ from 'lodash';
import { migrateDSConfig } from './migrations';
const SUPPORTED_SQL_DS = ['mysql', 'postgres'];
const defaultConfig = {
dbConnection: {
enable: false,
}
trends: false,
dbConnectionEnable: false,
dbConnectionDatasourceId: null,
alerting: false,
addThresholds: false,
alertingMinSeverity: 3,
disableReadOnlyUsersAck: false
};
export class ZabbixDSConfigController {
@@ -14,6 +19,7 @@ export class ZabbixDSConfigController {
constructor($scope, $injector, datasourceSrv) {
this.datasourceSrv = datasourceSrv;
this.current.jsonData = migrateDSConfig(this.current.jsonData);
_.defaults(this.current.jsonData, defaultConfig);
this.sqlDataSources = this.getSupportedSQLDataSources();
}