build dist
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
System.register(['lodash'], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var _, _createClass, NOT_IMPLEMENTED, DBConnector;
|
||||
var _, _createClass, DBConnector, ZabbixNotImplemented;
|
||||
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
@@ -34,8 +34,6 @@ System.register(['lodash'], function (_export, _context) {
|
||||
};
|
||||
}();
|
||||
|
||||
NOT_IMPLEMENTED = 'Method should be implemented in subclass of DBConnector';
|
||||
|
||||
DBConnector = function () {
|
||||
function DBConnector(options, backendSrv, datasourceSrv) {
|
||||
_classCallCheck(this, DBConnector);
|
||||
@@ -44,7 +42,8 @@ System.register(['lodash'], function (_export, _context) {
|
||||
this.datasourceSrv = datasourceSrv;
|
||||
this.datasourceId = options.datasourceId;
|
||||
this.datasourceName = options.datasourceName;
|
||||
this.datasourceType = null;
|
||||
this.datasourceTypeId = null;
|
||||
this.datasourceTypeName = null;
|
||||
}
|
||||
|
||||
_createClass(DBConnector, [{
|
||||
@@ -55,7 +54,9 @@ System.register(['lodash'], function (_export, _context) {
|
||||
var ds = _.find(this.datasourceSrv.getAll(), { 'id': this.datasourceId });
|
||||
if (ds) {
|
||||
return this.datasourceSrv.loadDatasource(ds.name).then(function (ds) {
|
||||
_this.datasourceType = ds.meta.id;
|
||||
_this.datasourceName = ds.name;
|
||||
_this.datasourceTypeId = ds.meta.id;
|
||||
_this.datasourceTypeName = ds.meta.name;
|
||||
return ds;
|
||||
});
|
||||
} else {
|
||||
@@ -65,17 +66,17 @@ System.register(['lodash'], function (_export, _context) {
|
||||
}, {
|
||||
key: 'testDataSource',
|
||||
value: function testDataSource() {
|
||||
throw NOT_IMPLEMENTED;
|
||||
throw new ZabbixNotImplemented('testDataSource()');
|
||||
}
|
||||
}, {
|
||||
key: 'getHistory',
|
||||
value: function getHistory() {
|
||||
throw NOT_IMPLEMENTED;
|
||||
throw new ZabbixNotImplemented('getHistory()');
|
||||
}
|
||||
}, {
|
||||
key: 'getTrends',
|
||||
value: function getTrends() {
|
||||
throw NOT_IMPLEMENTED;
|
||||
throw new ZabbixNotImplemented('getTrends()');
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -83,6 +84,27 @@ System.register(['lodash'], function (_export, _context) {
|
||||
}();
|
||||
|
||||
_export('default', DBConnector);
|
||||
|
||||
_export('ZabbixNotImplemented', ZabbixNotImplemented = function () {
|
||||
function ZabbixNotImplemented(methodName) {
|
||||
_classCallCheck(this, ZabbixNotImplemented);
|
||||
|
||||
this.code = null;
|
||||
this.name = 'ZabbixNotImplemented';
|
||||
this.message = 'Zabbix DB Connector Error: method ' + (methodName || '') + ' should be implemented in subclass of DBConnector';
|
||||
}
|
||||
|
||||
_createClass(ZabbixNotImplemented, [{
|
||||
key: 'toString',
|
||||
value: function toString() {
|
||||
return this.message;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ZabbixNotImplemented;
|
||||
}());
|
||||
|
||||
_export('ZabbixNotImplemented', ZabbixNotImplemented);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/datasource-zabbix/zabbix/connectors/dbConnector.js"],"names":["_","NOT_IMPLEMENTED","DBConnector","options","backendSrv","datasourceSrv","datasourceId","datasourceName","datasourceType","ds","find","getAll","loadDatasource","name","then","meta","id","Promise","reject"],"mappings":";;;;;;;;;;;;;;;AAAOA,O;;;;;;;;;;;;;;;;;;;;;AAEDC,qB,GAAkB,yD;;AAEHC,iB;AACnB,6BAAYC,OAAZ,EAAqBC,UAArB,EAAiCC,aAAjC,EAAgD;AAAA;;AAC9C,eAAKD,UAAL,GAAkBA,UAAlB;AACA,eAAKC,aAAL,GAAqBA,aAArB;AACA,eAAKC,YAAL,GAAoBH,QAAQG,YAA5B;AACA,eAAKC,cAAL,GAAsBJ,QAAQI,cAA9B;AACA,eAAKC,cAAL,GAAsB,IAAtB;AACD;;;;6CAEkB;AAAA;;AACjB,gBAAIC,KAAKT,EAAEU,IAAF,CAAO,KAAKL,aAAL,CAAmBM,MAAnB,EAAP,EAAoC,EAAC,MAAM,KAAKL,YAAZ,EAApC,CAAT;AACA,gBAAIG,EAAJ,EAAQ;AACN,qBAAO,KAAKJ,aAAL,CAAmBO,cAAnB,CAAkCH,GAAGI,IAArC,EACNC,IADM,CACD,cAAM;AACV,sBAAKN,cAAL,GAAsBC,GAAGM,IAAH,CAAQC,EAA9B;AACA,uBAAOP,EAAP;AACD,eAJM,CAAP;AAKD,aAND,MAMO;AACL,qBAAOQ,QAAQC,MAAR,8BAA0C,KAAKZ,YAA/C,gBAAP;AACD;AACF;;;2CAEgB;AACf,kBAAML,eAAN;AACD;;;uCAEY;AACX,kBAAMA,eAAN;AACD;;;sCAEW;AACV,kBAAMA,eAAN;AACD;;;;;;yBAhCkBC,W","file":"dbConnector.js","sourcesContent":["import _ from 'lodash';\n\nconst NOT_IMPLEMENTED = 'Method should be implemented in subclass of DBConnector';\n\nexport default class DBConnector {\n constructor(options, backendSrv, datasourceSrv) {\n this.backendSrv = backendSrv;\n this.datasourceSrv = datasourceSrv;\n this.datasourceId = options.datasourceId;\n this.datasourceName = options.datasourceName;\n this.datasourceType = null;\n }\n\n loadDBDataSource() {\n let ds = _.find(this.datasourceSrv.getAll(), {'id': this.datasourceId});\n if (ds) {\n return this.datasourceSrv.loadDatasource(ds.name)\n .then(ds => {\n this.datasourceType = ds.meta.id;\n return ds;\n });\n } else {\n return Promise.reject(`SQL Data Source with ID ${this.datasourceId} not found`);\n }\n }\n\n testDataSource() {\n throw NOT_IMPLEMENTED;\n }\n\n getHistory() {\n throw NOT_IMPLEMENTED;\n }\n\n getTrends() {\n throw NOT_IMPLEMENTED;\n }\n}\n"]}
|
||||
{"version":3,"sources":["../../../../src/datasource-zabbix/zabbix/connectors/dbConnector.js"],"names":["_","DBConnector","options","backendSrv","datasourceSrv","datasourceId","datasourceName","datasourceTypeId","datasourceTypeName","ds","find","getAll","loadDatasource","name","then","meta","id","Promise","reject","ZabbixNotImplemented","methodName","code","message"],"mappings":";;;;;;;;;;;;;;;AAAOA,O;;;;;;;;;;;;;;;;;;;;;AAMcC,iB;AACnB,6BAAYC,OAAZ,EAAqBC,UAArB,EAAiCC,aAAjC,EAAgD;AAAA;;AAC9C,eAAKD,UAAL,GAAkBA,UAAlB;AACA,eAAKC,aAAL,GAAqBA,aAArB;AACA,eAAKC,YAAL,GAAoBH,QAAQG,YAA5B;AACA,eAAKC,cAAL,GAAsBJ,QAAQI,cAA9B;AACA,eAAKC,gBAAL,GAAwB,IAAxB;AACA,eAAKC,kBAAL,GAA0B,IAA1B;AACD;;;;6CAEkB;AAAA;;AACjB,gBAAIC,KAAKT,EAAEU,IAAF,CAAO,KAAKN,aAAL,CAAmBO,MAAnB,EAAP,EAAoC,EAAC,MAAM,KAAKN,YAAZ,EAApC,CAAT;AACA,gBAAII,EAAJ,EAAQ;AACN,qBAAO,KAAKL,aAAL,CAAmBQ,cAAnB,CAAkCH,GAAGI,IAArC,EACNC,IADM,CACD,cAAM;AACV,sBAAKR,cAAL,GAAsBG,GAAGI,IAAzB;AACA,sBAAKN,gBAAL,GAAwBE,GAAGM,IAAH,CAAQC,EAAhC;AACA,sBAAKR,kBAAL,GAA0BC,GAAGM,IAAH,CAAQF,IAAlC;AACA,uBAAOJ,EAAP;AACD,eANM,CAAP;AAOD,aARD,MAQO;AACL,qBAAOQ,QAAQC,MAAR,8BAA0C,KAAKb,YAA/C,gBAAP;AACD;AACF;;;2CAKgB;AACf,kBAAM,IAAIc,oBAAJ,CAAyB,kBAAzB,CAAN;AACD;;;uCAKY;AACX,kBAAM,IAAIA,oBAAJ,CAAyB,cAAzB,CAAN;AACD;;;sCAKW;AACV,kBAAM,IAAIA,oBAAJ,CAAyB,aAAzB,CAAN;AACD;;;;;;yBA5CkBlB,W;;sCAgDRkB,oB;AACX,sCAAYC,UAAZ,EAAwB;AAAA;;AACtB,eAAKC,IAAL,GAAY,IAAZ;AACA,eAAKR,IAAL,GAAY,sBAAZ;AACA,eAAKS,OAAL,2CAAoDF,cAAc,EAAlE;AACD;;;;qCAEU;AACT,mBAAO,KAAKE,OAAZ;AACD","file":"dbConnector.js","sourcesContent":["import _ from 'lodash';\n\n/**\n * Base class for external history database connectors. Subclasses should implement `getHistory()`, `getTrends()` and\n * `testDataSource()` methods, which describe how to fetch data from source other than Zabbix API.\n */\nexport default class DBConnector {\n constructor(options, backendSrv, datasourceSrv) {\n this.backendSrv = backendSrv;\n this.datasourceSrv = datasourceSrv;\n this.datasourceId = options.datasourceId;\n this.datasourceName = options.datasourceName;\n this.datasourceTypeId = null;\n this.datasourceTypeName = null;\n }\n\n loadDBDataSource() {\n let ds = _.find(this.datasourceSrv.getAll(), {'id': this.datasourceId});\n if (ds) {\n return this.datasourceSrv.loadDatasource(ds.name)\n .then(ds => {\n this.datasourceName = ds.name;\n this.datasourceTypeId = ds.meta.id;\n this.datasourceTypeName = ds.meta.name;\n return ds;\n });\n } else {\n return Promise.reject(`SQL Data Source with ID ${this.datasourceId} not found`);\n }\n }\n\n /**\n * Send test request to datasource in order to ensure it's working.\n */\n testDataSource() {\n throw new ZabbixNotImplemented('testDataSource()');\n }\n\n /**\n * Get history data from external sources.\n */\n getHistory() {\n throw new ZabbixNotImplemented('getHistory()');\n }\n\n /**\n * Get trends data from external sources.\n */\n getTrends() {\n throw new ZabbixNotImplemented('getTrends()');\n }\n}\n\n// Define Zabbix DB Connector exception type for non-implemented methods\nexport class ZabbixNotImplemented {\n constructor(methodName) {\n this.code = null;\n this.name = 'ZabbixNotImplemented';\n this.message = `Zabbix DB Connector Error: method ${methodName || ''} should be implemented in subclass of DBConnector`;\n }\n\n toString() {\n return this.message;\n }\n}\n"]}
|
||||
@@ -167,7 +167,7 @@ System.register(['lodash', './mysql', './postgres', '../dbConnector'], function
|
||||
_createClass(SQLConnector, [{
|
||||
key: 'loadSQLDialect',
|
||||
value: function loadSQLDialect() {
|
||||
if (this.datasourceType === supportedDatabases.postgres) {
|
||||
if (this.datasourceTypeId === supportedDatabases.postgres) {
|
||||
this.sqlDialect = postgres;
|
||||
} else {
|
||||
this.sqlDialect = mysql;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user