From 5c32a0edbaa5a6bbcb527e7a4f986bed9a48c114 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 8 Jan 2024 18:02:11 +0530 Subject: [PATCH] ui: prevent scheduling readyforshutdown job when api inaccessible (#8448) Non-admin account may not have access to the readyForShutdown API therefore UI should not schedule the job. Signed-off-by: Abhishek Kumar --- ui/src/components/page/GlobalLayout.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/components/page/GlobalLayout.vue b/ui/src/components/page/GlobalLayout.vue index 85ca9f2c8c1..6dd5c530fa5 100644 --- a/ui/src/components/page/GlobalLayout.vue +++ b/ui/src/components/page/GlobalLayout.vue @@ -199,8 +199,10 @@ export default { created () { this.menus = this.mainMenu.find((item) => item.path === '/').children this.collapsed = !this.sidebarOpened - const readyForShutdownPollingJob = setInterval(this.checkShutdown, 5000) - this.$store.commit('SET_READY_FOR_SHUTDOWN_POLLING_JOB', readyForShutdownPollingJob) + if ('readyForShutdown' in this.$store.getters.apis) { + const readyForShutdownPollingJob = setInterval(this.checkShutdown, 5000) + this.$store.commit('SET_READY_FOR_SHUTDOWN_POLLING_JOB', readyForShutdownPollingJob) + } }, mounted () { const layoutMode = this.$config.theme['@layout-mode'] || 'light'