query-editor: add itemid query mode
This commit is contained in:
@@ -21,11 +21,12 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
this.replaceTemplateVars = this.datasource.replaceTemplateVars;
|
||||
this.templateSrv = templateSrv;
|
||||
|
||||
this.editorModes = {
|
||||
0: {value: 'num', text: 'Metrics', mode: c.MODE_METRICS},
|
||||
1: {value: 'itservice', text: 'IT Services', mode: c.MODE_ITSERVICE},
|
||||
2: {value: 'text', text: 'Text', mode: c.MODE_TEXT}
|
||||
};
|
||||
this.editorModes = [
|
||||
{value: 'num', text: 'Metrics', mode: c.MODE_METRICS},
|
||||
{value: 'text', text: 'Text', mode: c.MODE_TEXT},
|
||||
{value: 'itservice', text: 'IT Services', mode: c.MODE_ITSERVICE},
|
||||
{value: 'itemid', text: 'Item ID', mode: c.MODE_ITEMID}
|
||||
];
|
||||
|
||||
this.slaPropertyList = [
|
||||
{name: "Status", property: "status"},
|
||||
@@ -97,7 +98,8 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
}
|
||||
|
||||
initFilters() {
|
||||
let itemtype = this.editorModes[this.target.mode].value;
|
||||
let itemtype = _.find(this.editorModes, {'mode': this.target.mode});
|
||||
itemtype = itemtype ? itemtype.value : null;
|
||||
return Promise.all([
|
||||
this.suggestGroups(),
|
||||
this.suggestHosts(),
|
||||
@@ -122,6 +124,12 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
getVariables() {
|
||||
return _.map(this.templateSrv.variables, variable => {
|
||||
return '$' + variable.name;
|
||||
});
|
||||
}
|
||||
|
||||
suggestGroups() {
|
||||
return this.zabbix.getAllGroups()
|
||||
.then(groups => {
|
||||
|
||||
Reference in New Issue
Block a user