Files
grafana-zabbix/src/datasource-zabbix/config.controller.js
Alexander Zobnin 6fa4baed0c mysql-connector: add config options for selecting data source
and load SQL data source during plugin init
2017-07-21 17:32:46 +03:00

29 lines
674 B
JavaScript

import _ from 'lodash';
const SUPPORTED_SQL_DS = ['mysql'];
const defaultConfig = {
dbConnection: {
enable: false,
}
};
export class ZabbixDSConfigController {
/** @ngInject */
constructor($scope, $injector, datasourceSrv) {
this.datasourceSrv = datasourceSrv;
_.defaults(this.current.jsonData, defaultConfig);
this.sqlDataSources = this.getSupportedSQLDataSources();
}
getSupportedSQLDataSources() {
let datasources = this.datasourceSrv.getAll();
return _.filter(datasources, ds => {
return _.includes(SUPPORTED_SQL_DS, ds.type);
});
}
}
ZabbixDSConfigController.templateUrl = 'datasource-zabbix/partials/config.html';