Skip to content

Commit ef948bc

Browse files
authored
fix: 解决概览页多磁盘刷新问题 (#1640)
1 parent d01a964 commit ef948bc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

frontend/src/views/home/index.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ const isSafety = ref();
239239
const chartOption = ref('network');
240240
let timer: NodeJS.Timer | null = null;
241241
let isInit = ref<boolean>(true);
242+
let isStatusInit = ref<boolean>(true);
242243
let isActive = ref(true);
243244
244245
const ioReadBytes = ref<Array<number>>([]);
@@ -355,7 +356,8 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
355356
baseInfo.value = res.data;
356357
currentInfo.value = baseInfo.value.currentInfo;
357358
await onLoadCurrentInfo();
358-
statuRef.value.acceptParams(currentInfo.value, baseInfo.value);
359+
isStatusInit.value = false;
360+
statuRef.value.acceptParams(currentInfo.value, baseInfo.value, isStatusInit.value);
359361
appRef.value.acceptParams();
360362
if (isInit) {
361363
timer = setInterval(async () => {
@@ -421,7 +423,7 @@ const onLoadCurrentInfo = async () => {
421423
}
422424
loadData();
423425
currentInfo.value = res.data;
424-
statuRef.value.acceptParams(currentInfo.value, baseInfo.value);
426+
statuRef.value.acceptParams(currentInfo.value, baseInfo.value, isStatusInit.value);
425427
};
426428
427429
function loadUpTime(uptime: number) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
201201
shotTime: new Date(),
202202
});
203203
204-
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo): void => {
204+
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo, isInit: boolean): void => {
205205
currentInfo.value = current;
206206
baseInfo.value = base;
207207
freshChart('cpu', 'CPU', formatNumber(currentInfo.value.cpuUsedPercent));
@@ -215,7 +215,7 @@ const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo):
215215
freshChart('disk' + i, itemPath, formatNumber(currentInfo.value.diskData[i].usedPercent));
216216
}
217217
if (currentInfo.value.diskData.length > 5) {
218-
showMore.value = false;
218+
showMore.value = isInit ? false : showMore.value || false;
219219
}
220220
});
221221
};

0 commit comments

Comments
 (0)