Refactor: removed trick with self and this.
This commit is contained in:
@@ -257,10 +257,9 @@ export class ZabbixAPIDatasource {
|
|||||||
* @return {object} Connection status and Zabbix API version
|
* @return {object} Connection status and Zabbix API version
|
||||||
*/
|
*/
|
||||||
testDatasource() {
|
testDatasource() {
|
||||||
var self = this;
|
|
||||||
return this.zabbixAPI.getVersion()
|
return this.zabbixAPI.getVersion()
|
||||||
.then(version => {
|
.then(version => {
|
||||||
return self.zabbixAPI.login()
|
return this.zabbixAPI.login()
|
||||||
.then(auth => {
|
.then(auth => {
|
||||||
if (auth) {
|
if (auth) {
|
||||||
return {
|
return {
|
||||||
@@ -361,11 +360,10 @@ export class ZabbixAPIDatasource {
|
|||||||
.buildTriggerQuery(this.replaceTemplateVars(annotation.group, {}),
|
.buildTriggerQuery(this.replaceTemplateVars(annotation.group, {}),
|
||||||
this.replaceTemplateVars(annotation.host, {}),
|
this.replaceTemplateVars(annotation.host, {}),
|
||||||
this.replaceTemplateVars(annotation.application, {}));
|
this.replaceTemplateVars(annotation.application, {}));
|
||||||
var self = this;
|
|
||||||
return buildQuery.then(query => {
|
return buildQuery.then(query => {
|
||||||
return self.zabbixAPI
|
return this.zabbixAPI
|
||||||
.getTriggers(query.groupids, query.hostids, query.applicationids,
|
.getTriggers(query.groupids, query.hostids, query.applicationids, showTriggers)
|
||||||
showTriggers)
|
|
||||||
.then(triggers => {
|
.then(triggers => {
|
||||||
|
|
||||||
// Filter triggers by description
|
// Filter triggers by description
|
||||||
@@ -385,7 +383,7 @@ export class ZabbixAPIDatasource {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var objectids = _.map(triggers, 'triggerid');
|
var objectids = _.map(triggers, 'triggerid');
|
||||||
return self.zabbixAPI
|
return this.zabbixAPI
|
||||||
.getEvents(objectids, timeFrom, timeTo, showOkEvents)
|
.getEvents(objectids, timeFrom, timeTo, showOkEvents)
|
||||||
.then(events => {
|
.then(events => {
|
||||||
var indexedTriggers = _.keyBy(triggers, 'triggerid');
|
var indexedTriggers = _.keyBy(triggers, 'triggerid');
|
||||||
|
|||||||
Reference in New Issue
Block a user