mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
fix(ui): namespace cache refresh on reload EE-5155 (#8644)
This commit is contained in:
parent
44582732bb
commit
6ee5cc6a56
9 changed files with 28 additions and 15 deletions
|
@ -189,7 +189,7 @@ class KubernetesApplicationsController {
|
|||
};
|
||||
|
||||
this.state.namespaces = await this.KubernetesNamespaceService.get();
|
||||
this.state.namespaces = this.state.namespaces.filter((n) => n.Status !== 'Terminating');
|
||||
this.state.namespaces = this.state.namespaces.filter((n) => n.Status === 'Active');
|
||||
this.state.namespaces = _.sortBy(this.state.namespaces, 'Name');
|
||||
this.state.namespace = this.state.namespaces.length ? (this.state.namespaces.find((n) => n.Name === 'default') ? 'default' : this.state.namespaces[0].Name) : '';
|
||||
|
||||
|
|
|
@ -1208,7 +1208,10 @@ class KubernetesCreateApplicationController {
|
|||
]);
|
||||
this.nodesLimits = nodesLimits;
|
||||
|
||||
const nonSystemNamespaces = _.filter(resourcePools, (resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name));
|
||||
const nonSystemNamespaces = _.filter(
|
||||
resourcePools,
|
||||
(resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name) && resourcePool.Namespace.Status === 'Active'
|
||||
);
|
||||
|
||||
this.allNamespaces = resourcePools.map(({ Namespace }) => Namespace.Name);
|
||||
this.resourcePools = _.sortBy(nonSystemNamespaces, ({ Namespace }) => (Namespace.Name === 'default' ? 0 : 1));
|
||||
|
|
|
@ -196,7 +196,10 @@ class KubernetesCreateConfigurationController {
|
|||
|
||||
try {
|
||||
const resourcePools = await this.KubernetesResourcePoolService.get();
|
||||
this.resourcePools = _.filter(resourcePools, (resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name));
|
||||
this.resourcePools = _.filter(
|
||||
resourcePools,
|
||||
(resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name) && resourcePool.Namespace.Status === 'Active'
|
||||
);
|
||||
|
||||
this.formValues.ResourcePool = this.resourcePools[0];
|
||||
await this.getConfigurations();
|
||||
|
|
|
@ -165,7 +165,10 @@ class KubernetesConfigureController {
|
|||
const allResourcePools = await this.KubernetesResourcePoolService.get();
|
||||
const resourcePools = _.filter(
|
||||
allResourcePools,
|
||||
(resourcePool) => !KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name) && !KubernetesNamespaceHelper.isDefaultNamespace(resourcePool.Namespace.Name)
|
||||
(resourcePool) =>
|
||||
!KubernetesNamespaceHelper.isSystemNamespace(resourcePool.Namespace.Name) &&
|
||||
!KubernetesNamespaceHelper.isDefaultNamespace(resourcePool.Namespace.Name) &&
|
||||
resourcePool.Namespace.Status === 'Active'
|
||||
);
|
||||
|
||||
ingressesToDel.forEach((ingress) => {
|
||||
|
|
|
@ -284,7 +284,8 @@ class KubernetesDeployController {
|
|||
async getNamespacesAsync() {
|
||||
try {
|
||||
const pools = await this.KubernetesResourcePoolService.get();
|
||||
const namespaces = _.map(pools, 'Namespace').sort((a, b) => {
|
||||
let namespaces = pools.filter((pool) => pool.Namespace.Status === 'Active');
|
||||
namespaces = _.map(namespaces, 'Namespace').sort((a, b) => {
|
||||
if (a.Name === 'default') {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -50,11 +50,11 @@ class KubernetesResourcePoolsController {
|
|||
} finally {
|
||||
--actionCount;
|
||||
if (actionCount === 0) {
|
||||
await this.KubernetesNamespaceService.refreshCacheAsync();
|
||||
this.$state.reload(this.$state.current);
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.KubernetesNamespaceService.refreshCacheAsync();
|
||||
}
|
||||
|
||||
removeAction(selectedItems) {
|
||||
|
@ -77,7 +77,7 @@ class KubernetesResourcePoolsController {
|
|||
|
||||
async getResourcePoolsAsync() {
|
||||
try {
|
||||
this.resourcePools = await this.KubernetesResourcePoolService.get('', { getQuota: true });
|
||||
this.resourcePools = await this.KubernetesResourcePoolService.get('', { getQuota: true, refreshCache: true });
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retreive namespaces');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue