Skip to content

Commit f505745

Browse files
committed
Fix default datasource not being set if not listed first
1 parent 7c0a848 commit f505745

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Diff for: src/ldf-client-ui.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ require('yasgui-yasqe/dist/yasqe.css'); // Make webpack import the css as well
145145
// Update YASQE editor if applicable
146146
if ($query.yasqe && $query.yasqe.getValue() !== options.query)
147147
$query.yasqe.setValue(options.query);
148+
149+
// Load the transient datasources for the current query
150+
self._setSelectedDataSourcesForQuery();
148151
};
149152

150153
// Prettify SPARQL editors with YASQE
@@ -364,11 +367,7 @@ require('yasgui-yasqe/dist/yasqe.css'); // Make webpack import the css as well
364367
// Set the list of all possible queries
365368
case 'queries':
366369
// Load the transient datasources for the current query
367-
var queryId = this._getSelectedQueryId();
368-
if (queryId >= 0) {
369-
var newDatasources = this._getHashedQueryDatasources(this._getSelectedQueryId());
370-
self._setOption('selectedDatasources', newDatasources);
371-
}
370+
this._setSelectedDataSourcesForQuery();
372371

373372
// Set the queries applicable to the set datasources
374373
value.forEach(function (query) {
@@ -455,6 +454,15 @@ require('yasgui-yasqe/dist/yasqe.css'); // Make webpack import the css as well
455454
return persistedDatasources;
456455
},
457456

457+
// Set the default datasources based on the currently selected query
458+
_setSelectedDataSourcesForQuery: function () {
459+
var queryId = this._getSelectedQueryId();
460+
if (queryId >= 0) {
461+
var newDatasources = this._getHashedQueryDatasources(this._getSelectedQueryId());
462+
this._setOption('selectedDatasources', newDatasources);
463+
}
464+
},
465+
458466
// Get the query id of the given query
459467
_getSelectedQueryId: function () {
460468
var queryId = -1;

0 commit comments

Comments
 (0)