Trigger panel: added custom trigger status field (OK or Problem).

This commit is contained in:
Alexander Zobnin
2016-02-03 21:04:10 +03:00
parent a23dbe6aa7
commit 80022e8598
3 changed files with 24 additions and 1 deletions

View File

@@ -130,7 +130,7 @@
<strong>Show events</strong> <strong>Show events</strong>
</li> </li>
<li> <li>
<select class="tight-form-input input-medium last" <select class="tight-form-input input-medium"
ng-model="panel.showEvents" ng-model="panel.showEvents"
ng-options="f.text for f in showEventsFields track by f.value" ng-options="f.text for f in showEventsFields track by f.value"
ng-change="get_data()"> ng-change="get_data()">
@@ -153,6 +153,15 @@
ng-checked="panel.hostField"> ng-checked="panel.hostField">
<label for="panel.hostField" class="cr1"></label> <label for="panel.hostField" class="cr1"></label>
</li> </li>
<li class="tight-form-item">
<label class="checkbox-label" for="panel.severityField">Status</label>
<input class="cr1"
id="panel.statusField"
type="checkbox"
ng-model="panel.statusField"
ng-checked="panel.statusField">
<label for="panel.statusField" class="cr1"></label>
</li>
<li class="tight-form-item"> <li class="tight-form-item">
<label class="checkbox-label" for="panel.severityField">Severity</label> <label class="checkbox-label" for="panel.severityField">Severity</label>
<input class="cr1" <input class="cr1"

View File

@@ -11,6 +11,9 @@
Host Host
</div> </div>
</th> </th>
<th ng-if="panel.statusField" style="width: 85px">
<div class="table-panel-table-header-inner pointer">Status</div>
</th>
<th ng-if="panel.severityField" style="width: 120px"> <th ng-if="panel.severityField" style="width: 120px">
<div class="table-panel-table-header-inner pointer">Severity</div> <div class="table-panel-table-header-inner pointer">Severity</div>
</th> </th>
@@ -35,6 +38,11 @@
<span><strong>{{trigger.host}}</strong></span> <span><strong>{{trigger.host}}</strong></span>
</div> </div>
</td> </td>
<td ng-if="panel.statusField" style="background-color: {{trigger.color}}; color: white">
<div>
{{triggerStatusMap[trigger.value]}}
</div>
</td>
<td ng-if="panel.severityField" style="background-color: {{trigger.color}}; color: white"> <td ng-if="panel.severityField" style="background-color: {{trigger.color}}; color: white">
<div> <div>
{{trigger.severity}} {{trigger.severity}}

View File

@@ -54,6 +54,11 @@ function (angular, app, _, $, moment, config, PanelMeta) {
{ text: 'Problem events', value: 1 } { text: 'Problem events', value: 1 }
]; ];
$scope.triggerStatusMap = {
'0': 'OK',
'1': 'Problem'
};
var grafanaDefaultSeverity = [ var grafanaDefaultSeverity = [
{ priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true }, { priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true },
{ priority: 1, severity: 'Information', color: '#82B5D8', show: true }, { priority: 1, severity: 'Information', color: '#82B5D8', show: true },
@@ -72,6 +77,7 @@ function (angular, app, _, $, moment, config, PanelMeta) {
trigger: {filter: ""} trigger: {filter: ""}
}, },
hostField: true, hostField: true,
statusField: false,
severityField: false, severityField: false,
lastChangeField: true, lastChangeField: true,
ageField: true, ageField: true,