[tb] Make sure the default DB is opened by default in the Table Browser
@@ -272,10 +272,10 @@ var MetastoreViewModel = (function () {
loadedDeferred.done(function () {
var search = location.search;
- if (search) {
- search = search.replace('?', '');
var namespaceId;
var sourceType;
+ if (search) {
+ search = search.replace('?', '');
search.split('&').forEach(function (param) {
if (param.indexOf('namespace=') === 0) {
namespaceId = param.replace('namespace=', '');
@@ -284,6 +284,7 @@ var MetastoreViewModel = (function () {
sourceType = param.replace('source=', '');
}
});
+ }
if (sourceType && sourceType !== self.source().type) {
var found = self.sources().some(function (source) {
@@ -298,6 +299,10 @@ var MetastoreViewModel = (function () {
}
}
+ if (!namespaceId && ApiHelper.getInstance().getFromTotalStorage('contextSelector', 'lastSelectedNamespace')) {
+ namespaceId = ApiHelper.getInstance().getFromTotalStorage('contextSelector', 'lastSelectedNamespace').id;
+ }
+
self.source().lastLoadNamespacesDeferred.done(function () {
if (namespaceId && namespaceId !== self.source().namespace().id) {
var found = self.source().namespaces().some(function (namespace) {
@@ -316,7 +321,6 @@ var MetastoreViewModel = (function () {
sourceAndNamespaceDeferred.resolve();
}
});
- }
});
