update
This commit is contained in:
@@ -16,6 +16,7 @@ interface SettingsState {
|
||||
autoCopyOnSelect?: string; // 'true' or 'false' - 终端选中自动复制
|
||||
dockerStatusIntervalSeconds?: string; // NEW: Docker 状态刷新间隔 (秒)
|
||||
dockerDefaultExpand?: string; // NEW: Docker 默认展开详情 'true' or 'false'
|
||||
statusMonitorIntervalSeconds?: string; // NEW: 状态监控轮询间隔 (秒)
|
||||
// Add other general settings keys here as needed
|
||||
[key: string]: string | undefined; // Allow other string settings
|
||||
}
|
||||
@@ -74,7 +75,10 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
if (settings.value.dockerDefaultExpand === undefined) {
|
||||
settings.value.dockerDefaultExpand = 'false'; // 默认不展开
|
||||
}
|
||||
|
||||
// NEW: Status Monitor interval default
|
||||
if (settings.value.statusMonitorIntervalSeconds === undefined) {
|
||||
settings.value.statusMonitorIntervalSeconds = '3'; // 默认 3 秒
|
||||
}
|
||||
|
||||
// --- 语言设置 ---
|
||||
const langFromSettings = settings.value.language;
|
||||
@@ -124,7 +128,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
const allowedKeys: Array<keyof SettingsState> = [
|
||||
'language', 'ipWhitelist', 'maxLoginAttempts', 'loginBanDuration',
|
||||
'showPopupFileEditor', 'shareFileEditorTabs', 'ipWhitelistEnabled',
|
||||
'autoCopyOnSelect', 'dockerStatusIntervalSeconds', 'dockerDefaultExpand' // +++ 添加 Docker 设置键 +++
|
||||
'autoCopyOnSelect', 'dockerStatusIntervalSeconds', 'dockerDefaultExpand',
|
||||
'statusMonitorIntervalSeconds' // +++ 添加状态监控间隔键 +++
|
||||
];
|
||||
if (!allowedKeys.includes(key)) {
|
||||
console.error(`[SettingsStore] 尝试更新不允许的设置键: ${key}`);
|
||||
@@ -157,7 +162,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
const allowedKeys: Array<keyof SettingsState> = [
|
||||
'language', 'ipWhitelist', 'maxLoginAttempts', 'loginBanDuration',
|
||||
'showPopupFileEditor', 'shareFileEditorTabs', 'ipWhitelistEnabled',
|
||||
'autoCopyOnSelect', 'dockerStatusIntervalSeconds', 'dockerDefaultExpand' // +++ 添加 Docker 设置键 +++
|
||||
'autoCopyOnSelect', 'dockerStatusIntervalSeconds', 'dockerDefaultExpand',
|
||||
'statusMonitorIntervalSeconds' // +++ 添加状态监控间隔键 +++
|
||||
];
|
||||
const filteredUpdates: Partial<SettingsState> = {};
|
||||
let languageUpdate: 'en' | 'zh' | undefined = undefined;
|
||||
@@ -224,6 +230,12 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
return settings.value.dockerDefaultExpand === 'true';
|
||||
});
|
||||
|
||||
// NEW: Getter for Status Monitor interval, returning number
|
||||
const statusMonitorIntervalSecondsNumber = computed(() => {
|
||||
const val = parseInt(settings.value.statusMonitorIntervalSeconds || '3', 10);
|
||||
return isNaN(val) || val <= 0 ? 3 : val; // Fallback to 3 if invalid
|
||||
});
|
||||
|
||||
return {
|
||||
settings, // 只包含通用设置
|
||||
isLoading,
|
||||
@@ -234,6 +246,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
ipWhitelistEnabled, // 暴露 IP 白名单启用状态
|
||||
autoCopyOnSelectBoolean,
|
||||
dockerDefaultExpandBoolean, // +++ 暴露 Docker 默认展开 getter +++
|
||||
statusMonitorIntervalSecondsNumber, // +++ 暴露状态监控间隔 getter +++
|
||||
// 移除外观相关的 getters 和 actions
|
||||
loadInitialSettings,
|
||||
updateSetting,
|
||||
|
||||
Reference in New Issue
Block a user