|
|
@@ -272,10 +272,10 @@ var MetastoreViewModel = (function () {
|
|
|
|
|
|
loadedDeferred.done(function () {
|
|
|
var search = location.search;
|
|
|
+ var namespaceId;
|
|
|
+ var sourceType;
|
|
|
if (search) {
|
|
|
search = search.replace('?', '');
|
|
|
- var namespaceId;
|
|
|
- var sourceType;
|
|
|
search.split('&').forEach(function (param) {
|
|
|
if (param.indexOf('namespace=') === 0) {
|
|
|
namespaceId = param.replace('namespace=', '');
|
|
|
@@ -284,39 +284,43 @@ var MetastoreViewModel = (function () {
|
|
|
sourceType = param.replace('source=', '');
|
|
|
}
|
|
|
});
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sourceType && sourceType !== self.source().type) {
|
|
|
+ var found = self.sources().some(function (source) {
|
|
|
+ if (source.type === sourceType) {
|
|
|
+ self.source(source);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!found) {
|
|
|
+ sourceAndNamespaceDeferred.reject();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (sourceType && sourceType !== self.source().type) {
|
|
|
- var found = self.sources().some(function (source) {
|
|
|
- if (source.type === sourceType) {
|
|
|
- self.source(source);
|
|
|
+ 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) {
|
|
|
+ if (namespace.id === namespaceId) {
|
|
|
+ self.source().namespace(namespace);
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
if (!found) {
|
|
|
sourceAndNamespaceDeferred.reject();
|
|
|
return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- self.source().lastLoadNamespacesDeferred.done(function () {
|
|
|
- if (namespaceId && namespaceId !== self.source().namespace().id) {
|
|
|
- var found = self.source().namespaces().some(function (namespace) {
|
|
|
- if (namespace.id === namespaceId) {
|
|
|
- self.source().namespace(namespace);
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- if (!found) {
|
|
|
- sourceAndNamespaceDeferred.reject();
|
|
|
- return;
|
|
|
- } else {
|
|
|
- sourceAndNamespaceDeferred.resolve();
|
|
|
- }
|
|
|
} else {
|
|
|
sourceAndNamespaceDeferred.resolve();
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ sourceAndNamespaceDeferred.resolve();
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
|