From 04c1c7d8fb23c2641a8ca114088066c6c37d88a6 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Fri, 24 Nov 2023 11:27:52 +1300 Subject: [PATCH] fix(cache): cache fixes [EE-6293] (#10681) * fix(cache): default cache to on for new users [EE-6293] * clear cache to transition terminating namespace * add rq requests back to the namespace view --------- Co-authored-by: testa113 --- api/http/handler/users/user_create.go | 1 + .../views/resource-pools/resourcePoolsController.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/http/handler/users/user_create.go b/api/http/handler/users/user_create.go index d932b8c43..8e6112442 100644 --- a/api/http/handler/users/user_create.go +++ b/api/http/handler/users/user_create.go @@ -65,6 +65,7 @@ func (handler *Handler) userCreate(w http.ResponseWriter, r *http.Request) *http user = &portainer.User{ Username: payload.Username, Role: portainer.UserRole(payload.Role), + UseCache: true, } settings, err := handler.DataStore.Settings().Settings() diff --git a/app/kubernetes/views/resource-pools/resourcePoolsController.js b/app/kubernetes/views/resource-pools/resourcePoolsController.js index 7899375fd..4b39f4077 100644 --- a/app/kubernetes/views/resource-pools/resourcePoolsController.js +++ b/app/kubernetes/views/resource-pools/resourcePoolsController.js @@ -2,6 +2,7 @@ import angular from 'angular'; import { confirm } from '@@/modals/confirm'; import { ModalType } from '@@/modals'; import { buildConfirmButton } from '@@/modals/utils'; +import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper'; class KubernetesResourcePoolsController { /* @ngInject */ @@ -75,7 +76,11 @@ class KubernetesResourcePoolsController { async getResourcePoolsAsync() { try { - this.resourcePools = await this.KubernetesResourcePoolService.get(); + this.resourcePools = await this.KubernetesResourcePoolService.get('', { getQuota: true }); + // make sure table refreshes with fresh data when namespaces are in a terminating state + if (this.resourcePools.some((namespace) => namespace.Namespace.Status === 'Terminating')) { + dispatchCacheRefreshEvent(); + } } catch (err) { this.Notifications.error('Failure', err, 'Unable to retreive namespaces'); }