|
@@ -63,7 +63,7 @@ const TEMPLATE = `
|
|
|
)}</span>
|
|
)}</span>
|
|
|
<!-- /ko -->
|
|
<!-- /ko -->
|
|
|
|
|
|
|
|
- <!-- ko if: availableNamespaces().length > 0 && !hideNamespaces -->
|
|
|
|
|
|
|
+ <!-- ko if: availableNamespaces().length > 1 && !hideNamespaces && !window.getLastKnownConfig().has_computes -->
|
|
|
<!-- ko ifnot: hideLabels --><span class="editor-header-title">${I18n(
|
|
<!-- ko ifnot: hideLabels --><span class="editor-header-title">${I18n(
|
|
|
'Namespace'
|
|
'Namespace'
|
|
|
)}</span><!-- /ko -->
|
|
)}</span><!-- /ko -->
|
|
@@ -79,6 +79,9 @@ const TEMPLATE = `
|
|
|
<!-- /ko -->
|
|
<!-- /ko -->
|
|
|
|
|
|
|
|
<!-- ko if: availableDatabases().length > 0 && !hideDatabases-->
|
|
<!-- ko if: availableDatabases().length > 0 && !hideDatabases-->
|
|
|
|
|
+ <!-- ko if: window.getLastKnownConfig().has_computes && !hideLabels --><span class="editor-header-title">${I18n(
|
|
|
|
|
+ 'Active database'
|
|
|
|
|
+ )}</span><!-- /ko -->
|
|
|
<div data-bind="component: { name: 'hue-drop-down', params: { titleName: 'Database', value: database, entries: availableDatabases, foreachVisible: true, searchable: true, linkTitle: '${I18n(
|
|
<div data-bind="component: { name: 'hue-drop-down', params: { titleName: 'Database', value: database, entries: availableDatabases, foreachVisible: true, searchable: true, linkTitle: '${I18n(
|
|
|
'Active database'
|
|
'Active database'
|
|
|
)}' } }" style="display: inline-block"></div>
|
|
)}' } }" style="display: inline-block"></div>
|
|
@@ -248,13 +251,12 @@ const HueContextSelector = function (params) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
self.loadingContext = ko.pureComputed(() => {
|
|
self.loadingContext = ko.pureComputed(() => {
|
|
|
- /*return (
|
|
|
|
|
|
|
+ return (
|
|
|
self[TYPES_INDEX.cluster.loading]() ||
|
|
self[TYPES_INDEX.cluster.loading]() ||
|
|
|
self[TYPES_INDEX.namespace.loading]() ||
|
|
self[TYPES_INDEX.namespace.loading]() ||
|
|
|
self[TYPES_INDEX.compute.loading]() ||
|
|
self[TYPES_INDEX.compute.loading]() ||
|
|
|
self.loadingDatabases()
|
|
self.loadingDatabases()
|
|
|
- );*/
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ );
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -262,26 +264,31 @@ HueContextSelector.prototype.setMatchingNamespace = function (compute) {
|
|
|
const self = this;
|
|
const self = this;
|
|
|
if (self[TYPES_INDEX.namespace.name]) {
|
|
if (self[TYPES_INDEX.namespace.name]) {
|
|
|
// Select the first corresponding namespace when a compute is selected (unless selected)
|
|
// Select the first corresponding namespace when a compute is selected (unless selected)
|
|
|
- self[TYPES_INDEX.namespace.lastPromise].done(() => {
|
|
|
|
|
- if (
|
|
|
|
|
- !self[TYPES_INDEX.namespace.name]() ||
|
|
|
|
|
- self[TYPES_INDEX.namespace.name]().id !== compute.namespace
|
|
|
|
|
- ) {
|
|
|
|
|
- const found = self[TYPES_INDEX.namespace.available]().some(namespace => {
|
|
|
|
|
- if (compute.namespace === namespace.id) {
|
|
|
|
|
- self[TYPES_INDEX.namespace.name](namespace);
|
|
|
|
|
- setInLocalStorage('contextSelector.' + TYPES_INDEX.namespace.localStorageId, namespace);
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ self[TYPES_INDEX.namespace.lastPromise].done(() => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ !self[TYPES_INDEX.namespace.name]() ||
|
|
|
|
|
+ self[TYPES_INDEX.namespace.name]().id !== compute.namespace
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const found = self[TYPES_INDEX.namespace.available]().some(namespace => {
|
|
|
|
|
+ if (compute.namespace === namespace.id) {
|
|
|
|
|
+ self[TYPES_INDEX.namespace.name](namespace);
|
|
|
|
|
+ setInLocalStorage(
|
|
|
|
|
+ 'contextSelector.' + TYPES_INDEX.namespace.localStorageId,
|
|
|
|
|
+ namespace
|
|
|
|
|
+ );
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- if (!found) {
|
|
|
|
|
- // This can happen when a compute refers to a namespace that isn't returned by the namespaces call
|
|
|
|
|
- // TODO: What should we do?
|
|
|
|
|
- self[TYPES_INDEX.namespace.name](undefined);
|
|
|
|
|
|
|
+ if (!found) {
|
|
|
|
|
+ // This can happen when a compute refers to a namespace that isn't returned by the namespaces call
|
|
|
|
|
+ // TODO: What should we do?
|
|
|
|
|
+ self[TYPES_INDEX.namespace.name](undefined);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (e) {}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -289,27 +296,28 @@ HueContextSelector.prototype.setMatchingCompute = function (namespace) {
|
|
|
const self = this;
|
|
const self = this;
|
|
|
if (self[TYPES_INDEX.compute.name]) {
|
|
if (self[TYPES_INDEX.compute.name]) {
|
|
|
// Select the first corresponding compute when a namespace is selected (unless selected)
|
|
// Select the first corresponding compute when a namespace is selected (unless selected)
|
|
|
- self[TYPES_INDEX.compute.lastPromise].done(() => {
|
|
|
|
|
- if (
|
|
|
|
|
- !self[TYPES_INDEX.compute.name]() ||
|
|
|
|
|
- (self[TYPES_INDEX.compute.name]().namespace &&
|
|
|
|
|
- self[TYPES_INDEX.compute.name]().namespace !== namespace.id)
|
|
|
|
|
- ) {
|
|
|
|
|
- const found = self[TYPES_INDEX.compute.available]().some(compute => {
|
|
|
|
|
- if (namespace.id === compute.namespace) {
|
|
|
|
|
- self[TYPES_INDEX.compute.name](compute);
|
|
|
|
|
- setInLocalStorage('contextSelector.' + TYPES_INDEX.compute.localStorageId, namespace);
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ self[TYPES_INDEX.compute.lastPromise].done(() => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ !self[TYPES_INDEX.compute.name]() ||
|
|
|
|
|
+ (self[TYPES_INDEX.compute.name]().namespace &&
|
|
|
|
|
+ self[TYPES_INDEX.compute.name]().namespace !== namespace.id)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const found = self[TYPES_INDEX.compute.available]().some(compute => {
|
|
|
|
|
+ if (namespace.id === compute.namespace) {
|
|
|
|
|
+ self[TYPES_INDEX.compute.name](compute);
|
|
|
|
|
+ setInLocalStorage('contextSelector.' + TYPES_INDEX.compute.localStorageId, namespace);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!found) {
|
|
|
|
|
+ // This can happen when a namespace refers to a compute that isn't returned by the computes call
|
|
|
|
|
+ // TODO: What should we do?
|
|
|
|
|
+ self[TYPES_INDEX.compute.name](undefined);
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- if (!found) {
|
|
|
|
|
- // This can happen when a namespace refers to a compute that isn't returned by the computes call
|
|
|
|
|
- // TODO: What should we do?
|
|
|
|
|
- self[TYPES_INDEX.compute.name](undefined);
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (e) {}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|