Skip to content

Commit 1be1eae

Browse files
committed
fix(home): reset dashboard delta baseline after resume
1 parent f5e75d4 commit 1be1eae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

frontend/src/views/home/index.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ const currentChartInfo = reactive({
599599
netBytesSent: 0,
600600
netBytesRecv: 0,
601601
});
602+
const skipNextCurrentInfoDelta = ref(false);
602603
603604
const chartsOption = ref({ ioChart1: null, networkChart: null });
604605
@@ -686,6 +687,7 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
686687
const res = await loadBaseInfo(searchInfo.ioOption, searchInfo.netOption);
687688
baseInfo.value = res.data;
688689
updateCurrentInfo(baseInfo.value.currentInfo);
690+
skipNextCurrentInfoDelta.value = true;
689691
onLoadCurrentInfo();
690692
isStatusInit.value = false;
691693
statusRef.value?.acceptParams(currentInfo.value, baseInfo.value);
@@ -744,6 +746,19 @@ const jumpPanel = (row: any) => {
744746
745747
const onLoadCurrentInfo = async () => {
746748
const res = await loadCurrentInfo(searchInfo.ioOption, searchInfo.netOption);
749+
if (skipNextCurrentInfoDelta.value) {
750+
skipNextCurrentInfoDelta.value = false;
751+
currentChartInfo.netBytesSent = 0;
752+
currentChartInfo.netBytesRecv = 0;
753+
currentChartInfo.ioReadBytes = 0;
754+
currentChartInfo.ioWriteBytes = 0;
755+
currentChartInfo.ioCount = 0;
756+
currentChartInfo.ioTime = 0;
757+
updateCurrentInfo(res.data);
758+
statusRef.value?.acceptParams(currentInfo.value, baseInfo.value);
759+
return;
760+
}
761+
747762
currentInfo.value.timeSinceUptime = res.data.timeSinceUptime;
748763
749764
let timeInterval = Number(res.data.uptime - currentInfo.value.uptime) || 3;
@@ -984,6 +999,7 @@ const loadSource = (row: any) => {
984999
9851000
const onFocus = () => {
9861001
isActive.value = true;
1002+
skipNextCurrentInfoDelta.value = true;
9871003
};
9881004
const onBlur = () => {
9891005
isActive.value = false;

0 commit comments

Comments
 (0)