Skip to content

Commit b1bb311

Browse files
author
ssongliu
committed
fix: Fix disk and network card settings not taking effect issue
1 parent 607eae3 commit b1bb311

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

frontend/src/api/interface/setting.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export namespace Setting {
2020
theme: string;
2121
menuTabs: string;
2222
language: string;
23+
defaultIO: string;
2324
defaultNetwork: string;
2425
lastCleanTime: string;
2526
lastCleanSize: string;

frontend/src/views/home/index.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,14 @@ import { dateFormatForSecond, computeSize, computeSizeFromKBs, loadUpTime, jumpT
394394
import { useRouter } from 'vue-router';
395395
import { loadBaseInfo, loadCurrentInfo } from '@/api/modules/dashboard';
396396
import { getIOOptions, getNetworkOptions } from '@/api/modules/host';
397-
import { getSettingInfo, listAllSimpleNodes, loadUpgradeInfo, getMemo, updateMemo } from '@/api/modules/setting';
397+
import {
398+
getSettingInfo,
399+
getAgentSettingInfo,
400+
listAllSimpleNodes,
401+
loadUpgradeInfo,
402+
getMemo,
403+
updateMemo,
404+
} from '@/api/modules/setting';
398405
import { GlobalStore } from '@/store';
399406
import { storeToRefs } from 'pinia';
400407
import { routerToFileWithPath, routerToNameWithQuery, routerToPath } from '@/utils/router';
@@ -555,6 +562,13 @@ const applyDefaultNetOption = () => {
555562
}
556563
};
557564
565+
const onLoadAgentSettingInfo = async () => {
566+
await getAgentSettingInfo().then((res) => {
567+
globalStore.defaultIO = res.data.defaultIO;
568+
globalStore.defaultNetwork = res.data.defaultNetwork;
569+
});
570+
};
571+
558572
const onLoadNetworkOptions = async (force?: boolean) => {
559573
const cache = force ? null : getDashboardCache('netOptions');
560574
if (cache !== null) {
@@ -575,7 +589,7 @@ const onLoadSimpleNode = async () => {
575589
simpleNodes.value = res.data || [];
576590
};
577591
578-
const applyDefaultIOOption = () => {
592+
const applyDefaultIOOption = async () => {
579593
if (!ioOptions.value || ioOptions.value.length === 0) return;
580594
const defaultIO = globalStore.defaultIO || ioOptions.value[0];
581595
if (defaultIO && searchInfo.ioOption !== defaultIO) {
@@ -905,6 +919,7 @@ const fetchData = async () => {
905919
window.addEventListener('blur', onBlur);
906920
hasRefreshedOptionsOnHover.value = false;
907921
loadSafeStatus();
922+
onLoadAgentSettingInfo();
908923
onLoadBaseInfo(true, 'all');
909924
scheduleDeferredFetch();
910925
setTimeout(() => {

0 commit comments

Comments
 (0)