Resolved #53 - Get settings from data source configuration page.

This commit is contained in:
Alexander Zobnin
2015-07-12 20:55:56 +03:00
parent b466cc4cbc
commit ba48436a0a
2 changed files with 37 additions and 10 deletions

View File

@@ -26,16 +26,15 @@ function (angular, _, kbn) {
this.basicAuth = datasource.basicAuth;
this.withCredentials = datasource.withCredentials;
// TODO: fix passing username and password from config.html
this.username = datasource.meta.username;
this.password = datasource.meta.password;
this.username = datasource.jsonData.username || datasource.meta.username;
this.password = datasource.jsonData.password || datasource.meta.password;
// Use trends instead history since specified time
this.trends = datasource.meta.trends;
this.trendsFrom = datasource.meta.trendsFrom || '7d';
this.trends = datasource.jsonData.trends || datasource.meta.trends;
this.trendsFrom = datasource.jsonData.trendsFrom || datasource.meta.trendsFrom || '7d';
// Limit metrics per panel for templated request
this.limitmetrics = datasource.meta.limitmetrics || 100;
this.limitmetrics = datasource.jsonData.limitMetrics || datasource.meta.limitmetrics || 100;
// Initialize Zabbix API
this.zabbixAPI = new ZabbixAPI(this.url, this.username, this.password, this.basicAuth, this.withCredentials);

View File

@@ -10,16 +10,44 @@
User
</li>
<li>
<input type="text" class="tight-form-input input-large" ng-model='current.jsonData.zabbixUser' placeholder=""></input>
<input type="text" class="tight-form-input input-large" ng-model='current.jsonData.username' placeholder=""></input>
</li>
<li class="tight-form-item">
Password
</li>
<li>
<input type="password" class="tight-form-input input-large" ng-model='current.jsonData.zabbixPassword' placeholder=""></input>
<input type="password" class="tight-form-input input-large" ng-model='current.jsonData.password' placeholder=""></input>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px">
Trends
</li>
<li class="tight-form-item">
Enable&nbsp;
<input class="cr1" id="current.jsonData.trends" type="checkbox" ng-model="current.jsonData.trends" ng-checked="current.jsonData.trends">
<label for="current.jsonData.trends" class="cr1"></label>
</li>
<li class="tight-form-item" ng-if="current.jsonData.trends">
Use trends from
</li>
<li ng-if="current.jsonData.trends">
<input type="text" class="tight-form-input input-small" ng-model='current.basicAuthUser' placeholder="7d"></input>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form last">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px">
Metrics limit
</li>
<li>
<input type="text" class="tight-form-input input-small" ng-model='current.jsonData.limitMetrics' placeholder="100"></input>
</li>
</ul>
<div class="clearfix"></div>
</div>