From 4acd0660614c5424ca946942415b8a66c7b3c198 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 5 Jan 2024 11:49:12 +0530 Subject: [PATCH] ui: prevent scheduling readyforshutdown job when api inaccessible 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 85ca9f2c8c1d..6dd5c530fa5b 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'