Skip to content

Commit

Permalink
fix direct DB connection datasource config, closes #731
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Jul 5, 2019
1 parent 3a7da58 commit 6b5b5f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/datasource-zabbix/config.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export class ZabbixDSConfigController {
this.current.jsonData = migrateDSConfig(this.current.jsonData);
_.defaults(this.current.jsonData, defaultConfig);

this.dbConnectionEnable = this.current.jsonData.dbConnectionEnable;
this.dbConnectionDatasourceId = this.current.jsonData.dbConnectionDatasourceId;

this.dbDataSources = this.getSupportedDBDataSources();
this.zabbixVersions = _.cloneDeep(zabbixVersions);
this.autoDetectZabbixVersion();
Expand Down Expand Up @@ -81,4 +79,8 @@ export class ZabbixDSConfigController {
}
});
}

onDBConnectionDatasourceChange() {
this.current.jsonData.dbConnectionDatasourceId = this.dbConnectionDatasourceId;
}
}
10 changes: 6 additions & 4 deletions src/datasource-zabbix/partials/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ <h3 class="page-heading">Zabbix API details</h3>
<h3 class="page-heading">Direct DB Connection</h3>
<gf-form-switch class="gf-form" label-class="width-12"
label="Enable"
checked="ctrl.dbConnectionEnable">
checked="ctrl.current.jsonData.dbConnectionEnable">
</gf-form-switch>
<div ng-if="ctrl.dbConnectionEnable">
<div ng-if="ctrl.current.jsonData.dbConnectionEnable">
<div class="gf-form max-width-30">
<span class="gf-form-label width-12">
Data Source
Expand All @@ -103,8 +103,10 @@ <h3 class="page-heading">Direct DB Connection</h3>
</info-popover>
</span>
<div class="gf-form-select-wrapper max-width-16">
<select class="gf-form-input" ng-model="ctrl.dbConnectionDatasourceId"
ng-options="ds.id as ds.name for ds in ctrl.dbDataSources">
<select class="gf-form-input"
ng-model="ctrl.dbConnectionDatasourceId"
ng-options="ds.id as ds.name for ds in ctrl.dbDataSources"
ng-change="ctrl.onDBConnectionDatasourceChange()">
</select>
</div>
</div>
Expand Down

0 comments on commit 6b5b5f8

Please sign in to comment.