use direct db connection datasource name for provisioning, #614

This commit is contained in:
Alexander Zobnin
2018-08-28 22:34:41 +03:00
parent 2e84893279
commit 8096c0a65e
12 changed files with 158 additions and 21 deletions

View File

@@ -51,16 +51,21 @@ System.register(['lodash'], function (_export, _context) {
value: function loadDBDataSource() {
var _this = this;
var ds = _.find(this.datasourceSrv.getAll(), { 'id': this.datasourceId });
if (ds) {
return this.datasourceSrv.loadDatasource(ds.name).then(function (ds) {
_this.datasourceName = ds.name;
if (!this.datasourceName && this.datasourceId !== undefined) {
var ds = _.find(this.datasourceSrv.getAll(), { 'id': this.datasourceId });
if (!ds) {
return Promise.reject('SQL Data Source with ID ' + this.datasourceId + ' not found');
}
this.datasourceName = ds.name;
}
if (this.datasourceName) {
return this.datasourceSrv.loadDatasource(this.datasourceName).then(function (ds) {
_this.datasourceTypeId = ds.meta.id;
_this.datasourceTypeName = ds.meta.name;
return ds;
});
} else {
return Promise.reject('SQL Data Source with ID ' + this.datasourceId + ' not found');
return Promise.reject('SQL Data Source name should be specified');
}
}
}, {