feat: 服务升级重启等操作时取消前端定时请求 (#2801)

pull/2804/head
ssongliu 2023-11-04 21:46:23 +08:00 committed by GitHub
parent 4b69d77d3c
commit dedfe1e1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 1 deletions

View File

@ -134,6 +134,7 @@ const onUpgrade = async () => {
}).then(async () => {
globalStore.isLoading = true;
await upgrade(upgradeVersion.value);
globalStore.isOnRestart = true;
drawerVisible.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search();

View File

@ -22,6 +22,7 @@ export const GlobalStore = defineStore({
footer: true,
},
isFullScreen: false,
isOnRestart: false,
agreeLicense: false,
hasNewVersion: false,
ignoreCaptcha: true,

View File

@ -17,6 +17,7 @@ export interface GlobalState {
// assemblySize: string; // small | default | large
themeConfig: ThemeConfigProp;
isFullScreen: boolean;
isOnRestart: boolean;
agreeLicense: boolean;
hasNewVersion: boolean;
ignoreCaptcha: boolean;

View File

@ -381,7 +381,7 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
appRef.value.acceptParams();
if (isInit) {
timer = setInterval(async () => {
if (isActive.value) {
if (isActive.value && !globalStore.isOnRestart) {
await onLoadCurrentInfo();
}
}, 3000);
@ -550,6 +550,7 @@ const restart = async (type: string) => {
type: 'info',
},
).then(async () => {
globalStore.isOnRestart = true;
MsgSuccess(i18n.global.t('home.operationSuccess'));
await systemRestart(type);
});

View File

@ -315,6 +315,7 @@ const loadLanguage = async () => {
};
onMounted(() => {
globalStore.isOnRestart = false;
loginVerify();
loadLanguage();
document.title = globalStore.themeConfig.panelName;

View File

@ -82,6 +82,7 @@ const getStatus = async () => {
};
onMounted(() => {
globalStore.isOnRestart = false;
getStatus();
screenWidth.value = document.body.clientWidth;
window.onresize = () => {