diff --git a/dist/css/grafana-zabbix.dark.css b/dist/css/grafana-zabbix.dark.css
index 1a363aae8..c0c677842 100644
--- a/dist/css/grafana-zabbix.dark.css
+++ b/dist/css/grafana-zabbix.dark.css
@@ -9,6 +9,11 @@
font-weight: bold; }
.triggers-panel-container .alert-list-info.zbx-description {
color: #b3b3b3; }
+ .triggers-panel-container .zbx-trigger-tags {
+ margin-left: 0.6rem; }
+ .triggers-panel-container .zbx-trigger-tags .zbx-tag {
+ color: #ECECEC;
+ padding: 0px 6px; }
.triggers-panel-container .alert-list-footer {
justify-content: flex-start; }
.triggers-panel-container .trigger-info-block {
diff --git a/dist/css/grafana-zabbix.dark.css.map b/dist/css/grafana-zabbix.dark.css.map
index 63f31f234..b9798afb4 100644
--- a/dist/css/grafana-zabbix.dark.css.map
+++ b/dist/css/grafana-zabbix.dark.css.map
@@ -9,6 +9,6 @@
"../../src/sass/_panel-triggers.scss",
"../../src/sass/_query_editor.scss"
],
- "mappings": "AIAA,AAAA,sBAAsB,CAAC;EACrB,QAAQ,EAAE,IAAK,GAChB;;AAED,AAAA,yBAAyB,CAAC;EACxB,QAAQ,EAAE,QAAS,GAwCpB;EAzCD,AAGE,yBAHuB,CAGvB,gBAAgB,CAAC;IACf,KAAK,EHCU,OAAO;IGAtB,WAAW,EAAE,IAAK;IAClB,WAAW,EAAE,IAAK,GACnB;EAPH,AASkB,yBATO,CASvB,gBAAgB,AAAA,gBAAgB,CAAC;IAC/B,KAAK,EHJU,OAAO,GGKvB;EAXH,AAaE,yBAbuB,CAavB,kBAAkB,CAAC;IACjB,eAAe,EAAE,UAAW,GAC7B;EAfH,AAiBE,yBAjBuB,CAiBvB,mBAAmB,CAAC;IAClB,OAAO,EAAE,WAAY,GAkBtB;IApCH,AAwBI,yBAxBqB,CAiBvB,mBAAmB,CAOjB,CAAC,EAxBL,AAwBO,yBAxBkB,CAiBvB,mBAAmB,CAOd,CAAC,CAAC;MACH,WAAW,EAAE,MAAO;MACpB,KAAK,EHrBQ,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,OAAO,GGmHrB;;AAIL,AACE,YADU,CACV,aAAa,CAAC;EAEZ,SAAS,EAAE,gBAAiB;EAC5B,SAAS,EAAE,gBAAiB,GAC7B;;AALH,AAOE,YAPU,CAOV,aAAa,CAAC;EACZ,KAAK,EAAE,GAAI,GACZ;;AATH,AAWE,YAXU,CAWV,eAAe,CAAC;EACd,WAAW,EAAE,IAAK,GACnB;;AAbH,AAeQ,YAfI,CAeV,KAAK,CAAC,EAAE,EAfV,AAeY,YAfA,CAeA,EAAE,CAAC;EACX,aAAa,EAAE,IAAK,GACrB;;AAjBH,AAmBE,YAnBU,CAmBV,gBAAgB,CAAC;EACf,WAAW,EAAE,IAAK,GAWnB;EA/BH,AAsBI,YAtBQ,CAmBV,gBAAgB,CAGd,KAAK,CAAC;IACJ,MAAM,EAAE,SAAU;IAClB,aAAa,EAAE,GAAI;IACnB,KAAK,EAAE,GAAI,GACZ;EA1BL,AA4BI,YA5BQ,CAmBV,gBAAgB,CASd,MAAM,CAAC;IACL,WAAW,EAAE,IAAK,GACnB;;AAIL,AAAA,yBAAyB,AACtB,cAAc,CAAC;EACd,WAAW,EAAE,GAAI;EACjB,cAAc,EAAE,GAAI,GACrB;;AAJH,AAME,yBANuB,CAMvB,QAAQ,CAAC;EACP,SAAS,EAAE,IAAK,GACjB;;ACtLH,AAAA,UAAU,CAAC;EACT,KAAK,EJ6BY,OAAO,GI5BzB;;AAED,AAAA,aAAa,CAAC;EACZ,KAAK,EJwBY,OAAO,GIvBzB",
"names": []
}
\ No newline at end of file
diff --git a/dist/css/grafana-zabbix.light.css b/dist/css/grafana-zabbix.light.css
index 52571295f..f05e319b8 100644
--- a/dist/css/grafana-zabbix.light.css
+++ b/dist/css/grafana-zabbix.light.css
@@ -9,6 +9,11 @@
font-weight: bold; }
.triggers-panel-container .alert-list-info.zbx-description {
color: #acb6bf; }
+ .triggers-panel-container .zbx-trigger-tags {
+ margin-left: 0.6rem; }
+ .triggers-panel-container .zbx-trigger-tags .zbx-tag {
+ color: #e9edf2;
+ padding: 0px 6px; }
.triggers-panel-container .alert-list-footer {
justify-content: flex-start; }
.triggers-panel-container .trigger-info-block {
diff --git a/dist/css/grafana-zabbix.light.css.map b/dist/css/grafana-zabbix.light.css.map
index 78bf72e5b..0d5170abc 100644
--- a/dist/css/grafana-zabbix.light.css.map
+++ b/dist/css/grafana-zabbix.light.css.map
@@ -9,6 +9,6 @@
"../../src/sass/_panel-triggers.scss",
"../../src/sass/_query_editor.scss"
],
- "mappings": "AIAA,AAAA,sBAAsB,CAAC;EACrB,QAAQ,EAAE,IAAK,GAChB;;AAED,AAAA,yBAAyB,CAAC;EACxB,QAAQ,EAAE,QAAS,GAwCpB;EAzCD,AAGE,yBAHuB,CAGvB,gBAAgB,CAAC;IACf,KAAK,EHCU,OAAO;IGAtB,WAAW,EAAE,IAAK;IAClB,WAAW,EAAE,IAAK,GACnB;EAPH,AASkB,yBATO,CASvB,gBAAgB,AAAA,gBAAgB,CAAC;IAC/B,KAAK,EHJU,OAAO,GGKvB;EAXH,AAaE,yBAbuB,CAavB,kBAAkB,CAAC;IACjB,eAAe,EAAE,UAAW,GAC7B;EAfH,AAiBE,yBAjBuB,CAiBvB,mBAAmB,CAAC;IAClB,OAAO,EAAE,WAAY,GAkBtB;IApCH,AAwBI,yBAxBqB,CAiBvB,mBAAmB,CAOjB,CAAC,EAxBL,AAwBO,yBAxBkB,CAiBvB,mBAAmB,CAOd,CAAC,CAAC;MACH,WAAW,EAAE,MAAO;MACpB,KAAK,EHrBQ,OAAO,GGsBrB;IA3BL,AA6BI,yBA7BqB,CAiBvB,mBAAmB,CAYjB,sBAAsB,CAAC;MACrB,YAAY,EAAE,MAAO;MACrB,WAAW,EAAE,IAAK,GAInB;MAnCL,AAgCM,yBAhCmB,CAiBvB,mBAAmB,CAYjB,sBAAsB,CAGpB,kBAAkB,CAAC;QACjB,OAAO,EAAE,GAAI,GACd;EAlCP,AAsCE,yBAtCuB,CAsCvB,kBAAkB,CAAC;IACjB,YAA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Y,YAfA,CAeA,EAAE,CAAC;EACX,aAAa,EAAE,IAAK,GACrB;;AAjBH,AAmBE,YAnBU,CAmBV,gBAAgB,CAAC;EACf,WAAW,EAAE,IAAK,GAWnB;EA/BH,AAsBI,YAtBQ,CAmBV,gBAAgB,CAGd,KAAK,CAAC;IACJ,MAAM,EAAE,SAAU;IAClB,aAAa,EAAE,GAAI;IACnB,KAAK,EAAE,GAAI,GACZ;EA1BL,AA4BI,YA5BQ,CAmBV,gBAAgB,CASd,MAAM,CAAC;IACL,WAAW,EAAE,IAAK,GACnB;;AAIL,AAAA,yBAAyB,AACtB,cAAc,CAAC;EACd,WAAW,EAAE,GAAI;EACjB,cAAc,EAAE,GAAI,GACrB;;AAJH,AAME,yBANuB,CAMvB,QAAQ,CAAC;EACP,SAAS,EAAE,IAAK,GACjB;;ACtLH,AAAA,UAAU,CAAC;EACT,KAAK,EJ4BY,OAAO,GI3BzB;;AAED,AAAA,aAAa,CAAC;EACZ,KAAK,EJeY,OAAO,GIdzB",
"names": []
}
\ No newline at end of file
diff --git a/dist/datasource-zabbix/zabbixAPI.service.js b/dist/datasource-zabbix/zabbixAPI.service.js
index 806519dcc..790fd3656 100644
--- a/dist/datasource-zabbix/zabbixAPI.service.js
+++ b/dist/datasource-zabbix/zabbixAPI.service.js
@@ -337,7 +337,8 @@ System.register(['angular', 'lodash', './utils', './zabbixAPICore.service'], fun
selectGroups: ['name'],
selectHosts: ['name', 'host', 'maintenance_status'],
selectItems: ['name', 'key_', 'lastvalue'],
- selectLastEvent: 'extend'
+ selectLastEvent: 'extend',
+ selectTags: 'extend'
};
if (showTriggers) {
diff --git a/dist/datasource-zabbix/zabbixAPI.service.js.map b/dist/datasource-zabbix/zabbixAPI.service.js.map
index 92db9daff..70fa475b8 100644
--- a/dist/datasource-zabbix/zabbixAPI.service.js.map
+++ b/dist/datasource-zabbix/zabbixAPI.service.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/datasource-zabbix/zabbixAPI.service.js"],"names":["ZabbixAPIServiceFactory","alertSrv","zabbixAPICoreService","ZabbixAPI","api_url","username","password","basicAuth","withCredentials","url","auth","requestOptions","loginPromise","loginErrorCount","maxLoginAttempts","zabbixAPICore","getTrend","getTrend_ZBXNEXT1193","method","params","request","catch","isNotAuthorized","error","data","loginOnce","then","message","statusText","alertAPIError","timeout","set","Promise","resolve","login","getVersion","eventid","eventids","output","sortfield","real_hosts","groupids","hostids","appids","itemtype","webitems","filter","selectHosts","applicationids","value_type","utils","expandItems","itemids","globalmacro","itemid","items","length","lastvalue","timeFrom","timeTill","grouped_items","_","groupBy","promises","map","history","sortorder","time_from","time_till","all","flatten","trend","self","serviceids","timeRange","timeTo","intervals","from","to","options","showTriggers","maintenance","expandDescription","expandData","expandComment","monitored","skipDependent","value","selectGroups","selectItems","selectLastEvent","lastChangeSince","lastChangeTill","objectids","showEvents","select_acknowledges","preservekeys","events","event","acknowledges","minSeverity","acknowledged","count","min_severity","countOutput","triggers","filterTriggersByAcknowledge","trigger","lastEvent","angular","module","factory"],"mappings":";;;;;;;;;;;;;AAKA;AACA,WAASA,uBAAT,CAAiCC,QAAjC,EAA2CC,oBAA3C,EAAiE;AAAA,QAOzDC,SAPyD;AAS7D,yBAAYC,OAAZ,EAAqBC,QAArB,EAA+BC,QAA/B,EAAyCC,SAAzC,EAAoDC,eAApD,EAAqE;AAAA;;AACnE,aAAKC,GAAL,GAAwBL,OAAxB;AACA,aAAKC,QAAL,GAAwBA,QAAxB;AACA,aAAKC,QAAL,GAAwBA,QAAxB;AACA,aAAKI,IAAL,GAAwB,EAAxB;;AAEA,aAAKC,cAAL,GAAsB;AACpBJ,qBAAWA,SADS;AAEpBC,2BAAiBA;AAFG,SAAtB;;AAKA,aAAKI,YAAL,GAAoB,IAApB;AACA,aAAKC,eAAL,GAAuB,CAAvB;AACA,aAAKC,gBAAL,GAAwB,CAAxB;;AAEA,aAAKb,QAAL,GAAgBA,QAAhB;AACA,aAAKc,aAAL,GAAqBb,oBAArB;;AAE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OyE,cAAP,GAAwBjB,MAAxB;AACD;;AAED,iBAAO,KAAKvD,OAAL,CAAa,aAAb,EAA4BD,MAA5B,EACNO,IADM,CACD,UAAC+E,QAAD,EAAc;AAClB,gBAAI,CAACH,KAAD,IAAUD,iBAAiB,CAA3B,IAAgCA,iBAAiB,CAArD,EAAwD;AACtDI,yBAAWC,4BAA4BD,QAA5B,EAAsCJ,YAAtC,CAAX;AACA,kBAAIC,KAAJ,EAAW;AACTG,2BAAWA,SAASjD,MAApB;AACD;AACF;AACD,mBAAOiD,QAAP;AACD,WATM,CAAP;AAUD;AAtd4D;;AAAA;AAAA;;AAyd/D,WAAOtG,SAAP;AACD;;AAED,WAASuG,2BAAT,CAAqCD,QAArC,EAA+CJ,YAA/C,EAA6D;AAC3D,QAAIA,iBAAiB,CAArB,EAAwB;AACtB,aAAOxC,EAAEf,MAAF,CAAS2D,QAAT,EAAmB,UAACE,OAAD;AAAA,eAAaA,QAAQC,SAAR,CAAkBP,YAAlB,KAAmC,GAAhD;AAAA,OAAnB,CAAP;AACD,KAFD,MAEO,IAAIA,iBAAiB,CAArB,EAAwB;AAC7B,aAAOxC,EAAEf,MAAF,CAAS2D,QAAT,EAAmB,UAACE,OAAD;AAAA,eAAaA,QAAQC,SAAR,CAAkBP,YAAlB,KAAmC,GAAhD;AAAA,OAAnB,CAAP;AACD,KAFM,MAEA;AACL,aAAOI,QAAP;AACD;AACF;;AAED,WAASnF,eAAT,CAAyBK,OAAzB,EAAkC;AAChC,WACEA,YAAY,uCAAZ,IACAA,YAAY,iBADZ,IAEAA,YAAY,iBAHd;AAKD;;;;AAlfMkF,a;;AACAhD,O;;AACKX,W;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkfZ2D,cACGC,MADH,CACU,kBADV,EAEGC,OAFH,CAEW,kBAFX,EAE+B/G,uBAF/B","file":"zabbixAPI.service.js","sourcesContent":["import angular from 'angular';\nimport _ from 'lodash';\nimport * as utils from './utils';\nimport './zabbixAPICore.service';\n\n/** @ngInject */\nfunction ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {\n\n /**\n * Zabbix API Wrapper.\n * Creates Zabbix API instance with given parameters (url, credentials and other).\n * Wraps API calls and provides high-level methods.\n */\n class ZabbixAPI {\n\n constructor(api_url, username, password, basicAuth, withCredentials) {\n this.url = api_url;\n this.username = username;\n this.password = password;\n this.auth = \"\";\n\n this.requestOptions = {\n basicAuth: basicAuth,\n withCredentials: withCredentials\n };\n\n this.loginPromise = null;\n this.loginErrorCount = 0;\n this.maxLoginAttempts = 3;\n\n this.alertSrv = alertSrv;\n this.zabbixAPICore = zabbixAPICoreService;\n\n this.getTrend = this.getTrend_ZBXNEXT1193;\n //getTrend = getTrend_30;\n }\n\n //////////////////////////\n // Core method wrappers //\n //////////////////////////\n\n request(method, params) {\n return this.zabbixAPICore.request(this.url, method, params, this.requestOptions, this.auth)\n .catch(error => {\n if (isNotAuthorized(error.data)) {\n // Handle auth errors\n this.loginErrorCount++;\n if (this.loginErrorCount > this.maxLoginAttempts) {\n this.loginErrorCount = 0;\n return null;\n } else {\n return this.loginOnce()\n .then(() => this.request(method, params));\n }\n } else {\n // Handle API errors\n let message = error.data ? error.data : error.statusText;\n this.alertAPIError(message);\n }\n });\n }\n\n alertAPIError(message, timeout = 5000) {\n this.alertSrv.set(\n \"Zabbix API Error\",\n message,\n 'error',\n timeout\n );\n }\n\n /**\n * When API unauthenticated or auth token expired each request produce login()\n * call. But auth token is common to all requests. This function wraps login() method\n * and call it once. If login() already called just wait for it (return its promise).\n * @return login promise\n */\n loginOnce() {\n if (!this.loginPromise) {\n this.loginPromise = Promise.resolve(\n this.login().then(auth => {\n this.auth = auth;\n this.loginPromise = null;\n return auth;\n })\n );\n }\n return this.loginPromise;\n }\n\n /**\n * Get authentication token.\n */\n login() {\n return this.zabbixAPICore.login(this.url, this.username, this.password, this.requestOptions);\n }\n\n /**\n * Get Zabbix API version\n */\n getVersion() {\n return this.zabbixAPICore.getVersion(this.url, this.requestOptions);\n }\n\n ////////////////////////////////\n // Zabbix API method wrappers //\n ////////////////////////////////\n\n acknowledgeEvent(eventid, message) {\n var params = {\n eventids: eventid,\n message: message\n };\n\n return this.request('event.acknowledge', params);\n }\n\n getGroups() {\n var params = {\n output: ['name'],\n sortfield: 'name',\n real_hosts: true\n };\n\n return this.request('hostgroup.get', params);\n }\n\n getHosts(groupids) {\n var params = {\n output: ['name', 'host'],\n sortfield: 'name'\n };\n if (groupids) {\n params.groupids = groupids;\n }\n\n return this.request('host.get', params);\n }\n\n getApps(hostids) {\n var params = {\n output: 'extend',\n hostids: hostids\n };\n\n return this.request('application.get', params);\n }\n\n /**\n * Get Zabbix items\n * @param {[type]} hostids host ids\n * @param {[type]} appids application ids\n * @param {String} itemtype 'num' or 'text'\n * @return {[type]} array of items\n */\n getItems(hostids, appids, itemtype) {\n var params = {\n output: [\n 'name', 'key_',\n 'value_type',\n 'hostid',\n 'status',\n 'state'\n ],\n sortfield: 'name',\n webitems: true,\n filter: {},\n selectHosts: ['hostid', 'name']\n };\n if (hostids) {\n params.hostids = hostids;\n }\n if (appids) {\n params.applicationids = appids;\n }\n if (itemtype === 'num') {\n // Return only numeric metrics\n params.filter.value_type = [0, 3];\n }\n if (itemtype === 'text') {\n // Return only text metrics\n params.filter.value_type = [1, 2, 4];\n }\n\n return this.request('item.get', params)\n .then(utils.expandItems);\n }\n\n getItemsByIDs(itemids) {\n var params = {\n itemids: itemids,\n output: [\n 'name', 'key_',\n 'value_type',\n 'hostid',\n 'status',\n 'state'\n ],\n webitems: true,\n selectHosts: ['hostid', 'name']\n };\n\n return this.request('item.get', params)\n .then(utils.expandItems);\n }\n\n getMacros(hostids) {\n var params = {\n output: 'extend',\n hostids: hostids\n };\n\n return this.request('usermacro.get', params);\n }\n\n getGlobalMacros() {\n var params = {\n output: 'extend',\n globalmacro: true\n };\n\n return this.request('usermacro.get', params);\n }\n\n getLastValue(itemid) {\n var params = {\n output: ['lastvalue'],\n itemids: itemid\n };\n return this.request('item.get', params)\n .then(items => items.length ? items[0].lastvalue : null);\n }\n\n /**\n * Perform history query from Zabbix API\n *\n * @param {Array} items Array of Zabbix item objects\n * @param {Number} timeFrom Time in seconds\n * @param {Number} timeTill Time in seconds\n * @return {Array} Array of Zabbix history objects\n */\n getHistory(items, timeFrom, timeTill) {\n\n // Group items by value type and perform request for each value type\n let grouped_items = _.groupBy(items, 'value_type');\n let promises = _.map(grouped_items, (items, value_type) => {\n let itemids = _.map(items, 'itemid');\n let params = {\n output: 'extend',\n history: value_type,\n itemids: itemids,\n sortfield: 'clock',\n sortorder: 'ASC',\n time_from: timeFrom\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (timeTill) {\n params.time_till = timeTill;\n }\n\n return this.request('history.get', params);\n });\n\n return Promise.all(promises).then(_.flatten);\n }\n\n /**\n * Perform trends query from Zabbix API\n * Use trends api extension from ZBXNEXT-1193 patch.\n *\n * @param {Array} items Array of Zabbix item objects\n * @param {Number} time_from Time in seconds\n * @param {Number} time_till Time in seconds\n * @return {Array} Array of Zabbix trend objects\n */\n getTrend_ZBXNEXT1193(items, timeFrom, timeTill) {\n\n // Group items by value type and perform request for each value type\n let grouped_items = _.groupBy(items, 'value_type');\n let promises = _.map(grouped_items, (items, value_type) => {\n let itemids = _.map(items, 'itemid');\n let params = {\n output: 'extend',\n trend: value_type,\n itemids: itemids,\n sortfield: 'clock',\n sortorder: 'ASC',\n time_from: timeFrom\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (timeTill) {\n params.time_till = timeTill;\n }\n\n return this.request('trend.get', params);\n });\n\n return Promise.all(promises).then(_.flatten);\n }\n\n getTrend_30(items, time_from, time_till, value_type) {\n var self = this;\n var itemids = _.map(items, 'itemid');\n\n var params = {\n output: [\"itemid\",\n \"clock\",\n value_type\n ],\n itemids: itemids,\n time_from: time_from\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (time_till) {\n params.time_till = time_till;\n }\n\n return self.request('trend.get', params);\n }\n\n getITService(serviceids) {\n var params = {\n output: 'extend',\n serviceids: serviceids\n };\n return this.request('service.get', params);\n }\n\n getSLA(serviceids, timeRange) {\n let [timeFrom, timeTo] = timeRange;\n var params = {\n serviceids: serviceids,\n intervals: [{\n from: timeFrom,\n to: timeTo\n }]\n };\n return this.request('service.getsla', params);\n }\n\n getTriggers(groupids, hostids, applicationids, options) {\n let {showTriggers, maintenance, timeFrom, timeTo} = options;\n\n let params = {\n output: 'extend',\n groupids: groupids,\n hostids: hostids,\n applicationids: applicationids,\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n //only_true: true,\n filter: {\n value: 1\n },\n selectGroups: ['name'],\n selectHosts: ['name', 'host', 'maintenance_status'],\n selectItems: ['name', 'key_', 'lastvalue'],\n selectLastEvent: 'extend'\n };\n\n if (showTriggers) {\n params.filter.value = showTriggers;\n }\n\n if (maintenance) {\n params.maintenance = true;\n }\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params);\n }\n\n getEvents(objectids, timeFrom, timeTo, showEvents) {\n var params = {\n output: 'extend',\n time_from: timeFrom,\n time_till: timeTo,\n objectids: objectids,\n select_acknowledges: 'extend',\n selectHosts: 'extend',\n value: showEvents\n };\n\n return this.request('event.get', params);\n }\n\n getAcknowledges(eventids) {\n var params = {\n output: 'extend',\n eventids: eventids,\n preservekeys: true,\n select_acknowledges: 'extend',\n sortfield: 'clock',\n sortorder: 'DESC'\n };\n\n return this.request('event.get', params)\n .then(events => {\n return _.filter(events, (event) => event.acknowledges.length);\n });\n }\n\n getAlerts(itemids, timeFrom, timeTo) {\n var params = {\n output: 'extend',\n itemids: itemids,\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n //only_true: true,\n // filter: {\n // value: 1\n // },\n selectLastEvent: 'extend'\n };\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params);\n }\n\n getHostAlerts(hostids, applicationids, options) {\n let {minSeverity, acknowledged, count, timeFrom, timeTo} = options;\n let params = {\n output: 'extend',\n hostids: hostids,\n min_severity: minSeverity,\n filter: { value: 1 },\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n selectLastEvent: 'extend',\n selectGroups: 'extend',\n selectHosts: ['host', 'name']\n };\n\n if (count && acknowledged !== 0 && acknowledged !== 1) {\n params.countOutput = true;\n }\n\n if (applicationids && applicationids.length) {\n params.applicationids = applicationids;\n }\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params)\n .then((triggers) => {\n if (!count || acknowledged === 0 || acknowledged === 1) {\n triggers = filterTriggersByAcknowledge(triggers, acknowledged);\n if (count) {\n triggers = triggers.length;\n }\n }\n return triggers;\n });\n }\n }\n\n return ZabbixAPI;\n}\n\nfunction filterTriggersByAcknowledge(triggers, acknowledged) {\n if (acknowledged === 0) {\n return _.filter(triggers, (trigger) => trigger.lastEvent.acknowledged === \"0\");\n } else if (acknowledged === 1) {\n return _.filter(triggers, (trigger) => trigger.lastEvent.acknowledged === \"1\");\n } else {\n return triggers;\n }\n}\n\nfunction isNotAuthorized(message) {\n return (\n message === \"Session terminated, re-login, please.\" ||\n message === \"Not authorised.\" ||\n message === \"Not authorized.\"\n );\n}\n\nangular\n .module('grafana.services')\n .factory('zabbixAPIService', ZabbixAPIServiceFactory);\n"]}
\ No newline at end of file
+{"version":3,"sources":["../../src/datasource-zabbix/zabbixAPI.service.js"],"names":["ZabbixAPIServiceFactory","alertSrv","zabbixAPICoreService","ZabbixAPI","api_url","username","password","basicAuth","withCredentials","url","auth","requestOptions","loginPromise","loginErrorCount","maxLoginAttempts","zabbixAPICore","getTrend","getTrend_ZBXNEXT1193","method","params","request","catch","isNotAuthorized","error","data","loginOnce","then","message","statusText","alertAPIError","timeout","set","Promise","resolve","login","getVersion","eventid","eventids","output","sortfield","real_hosts","groupids","hostids","appids","itemtype","webitems","filter","selectHosts","applicationids","value_type","utils","expandItems","itemids","globalmacro","itemid","items","length","lastvalue","timeFrom","timeTill","grouped_items","_","groupBy","promises","map","history","sortorder","time_from","time_till","all","flatten","trend","self","serviceids","timeRange","timeTo","intervals","from","to","options","showTriggers","maintenance","expandDescription","expandData","expandComment","monitored","skipDependent","value","selectGroups","selectItems","selectLastEvent","selectTags","lastChangeSince","lastChangeTill","objectids","showEvents","select_acknowledges","preservekeys","events","event","acknowledges","minSeverity","acknowledged","count","min_severity","countOutput","triggers","filterTriggersByAcknowledge","trigger","lastEvent","angular","module","factory"],"mappings":";;;;;;;;;;;;;AAKA;AACA,WAASA,uBAAT,CAAiCC,QAAjC,EAA2CC,oBAA3C,EAAiE;AAAA,QAOzDC,SAPyD;AAS7D,yBAAYC,OAAZ,EAAqBC,QAArB,EAA+BC,QAA/B,EAAyCC,SAAzC,EAAoDC,eAApD,EAAqE;AAAA;;AACnE,aAAKC,GAAL,GAAwBL,OAAxB;AACA,aAAKC,QAAL,GAAwBA,QAAxB;AACA,aAAKC,QAAL,GAAwBA,QAAxB;AACA,aAAKI,IAAL,GAAwB,EAAxB;;AAEA,aAAKC,cAAL,GAAsB;AACpBJ,qBAAWA,SADS;AAEpBC,2BAAiBA;AAFG,SAAtB;;AAKA,aAAKI,YAAL,GAAoB,IAApB;AACA,aAAKC,eAAL,GAAuB,CAAvB;AACA,aAAKC,gBAAL,GAAwB,CAAxB;;AAEA,aAAKb,QAAL,GAAgBA,QAAhB;AACA,aAAKc,aAAL,GAAqBb,oBAArB;;AAEA,aAAKc,QAAL,GAAgB,KAAKC,oBAArB;AACA;AACD;;AAED;AACA;AACA;;AAjC6D;AAAA;AAAA,gCAmCrDC,MAnCqD,EAmC7CC,MAnC6C,EAmCrC;AAAA;;AACtB,iBAAO,KAAKJ,aAAL,CAAmBK,OAAnB,CAA2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AiB,CAA3B,IAAgCA,iBAAiB,CAArD,EAAwD;AACtDI,yBAAWC,4BAA4BD,QAA5B,EAAsCJ,YAAtC,CAAX;AACA,kBAAIC,KAAJ,EAAW;AACTG,2BAAWA,SAASlD,MAApB;AACD;AACF;AACD,mBAAOkD,QAAP;AACD,WATM,CAAP;AAUD;AAvd4D;;AAAA;AAAA;;AA0d/D,WAAOvG,SAAP;AACD;;AAED,WAASwG,2BAAT,CAAqCD,QAArC,EAA+CJ,YAA/C,EAA6D;AAC3D,QAAIA,iBAAiB,CAArB,EAAwB;AACtB,aAAOzC,EAAEf,MAAF,CAAS4D,QAAT,EAAmB,UAACE,OAAD;AAAA,eAAaA,QAAQC,SAAR,CAAkBP,YAAlB,KAAmC,GAAhD;AAAA,OAAnB,CAAP;AACD,KAFD,MAEO,IAAIA,iBAAiB,CAArB,EAAwB;AAC7B,aAAOzC,EAAEf,MAAF,CAAS4D,QAAT,EAAmB,UAACE,OAAD;AAAA,eAAaA,QAAQC,SAAR,CAAkBP,YAAlB,KAAmC,GAAhD;AAAA,OAAnB,CAAP;AACD,KAFM,MAEA;AACL,aAAOI,QAAP;AACD;AACF;;AAED,WAASpF,eAAT,CAAyBK,OAAzB,EAAkC;AAChC,WACEA,YAAY,uCAAZ,IACAA,YAAY,iBADZ,IAEAA,YAAY,iBAHd;AAKD;;;;AAnfMmF,a;;AACAjD,O;;AACKX,W;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmfZ4D,cACGC,MADH,CACU,kBADV,EAEGC,OAFH,CAEW,kBAFX,EAE+BhH,uBAF/B","file":"zabbixAPI.service.js","sourcesContent":["import angular from 'angular';\nimport _ from 'lodash';\nimport * as utils from './utils';\nimport './zabbixAPICore.service';\n\n/** @ngInject */\nfunction ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {\n\n /**\n * Zabbix API Wrapper.\n * Creates Zabbix API instance with given parameters (url, credentials and other).\n * Wraps API calls and provides high-level methods.\n */\n class ZabbixAPI {\n\n constructor(api_url, username, password, basicAuth, withCredentials) {\n this.url = api_url;\n this.username = username;\n this.password = password;\n this.auth = \"\";\n\n this.requestOptions = {\n basicAuth: basicAuth,\n withCredentials: withCredentials\n };\n\n this.loginPromise = null;\n this.loginErrorCount = 0;\n this.maxLoginAttempts = 3;\n\n this.alertSrv = alertSrv;\n this.zabbixAPICore = zabbixAPICoreService;\n\n this.getTrend = this.getTrend_ZBXNEXT1193;\n //getTrend = getTrend_30;\n }\n\n //////////////////////////\n // Core method wrappers //\n //////////////////////////\n\n request(method, params) {\n return this.zabbixAPICore.request(this.url, method, params, this.requestOptions, this.auth)\n .catch(error => {\n if (isNotAuthorized(error.data)) {\n // Handle auth errors\n this.loginErrorCount++;\n if (this.loginErrorCount > this.maxLoginAttempts) {\n this.loginErrorCount = 0;\n return null;\n } else {\n return this.loginOnce()\n .then(() => this.request(method, params));\n }\n } else {\n // Handle API errors\n let message = error.data ? error.data : error.statusText;\n this.alertAPIError(message);\n }\n });\n }\n\n alertAPIError(message, timeout = 5000) {\n this.alertSrv.set(\n \"Zabbix API Error\",\n message,\n 'error',\n timeout\n );\n }\n\n /**\n * When API unauthenticated or auth token expired each request produce login()\n * call. But auth token is common to all requests. This function wraps login() method\n * and call it once. If login() already called just wait for it (return its promise).\n * @return login promise\n */\n loginOnce() {\n if (!this.loginPromise) {\n this.loginPromise = Promise.resolve(\n this.login().then(auth => {\n this.auth = auth;\n this.loginPromise = null;\n return auth;\n })\n );\n }\n return this.loginPromise;\n }\n\n /**\n * Get authentication token.\n */\n login() {\n return this.zabbixAPICore.login(this.url, this.username, this.password, this.requestOptions);\n }\n\n /**\n * Get Zabbix API version\n */\n getVersion() {\n return this.zabbixAPICore.getVersion(this.url, this.requestOptions);\n }\n\n ////////////////////////////////\n // Zabbix API method wrappers //\n ////////////////////////////////\n\n acknowledgeEvent(eventid, message) {\n var params = {\n eventids: eventid,\n message: message\n };\n\n return this.request('event.acknowledge', params);\n }\n\n getGroups() {\n var params = {\n output: ['name'],\n sortfield: 'name',\n real_hosts: true\n };\n\n return this.request('hostgroup.get', params);\n }\n\n getHosts(groupids) {\n var params = {\n output: ['name', 'host'],\n sortfield: 'name'\n };\n if (groupids) {\n params.groupids = groupids;\n }\n\n return this.request('host.get', params);\n }\n\n getApps(hostids) {\n var params = {\n output: 'extend',\n hostids: hostids\n };\n\n return this.request('application.get', params);\n }\n\n /**\n * Get Zabbix items\n * @param {[type]} hostids host ids\n * @param {[type]} appids application ids\n * @param {String} itemtype 'num' or 'text'\n * @return {[type]} array of items\n */\n getItems(hostids, appids, itemtype) {\n var params = {\n output: [\n 'name', 'key_',\n 'value_type',\n 'hostid',\n 'status',\n 'state'\n ],\n sortfield: 'name',\n webitems: true,\n filter: {},\n selectHosts: ['hostid', 'name']\n };\n if (hostids) {\n params.hostids = hostids;\n }\n if (appids) {\n params.applicationids = appids;\n }\n if (itemtype === 'num') {\n // Return only numeric metrics\n params.filter.value_type = [0, 3];\n }\n if (itemtype === 'text') {\n // Return only text metrics\n params.filter.value_type = [1, 2, 4];\n }\n\n return this.request('item.get', params)\n .then(utils.expandItems);\n }\n\n getItemsByIDs(itemids) {\n var params = {\n itemids: itemids,\n output: [\n 'name', 'key_',\n 'value_type',\n 'hostid',\n 'status',\n 'state'\n ],\n webitems: true,\n selectHosts: ['hostid', 'name']\n };\n\n return this.request('item.get', params)\n .then(utils.expandItems);\n }\n\n getMacros(hostids) {\n var params = {\n output: 'extend',\n hostids: hostids\n };\n\n return this.request('usermacro.get', params);\n }\n\n getGlobalMacros() {\n var params = {\n output: 'extend',\n globalmacro: true\n };\n\n return this.request('usermacro.get', params);\n }\n\n getLastValue(itemid) {\n var params = {\n output: ['lastvalue'],\n itemids: itemid\n };\n return this.request('item.get', params)\n .then(items => items.length ? items[0].lastvalue : null);\n }\n\n /**\n * Perform history query from Zabbix API\n *\n * @param {Array} items Array of Zabbix item objects\n * @param {Number} timeFrom Time in seconds\n * @param {Number} timeTill Time in seconds\n * @return {Array} Array of Zabbix history objects\n */\n getHistory(items, timeFrom, timeTill) {\n\n // Group items by value type and perform request for each value type\n let grouped_items = _.groupBy(items, 'value_type');\n let promises = _.map(grouped_items, (items, value_type) => {\n let itemids = _.map(items, 'itemid');\n let params = {\n output: 'extend',\n history: value_type,\n itemids: itemids,\n sortfield: 'clock',\n sortorder: 'ASC',\n time_from: timeFrom\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (timeTill) {\n params.time_till = timeTill;\n }\n\n return this.request('history.get', params);\n });\n\n return Promise.all(promises).then(_.flatten);\n }\n\n /**\n * Perform trends query from Zabbix API\n * Use trends api extension from ZBXNEXT-1193 patch.\n *\n * @param {Array} items Array of Zabbix item objects\n * @param {Number} time_from Time in seconds\n * @param {Number} time_till Time in seconds\n * @return {Array} Array of Zabbix trend objects\n */\n getTrend_ZBXNEXT1193(items, timeFrom, timeTill) {\n\n // Group items by value type and perform request for each value type\n let grouped_items = _.groupBy(items, 'value_type');\n let promises = _.map(grouped_items, (items, value_type) => {\n let itemids = _.map(items, 'itemid');\n let params = {\n output: 'extend',\n trend: value_type,\n itemids: itemids,\n sortfield: 'clock',\n sortorder: 'ASC',\n time_from: timeFrom\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (timeTill) {\n params.time_till = timeTill;\n }\n\n return this.request('trend.get', params);\n });\n\n return Promise.all(promises).then(_.flatten);\n }\n\n getTrend_30(items, time_from, time_till, value_type) {\n var self = this;\n var itemids = _.map(items, 'itemid');\n\n var params = {\n output: [\"itemid\",\n \"clock\",\n value_type\n ],\n itemids: itemids,\n time_from: time_from\n };\n\n // Relative queries (e.g. last hour) don't include an end time\n if (time_till) {\n params.time_till = time_till;\n }\n\n return self.request('trend.get', params);\n }\n\n getITService(serviceids) {\n var params = {\n output: 'extend',\n serviceids: serviceids\n };\n return this.request('service.get', params);\n }\n\n getSLA(serviceids, timeRange) {\n let [timeFrom, timeTo] = timeRange;\n var params = {\n serviceids: serviceids,\n intervals: [{\n from: timeFrom,\n to: timeTo\n }]\n };\n return this.request('service.getsla', params);\n }\n\n getTriggers(groupids, hostids, applicationids, options) {\n let {showTriggers, maintenance, timeFrom, timeTo} = options;\n\n let params = {\n output: 'extend',\n groupids: groupids,\n hostids: hostids,\n applicationids: applicationids,\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n //only_true: true,\n filter: {\n value: 1\n },\n selectGroups: ['name'],\n selectHosts: ['name', 'host', 'maintenance_status'],\n selectItems: ['name', 'key_', 'lastvalue'],\n selectLastEvent: 'extend',\n selectTags: 'extend'\n };\n\n if (showTriggers) {\n params.filter.value = showTriggers;\n }\n\n if (maintenance) {\n params.maintenance = true;\n }\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params);\n }\n\n getEvents(objectids, timeFrom, timeTo, showEvents) {\n var params = {\n output: 'extend',\n time_from: timeFrom,\n time_till: timeTo,\n objectids: objectids,\n select_acknowledges: 'extend',\n selectHosts: 'extend',\n value: showEvents\n };\n\n return this.request('event.get', params);\n }\n\n getAcknowledges(eventids) {\n var params = {\n output: 'extend',\n eventids: eventids,\n preservekeys: true,\n select_acknowledges: 'extend',\n sortfield: 'clock',\n sortorder: 'DESC'\n };\n\n return this.request('event.get', params)\n .then(events => {\n return _.filter(events, (event) => event.acknowledges.length);\n });\n }\n\n getAlerts(itemids, timeFrom, timeTo) {\n var params = {\n output: 'extend',\n itemids: itemids,\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n //only_true: true,\n // filter: {\n // value: 1\n // },\n selectLastEvent: 'extend'\n };\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params);\n }\n\n getHostAlerts(hostids, applicationids, options) {\n let {minSeverity, acknowledged, count, timeFrom, timeTo} = options;\n let params = {\n output: 'extend',\n hostids: hostids,\n min_severity: minSeverity,\n filter: { value: 1 },\n expandDescription: true,\n expandData: true,\n expandComment: true,\n monitored: true,\n skipDependent: true,\n selectLastEvent: 'extend',\n selectGroups: 'extend',\n selectHosts: ['host', 'name']\n };\n\n if (count && acknowledged !== 0 && acknowledged !== 1) {\n params.countOutput = true;\n }\n\n if (applicationids && applicationids.length) {\n params.applicationids = applicationids;\n }\n\n if (timeFrom || timeTo) {\n params.lastChangeSince = timeFrom;\n params.lastChangeTill = timeTo;\n }\n\n return this.request('trigger.get', params)\n .then((triggers) => {\n if (!count || acknowledged === 0 || acknowledged === 1) {\n triggers = filterTriggersByAcknowledge(triggers, acknowledged);\n if (count) {\n triggers = triggers.length;\n }\n }\n return triggers;\n });\n }\n }\n\n return ZabbixAPI;\n}\n\nfunction filterTriggersByAcknowledge(triggers, acknowledged) {\n if (acknowledged === 0) {\n return _.filter(triggers, (trigger) => trigger.lastEvent.acknowledged === \"0\");\n } else if (acknowledged === 1) {\n return _.filter(triggers, (trigger) => trigger.lastEvent.acknowledged === \"1\");\n } else {\n return triggers;\n }\n}\n\nfunction isNotAuthorized(message) {\n return (\n message === \"Session terminated, re-login, please.\" ||\n message === \"Not authorised.\" ||\n message === \"Not authorized.\"\n );\n}\n\nangular\n .module('grafana.services')\n .factory('zabbixAPIService', ZabbixAPIServiceFactory);\n"]}
\ No newline at end of file
diff --git a/dist/panel-triggers/partials/module.html b/dist/panel-triggers/partials/module.html
index e46a4c14d..6ec3ad344 100644
--- a/dist/panel-triggers/partials/module.html
+++ b/dist/panel-triggers/partials/module.html
@@ -16,6 +16,12 @@
{{ ctrl.formatHostName(trigger) }}
+
+
+
+ {{tag.tag}}: {{tag.value}}
+
+
diff --git a/dist/panel-triggers/partials/options_tab.html b/dist/panel-triggers/partials/options_tab.html
index 27224ec1b..08d85463d 100644
--- a/dist/panel-triggers/partials/options_tab.html
+++ b/dist/panel-triggers/partials/options_tab.html
@@ -13,6 +13,12 @@
Show fields
checked="ctrl.panel.hostTechNameField"
on-change="ctrl.render()">
+
+
{
},
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: false,
severityField: false,
descriptionField: true,
@@ -86,6 +87,7 @@ describe('Triggers Panel schema migration', () => {
},
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: true,
severityField: true,
descriptionField: true,
diff --git a/dist/panel-triggers/triggers_panel_ctrl.js b/dist/panel-triggers/triggers_panel_ctrl.js
index 0a8086dc8..560245e90 100644
--- a/dist/panel-triggers/triggers_panel_ctrl.js
+++ b/dist/panel-triggers/triggers_panel_ctrl.js
@@ -132,6 +132,7 @@ System.register(['lodash', 'jquery', 'moment', '../datasource-zabbix/utils', 'ap
// Fields
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: true,
severityField: true,
descriptionField: true,
@@ -467,6 +468,11 @@ System.register(['lodash', 'jquery', 'moment', '../datasource-zabbix/utils', 'ap
triggerObj.hostTechName = trigger.hosts[0].host;
}
+ // Set tags if present
+ if (trigger.tags && trigger.tags.length === 0) {
+ trigger.tags = null;
+ }
+
// Handle multi-line description
if (trigger.comments) {
trigger.comments = trigger.comments.replace('\n', '
');
@@ -682,11 +688,15 @@ System.register(['lodash', 'jquery', 'moment', '../datasource-zabbix/utils', 'ap
triggerCardElem.find('.alert-list-icon').css({ 'font-size': fontSize + '%' });
triggerCardElem.find('.alert-list-title').css({ 'font-size': fontSize + '%' });
triggerCardElem.find('.alert-list-text').css({ 'font-size': fontSize * 0.8 + '%' });
+ triggerCardElem.find('.zbx-tag').css({ 'font-size': fontSize * 0.6 + '%' });
+ triggerCardElem.find('.zbx-tag').css({ 'line-height': fontSize / 100 * 16 + 'px' });
} else {
// remove css
triggerCardElem.find('.alert-list-icon').css({ 'font-size': '' });
triggerCardElem.find('.alert-list-title').css({ 'font-size': '' });
triggerCardElem.find('.alert-list-text').css({ 'font-size': '' });
+ triggerCardElem.find('.zbx-tag').css({ 'font-size': '' });
+ triggerCardElem.find('.zbx-tag').css({ 'line-height': '' });
}
}
diff --git a/dist/panel-triggers/triggers_panel_ctrl.js.map b/dist/panel-triggers/triggers_panel_ctrl.js.map
index 3eaa43bff..81f0e1e3a 100644
--- a/dist/panel-triggers/triggers_panel_ctrl.js.map
+++ b/dist/panel-triggers/triggers_panel_ctrl.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/panel-triggers/triggers_panel_ctrl.js"],"names":["filterTriggers","triggers","triggerFilter","utils","isRegex","_","filter","trigger","buildRegex","test","description","$","moment","PanelCtrl","triggerPanelOptionsTab","triggerPanelTriggersTab","migratePanelSchema","ZABBIX_DS_ID","DEFAULT_TARGET","group","host","application","DEFAULT_SEVERITY","priority","severity","color","show","DEFAULT_TIME_FORMAT","PANEL_DEFAULTS","schemaVersion","datasources","targets","hostField","hostTechNameField","statusField","severityField","descriptionField","descriptionAtNewLine","hostsInMaintenance","showTriggers","sortTriggersBy","text","value","showEvents","limit","fontSize","pageSize","highlightNewEvents","highlightNewerThan","customLastChangeFormat","lastChangeFormat","triggerSeverity","okEventColor","ackEventColor","triggerStatusMap","TriggerPanelCtrl","$scope","$injector","$timeout","datasourceSrv","templateSrv","contextSrv","dashboardSrv","scope","editorTabIndex","defaultTimeFormat","pageIndex","triggerList","currentTriggersPage","panel","defaultsDeep","cloneDeep","available_datasources","map","getZabbixDataSources","length","push","isEmpty","initDatasources","events","on","onInitEditMode","bind","onRefresh","promises","ds","get","then","datasource","Promise","all","getMetricSources","meta","id","addEditorTab","timing","queryStart","Date","getTime","queryEnd","otherPanelInFullscreenMode","error","loading","setTimeQueryStart","getTriggers","setTimeQueryEnd","render","zabbixTriggers","catch","err","cancelled","console","log","message","data","emit","triggerListUnfiltered","formatTrigger","filterTriggersPost","sortTriggers","slice","getCurrentTriggersPage","zabbix","groupFilter","replaceTemplateVars","hostFilter","appFilter","triggersOptions","getAcknowledges","setMaintenanceStatus","filterTriggersPre","addTriggerDataSource","flatten","results","eventids","lastEvent","eventid","each","event","find","acknowledges","timestamp","unix","ack","clock","time","format","user","alias","name","surname","maintenance","maintenance_status","some","hosts","orderBy","zabbixTrigger","triggerObj","hostTechName","comments","replace","lastchangeUnix","Number","lastchange","setTriggerLastChange","setTriggerSeverity","markAckEvents","age","fromNow","showComment","grafana_user","ack_message","zabbixAPI","acknowledgeEvent","reject","startPos","endPos","Math","min","triggerValue","iconClass","isNewTrigger","statusClass","highlightIntervalMs","parseInterval","durationSec","now","e","elem","attrs","ctrl","pageCount","$watchGroup","renderPanel","switchPage","renderData","getContentHeight","panelHeight","height","el","currentTarget","parseInt","$apply","appendPaginationControls","footerElem","empty","ceil","startPage","max","endPage","paginationList","i","activeClass","pageLinkElem","append","setFontSize","triggerCardElem","css","rootElem","renderingCompleted","unbindDestroy","$on","off","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsjBA,WAASA,cAAT,CAAwBC,QAAxB,EAAkCC,aAAlC,EAAiD;AAC/C,QAAIC,MAAMC,OAAN,CAAcF,aAAd,CAAJ,EAAkC;AAChC,aAAOG,EAAEC,MAAF,CAASL,QAAT,EAAmB,UAASM,OAAT,EAAkB;AAC1C,eAAOJ,MAAMK,UAAN,CAAiBN,aAAjB,EAAgCO,IAAhC,CAAqCF,QAAQG,WAA7C,CAAP;AACD,OAFM,CAAP;AAGD,KAJD,MAIO;AACL,aAAOL,EAAEC,MAAF,CAASL,QAAT,EAAmB,UAASM,OAAT,EAAkB;AAC1C,eAAOA,QAAQG,WAAR,KAAwBR,aAA/B;AACD,OAFM,CAAP;AAGD;AACF;;;AAhkBMG,O;;AACAM,O;;AACAC,Y;;AACKT,W;;AACJU,e,kBAAAA,S;;AACAC,4B,gBAAAA,sB;;AACAC,6B,iBAAAA,uB;;AACAC,wB,eAAAA,kB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEFC,kB,GAAe,mC;;gCAERC,c,GAAiB;AAC5BC,eAAO,EAACb,QAAQ,EAAT,EADqB;AAE5Bc,cAAM,EAACd,QA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2K,gCAAgB7E,IAAhB,CAAqB,kBAArB,EAAyC8E,GAAzC,CAA6C,EAAC,aAAa5K,WAAW,GAAzB,EAA7C;AACA2K,gCAAgB7E,IAAhB,CAAqB,mBAArB,EAA0C8E,GAA1C,CAA8C,EAAC,aAAa5K,WAAW,GAAzB,EAA9C;AACA2K,gCAAgB7E,IAAhB,CAAqB,kBAArB,EAAyC8E,GAAzC,CAA6C,EAAC,aAAa5K,WAAW,GAAX,GAAiB,GAA/B,EAA7C;AACD,eAJD,MAIO;AACL;AACA2K,gCAAgB7E,IAAhB,CAAqB,kBAArB,EAAyC8E,GAAzC,CAA6C,EAAC,aAAa,EAAd,EAA7C;AACAD,gCAAgB7E,IAAhB,CAAqB,mBAArB,EAA0C8E,GAA1C,CAA8C,EAAC,aAAa,EAAd,EAA9C;AACAD,gCAAgB7E,IAAhB,CAAqB,kBAArB,EAAyC8E,GAAzC,CAA6C,EAAC,aAAa,EAAd,EAA7C;AACD;AACF;;AAED,qBAASxB,WAAT,GAAuB;AACrB,kBAAIyB,WAAW9B,KAAKjD,IAAL,CAAU,wBAAV,CAAf;AACA,kBAAIiE,aAAahB,KAAKjD,IAAL,CAAU,wBAAV,CAAjB;AACAgE,uCAAyBC,UAAzB;AACAc,uBAASD,GAAT,CAAa,EAAC,cAAcrB,kBAAf,EAAb;AACAsB,uBAASD,GAAT,CAAa,EAAC,UAAUrB,kBAAX,EAAb;AACAmB;AACAzB,mBAAK6B,kBAAL;AACD;;AAED,gBAAIC,gBAAgB7J,MAAM8J,GAAN,CAAU,UAAV,EAAsB,YAAW;AACnDjC,mBAAKkC,GAAL,CAAS,OAAT,EAAkB,2BAAlB;AACAF;AACD,aAHmB,CAApB;AAID;;;;QAjfmC/M,S;;;;AAoftC0C,uBAAiBwK,WAAjB,GAA+B,+EAA/B","file":"triggers_panel_ctrl.js","sourcesContent":["import _ from 'lodash';\nimport $ from 'jquery';\nimport moment from 'moment';\nimport * as utils from '../datasource-zabbix/utils';\nimport {PanelCtrl} from 'app/plugins/sdk';\nimport {triggerPanelOptionsTab} from './options_tab';\nimport {triggerPanelTriggersTab} from './triggers_tab';\nimport {migratePanelSchema} from './migrations';\n\nconst ZABBIX_DS_ID = 'alexanderzobnin-zabbix-datasource';\n\nexport const DEFAULT_TARGET = {\n group: {filter: \"\"},\n host: {filter: \"\"},\n application: {filter: \"\"},\n trigger: {filter: \"\"}\n};\n\nexport const DEFAULT_SEVERITY = [\n { priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true},\n { priority: 1, severity: 'Information', color: '#82B5D8', show: true},\n { priority: 2, severity: 'Warning', color: '#E5AC0E', show: true},\n { priority: 3, severity: 'Average', color: '#C15C17', show: true},\n { priority: 4, severity: 'High', color: '#BF1B00', show: true},\n { priority: 5, severity: 'Disaster', color: '#890F02', show: true},\n];\n\nconst DEFAULT_TIME_FORMAT = \"DD MMM YYYY HH:mm:ss\";\n\nexport const PANEL_DEFAULTS = {\n schemaVersion: 3,\n datasources: [],\n targets: {},\n // Fields\n hostField: true,\n hostTechNameField: false,\n statusField: true,\n severityField: true,\n descriptionField: true,\n descriptionAtNewLine: false,\n // Options\n hostsInMaintenance: true,\n showTriggers: 'all triggers',\n sortTriggersBy: { text: 'last change', value: 'lastchange' },\n showEvents: { text: 'Problems', value: '1' },\n limit: 100,\n // View options\n fontSize: '100%',\n pageSize: 10,\n highlightNewEvents: true,\n highlightNewerThan: '1h',\n customLastChangeFormat: false,\n lastChangeFormat: \"\",\n // Triggers severity and colors\n triggerSeverity: DEFAULT_SEVERITY,\n okEventColor: 'rgba(0, 245, 153, 0.45)',\n ackEventColor: 'rgba(0, 0, 0, 0)'\n};\n\nconst triggerStatusMap = {\n '0': 'OK',\n '1': 'PROBLEM'\n};\n\nexport class TriggerPanelCtrl extends PanelCtrl {\n\n /** @ngInject */\n constructor($scope, $injector, $timeout, datasourceSrv, templateSrv, contextSrv, dashboardSrv) {\n super($scope, $injector);\n this.datasourceSrv = datasourceSrv;\n this.templateSrv = templateSrv;\n this.contextSrv = contextSrv;\n this.dashboardSrv = dashboardSrv;\n this.scope = $scope;\n this.$timeout = $timeout;\n\n this.editorTabIndex = 1;\n this.triggerStatusMap = triggerStatusMap;\n this.defaultTimeFormat = DEFAULT_TIME_FORMAT;\n this.pageIndex = 0;\n this.triggerList = [];\n this.currentTriggersPage = [];\n this.datasources = {};\n\n this.panel = migratePanelSchema(this.panel);\n _.defaultsDeep(this.panel, _.cloneDeep(PANEL_DEFAULTS));\n\n this.available_datasources = _.map(this.getZabbixDataSources(), 'name');\n if (this.panel.datasources.length === 0) {\n this.panel.datasources.push(this.available_datasources[0]);\n }\n if (_.isEmpty(this.panel.targets)) {\n this.panel.targets[this.panel.datasources[0]] = DEFAULT_TARGET;\n }\n\n this.initDatasources();\n this.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n this.events.on('refresh', this.onRefresh.bind(this));\n }\n\n initDatasources() {\n let promises = _.map(this.panel.datasources, (ds) => {\n // Load datasource\n return this.datasourceSrv.get(ds)\n .then(datasource => {\n this.datasources[ds] = datasource;\n return datasource;\n });\n });\n return Promise.all(promises);\n }\n\n getZabbixDataSources() {\n return _.filter(this.datasourceSrv.getMetricSources(), datasource => {\n return datasource.meta.id === ZABBIX_DS_ID && datasource.value;\n });\n }\n\n onInitEditMode() {\n this.addEditorTab('Triggers', triggerPanelTriggersTab, 1);\n this.addEditorTab('Options', triggerPanelOptionsTab, 2);\n }\n\n setTimeQueryStart() {\n this.timing.queryStart = new Date().getTime();\n }\n\n setTimeQueryEnd() {\n this.timing.queryEnd = new Date().getTime();\n }\n\n onRefresh() {\n // ignore fetching data if another panel is in fullscreen\n if (this.otherPanelInFullscreenMode()) { return; }\n\n // clear loading/error state\n delete this.error;\n this.loading = true;\n this.setTimeQueryStart();\n this.pageIndex = 0;\n\n return this.getTriggers()\n .then(zabbixTriggers => {\n // Notify panel that request is finished\n this.loading = false;\n this.setTimeQueryEnd();\n\n this.render(zabbixTriggers);\n })\n .catch(err => {\n // if cancelled keep loading set to true\n if (err.cancelled) {\n console.log('Panel request cancelled', err);\n return;\n }\n\n this.loading = false;\n this.error = err.message || \"Request Error\";\n\n if (err.data) {\n if (err.data.message) {\n this.error = err.data.message;\n }\n if (err.data.error) {\n this.error = err.data.error;\n }\n }\n\n this.events.emit('data-error', err);\n console.log('Panel data error:', err);\n });\n }\n\n render(zabbixTriggers) {\n let triggers = _.cloneDeep(zabbixTriggers || this.triggerListUnfiltered);\n this.triggerListUnfiltered = _.cloneDeep(triggers);\n\n triggers = _.map(triggers, this.formatTrigger.bind(this));\n triggers = this.filterTriggersPost(triggers);\n triggers = this.sortTriggers(triggers);\n\n // Limit triggers number\n triggers = triggers.slice(0, this.panel.limit || PANEL_DEFAULTS.limit);\n\n this.triggerList = triggers;\n this.getCurrentTriggersPage();\n\n this.$timeout(() => {\n super.render(this.triggerList);\n });\n }\n\n getTriggers() {\n let promises = _.map(this.panel.datasources, (ds) => {\n return this.datasourceSrv.get(ds)\n .then(datasource => {\n var zabbix = datasource.zabbix;\n var showEvents = this.panel.showEvents.value;\n var triggerFilter = this.panel.targets[ds];\n\n // Replace template variables\n var groupFilter = datasource.replaceTemplateVars(triggerFilter.group.filter);\n var hostFilter = datasource.replaceTemplateVars(triggerFilter.host.filter);\n var appFilter = datasource.replaceTemplateVars(triggerFilter.application.filter);\n\n let triggersOptions = {\n showTriggers: showEvents\n };\n\n return zabbix.getTriggers(groupFilter, hostFilter, appFilter, triggersOptions);\n }).then((triggers) => {\n return this.getAcknowledges(triggers, ds);\n }).then((triggers) => {\n return this.setMaintenanceStatus(triggers);\n }).then((triggers) => {\n return this.filterTriggersPre(triggers, ds);\n }).then((triggers) => {\n return this.addTriggerDataSource(triggers, ds);\n });\n });\n\n return Promise.all(promises)\n .then(results => _.flatten(results));\n }\n\n getAcknowledges(triggerList, ds) {\n // Request acknowledges for trigger\n var eventids = _.map(triggerList, trigger => {\n return trigger.lastEvent.eventid;\n });\n\n return this.datasources[ds].zabbix.getAcknowledges(eventids)\n .then(events => {\n\n // Map events to triggers\n _.each(triggerList, trigger => {\n var event = _.find(events, event => {\n return event.eventid === trigger.lastEvent.eventid;\n });\n\n if (event) {\n trigger.acknowledges = _.map(event.acknowledges, ack => {\n let timestamp = moment.unix(ack.clock);\n if (this.panel.customLastChangeFormat) {\n ack.time = timestamp.format(this.panel.lastChangeFormat);\n } else {\n ack.time = timestamp.format(this.defaultTimeFormat);\n }\n ack.user = ack.alias + ' (' + ack.name + ' ' + ack.surname + ')';\n return ack;\n });\n }\n\n if (!trigger.lastEvent.eventid) {\n trigger.lastEvent = null;\n }\n });\n\n return triggerList;\n });\n }\n\n filterTriggersPre(triggerList, ds) {\n // Filter triggers by description\n var triggerFilter = this.panel.targets[ds].trigger.filter;\n triggerFilter = this.datasources[ds].replaceTemplateVars(triggerFilter);\n if (triggerFilter) {\n triggerList = filterTriggers(triggerList, triggerFilter);\n }\n\n return triggerList;\n }\n\n filterTriggersPost(triggers) {\n let triggerList = _.cloneDeep(triggers);\n\n // Filter acknowledged triggers\n if (this.panel.showTriggers === 'unacknowledged') {\n triggerList = _.filter(triggerList, trigger => {\n return !trigger.acknowledges;\n });\n } else if (this.panel.showTriggers === 'acknowledged') {\n triggerList = _.filter(triggerList, 'acknowledges');\n } else {\n triggerList = triggerList;\n }\n\n // Filter by maintenance status\n if (!this.panel.hostsInMaintenance) {\n triggerList = _.filter(triggerList, (trigger) => trigger.maintenance === false);\n }\n\n // Filter triggers by severity\n triggerList = _.filter(triggerList, trigger => {\n return this.panel.triggerSeverity[trigger.priority].show;\n });\n\n return triggerList;\n }\n\n setMaintenanceStatus(triggers) {\n _.each(triggers, (trigger) => {\n let maintenance_status = _.some(trigger.hosts, (host) => host.maintenance_status === '1');\n trigger.maintenance = maintenance_status;\n });\n return triggers;\n }\n\n addTriggerDataSource(triggers, ds) {\n _.each(triggers, (trigger) => {\n trigger.datasource = ds;\n });\n return triggers;\n }\n\n sortTriggers(triggerList) {\n if (this.panel.sortTriggersBy.value === 'priority') {\n triggerList = _.orderBy(triggerList, ['priority', 'lastchangeUnix', 'triggerid'], ['desc', 'desc', 'desc']);\n } else {\n triggerList = _.orderBy(triggerList, ['lastchangeUnix', 'priority', 'triggerid'], ['desc', 'desc', 'desc']);\n }\n return triggerList;\n }\n\n formatTrigger(zabbixTrigger) {\n let trigger = _.cloneDeep(zabbixTrigger);\n let triggerObj = trigger;\n\n // Set host that the trigger belongs\n if (trigger.hosts && trigger.hosts.length) {\n triggerObj.host = trigger.hosts[0].name;\n triggerObj.hostTechName = trigger.hosts[0].host;\n }\n\n // Handle multi-line description\n if (trigger.comments) {\n trigger.comments = trigger.comments.replace('\\n', '
');\n }\n\n // Format last change and age\n trigger.lastchangeUnix = Number(trigger.lastchange);\n triggerObj = this.setTriggerLastChange(triggerObj);\n triggerObj = this.setTriggerSeverity(triggerObj);\n return triggerObj;\n }\n\n updateTriggerFormat(trigger) {\n trigger = this.setTriggerLastChange(trigger);\n trigger = this.setTriggerSeverity(trigger);\n return trigger;\n }\n\n setTriggerSeverity(trigger) {\n if (trigger.value === '1') {\n // Problem state\n trigger.color = this.panel.triggerSeverity[trigger.priority].color;\n } else {\n // OK state\n trigger.color = this.panel.okEventColor;\n }\n trigger.severity = this.panel.triggerSeverity[trigger.priority].severity;\n\n // Mark acknowledged triggers with different color\n if (this.panel.markAckEvents && trigger.acknowledges && trigger.acknowledges.length) {\n trigger.color = this.panel.ackEventColor;\n }\n\n return trigger;\n }\n\n setTriggerLastChange(trigger) {\n if (!trigger.lastchangeUnix) {\n trigger.lastchange = \"\";\n trigger.age = \"\";\n return trigger;\n }\n\n let timestamp = moment.unix(trigger.lastchangeUnix);\n if (this.panel.customLastChangeFormat) {\n // User defined format\n trigger.lastchange = timestamp.format(this.panel.lastChangeFormat);\n } else {\n trigger.lastchange = timestamp.format(this.defaultTimeFormat);\n }\n trigger.age = timestamp.fromNow(true);\n return trigger;\n }\n\n switchComment(trigger) {\n trigger.showComment = !trigger.showComment;\n }\n\n acknowledgeTrigger(trigger, message) {\n let eventid = trigger.lastEvent ? trigger.lastEvent.eventid : null;\n let grafana_user = this.contextSrv.user.name;\n let ack_message = grafana_user + ' (Grafana): ' + message;\n return this.datasourceSrv.get(trigger.datasource)\n .then(datasource => {\n if (eventid) {\n return datasource.zabbix.zabbixAPI.acknowledgeEvent(eventid, ack_message);\n } else {\n return Promise.reject({message: 'Trigger has no events. Nothing to acknowledge.'});\n }\n })\n .then(this.onRefresh.bind(this))\n .catch((err) => {\n this.error = err.message || \"Acknowledge Error\";\n this.events.emit('data-error', err);\n console.log('Panel data error:', err);\n });\n }\n\n getCurrentTriggersPage() {\n let pageSize = this.panel.pageSize || PANEL_DEFAULTS.pageSize;\n let startPos = this.pageIndex * pageSize;\n let endPos = Math.min(startPos + pageSize, this.triggerList.length);\n this.currentTriggersPage = this.triggerList.slice(startPos, endPos);\n return this.currentTriggersPage;\n }\n\n formatHostName(trigger) {\n if (this.panel.hostField && this.panel.hostTechNameField) {\n return `${trigger.host} (${trigger.hostTechName})`;\n } else if (this.panel.hostField || this.panel.hostTechNameField) {\n return trigger.host || trigger.hostTechName;\n } else {\n return \"\";\n }\n }\n\n getAlertIconClass(trigger) {\n const triggerValue = Number(trigger.value);\n let iconClass = '';\n if (triggerValue || trigger.color) {\n if (trigger.priority >= 3) {\n iconClass = 'icon-gf-critical';\n } else {\n iconClass = 'icon-gf-warning';\n }\n } else {\n iconClass = 'icon-gf-online';\n }\n\n if (this.panel.highlightNewEvents && this.isNewTrigger(trigger)) {\n iconClass += ' zabbix-trigger--blinked';\n }\n return iconClass;\n }\n\n getAlertStateClass(trigger) {\n let statusClass = '';\n\n if (trigger.value === '1') {\n statusClass = 'alert-state-critical';\n } else {\n statusClass = 'alert-state-ok';\n }\n\n if (this.panel.highlightNewEvents && this.isNewTrigger(trigger)) {\n statusClass += ' zabbix-trigger--blinked';\n }\n\n return statusClass;\n }\n\n isNewTrigger(trigger) {\n try {\n const highlightIntervalMs = utils.parseInterval(this.panel.highlightNewerThan || PANEL_DEFAULTS.highlightNewerThan);\n const durationSec = (Date.now() - trigger.lastchangeUnix * 1000);\n return durationSec < highlightIntervalMs;\n } catch (e) {\n return false;\n }\n }\n\n link(scope, elem, attrs, ctrl) {\n let panel = ctrl.panel;\n let pageCount = 0;\n let triggerList = ctrl.triggerList;\n\n scope.$watchGroup(['ctrl.currentTriggersPage', 'ctrl.triggerList'], renderPanel);\n elem.on('click', '.triggers-panel-page-link', switchPage);\n ctrl.events.on('render', (renderData) => {\n triggerList = renderData || triggerList;\n renderPanel();\n });\n\n function getContentHeight() {\n let panelHeight = ctrl.height;\n if (pageCount > 1) {\n panelHeight -= 36;\n }\n return panelHeight + 'px';\n }\n\n function switchPage(e) {\n let el = $(e.currentTarget);\n ctrl.pageIndex = (parseInt(el.text(), 10)-1);\n\n let pageSize = panel.pageSize || 10;\n let startPos = ctrl.pageIndex * pageSize;\n let endPos = Math.min(startPos + pageSize, triggerList.length);\n ctrl.currentTriggersPage = triggerList.slice(startPos, endPos);\n\n scope.$apply(() => {\n renderPanel();\n });\n }\n\n function appendPaginationControls(footerElem) {\n footerElem.empty();\n\n let pageSize = panel.pageSize || 5;\n pageCount = Math.ceil(triggerList.length / pageSize);\n if (pageCount === 1) {\n return;\n }\n\n let startPage = Math.max(ctrl.pageIndex - 3, 0);\n let endPage = Math.min(pageCount, startPage + 9);\n\n let paginationList = $('');\n\n for (let i = startPage; i < endPage; i++) {\n let activeClass = i === ctrl.pageIndex ? 'active' : '';\n let pageLinkElem = $('' + (i+1) + '');\n paginationList.append(pageLinkElem);\n }\n\n footerElem.append(paginationList);\n }\n\n function setFontSize() {\n const fontSize = parseInt(panel.fontSize.slice(0, panel.fontSize.length - 1));\n let triggerCardElem = elem.find('.card-item-wrapper');\n if (fontSize && fontSize !== 100) {\n triggerCardElem.find('.alert-list-icon').css({'font-size': fontSize + '%'});\n triggerCardElem.find('.alert-list-title').css({'font-size': fontSize + '%'});\n triggerCardElem.find('.alert-list-text').css({'font-size': fontSize * 0.8 + '%'});\n } else {\n // remove css\n triggerCardElem.find('.alert-list-icon').css({'font-size': ''});\n triggerCardElem.find('.alert-list-title').css({'font-size': ''});\n triggerCardElem.find('.alert-list-text').css({'font-size': ''});\n }\n }\n\n function renderPanel() {\n let rootElem = elem.find('.triggers-panel-scroll');\n let footerElem = elem.find('.triggers-panel-footer');\n appendPaginationControls(footerElem);\n rootElem.css({'max-height': getContentHeight()});\n rootElem.css({'height': getContentHeight()});\n setFontSize();\n ctrl.renderingCompleted();\n }\n\n let unbindDestroy = scope.$on('$destroy', function() {\n elem.off('click', '.triggers-panel-page-link');\n unbindDestroy();\n });\n }\n}\n\nTriggerPanelCtrl.templateUrl = 'public/plugins/alexanderzobnin-zabbix-app/panel-triggers/partials/module.html';\n\nfunction filterTriggers(triggers, triggerFilter) {\n if (utils.isRegex(triggerFilter)) {\n return _.filter(triggers, function(trigger) {\n return utils.buildRegex(triggerFilter).test(trigger.description);\n });\n } else {\n return _.filter(triggers, function(trigger) {\n return trigger.description === triggerFilter;\n });\n }\n}\n"]}
\ No newline at end of file
+{"version":3,"sources":["../../src/panel-triggers/triggers_panel_ctrl.js"],"names":["filterTriggers","triggers","triggerFilter","utils","isRegex","_","filter","trigger","buildRegex","test","description","$","moment","PanelCtrl","triggerPanelOptionsTab","triggerPanelTriggersTab","migratePanelSchema","ZABBIX_DS_ID","DEFAULT_TARGET","group","host","application","DEFAULT_SEVERITY","priority","severity","color","show","DEFAULT_TIME_FORMAT","PANEL_DEFAULTS","schemaVersion","datasources","targets","hostField","hostTechNameField","showTags","statusField","severityField","descriptionField","descriptionAtNewLine","hostsInMaintenance","showTriggers","sortTriggersBy","text","value","showEvents","limit","fontSize","pageSize","highlightNewEvents","highlightNewerThan","customLastChangeFormat","lastChangeFormat","triggerSeverity","okEventColor","ackEventColor","triggerStatusMap","TriggerPanelCtrl","$scope","$injector","$timeout","datasourceSrv","templateSrv","contextSrv","dashboardSrv","scope","editorTabIndex","defaultTimeFormat","pageIndex","triggerList","currentTriggersPage","panel","defaultsDeep","cloneDeep","available_datasources","map","getZabbixDataSources","length","push","isEmpty","initDatasources","events","on","onInitEditMode","bind","onRefresh","promises","ds","get","then","datasource","Promise","all","getMetricSources","meta","id","addEditorTab","timing","queryStart","Date","getTime","queryEnd","otherPanelInFullscreenMode","error","loading","setTimeQueryStart","getTriggers","setTimeQueryEnd","render","zabbixTriggers","catch","err","cancelled","console","log","message","data","emit","triggerListUnfiltered","formatTrigger","filterTriggersPost","sortTriggers","slice","getCurrentTriggersPage","zabbix","groupFilter","replaceTemplateVars","hostFilter","appFilter","triggersOptions","getAcknowledges","setMaintenanceStatus","filterTriggersPre","addTriggerDataSource","flatten","results","eventids","lastEvent","eventid","each","event","find","acknowledges","timestamp","unix","ack","clock","time","format","user","alias","name","surname","maintenance","maintenance_status","some","hosts","orderBy","zabbixTrigger","triggerObj","hostTechName","tags","comments","replace","lastchangeUnix","Number","lastchange","setTriggerLastChange","setTriggerSeverity","markAckEvents","age","fromNow","showComment","grafana_user","ack_message","zabbixAPI","acknowledgeEvent","reject","startPos","endPos","Math","min","triggerValue","iconClass","isNewTrigger","statusClass","highlightIntervalMs","parseInterval","durationSec","now","e","elem","attrs","ctrl","pageCount","$watchGroup","renderPanel","switchPage","renderData","getContentHeight","panelHeight","height","el","currentTarget","parseInt","$apply","appendPaginationControls","footerElem","empty","ceil","startPage","max","endPage","paginationList","i","activeClass","pageLinkElem","append","setFontSize","triggerCardElem","css","rootElem","renderingCompleted","unbindDestroy","$on","off","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgkBA,WAASA,cAAT,CAAwBC,QAAxB,EAAkCC,aAAlC,EAAiD;AAC/C,QAAIC,MAAMC,OAAN,CAAcF,aAAd,CAAJ,EAAkC;AAChC,aAAOG,EAAEC,MAAF,CAASL,QAAT,EAAmB,UAASM,OAAT,EAAkB;AAC1C,eAAOJ,MAAMK,UAAN,CAAiBN,aAAjB,EAAgCO,IAAhC,CAA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hB,CAAqB,kBAArB,EAAyC+E,GAAzC,CAA6C,EAAC,aAAa,EAAd,EAA7C;AACAD,gCAAgB9E,IAAhB,CAAqB,mBAArB,EAA0C+E,GAA1C,CAA8C,EAAC,aAAa,EAAd,EAA9C;AACAD,gCAAgB9E,IAAhB,CAAqB,kBAArB,EAAyC+E,GAAzC,CAA6C,EAAC,aAAa,EAAd,EAA7C;AACAD,gCAAgB9E,IAAhB,CAAqB,UAArB,EAAiC+E,GAAjC,CAAqC,EAAC,aAAa,EAAd,EAArC;AACAD,gCAAgB9E,IAAhB,CAAqB,UAArB,EAAiC+E,GAAjC,CAAqC,EAAC,eAAe,EAAhB,EAArC;AACD;AACF;;AAED,qBAASxB,WAAT,GAAuB;AACrB,kBAAIyB,WAAW9B,KAAKlD,IAAL,CAAU,wBAAV,CAAf;AACA,kBAAIkE,aAAahB,KAAKlD,IAAL,CAAU,wBAAV,CAAjB;AACAiE,uCAAyBC,UAAzB;AACAc,uBAASD,GAAT,CAAa,EAAC,cAAcrB,kBAAf,EAAb;AACAsB,uBAASD,GAAT,CAAa,EAAC,UAAUrB,kBAAX,EAAb;AACAmB;AACAzB,mBAAK6B,kBAAL;AACD;;AAED,gBAAIC,gBAAgB9J,MAAM+J,GAAN,CAAU,UAAV,EAAsB,YAAW;AACnDjC,mBAAKkC,GAAL,CAAS,OAAT,EAAkB,2BAAlB;AACAF;AACD,aAHmB,CAApB;AAID;;;;QA1fmCjN,S;;;;AA6ftC2C,uBAAiByK,WAAjB,GAA+B,+EAA/B","file":"triggers_panel_ctrl.js","sourcesContent":["import _ from 'lodash';\nimport $ from 'jquery';\nimport moment from 'moment';\nimport * as utils from '../datasource-zabbix/utils';\nimport {PanelCtrl} from 'app/plugins/sdk';\nimport {triggerPanelOptionsTab} from './options_tab';\nimport {triggerPanelTriggersTab} from './triggers_tab';\nimport {migratePanelSchema} from './migrations';\n\nconst ZABBIX_DS_ID = 'alexanderzobnin-zabbix-datasource';\n\nexport const DEFAULT_TARGET = {\n group: {filter: \"\"},\n host: {filter: \"\"},\n application: {filter: \"\"},\n trigger: {filter: \"\"}\n};\n\nexport const DEFAULT_SEVERITY = [\n { priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true},\n { priority: 1, severity: 'Information', color: '#82B5D8', show: true},\n { priority: 2, severity: 'Warning', color: '#E5AC0E', show: true},\n { priority: 3, severity: 'Average', color: '#C15C17', show: true},\n { priority: 4, severity: 'High', color: '#BF1B00', show: true},\n { priority: 5, severity: 'Disaster', color: '#890F02', show: true},\n];\n\nconst DEFAULT_TIME_FORMAT = \"DD MMM YYYY HH:mm:ss\";\n\nexport const PANEL_DEFAULTS = {\n schemaVersion: 3,\n datasources: [],\n targets: {},\n // Fields\n hostField: true,\n hostTechNameField: false,\n showTags: true,\n statusField: true,\n severityField: true,\n descriptionField: true,\n descriptionAtNewLine: false,\n // Options\n hostsInMaintenance: true,\n showTriggers: 'all triggers',\n sortTriggersBy: { text: 'last change', value: 'lastchange' },\n showEvents: { text: 'Problems', value: '1' },\n limit: 100,\n // View options\n fontSize: '100%',\n pageSize: 10,\n highlightNewEvents: true,\n highlightNewerThan: '1h',\n customLastChangeFormat: false,\n lastChangeFormat: \"\",\n // Triggers severity and colors\n triggerSeverity: DEFAULT_SEVERITY,\n okEventColor: 'rgba(0, 245, 153, 0.45)',\n ackEventColor: 'rgba(0, 0, 0, 0)'\n};\n\nconst triggerStatusMap = {\n '0': 'OK',\n '1': 'PROBLEM'\n};\n\nexport class TriggerPanelCtrl extends PanelCtrl {\n\n /** @ngInject */\n constructor($scope, $injector, $timeout, datasourceSrv, templateSrv, contextSrv, dashboardSrv) {\n super($scope, $injector);\n this.datasourceSrv = datasourceSrv;\n this.templateSrv = templateSrv;\n this.contextSrv = contextSrv;\n this.dashboardSrv = dashboardSrv;\n this.scope = $scope;\n this.$timeout = $timeout;\n\n this.editorTabIndex = 1;\n this.triggerStatusMap = triggerStatusMap;\n this.defaultTimeFormat = DEFAULT_TIME_FORMAT;\n this.pageIndex = 0;\n this.triggerList = [];\n this.currentTriggersPage = [];\n this.datasources = {};\n\n this.panel = migratePanelSchema(this.panel);\n _.defaultsDeep(this.panel, _.cloneDeep(PANEL_DEFAULTS));\n\n this.available_datasources = _.map(this.getZabbixDataSources(), 'name');\n if (this.panel.datasources.length === 0) {\n this.panel.datasources.push(this.available_datasources[0]);\n }\n if (_.isEmpty(this.panel.targets)) {\n this.panel.targets[this.panel.datasources[0]] = DEFAULT_TARGET;\n }\n\n this.initDatasources();\n this.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n this.events.on('refresh', this.onRefresh.bind(this));\n }\n\n initDatasources() {\n let promises = _.map(this.panel.datasources, (ds) => {\n // Load datasource\n return this.datasourceSrv.get(ds)\n .then(datasource => {\n this.datasources[ds] = datasource;\n return datasource;\n });\n });\n return Promise.all(promises);\n }\n\n getZabbixDataSources() {\n return _.filter(this.datasourceSrv.getMetricSources(), datasource => {\n return datasource.meta.id === ZABBIX_DS_ID && datasource.value;\n });\n }\n\n onInitEditMode() {\n this.addEditorTab('Triggers', triggerPanelTriggersTab, 1);\n this.addEditorTab('Options', triggerPanelOptionsTab, 2);\n }\n\n setTimeQueryStart() {\n this.timing.queryStart = new Date().getTime();\n }\n\n setTimeQueryEnd() {\n this.timing.queryEnd = new Date().getTime();\n }\n\n onRefresh() {\n // ignore fetching data if another panel is in fullscreen\n if (this.otherPanelInFullscreenMode()) { return; }\n\n // clear loading/error state\n delete this.error;\n this.loading = true;\n this.setTimeQueryStart();\n this.pageIndex = 0;\n\n return this.getTriggers()\n .then(zabbixTriggers => {\n // Notify panel that request is finished\n this.loading = false;\n this.setTimeQueryEnd();\n\n this.render(zabbixTriggers);\n })\n .catch(err => {\n // if cancelled keep loading set to true\n if (err.cancelled) {\n console.log('Panel request cancelled', err);\n return;\n }\n\n this.loading = false;\n this.error = err.message || \"Request Error\";\n\n if (err.data) {\n if (err.data.message) {\n this.error = err.data.message;\n }\n if (err.data.error) {\n this.error = err.data.error;\n }\n }\n\n this.events.emit('data-error', err);\n console.log('Panel data error:', err);\n });\n }\n\n render(zabbixTriggers) {\n let triggers = _.cloneDeep(zabbixTriggers || this.triggerListUnfiltered);\n this.triggerListUnfiltered = _.cloneDeep(triggers);\n\n triggers = _.map(triggers, this.formatTrigger.bind(this));\n triggers = this.filterTriggersPost(triggers);\n triggers = this.sortTriggers(triggers);\n\n // Limit triggers number\n triggers = triggers.slice(0, this.panel.limit || PANEL_DEFAULTS.limit);\n\n this.triggerList = triggers;\n this.getCurrentTriggersPage();\n\n this.$timeout(() => {\n super.render(this.triggerList);\n });\n }\n\n getTriggers() {\n let promises = _.map(this.panel.datasources, (ds) => {\n return this.datasourceSrv.get(ds)\n .then(datasource => {\n var zabbix = datasource.zabbix;\n var showEvents = this.panel.showEvents.value;\n var triggerFilter = this.panel.targets[ds];\n\n // Replace template variables\n var groupFilter = datasource.replaceTemplateVars(triggerFilter.group.filter);\n var hostFilter = datasource.replaceTemplateVars(triggerFilter.host.filter);\n var appFilter = datasource.replaceTemplateVars(triggerFilter.application.filter);\n\n let triggersOptions = {\n showTriggers: showEvents\n };\n\n return zabbix.getTriggers(groupFilter, hostFilter, appFilter, triggersOptions);\n }).then((triggers) => {\n return this.getAcknowledges(triggers, ds);\n }).then((triggers) => {\n return this.setMaintenanceStatus(triggers);\n }).then((triggers) => {\n return this.filterTriggersPre(triggers, ds);\n }).then((triggers) => {\n return this.addTriggerDataSource(triggers, ds);\n });\n });\n\n return Promise.all(promises)\n .then(results => _.flatten(results));\n }\n\n getAcknowledges(triggerList, ds) {\n // Request acknowledges for trigger\n var eventids = _.map(triggerList, trigger => {\n return trigger.lastEvent.eventid;\n });\n\n return this.datasources[ds].zabbix.getAcknowledges(eventids)\n .then(events => {\n\n // Map events to triggers\n _.each(triggerList, trigger => {\n var event = _.find(events, event => {\n return event.eventid === trigger.lastEvent.eventid;\n });\n\n if (event) {\n trigger.acknowledges = _.map(event.acknowledges, ack => {\n let timestamp = moment.unix(ack.clock);\n if (this.panel.customLastChangeFormat) {\n ack.time = timestamp.format(this.panel.lastChangeFormat);\n } else {\n ack.time = timestamp.format(this.defaultTimeFormat);\n }\n ack.user = ack.alias + ' (' + ack.name + ' ' + ack.surname + ')';\n return ack;\n });\n }\n\n if (!trigger.lastEvent.eventid) {\n trigger.lastEvent = null;\n }\n });\n\n return triggerList;\n });\n }\n\n filterTriggersPre(triggerList, ds) {\n // Filter triggers by description\n var triggerFilter = this.panel.targets[ds].trigger.filter;\n triggerFilter = this.datasources[ds].replaceTemplateVars(triggerFilter);\n if (triggerFilter) {\n triggerList = filterTriggers(triggerList, triggerFilter);\n }\n\n return triggerList;\n }\n\n filterTriggersPost(triggers) {\n let triggerList = _.cloneDeep(triggers);\n\n // Filter acknowledged triggers\n if (this.panel.showTriggers === 'unacknowledged') {\n triggerList = _.filter(triggerList, trigger => {\n return !trigger.acknowledges;\n });\n } else if (this.panel.showTriggers === 'acknowledged') {\n triggerList = _.filter(triggerList, 'acknowledges');\n } else {\n triggerList = triggerList;\n }\n\n // Filter by maintenance status\n if (!this.panel.hostsInMaintenance) {\n triggerList = _.filter(triggerList, (trigger) => trigger.maintenance === false);\n }\n\n // Filter triggers by severity\n triggerList = _.filter(triggerList, trigger => {\n return this.panel.triggerSeverity[trigger.priority].show;\n });\n\n return triggerList;\n }\n\n setMaintenanceStatus(triggers) {\n _.each(triggers, (trigger) => {\n let maintenance_status = _.some(trigger.hosts, (host) => host.maintenance_status === '1');\n trigger.maintenance = maintenance_status;\n });\n return triggers;\n }\n\n addTriggerDataSource(triggers, ds) {\n _.each(triggers, (trigger) => {\n trigger.datasource = ds;\n });\n return triggers;\n }\n\n sortTriggers(triggerList) {\n if (this.panel.sortTriggersBy.value === 'priority') {\n triggerList = _.orderBy(triggerList, ['priority', 'lastchangeUnix', 'triggerid'], ['desc', 'desc', 'desc']);\n } else {\n triggerList = _.orderBy(triggerList, ['lastchangeUnix', 'priority', 'triggerid'], ['desc', 'desc', 'desc']);\n }\n return triggerList;\n }\n\n formatTrigger(zabbixTrigger) {\n let trigger = _.cloneDeep(zabbixTrigger);\n let triggerObj = trigger;\n\n // Set host that the trigger belongs\n if (trigger.hosts && trigger.hosts.length) {\n triggerObj.host = trigger.hosts[0].name;\n triggerObj.hostTechName = trigger.hosts[0].host;\n }\n\n // Set tags if present\n if (trigger.tags && trigger.tags.length === 0) {\n trigger.tags = null;\n }\n\n // Handle multi-line description\n if (trigger.comments) {\n trigger.comments = trigger.comments.replace('\\n', '
');\n }\n\n // Format last change and age\n trigger.lastchangeUnix = Number(trigger.lastchange);\n triggerObj = this.setTriggerLastChange(triggerObj);\n triggerObj = this.setTriggerSeverity(triggerObj);\n return triggerObj;\n }\n\n updateTriggerFormat(trigger) {\n trigger = this.setTriggerLastChange(trigger);\n trigger = this.setTriggerSeverity(trigger);\n return trigger;\n }\n\n setTriggerSeverity(trigger) {\n if (trigger.value === '1') {\n // Problem state\n trigger.color = this.panel.triggerSeverity[trigger.priority].color;\n } else {\n // OK state\n trigger.color = this.panel.okEventColor;\n }\n trigger.severity = this.panel.triggerSeverity[trigger.priority].severity;\n\n // Mark acknowledged triggers with different color\n if (this.panel.markAckEvents && trigger.acknowledges && trigger.acknowledges.length) {\n trigger.color = this.panel.ackEventColor;\n }\n\n return trigger;\n }\n\n setTriggerLastChange(trigger) {\n if (!trigger.lastchangeUnix) {\n trigger.lastchange = \"\";\n trigger.age = \"\";\n return trigger;\n }\n\n let timestamp = moment.unix(trigger.lastchangeUnix);\n if (this.panel.customLastChangeFormat) {\n // User defined format\n trigger.lastchange = timestamp.format(this.panel.lastChangeFormat);\n } else {\n trigger.lastchange = timestamp.format(this.defaultTimeFormat);\n }\n trigger.age = timestamp.fromNow(true);\n return trigger;\n }\n\n switchComment(trigger) {\n trigger.showComment = !trigger.showComment;\n }\n\n acknowledgeTrigger(trigger, message) {\n let eventid = trigger.lastEvent ? trigger.lastEvent.eventid : null;\n let grafana_user = this.contextSrv.user.name;\n let ack_message = grafana_user + ' (Grafana): ' + message;\n return this.datasourceSrv.get(trigger.datasource)\n .then(datasource => {\n if (eventid) {\n return datasource.zabbix.zabbixAPI.acknowledgeEvent(eventid, ack_message);\n } else {\n return Promise.reject({message: 'Trigger has no events. Nothing to acknowledge.'});\n }\n })\n .then(this.onRefresh.bind(this))\n .catch((err) => {\n this.error = err.message || \"Acknowledge Error\";\n this.events.emit('data-error', err);\n console.log('Panel data error:', err);\n });\n }\n\n getCurrentTriggersPage() {\n let pageSize = this.panel.pageSize || PANEL_DEFAULTS.pageSize;\n let startPos = this.pageIndex * pageSize;\n let endPos = Math.min(startPos + pageSize, this.triggerList.length);\n this.currentTriggersPage = this.triggerList.slice(startPos, endPos);\n return this.currentTriggersPage;\n }\n\n formatHostName(trigger) {\n if (this.panel.hostField && this.panel.hostTechNameField) {\n return `${trigger.host} (${trigger.hostTechName})`;\n } else if (this.panel.hostField || this.panel.hostTechNameField) {\n return trigger.host || trigger.hostTechName;\n } else {\n return \"\";\n }\n }\n\n getAlertIconClass(trigger) {\n const triggerValue = Number(trigger.value);\n let iconClass = '';\n if (triggerValue || trigger.color) {\n if (trigger.priority >= 3) {\n iconClass = 'icon-gf-critical';\n } else {\n iconClass = 'icon-gf-warning';\n }\n } else {\n iconClass = 'icon-gf-online';\n }\n\n if (this.panel.highlightNewEvents && this.isNewTrigger(trigger)) {\n iconClass += ' zabbix-trigger--blinked';\n }\n return iconClass;\n }\n\n getAlertStateClass(trigger) {\n let statusClass = '';\n\n if (trigger.value === '1') {\n statusClass = 'alert-state-critical';\n } else {\n statusClass = 'alert-state-ok';\n }\n\n if (this.panel.highlightNewEvents && this.isNewTrigger(trigger)) {\n statusClass += ' zabbix-trigger--blinked';\n }\n\n return statusClass;\n }\n\n isNewTrigger(trigger) {\n try {\n const highlightIntervalMs = utils.parseInterval(this.panel.highlightNewerThan || PANEL_DEFAULTS.highlightNewerThan);\n const durationSec = (Date.now() - trigger.lastchangeUnix * 1000);\n return durationSec < highlightIntervalMs;\n } catch (e) {\n return false;\n }\n }\n\n link(scope, elem, attrs, ctrl) {\n let panel = ctrl.panel;\n let pageCount = 0;\n let triggerList = ctrl.triggerList;\n\n scope.$watchGroup(['ctrl.currentTriggersPage', 'ctrl.triggerList'], renderPanel);\n elem.on('click', '.triggers-panel-page-link', switchPage);\n ctrl.events.on('render', (renderData) => {\n triggerList = renderData || triggerList;\n renderPanel();\n });\n\n function getContentHeight() {\n let panelHeight = ctrl.height;\n if (pageCount > 1) {\n panelHeight -= 36;\n }\n return panelHeight + 'px';\n }\n\n function switchPage(e) {\n let el = $(e.currentTarget);\n ctrl.pageIndex = (parseInt(el.text(), 10)-1);\n\n let pageSize = panel.pageSize || 10;\n let startPos = ctrl.pageIndex * pageSize;\n let endPos = Math.min(startPos + pageSize, triggerList.length);\n ctrl.currentTriggersPage = triggerList.slice(startPos, endPos);\n\n scope.$apply(() => {\n renderPanel();\n });\n }\n\n function appendPaginationControls(footerElem) {\n footerElem.empty();\n\n let pageSize = panel.pageSize || 5;\n pageCount = Math.ceil(triggerList.length / pageSize);\n if (pageCount === 1) {\n return;\n }\n\n let startPage = Math.max(ctrl.pageIndex - 3, 0);\n let endPage = Math.min(pageCount, startPage + 9);\n\n let paginationList = $('');\n\n for (let i = startPage; i < endPage; i++) {\n let activeClass = i === ctrl.pageIndex ? 'active' : '';\n let pageLinkElem = $('' + (i+1) + '');\n paginationList.append(pageLinkElem);\n }\n\n footerElem.append(paginationList);\n }\n\n function setFontSize() {\n const fontSize = parseInt(panel.fontSize.slice(0, panel.fontSize.length - 1));\n let triggerCardElem = elem.find('.card-item-wrapper');\n if (fontSize && fontSize !== 100) {\n triggerCardElem.find('.alert-list-icon').css({'font-size': fontSize + '%'});\n triggerCardElem.find('.alert-list-title').css({'font-size': fontSize + '%'});\n triggerCardElem.find('.alert-list-text').css({'font-size': fontSize * 0.8 + '%'});\n triggerCardElem.find('.zbx-tag').css({'font-size': fontSize * 0.6 + '%'});\n triggerCardElem.find('.zbx-tag').css({'line-height': fontSize / 100 * 16 + 'px'});\n } else {\n // remove css\n triggerCardElem.find('.alert-list-icon').css({'font-size': ''});\n triggerCardElem.find('.alert-list-title').css({'font-size': ''});\n triggerCardElem.find('.alert-list-text').css({'font-size': ''});\n triggerCardElem.find('.zbx-tag').css({'font-size': ''});\n triggerCardElem.find('.zbx-tag').css({'line-height': ''});\n }\n }\n\n function renderPanel() {\n let rootElem = elem.find('.triggers-panel-scroll');\n let footerElem = elem.find('.triggers-panel-footer');\n appendPaginationControls(footerElem);\n rootElem.css({'max-height': getContentHeight()});\n rootElem.css({'height': getContentHeight()});\n setFontSize();\n ctrl.renderingCompleted();\n }\n\n let unbindDestroy = scope.$on('$destroy', function() {\n elem.off('click', '.triggers-panel-page-link');\n unbindDestroy();\n });\n }\n}\n\nTriggerPanelCtrl.templateUrl = 'public/plugins/alexanderzobnin-zabbix-app/panel-triggers/partials/module.html';\n\nfunction filterTriggers(triggers, triggerFilter) {\n if (utils.isRegex(triggerFilter)) {\n return _.filter(triggers, function(trigger) {\n return utils.buildRegex(triggerFilter).test(trigger.description);\n });\n } else {\n return _.filter(triggers, function(trigger) {\n return trigger.description === triggerFilter;\n });\n }\n}\n"]}
\ No newline at end of file
diff --git a/src/datasource-zabbix/zabbixAPI.service.js b/src/datasource-zabbix/zabbixAPI.service.js
index 1ac41f9bc..43e4fea72 100644
--- a/src/datasource-zabbix/zabbixAPI.service.js
+++ b/src/datasource-zabbix/zabbixAPI.service.js
@@ -361,7 +361,8 @@ function ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {
selectGroups: ['name'],
selectHosts: ['name', 'host', 'maintenance_status'],
selectItems: ['name', 'key_', 'lastvalue'],
- selectLastEvent: 'extend'
+ selectLastEvent: 'extend',
+ selectTags: 'extend'
};
if (showTriggers) {
diff --git a/src/panel-triggers/partials/module.html b/src/panel-triggers/partials/module.html
index e46a4c14d..6ec3ad344 100644
--- a/src/panel-triggers/partials/module.html
+++ b/src/panel-triggers/partials/module.html
@@ -16,6 +16,12 @@
{{ ctrl.formatHostName(trigger) }}
+
+
+
+ {{tag.tag}}: {{tag.value}}
+
+
diff --git a/src/panel-triggers/partials/options_tab.html b/src/panel-triggers/partials/options_tab.html
index 27224ec1b..08d85463d 100644
--- a/src/panel-triggers/partials/options_tab.html
+++ b/src/panel-triggers/partials/options_tab.html
@@ -13,6 +13,12 @@
Show fields
checked="ctrl.panel.hostTechNameField"
on-change="ctrl.render()">
+
+
{
},
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: false,
severityField: false,
descriptionField: true,
@@ -86,6 +87,7 @@ describe('Triggers Panel schema migration', () => {
},
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: true,
severityField: true,
descriptionField: true,
diff --git a/src/panel-triggers/triggers_panel_ctrl.js b/src/panel-triggers/triggers_panel_ctrl.js
index b09d9faf5..e51b9c9c4 100644
--- a/src/panel-triggers/triggers_panel_ctrl.js
+++ b/src/panel-triggers/triggers_panel_ctrl.js
@@ -34,6 +34,7 @@ export const PANEL_DEFAULTS = {
// Fields
hostField: true,
hostTechNameField: false,
+ showTags: true,
statusField: true,
severityField: true,
descriptionField: true,
@@ -332,6 +333,11 @@ export class TriggerPanelCtrl extends PanelCtrl {
triggerObj.hostTechName = trigger.hosts[0].host;
}
+ // Set tags if present
+ if (trigger.tags && trigger.tags.length === 0) {
+ trigger.tags = null;
+ }
+
// Handle multi-line description
if (trigger.comments) {
trigger.comments = trigger.comments.replace('\n', '
');
@@ -537,11 +543,15 @@ export class TriggerPanelCtrl extends PanelCtrl {
triggerCardElem.find('.alert-list-icon').css({'font-size': fontSize + '%'});
triggerCardElem.find('.alert-list-title').css({'font-size': fontSize + '%'});
triggerCardElem.find('.alert-list-text').css({'font-size': fontSize * 0.8 + '%'});
+ triggerCardElem.find('.zbx-tag').css({'font-size': fontSize * 0.6 + '%'});
+ triggerCardElem.find('.zbx-tag').css({'line-height': fontSize / 100 * 16 + 'px'});
} else {
// remove css
triggerCardElem.find('.alert-list-icon').css({'font-size': ''});
triggerCardElem.find('.alert-list-title').css({'font-size': ''});
triggerCardElem.find('.alert-list-text').css({'font-size': ''});
+ triggerCardElem.find('.zbx-tag').css({'font-size': ''});
+ triggerCardElem.find('.zbx-tag').css({'line-height': ''});
}
}
diff --git a/src/sass/_panel-triggers.scss b/src/sass/_panel-triggers.scss
index 50d15337c..8dffbe69d 100644
--- a/src/sass/_panel-triggers.scss
+++ b/src/sass/_panel-triggers.scss
@@ -15,6 +15,16 @@
color: $gray-3;
}
+ .zbx-trigger-tags {
+ margin-left: 0.6rem;
+
+ .zbx-tag {
+ color: $zbx-tag-color;
+ // opacity: 0.9;
+ padding: 0px 6px;
+ }
+ }
+
.alert-list-footer {
justify-content: flex-start;
}
diff --git a/src/sass/_variables.dark.scss b/src/sass/_variables.dark.scss
index 6fd203e94..95f6b5e9d 100644
--- a/src/sass/_variables.dark.scss
+++ b/src/sass/_variables.dark.scss
@@ -36,3 +36,4 @@ $text-color: $gray-4;
$tight-form-func-bg: #333;
$grafanaListAccent: lighten($dark-2, 2%);
+$zbx-tag-color: $gray-5;
diff --git a/src/sass/_variables.light.scss b/src/sass/_variables.light.scss
index 4f96466e5..5652967c5 100644
--- a/src/sass/_variables.light.scss
+++ b/src/sass/_variables.light.scss
@@ -34,3 +34,5 @@ $body-color: $gray-1;
$text-color: $gray-1;
$tight-form-func-bg: $gray-5;
$grafanaListAccent: $gray-5;
+
+$zbx-tag-color: $gray-6;