Fix the poll for the API ReadyForShutdown even after logout (#8004)

This commit is contained in:
Harikrishna 2023-09-28 12:13:22 +05:30 committed by GitHub
parent 3694667f50
commit 285387105f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 4 deletions

View File

@ -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)

View File

@ -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'

View File

@ -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

View File

@ -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)
}
}
}

View File

@ -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
}
},

View File

@ -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 {