Fix host group list update.
This commit is contained in:
@@ -1,133 +1,132 @@
|
|||||||
|
|
||||||
<div class="editor-row">
|
<div class="editor-row">
|
||||||
<div ng-repeat="target in panel.targets"
|
<div ng-repeat="target in panel.targets"
|
||||||
class="grafana-target"
|
class="grafana-target"
|
||||||
ng-class="{'grafana-target-hidden': target.hide}"
|
ng-class="{'grafana-target-hidden': target.hide}"
|
||||||
ng-controller="ZabbixAPITargetCtrl"
|
ng-controller="ZabbixAPITargetCtrl"
|
||||||
ng-init="init()">
|
ng-init="init()">
|
||||||
|
|
||||||
<div class="grafana-target-inner">
|
<div class="grafana-target-inner">
|
||||||
<ul class="grafana-target-controls">
|
<ul class="grafana-target-controls">
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="pointer dropdown-toggle"
|
<a class="pointer dropdown-toggle"
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
tabindex="1">
|
tabindex="1">
|
||||||
<i class="icon-cog"></i>
|
<i class="icon-cog"></i>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu pull-right" role="menu">
|
<ul class="dropdown-menu pull-right" role="menu">
|
||||||
<li role="menuitem">
|
<li role="menuitem">
|
||||||
<a tabindex="1"
|
<a tabindex="1"
|
||||||
ng-click="duplicate()">
|
ng-click="duplicate()">
|
||||||
Duplicate
|
Duplicate
|
||||||
</a>
|
</a>
|
||||||
</li>
|
|
||||||
<li role="menuitem">
|
|
||||||
<a tabindex="1"
|
|
||||||
ng-click="moveMetricQuery($index, $index-1)">
|
|
||||||
Move up
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li role="menuitem">
|
|
||||||
<a tabindex="1"
|
|
||||||
ng-click="moveMetricQuery($index, $index+1)">
|
|
||||||
Move down
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li role="menuitem">
|
||||||
<a class="pointer" tabindex="1" ng-click="removeDataQuery(target)">
|
<a tabindex="1"
|
||||||
<i class="icon-remove"></i>
|
ng-click="moveMetricQuery($index, $index-1)">
|
||||||
</a>
|
Move up
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<li role="menuitem">
|
||||||
|
<a tabindex="1"
|
||||||
|
ng-click="moveMetricQuery($index, $index+1)">
|
||||||
|
Move down
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="pointer" tabindex="1" ng-click="removeDataQuery(target)">
|
||||||
|
<i class="icon-remove"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul class="grafana-segment-list">
|
<ul class="grafana-segment-list">
|
||||||
<li class="grafana-target-segment" style="min-width: 15px; text-align: center">
|
<li class="grafana-target-segment" style="min-width: 15px; text-align: center">
|
||||||
{{targetLetters[$index]}}
|
{{targetLetters[$index]}}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="grafana-target-segment"
|
<a class="grafana-target-segment"
|
||||||
ng-click="target.hide = !target.hide; targetBlur();"
|
ng-click="target.hide = !target.hide; targetBlur();"
|
||||||
role="menuitem">
|
role="menuitem">
|
||||||
<i class="icon-eye-open"></i>
|
<i class="icon-eye-open"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="grafana-segment-list" role="menu">
|
<ul class="grafana-segment-list" role="menu">
|
||||||
<li>
|
<li>
|
||||||
<input type="text" class="input-medium grafana-target-text-input" ng-model="target.alias"
|
<input type="text" class="input-medium grafana-target-text-input" ng-model="target.alias"
|
||||||
spellcheck='false' placeholder="alias" ng-blur="targetBlur()">
|
spellcheck='false' placeholder="alias" ng-blur="targetBlur()">
|
||||||
</li>
|
</li>
|
||||||
<!-- Select Host Group -->
|
<!-- Select Host Group -->
|
||||||
<li>
|
<li>
|
||||||
<select style="width: 10em"
|
<select style="width: 10em"
|
||||||
class="input-medium grafana-target-segment-input"
|
class="input-medium grafana-target-segment-input"
|
||||||
ng-change="selectHostGroup()"
|
ng-change="selectHostGroup()"
|
||||||
ng-model="target.hostGroup"
|
ng-model="target.hostGroup"
|
||||||
bs-tooltip="target.hostGroup.name.length > 25 ? target.hostGroup.name : ''"
|
bs-tooltip="target.hostGroup.name.length > 25 ? target.hostGroup.name : ''"
|
||||||
ng-options="hostgroup.name for hostgroup in metric.hostGroupList" >
|
ng-options="hostgroup.name for hostgroup in metric.hostGroupList" >
|
||||||
<option value="">All</option>
|
<option value="">All</option>
|
||||||
</select>
|
</select>
|
||||||
<a bs-tooltip="target.errors.metric"
|
<a bs-tooltip="target.errors.metric"
|
||||||
style="color: rgb(229, 189, 28)"
|
style="color: rgb(229, 189, 28)"
|
||||||
ng-show="target.errors.metric">
|
ng-show="target.errors.metric">
|
||||||
<i class="icon-warning-sign"></i>
|
<i class="icon-warning-sign"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- Select Host -->
|
<!-- Select Host -->
|
||||||
<li>
|
<li>
|
||||||
<select style="width: 15em"
|
<select style="width: 15em"
|
||||||
class="input-medium grafana-target-segment-input"
|
class="input-medium grafana-target-segment-input"
|
||||||
ng-change="selectHost()"
|
ng-change="selectHost()"
|
||||||
ng-model="target.host"
|
ng-model="target.host"
|
||||||
bs-tooltip="target.host.name.length > 25 ? target.host.name : ''"
|
bs-tooltip="target.host.name.length > 25 ? target.host.name : ''"
|
||||||
ng-options="host.name for host in metric.hostList" >
|
ng-options="host.name for host in metric.hostList" >
|
||||||
<option value="">-- select host --</option>
|
<option value="">-- select host --</option>
|
||||||
</select>
|
</select>
|
||||||
<a bs-tooltip="target.errors.metric"
|
<a bs-tooltip="target.errors.metric"
|
||||||
style="color: rgb(229, 189, 28)"
|
style="color: rgb(229, 189, 28)"
|
||||||
ng-show="target.errors.metric">
|
ng-show="target.errors.metric">
|
||||||
<i class="icon-warning-sign"></i>
|
<i class="icon-warning-sign"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- Select Application -->
|
<!-- Select Application -->
|
||||||
<li>
|
<li>
|
||||||
<select style="width: 10em"
|
<select style="width: 10em"
|
||||||
class="input-medium grafana-target-segment-input"
|
class="input-medium grafana-target-segment-input"
|
||||||
ng-change="selectApplication()"
|
ng-change="selectApplication()"
|
||||||
ng-model="target.application"
|
ng-model="target.application"
|
||||||
bs-tooltip="target.application.name.length > 15 ? target.application.name : ''"
|
bs-tooltip="target.application.name.length > 15 ? target.application.name : ''"
|
||||||
ng-options="app.name for app in metric.applicationList" >
|
ng-options="app.name for app in metric.applicationList" >
|
||||||
<option value="">All</option>
|
<option value="">All</option>
|
||||||
</select>
|
</select>
|
||||||
<a bs-tooltip="target.errors.metric"
|
<a bs-tooltip="target.errors.metric"
|
||||||
style="color: rgb(229, 189, 28)"
|
style="color: rgb(229, 189, 28)"
|
||||||
ng-show="target.errors.metric">
|
ng-show="target.errors.metric">
|
||||||
<i class="icon-warning-sign"></i>
|
<i class="icon-warning-sign"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- Select Item -->
|
<!-- Select Item -->
|
||||||
<li>
|
<li>
|
||||||
<select style="width: 20em"
|
<select style="width: 20em"
|
||||||
class="input-medium grafana-target-segment-input"
|
class="input-medium grafana-target-segment-input"
|
||||||
ng-change="selectItem()"
|
ng-change="selectItem()"
|
||||||
ng-model="target.item"
|
ng-model="target.item"
|
||||||
bs-tooltip="target.expandedName.length > 30 ? target.expandedName : ''"
|
bs-tooltip="target.item.expandedName.length > 30 ? target.item.expandedName : ''"
|
||||||
ng-options="item.expandedName for item in metric.itemList" >
|
ng-options="item.expandedName for item in metric.itemList" >
|
||||||
<option value="">--select item--</option>
|
<option value="">--select item--</option>
|
||||||
</select>
|
</select>
|
||||||
<a bs-tooltip="target.errors.metric"
|
<a bs-tooltip="target.errors.metric"
|
||||||
style="color: rgb(229, 189, 28)"
|
style="color: rgb(229, 189, 28)"
|
||||||
ng-show="target.errors.metric">
|
ng-show="target.errors.metric">
|
||||||
<i class="icon-warning-sign"></i>
|
<i class="icon-warning-sign"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ function (angular, _) {
|
|||||||
var module = angular.module('grafana.controllers');
|
var module = angular.module('grafana.controllers');
|
||||||
var targetLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
var targetLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
var hostGroupList = [];
|
|
||||||
var hostList = [];
|
|
||||||
var applicationList = [];
|
|
||||||
var itemList = [];
|
|
||||||
|
|
||||||
module.controller('ZabbixAPITargetCtrl', function($scope) {
|
module.controller('ZabbixAPITargetCtrl', function($scope) {
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
@@ -26,7 +21,11 @@ function (angular, _) {
|
|||||||
|
|
||||||
// Update host group, host, application and item lists
|
// Update host group, host, application and item lists
|
||||||
$scope.updateHostGroupList();
|
$scope.updateHostGroupList();
|
||||||
$scope.updateHostList();
|
if ($scope.target.hostGroup) {
|
||||||
|
$scope.updateHostList($scope.target.hostGroup.groupid);
|
||||||
|
} else {
|
||||||
|
$scope.updateHostList();
|
||||||
|
}
|
||||||
if ($scope.target.host) {
|
if ($scope.target.host) {
|
||||||
$scope.updateAppList($scope.target.host.hostid);
|
$scope.updateAppList($scope.target.host.hostid);
|
||||||
if ($scope.target.application) {
|
if ($scope.target.application) {
|
||||||
|
|||||||
Reference in New Issue
Block a user