diff --git a/plugins/shutdown/src/main/java/org/apache/cloudstack/api/command/ReadyForShutdownCmd.java b/plugins/shutdown/src/main/java/org/apache/cloudstack/api/command/ReadyForShutdownCmd.java index d7ab6a24ee6..1e6b3e1a2d5 100644 --- a/plugins/shutdown/src/main/java/org/apache/cloudstack/api/command/ReadyForShutdownCmd.java +++ b/plugins/shutdown/src/main/java/org/apache/cloudstack/api/command/ReadyForShutdownCmd.java @@ -30,7 +30,7 @@ import org.apache.log4j.Logger; import com.cloud.user.Account; @APICommand(name = ReadyForShutdownCmd.APINAME, - description = "Returs the status of CloudStack, whether a shutdown has been triggered and if ready to shutdown", + description = "Returns the status of CloudStack, whether a shutdown has been triggered and if ready to shutdown", since = "4.19.0", responseObject = ReadyForShutdownResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) diff --git a/ui/src/components/page/GlobalLayout.vue b/ui/src/components/page/GlobalLayout.vue index d807525068e..7a26599a2ba 100644 --- a/ui/src/components/page/GlobalLayout.vue +++ b/ui/src/components/page/GlobalLayout.vue @@ -199,7 +199,8 @@ export default { created () { this.menus = this.mainMenu.find((item) => item.path === '/').children this.collapsed = !this.sidebarOpened - setInterval(this.checkShutdown, 5000) + 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' diff --git a/ui/src/store/getters.js b/ui/src/store/getters.js index b0c4ecdfccd..67b168be8c2 100644 --- a/ui/src/store/getters.js +++ b/ui/src/store/getters.js @@ -50,7 +50,8 @@ const getters = { twoFaIssuer: state => state.user.twoFaIssuer, loginFlag: state => state.user.loginFlag, allProjects: (state) => state.app.allProjects, - customHypervisorName: state => state.user.customHypervisorName + customHypervisorName: state => state.user.customHypervisorName, + readyForShutdownPollingJob: state => state.user.readyForShutdownPollingJob } export default getters diff --git a/ui/src/store/modules/app.js b/ui/src/store/modules/app.js index b3130b68d61..cf2b34e4b8e 100644 --- a/ui/src/store/modules/app.js +++ b/ui/src/store/modules/app.js @@ -130,6 +130,9 @@ const app = { }, SET_SHUTDOWN_TRIGGERED: (state, shutdownTriggered) => { state.shutdownTriggered = shutdownTriggered + }, + SET_READY_FOR_SHUTDOWN_POLLING_JOB: (state, readyForShutdownPollingJob) => { + state.readyForShutdownPollingJob = readyForShutdownPollingJob } }, actions: { @@ -192,6 +195,9 @@ const app = { }, SetShutdownTriggered ({ commit }, bool) { commit('SET_SHUTDOWN_TRIGGERED', bool) + }, + SetReadyForShutdownPollingJob ({ commit }, job) { + commit('SET_READY_FOR_SHUTDOWN_POLLING_JOB', job) } } } diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index 6a3ba217baf..0e45ac7e676 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -65,7 +65,8 @@ const user = { twoFaEnabled: false, twoFaProvider: '', twoFaIssuer: '', - customHypervisorName: 'Custom' + customHypervisorName: 'Custom', + readyForShutdownPollingJob: '' }, mutations: { @@ -155,6 +156,9 @@ const user = { }, SET_CUSTOM_HYPERVISOR_NAME (state, name) { state.customHypervisorName = name + }, + SET_READY_FOR_SHUTDOWN_POLLING_JOB: (state, job) => { + state.readyForShutdownPollingJob = job } }, diff --git a/ui/src/views/auth/Login.vue b/ui/src/views/auth/Login.vue index 56ac141c207..cab9b887f0a 100644 --- a/ui/src/views/auth/Login.vue +++ b/ui/src/views/auth/Login.vue @@ -189,6 +189,9 @@ export default { } this.initForm() if (store.getters.logoutFlag) { + if (store.getters.readyForShutdownPollingJob !== '' || store.getters.readyForShutdownPollingJob !== undefined) { + clearInterval(store.getters.readyForShutdownPollingJob) + } sourceToken.init() this.fetchData() } else {