Multiple data sources support for triggers panel, #431
This commit is contained in:
65
src/panel-triggers/options_tab.js
Normal file
65
src/panel-triggers/options_tab.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Grafana-Zabbix
|
||||
* Zabbix plugin for Grafana.
|
||||
* http://github.com/alexanderzobnin/grafana-zabbix
|
||||
*
|
||||
* Trigger panel.
|
||||
* This feature sponsored by CORE IT
|
||||
* http://www.coreit.fr
|
||||
*
|
||||
* Copyright 2015 Alexander Zobnin alexanderzobnin@gmail.com
|
||||
* Licensed under the Apache License, Version 2.0
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import './datasource-selector.directive';
|
||||
|
||||
import '../datasource-zabbix/css/query-editor.css!';
|
||||
|
||||
class TriggerPanelOptionsCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope) {
|
||||
$scope.editor = this;
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
|
||||
this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
|
||||
this.ackFilters = [
|
||||
'all triggers',
|
||||
'unacknowledged',
|
||||
'acknowledged'
|
||||
];
|
||||
this.sortByFields = [
|
||||
{ text: 'last change', value: 'lastchange' },
|
||||
{ text: 'severity', value: 'priority' }
|
||||
];
|
||||
this.showEventsFields = [
|
||||
{ text: 'All', value: [0,1] },
|
||||
{ text: 'OK', value: [0] },
|
||||
{ text: 'Problems', value: 1 }
|
||||
];
|
||||
}
|
||||
|
||||
refreshTriggerSeverity() {
|
||||
_.each(this.triggerList, function(trigger) {
|
||||
trigger.color = this.panel.triggerSeverity[trigger.priority].color;
|
||||
trigger.severity = this.panel.triggerSeverity[trigger.priority].severity;
|
||||
});
|
||||
this.panelCtrl.refresh();
|
||||
}
|
||||
|
||||
changeTriggerSeverityColor(trigger, color) {
|
||||
this.panel.triggerSeverity[trigger.priority].color = color;
|
||||
this.refreshTriggerSeverity();
|
||||
}
|
||||
}
|
||||
|
||||
export function triggerPanelOptionsTab() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
templateUrl: 'public/plugins/alexanderzobnin-zabbix-app/panel-triggers/partials/options_tab.html',
|
||||
controller: TriggerPanelOptionsCtrl,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user