3
dist/panel-triggers/partials/module.html
vendored
3
dist/panel-triggers/partials/module.html
vendored
@@ -16,6 +16,9 @@
|
|||||||
<i ng-if="trigger.maintenance" class="fa fa-wrench zbx-maintenance-icon"></i>
|
<i ng-if="trigger.maintenance" class="fa fa-wrench zbx-maintenance-icon"></i>
|
||||||
{{ ctrl.formatHostName(trigger) }}
|
{{ ctrl.formatHostName(trigger) }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="zabbix-hostname" ng-if="ctrl.panel.hostGroups">
|
||||||
|
{{ ctrl.formatHostGroups(trigger) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
<span class="zbx-trigger-tags" ng-if="ctrl.panel.showTags && trigger.tags">
|
<span class="zbx-trigger-tags" ng-if="ctrl.panel.showTags && trigger.tags">
|
||||||
<span ng-repeat="tag in trigger.tags" ng-click="ctrl.addTagFilter(tag, trigger.datasource)"
|
<span ng-repeat="tag in trigger.tags" ng-click="ctrl.addTagFilter(tag, trigger.datasource)"
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
checked="ctrl.panel.hostTechNameField"
|
checked="ctrl.panel.hostTechNameField"
|
||||||
on-change="ctrl.render()">
|
on-change="ctrl.render()">
|
||||||
</gf-form-switch>
|
</gf-form-switch>
|
||||||
|
<gf-form-switch class="gf-form"
|
||||||
|
label-class="width-9"
|
||||||
|
label="Host groups"
|
||||||
|
checked="ctrl.panel.hostGroups"
|
||||||
|
on-change="ctrl.render()">
|
||||||
|
</gf-form-switch>
|
||||||
<gf-form-switch class="gf-form"
|
<gf-form-switch class="gf-form"
|
||||||
label-class="width-9"
|
label-class="width-9"
|
||||||
label="Tags"
|
label="Tags"
|
||||||
|
|||||||
2
dist/panel-triggers/specs/migrations.spec.js
vendored
2
dist/panel-triggers/specs/migrations.spec.js
vendored
@@ -51,6 +51,7 @@ describe('Triggers Panel schema migration', () => {
|
|||||||
},
|
},
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: false,
|
statusField: false,
|
||||||
severityField: false,
|
severityField: false,
|
||||||
@@ -87,6 +88,7 @@ describe('Triggers Panel schema migration', () => {
|
|||||||
},
|
},
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: true,
|
statusField: true,
|
||||||
severityField: true,
|
severityField: true,
|
||||||
|
|||||||
21
dist/panel-triggers/triggers_panel_ctrl.js
vendored
21
dist/panel-triggers/triggers_panel_ctrl.js
vendored
@@ -134,6 +134,7 @@ System.register(['lodash', 'jquery', 'moment', '../datasource-zabbix/utils', 'ap
|
|||||||
// Fields
|
// Fields
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: true,
|
statusField: true,
|
||||||
severityField: true,
|
severityField: true,
|
||||||
@@ -617,13 +618,25 @@ System.register(['lodash', 'jquery', 'moment', '../datasource-zabbix/utils', 'ap
|
|||||||
}, {
|
}, {
|
||||||
key: 'formatHostName',
|
key: 'formatHostName',
|
||||||
value: function formatHostName(trigger) {
|
value: function formatHostName(trigger) {
|
||||||
|
var host = "";
|
||||||
if (this.panel.hostField && this.panel.hostTechNameField) {
|
if (this.panel.hostField && this.panel.hostTechNameField) {
|
||||||
return trigger.host + ' (' + trigger.hostTechName + ')';
|
host = trigger.host + ' (' + trigger.hostTechName + ')';
|
||||||
} else if (this.panel.hostField || this.panel.hostTechNameField) {
|
} else if (this.panel.hostField || this.panel.hostTechNameField) {
|
||||||
return this.panel.hostField ? trigger.host : trigger.hostTechName;
|
host = this.panel.hostField ? trigger.host : trigger.hostTechName;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'formatHostGroups',
|
||||||
|
value: function formatHostGroups(trigger) {
|
||||||
|
var groupNames = "";
|
||||||
|
if (this.panel.hostGroups) {
|
||||||
|
var groups = _.map(trigger.groups, 'name').join(', ');
|
||||||
|
groupNames += '[ ' + groups + ' ]';
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupNames;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'getAlertIconClass',
|
key: 'getAlertIconClass',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -16,6 +16,9 @@
|
|||||||
<i ng-if="trigger.maintenance" class="fa fa-wrench zbx-maintenance-icon"></i>
|
<i ng-if="trigger.maintenance" class="fa fa-wrench zbx-maintenance-icon"></i>
|
||||||
{{ ctrl.formatHostName(trigger) }}
|
{{ ctrl.formatHostName(trigger) }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="zabbix-hostname" ng-if="ctrl.panel.hostGroups">
|
||||||
|
{{ ctrl.formatHostGroups(trigger) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
<span class="zbx-trigger-tags" ng-if="ctrl.panel.showTags && trigger.tags">
|
<span class="zbx-trigger-tags" ng-if="ctrl.panel.showTags && trigger.tags">
|
||||||
<span ng-repeat="tag in trigger.tags" ng-click="ctrl.addTagFilter(tag, trigger.datasource)"
|
<span ng-repeat="tag in trigger.tags" ng-click="ctrl.addTagFilter(tag, trigger.datasource)"
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
checked="ctrl.panel.hostTechNameField"
|
checked="ctrl.panel.hostTechNameField"
|
||||||
on-change="ctrl.render()">
|
on-change="ctrl.render()">
|
||||||
</gf-form-switch>
|
</gf-form-switch>
|
||||||
|
<gf-form-switch class="gf-form"
|
||||||
|
label-class="width-9"
|
||||||
|
label="Host groups"
|
||||||
|
checked="ctrl.panel.hostGroups"
|
||||||
|
on-change="ctrl.render()">
|
||||||
|
</gf-form-switch>
|
||||||
<gf-form-switch class="gf-form"
|
<gf-form-switch class="gf-form"
|
||||||
label-class="width-9"
|
label-class="width-9"
|
||||||
label="Tags"
|
label="Tags"
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ describe('Triggers Panel schema migration', () => {
|
|||||||
},
|
},
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: false,
|
statusField: false,
|
||||||
severityField: false,
|
severityField: false,
|
||||||
@@ -87,6 +88,7 @@ describe('Triggers Panel schema migration', () => {
|
|||||||
},
|
},
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: true,
|
statusField: true,
|
||||||
severityField: true,
|
severityField: true,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export const PANEL_DEFAULTS = {
|
|||||||
// Fields
|
// Fields
|
||||||
hostField: true,
|
hostField: true,
|
||||||
hostTechNameField: false,
|
hostTechNameField: false,
|
||||||
|
hostGroups: false,
|
||||||
showTags: true,
|
showTags: true,
|
||||||
statusField: true,
|
statusField: true,
|
||||||
severityField: true,
|
severityField: true,
|
||||||
@@ -468,13 +469,24 @@ export class TriggerPanelCtrl extends PanelCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
formatHostName(trigger) {
|
formatHostName(trigger) {
|
||||||
|
let host = "";
|
||||||
if (this.panel.hostField && this.panel.hostTechNameField) {
|
if (this.panel.hostField && this.panel.hostTechNameField) {
|
||||||
return `${trigger.host} (${trigger.hostTechName})`;
|
host = `${trigger.host} (${trigger.hostTechName})`;
|
||||||
} else if (this.panel.hostField || this.panel.hostTechNameField) {
|
} else if (this.panel.hostField || this.panel.hostTechNameField) {
|
||||||
return this.panel.hostField ? trigger.host : trigger.hostTechName;
|
host = this.panel.hostField ? trigger.host : trigger.hostTechName;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
formatHostGroups(trigger) {
|
||||||
|
let groupNames = "";
|
||||||
|
if (this.panel.hostGroups) {
|
||||||
|
let groups = _.map(trigger.groups, 'name').join(', ');
|
||||||
|
groupNames += `[ ${groups} ]`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAlertIconClass(trigger) {
|
getAlertIconClass(trigger) {
|
||||||
|
|||||||
Reference in New Issue
Block a user