Skip to content

Commit 11101a5

Browse files
committed
fix: Fix some overview page caching issues
1 parent 25fb431 commit 11101a5

File tree

4 files changed

+17
-25
lines changed

4 files changed

+17
-25
lines changed

frontend/src/layout/components/Sidebar/components/Collapse.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ const changeNode = (command: string) => {
183183
globalStore.currentNode = 'local';
184184
globalStore.currentNodeAddr = item.addr;
185185
loadGlobalSetting();
186+
localStorage.removeItem('dashboardCache');
187+
localStorage.removeItem('upgradeChecked');
186188
loadProductProFromDB();
187189
routerToNameWithQuery('home', { t: Date.now() });
188190
return;
@@ -200,6 +202,8 @@ const changeNode = (command: string) => {
200202
return;
201203
}
202204
loadGlobalSetting();
205+
localStorage.removeItem('dashboardCache');
206+
localStorage.removeItem('upgradeChecked');
203207
globalStore.currentNode = command || 'local';
204208
globalStore.currentNodeAddr = item.addr;
205209
loadProductProFromDB();
@@ -238,10 +242,6 @@ const logout = () => {
238242
})
239243
.then(async () => {
240244
await logOutApi();
241-
sessionStorage.removeItem('dashboardCache');
242-
localStorage.removeItem('dashboardCache');
243-
sessionStorage.removeItem('upgradeChecked');
244-
localStorage.removeItem('upgradeChecked');
245245
router.push({ name: 'entrance', params: { code: globalStore.entrance } });
246246
globalStore.setLogStatus(false);
247247
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));

frontend/src/views/home/index.vue

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ const DASHBOARD_CACHE_TTL = {
345345
netOptions: 60 * 60 * 1000,
346346
ioOptions: 60 * 60 * 1000,
347347
};
348-
const UPGRADE_CHECK_KEY = 'upgradeChecked';
349-
const UPGRADE_CHECK_EXPIRE = 24 * 60 * 60 * 1000;
350348
351349
const statusRef = ref();
352350
const appRef = ref();
@@ -586,11 +584,9 @@ const toggleSensitiveInfo = () => {
586584
587585
const refreshDashboard = async () => {
588586
clearDashboardCache();
589-
localStorage.removeItem(UPGRADE_CHECK_KEY);
590587
hasRefreshedOptionsOnHover.value = false;
591588
await onLoadBaseInfo(false, 'all');
592589
await Promise.allSettled([onLoadSimpleNode(), onLoadNetworkOptions(true), onLoadIOOptions(true), loadSafeStatus()]);
593-
await loadUpgradeStatus();
594590
};
595591
596592
const jumpPanel = (row: any) => {
@@ -733,15 +729,12 @@ const hideEntrance = () => {
733729
};
734730
735731
const loadUpgradeStatus = async () => {
736-
const checkedAt = Number(localStorage.getItem(UPGRADE_CHECK_KEY));
737-
if (checkedAt && Date.now() - checkedAt < UPGRADE_CHECK_EXPIRE) return;
738732
const res = await loadUpgradeInfo();
739733
if (res && (res.data.testVersion || res.data.newVersion || res.data.latestVersion)) {
740734
globalStore.hasNewVersion = true;
741735
} else {
742736
globalStore.hasNewVersion = false;
743737
}
744-
localStorage.setItem(UPGRADE_CHECK_KEY, Date.now().toString());
745738
};
746739
747740
const loadSafeStatus = async () => {
@@ -799,25 +792,21 @@ const refreshOptionsOnHover = async () => {
799792
const scheduleDeferredFetch = () => {
800793
setTimeout(() => {
801794
onLoadSimpleNode();
802-
}, 200);
803-
setTimeout(() => {
804795
onLoadNetworkOptions();
805-
}, 400);
806-
setTimeout(() => {
807796
onLoadIOOptions();
808797
}, 600);
809-
setTimeout(() => {
810-
loadUpgradeStatus();
811-
}, 800);
812798
};
813799
814800
const fetchData = async () => {
815801
window.addEventListener('focus', onFocus);
816802
window.addEventListener('blur', onBlur);
817803
hasRefreshedOptionsOnHover.value = false;
818-
await loadSafeStatus();
819-
await onLoadBaseInfo(true, 'all');
804+
loadSafeStatus();
805+
onLoadBaseInfo(true, 'all');
820806
scheduleDeferredFetch();
807+
setTimeout(() => {
808+
loadUpgradeStatus();
809+
}, 2000);
821810
};
822811
823812
const loadWelcome = async () => {

frontend/src/views/home/status/index.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,7 @@
303303
<template v-for="(item, index) of currentInfo.xpuData" :key="index">
304304
<el-col :xs="6" :sm="6" :md="3" :lg="3" :xl="3" align="center" v-if="isShow('xpu', index)">
305305
<el-popover :hide-after="20" :teleported="false" :width="400" v-if="chartsOption[`xpu${index}`]">
306-
<el-descriptions :title="item.deviceName" direction="vertical" :column="4" size="small">
307-
<el-descriptions-item :label="$t('monitor.gpuUtil')">
308-
{{ item.memoryUtil }}
309-
</el-descriptions-item>
306+
<el-descriptions :title="item.deviceName" direction="vertical" :column="3" size="small">
310307
<el-descriptions-item :label="$t('monitor.temperature')">
311308
{{ item.temperature }}
312309
</el-descriptions-item>

frontend/src/views/login/components/login-form.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ import { useI18n } from 'vue-i18n';
192192
import { encryptPassword } from '@/utils/util';
193193
import { getXpackSettingForTheme } from '@/utils/xpack';
194194
import { routerToName } from '@/utils/router';
195-
import { changeToLocal } from '@/utils/node';
195+
import { changeToLocal, setDefaultNodeInfo } from '@/utils/node';
196196
197197
const i18n = useI18n();
198198
const themeConfig = computed(() => globalStore.themeConfig);
@@ -345,6 +345,9 @@ const login = (formEl: FormInstance | undefined) => {
345345
tabsStore.removeAllTabs();
346346
changeToLocal();
347347
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
348+
setDefaultNodeInfo();
349+
localStorage.removeItem('dashboardCache');
350+
localStorage.removeItem('upgradeChecked');
348351
routerToName('home');
349352
document.onkeydown = null;
350353
} catch (res) {
@@ -386,6 +389,9 @@ const mfaLogin = async (auto: boolean) => {
386389
tabsStore.removeAllTabs();
387390
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
388391
changeToLocal();
392+
setDefaultNodeInfo();
393+
localStorage.removeItem('dashboardCache');
394+
localStorage.removeItem('upgradeChecked');
389395
routerToName('home');
390396
document.onkeydown = null;
391397
} catch (res) {

0 commit comments

Comments
 (0)