mirror of https://github.com/1Panel-dev/1Panel
feat: 服务升级重启等操作时取消前端定时请求 (#2801)
parent
4b69d77d3c
commit
dedfe1e1e1
|
@ -134,6 +134,7 @@ const onUpgrade = async () => {
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
globalStore.isLoading = true;
|
globalStore.isLoading = true;
|
||||||
await upgrade(upgradeVersion.value);
|
await upgrade(upgradeVersion.value);
|
||||||
|
globalStore.isOnRestart = true;
|
||||||
drawerVisible.value = false;
|
drawerVisible.value = false;
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
search();
|
search();
|
||||||
|
|
|
@ -22,6 +22,7 @@ export const GlobalStore = defineStore({
|
||||||
footer: true,
|
footer: true,
|
||||||
},
|
},
|
||||||
isFullScreen: false,
|
isFullScreen: false,
|
||||||
|
isOnRestart: false,
|
||||||
agreeLicense: false,
|
agreeLicense: false,
|
||||||
hasNewVersion: false,
|
hasNewVersion: false,
|
||||||
ignoreCaptcha: true,
|
ignoreCaptcha: true,
|
||||||
|
|
|
@ -17,6 +17,7 @@ export interface GlobalState {
|
||||||
// assemblySize: string; // small | default | large
|
// assemblySize: string; // small | default | large
|
||||||
themeConfig: ThemeConfigProp;
|
themeConfig: ThemeConfigProp;
|
||||||
isFullScreen: boolean;
|
isFullScreen: boolean;
|
||||||
|
isOnRestart: boolean;
|
||||||
agreeLicense: boolean;
|
agreeLicense: boolean;
|
||||||
hasNewVersion: boolean;
|
hasNewVersion: boolean;
|
||||||
ignoreCaptcha: boolean;
|
ignoreCaptcha: boolean;
|
||||||
|
|
|
@ -381,7 +381,7 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
|
||||||
appRef.value.acceptParams();
|
appRef.value.acceptParams();
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
timer = setInterval(async () => {
|
timer = setInterval(async () => {
|
||||||
if (isActive.value) {
|
if (isActive.value && !globalStore.isOnRestart) {
|
||||||
await onLoadCurrentInfo();
|
await onLoadCurrentInfo();
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
@ -550,6 +550,7 @@ const restart = async (type: string) => {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
},
|
},
|
||||||
).then(async () => {
|
).then(async () => {
|
||||||
|
globalStore.isOnRestart = true;
|
||||||
MsgSuccess(i18n.global.t('home.operationSuccess'));
|
MsgSuccess(i18n.global.t('home.operationSuccess'));
|
||||||
await systemRestart(type);
|
await systemRestart(type);
|
||||||
});
|
});
|
||||||
|
|
|
@ -315,6 +315,7 @@ const loadLanguage = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
globalStore.isOnRestart = false;
|
||||||
loginVerify();
|
loginVerify();
|
||||||
loadLanguage();
|
loadLanguage();
|
||||||
document.title = globalStore.themeConfig.panelName;
|
document.title = globalStore.themeConfig.panelName;
|
||||||
|
|
|
@ -82,6 +82,7 @@ const getStatus = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
globalStore.isOnRestart = false;
|
||||||
getStatus();
|
getStatus();
|
||||||
screenWidth.value = document.body.clientWidth;
|
screenWidth.value = document.body.clientWidth;
|
||||||
window.onresize = () => {
|
window.onresize = () => {
|
||||||
|
|
Loading…
Reference in New Issue