mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 02:59:16 +08:00
fix: 解决概览页多磁盘刷新问题 (#1640)
This commit is contained in:
parent
d01a964534
commit
ef948bca76
@ -239,6 +239,7 @@ const isSafety = ref();
|
||||
const chartOption = ref('network');
|
||||
let timer: NodeJS.Timer | null = null;
|
||||
let isInit = ref<boolean>(true);
|
||||
let isStatusInit = ref<boolean>(true);
|
||||
let isActive = ref(true);
|
||||
|
||||
const ioReadBytes = ref<Array<number>>([]);
|
||||
@ -355,7 +356,8 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
|
||||
baseInfo.value = res.data;
|
||||
currentInfo.value = baseInfo.value.currentInfo;
|
||||
await onLoadCurrentInfo();
|
||||
statuRef.value.acceptParams(currentInfo.value, baseInfo.value);
|
||||
isStatusInit.value = false;
|
||||
statuRef.value.acceptParams(currentInfo.value, baseInfo.value, isStatusInit.value);
|
||||
appRef.value.acceptParams();
|
||||
if (isInit) {
|
||||
timer = setInterval(async () => {
|
||||
@ -421,7 +423,7 @@ const onLoadCurrentInfo = async () => {
|
||||
}
|
||||
loadData();
|
||||
currentInfo.value = res.data;
|
||||
statuRef.value.acceptParams(currentInfo.value, baseInfo.value);
|
||||
statuRef.value.acceptParams(currentInfo.value, baseInfo.value, isStatusInit.value);
|
||||
};
|
||||
|
||||
function loadUpTime(uptime: number) {
|
||||
|
@ -201,7 +201,7 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
|
||||
shotTime: new Date(),
|
||||
});
|
||||
|
||||
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo): void => {
|
||||
const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo, isInit: boolean): void => {
|
||||
currentInfo.value = current;
|
||||
baseInfo.value = base;
|
||||
freshChart('cpu', 'CPU', formatNumber(currentInfo.value.cpuUsedPercent));
|
||||
@ -215,7 +215,7 @@ const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo):
|
||||
freshChart('disk' + i, itemPath, formatNumber(currentInfo.value.diskData[i].usedPercent));
|
||||
}
|
||||
if (currentInfo.value.diskData.length > 5) {
|
||||
showMore.value = false;
|
||||
showMore.value = isInit ? false : showMore.value || false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user