iss #71 - Added text metrics editor.
This commit is contained in:
@@ -94,7 +94,7 @@ function (angular, _, kbn) {
|
|||||||
// Create request for each target
|
// Create request for each target
|
||||||
var promises = _.map(options.targets, function(target) {
|
var promises = _.map(options.targets, function(target) {
|
||||||
|
|
||||||
if (!target.ITService) {
|
if (!target.mode || target.mode === 0) {
|
||||||
// Don't show undefined and hidden targets
|
// Don't show undefined and hidden targets
|
||||||
if (target.hide || !target.group || !target.host
|
if (target.hide || !target.group || !target.host
|
||||||
|| !target.application || !target.item) {
|
|| !target.application || !target.item) {
|
||||||
@@ -199,7 +199,10 @@ function (angular, _, kbn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// IT services mode
|
||||||
|
else if (target.mode === 1) {
|
||||||
// Don't show undefined and hidden targets
|
// Don't show undefined and hidden targets
|
||||||
if (target.hide || !target.itservice || !target.slaProperty) {
|
if (target.hide || !target.itservice || !target.slaProperty) {
|
||||||
return [];
|
return [];
|
||||||
@@ -208,6 +211,11 @@ function (angular, _, kbn) {
|
|||||||
.then(_.bind(zabbixHelperSrv.handleSLAResponse, zabbixHelperSrv, target.itservice, target.slaProperty));
|
.then(_.bind(zabbixHelperSrv.handleSLAResponse, zabbixHelperSrv, target.itservice, target.slaProperty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text metrics mode
|
||||||
|
else if (target.mode === 2) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
return $q.all(_.flatten(promises)).then(function (results) {
|
return $q.all(_.flatten(promises)).then(function (results) {
|
||||||
|
|||||||
@@ -16,14 +16,18 @@
|
|||||||
<i class="fa fa-bars"></i>
|
<i class="fa fa-bars"></i>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu pull-right" role="menu">
|
<ul class="dropdown-menu pull-right" role="menu">
|
||||||
<!-- Switch to IT Services editor -->
|
<!-- Switch editor mode -->
|
||||||
<li role="menuitem" ng-hide="target.mode == 1">
|
<li role="menuitem" ng-show="target.mode">
|
||||||
|
<a class="pointer" tabindex="1"
|
||||||
|
ng-click="switchEditorMode(0)">Numeric metrics</a>
|
||||||
|
</li>
|
||||||
|
<li role="menuitem" ng-show="target.mode != 1">
|
||||||
<a class="pointer" tabindex="1"
|
<a class="pointer" tabindex="1"
|
||||||
ng-click="switchEditorMode(1)">IT services</a>
|
ng-click="switchEditorMode(1)">IT services</a>
|
||||||
</li>
|
</li>
|
||||||
<li role="menuitem" ng-show="target.mode">
|
<li role="menuitem" ng-show="target.mode != 2">
|
||||||
<a class="pointer" tabindex="1"
|
<a class="pointer" tabindex="1"
|
||||||
ng-click="switchEditorMode(0)">Items</a>
|
ng-click="switchEditorMode(2)">Text metrics</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="divider" role="menuitem"></li>
|
<li class="divider" role="menuitem"></li>
|
||||||
<li role="menuitem"><a tabindex="1" ng-click="duplicate()">Duplicate</a></li>
|
<li role="menuitem"><a tabindex="1" ng-click="duplicate()">Duplicate</a></li>
|
||||||
@@ -75,7 +79,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="tight-form-list" role="menu" ng-hide="target.mode">
|
<ul class="tight-form-list" role="menu" ng-hide="target.mode == 1">
|
||||||
<!-- Alias -->
|
<!-- Alias -->
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
@@ -118,12 +122,12 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- Host filter -->
|
<!-- Host filter -->
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item" ng-hide="target.mode == 2">
|
||||||
Filter
|
Filter
|
||||||
<i class="fa fa-question-circle"
|
<i class="fa fa-question-circle"
|
||||||
bs-tooltip="'Filtering hosts by regex. Select All in items and specify regex for host names.'"></i>
|
bs-tooltip="'Filtering hosts by regex. Select All in items and specify regex for host names.'"></i>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li ng-hide="target.mode == 2">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="tight-form-input input-large"
|
class="tight-form-input input-large"
|
||||||
ng-model="target.hostFilter"
|
ng-model="target.hostFilter"
|
||||||
@@ -132,8 +136,10 @@
|
|||||||
ng-blur="targetBlur()">
|
ng-blur="targetBlur()">
|
||||||
</li>
|
</li>
|
||||||
<!-- Downsampling function -->
|
<!-- Downsampling function -->
|
||||||
<li class="tight-form-item input-medium">Downsampling</li>
|
<li class="tight-form-item input-medium" ng-hide="target.mode == 2">
|
||||||
<li>
|
Downsampling
|
||||||
|
</li>
|
||||||
|
<li ng-hide="target.mode == 2">
|
||||||
<select class="tight-form-input input-small"
|
<select class="tight-form-input input-small"
|
||||||
ng-change="targetBlur()"
|
ng-change="targetBlur()"
|
||||||
ng-model="target.downsampleFunction"
|
ng-model="target.downsampleFunction"
|
||||||
@@ -151,7 +157,7 @@
|
|||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tight-form" ng-hide="target.mode">
|
<div class="tight-form" ng-hide="target.mode == 1">
|
||||||
<ul class="tight-form-list" role="menu">
|
<ul class="tight-form-list" role="menu">
|
||||||
<li class="tight-form-item" style="min-width: 15px; text-align: center"> </li>
|
<li class="tight-form-item" style="min-width: 15px; text-align: center"> </li>
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item">
|
||||||
@@ -192,12 +198,12 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- Item filter -->
|
<!-- Item filter -->
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item" ng-hide="target.mode == 2">
|
||||||
Filter
|
Filter
|
||||||
<i class="fa fa-question-circle"
|
<i class="fa fa-question-circle"
|
||||||
bs-tooltip="'Filtering items by regex. Select All in items and specify regex for item names.'"></i>
|
bs-tooltip="'Filtering items by regex. Select All in items and specify regex for item names.'"></i>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li ng-hide="target.mode == 2">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="tight-form-input input-large"
|
class="tight-form-input input-large"
|
||||||
ng-model="target.itemFilter"
|
ng-model="target.itemFilter"
|
||||||
@@ -206,12 +212,12 @@
|
|||||||
ng-blur="targetBlur()">
|
ng-blur="targetBlur()">
|
||||||
</li>
|
</li>
|
||||||
<!-- Scale -->
|
<!-- Scale -->
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item" ng-hide="target.mode == 2">
|
||||||
Scale
|
Scale
|
||||||
<i class="fa fa-question-circle"
|
<i class="fa fa-question-circle"
|
||||||
bs-tooltip="'Set a custom multiplier for series values, for example -1 to invert series'"></i>
|
bs-tooltip="'Set a custom multiplier for series values, for example -1 to invert series'"></i>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li ng-hide="target.mode == 2">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="tight-form-input input-small"
|
class="tight-form-input input-small"
|
||||||
ng-model="target.scale"
|
ng-model="target.scale"
|
||||||
|
|||||||
@@ -13,17 +13,7 @@ define([
|
|||||||
|
|
||||||
$scope.init = function () {
|
$scope.init = function () {
|
||||||
$scope.targetLetters = targetLetters;
|
$scope.targetLetters = targetLetters;
|
||||||
if ($scope.target.mode === 1) {
|
if (!$scope.target.mode || $scope.target.mode === 0) {
|
||||||
$scope.slaPropertyList = [
|
|
||||||
{name: "Status", property: "status"},
|
|
||||||
{name: "SLA", property: "sla"},
|
|
||||||
{name: "OK time", property: "okTime"},
|
|
||||||
{name: "Problem time", property: "problemTime"},
|
|
||||||
{name: "Down time", property: "downtimeTime"}
|
|
||||||
];
|
|
||||||
$scope.itserviceList = [{name: "test"}];
|
|
||||||
$scope.updateITServiceList();
|
|
||||||
} else {
|
|
||||||
$scope.downsampleFunctionList = [
|
$scope.downsampleFunctionList = [
|
||||||
{name: "avg", value: "avg"},
|
{name: "avg", value: "avg"},
|
||||||
{name: "min", value: "min"},
|
{name: "min", value: "min"},
|
||||||
@@ -34,12 +24,14 @@ define([
|
|||||||
if (!$scope.target.downsampleFunction) {
|
if (!$scope.target.downsampleFunction) {
|
||||||
$scope.target.downsampleFunction = $scope.downsampleFunctionList[0];
|
$scope.target.downsampleFunction = $scope.downsampleFunctionList[0];
|
||||||
}
|
}
|
||||||
$scope.metric = {
|
if (!$scope.metric) {
|
||||||
hostGroupList: [],
|
$scope.metric = {
|
||||||
hostList: [{name: '*', visible_name: 'All'}],
|
hostGroupList: [],
|
||||||
applicationList: [{name: '*', visible_name: 'All'}],
|
hostList: [{name: '*', visible_name: 'All'}],
|
||||||
itemList: [{name: 'All'}]
|
applicationList: [{name: '*', visible_name: 'All'}],
|
||||||
};
|
itemList: [{name: 'All'}]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Update host group, host, application and item lists
|
// Update host group, host, application and item lists
|
||||||
$scope.updateGroupList();
|
$scope.updateGroupList();
|
||||||
@@ -49,6 +41,17 @@ define([
|
|||||||
|
|
||||||
setItemAlias();
|
setItemAlias();
|
||||||
}
|
}
|
||||||
|
else if ($scope.target.mode === 1) {
|
||||||
|
$scope.slaPropertyList = [
|
||||||
|
{name: "Status", property: "status"},
|
||||||
|
{name: "SLA", property: "sla"},
|
||||||
|
{name: "OK time", property: "okTime"},
|
||||||
|
{name: "Problem time", property: "problemTime"},
|
||||||
|
{name: "Down time", property: "downtimeTime"}
|
||||||
|
];
|
||||||
|
$scope.itserviceList = [{name: "test"}];
|
||||||
|
$scope.updateITServiceList();
|
||||||
|
}
|
||||||
|
|
||||||
$scope.target.errors = validateTarget($scope.target);
|
$scope.target.errors = validateTarget($scope.target);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user