Skip to content

Commit bf09c36

Browse files
committed
Fix enabled option on datasources being ignored
1 parent bd52749 commit bf09c36

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/core/lib/datasources/Datasource.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Datasource extends EventEmitter {
2222
this.title = options.title;
2323
this.id = options.id;
2424
this.hide = options.hide;
25+
this.enabled = options.enabled !== false;
26+
if (this.enabled === false)
27+
this.hide = true;
2528
this.description = options.description;
2629
this.path = this._datasourcePath;
2730
this.url = urlData.baseURLRoot + this._datasourcePath + '#dataset';
@@ -61,6 +64,11 @@ class Datasource extends EventEmitter {
6164

6265
// Initialize the datasource asynchronously
6366
initialize() {
67+
if (!this.enabled) {
68+
this.initialized = true;
69+
return this.emit('initialized');
70+
}
71+
6472
try {
6573
this._initialize()
6674
.then(() => {

0 commit comments

Comments
 (0)