feat: 状态监视器添加IP地址显示
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ref, nextTick, type Ref, type ComponentPublicInstance } from 'vue'; // 导入 ComponentPublicInstance
|
||||
import type { FileListItem } from '../../types/sftp.types'; // 修正路径
|
||||
import { type useI18n } from 'vue-i18n'; // 导入 useI18n 以获取 t 的类型
|
||||
import type FileManagerContextMenu from '../../components/FileManagerContextMenu.vue'; // <-- 导入组件类型
|
||||
import { ref, nextTick, type Ref, type ComponentPublicInstance } from 'vue';
|
||||
import type { FileListItem } from '../../types/sftp.types';
|
||||
import { type useI18n } from 'vue-i18n';
|
||||
import type FileManagerContextMenu from '../../components/FileManagerContextMenu.vue';
|
||||
|
||||
// 定义菜单项类型 (可以根据需要扩展)
|
||||
export interface ContextMenuItem {
|
||||
@@ -242,7 +242,7 @@ export function useFileManagerContextMenu(options: UseFileManagerContextMenuOpti
|
||||
];
|
||||
} else { // Clicked on '..'
|
||||
menu = [
|
||||
// +++ 添加粘贴 (可以粘贴到上级目录) +++
|
||||
// +++ 粘贴 (可以粘贴到上级目录) +++
|
||||
{ label: t('fileManager.actions.paste'), action: onPaste, disabled: !(isConnected.value && isSftpReady.value) || !hasClipboardContent },
|
||||
{ label: t('fileManager.actions.refresh'), action: onRefresh, disabled: !(isConnected.value && isSftpReady.value) }
|
||||
];
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ref, watch } from 'vue';
|
||||
import { useSettingsStore } from '../../stores/settings.store';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { availableLocales } from '../../i18n'; // 导入可用语言列表
|
||||
import { availableLocales } from '../../i18n';
|
||||
|
||||
export function useSystemSettings() {
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
@@ -17,8 +17,9 @@ export function useWorkspaceSettings() {
|
||||
showQuickCommandTagsBoolean,
|
||||
terminalScrollbackLimitNumber,
|
||||
fileManagerShowDeleteConfirmationBoolean,
|
||||
terminalEnableRightClickPasteBoolean,
|
||||
showPopupFileManagerBoolean, // +++ Import the new getter +++
|
||||
terminalEnableRightClickPasteBoolean,
|
||||
showPopupFileManagerBoolean,
|
||||
statusMonitorShowIpBoolean,
|
||||
} = storeToRefs(settingsStore);
|
||||
|
||||
// --- Popup Editor ---
|
||||
@@ -286,6 +287,30 @@ export function useWorkspaceSettings() {
|
||||
}
|
||||
};
|
||||
|
||||
// --- Status Monitor Show IP ---
|
||||
const statusMonitorShowIpEnabled = ref(false);
|
||||
const statusMonitorShowIpLoading = ref(false);
|
||||
const statusMonitorShowIpMessage = ref('');
|
||||
const statusMonitorShowIpSuccess = ref(false);
|
||||
|
||||
const handleUpdateStatusMonitorShowIpSetting = async () => {
|
||||
statusMonitorShowIpLoading.value = true;
|
||||
statusMonitorShowIpMessage.value = '';
|
||||
statusMonitorShowIpSuccess.value = false;
|
||||
try {
|
||||
const valueToSave = statusMonitorShowIpEnabled.value ? 'true' : 'false';
|
||||
await settingsStore.updateSetting('showStatusMonitorIpAddress', valueToSave);
|
||||
statusMonitorShowIpMessage.value = t('common.saved');
|
||||
statusMonitorShowIpSuccess.value = true;
|
||||
} catch (error: any) {
|
||||
console.error('Failed to update status monitor IP display setting:', error);
|
||||
statusMonitorShowIpMessage.value = error.message || t('settings.statusMonitorShowIp.error.saveFailed', 'Failed to save status monitor IP display setting.'); // 需要添加相应的i18n键
|
||||
statusMonitorShowIpSuccess.value = false;
|
||||
} finally {
|
||||
statusMonitorShowIpLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Watchers to sync local state with store state
|
||||
watch(showPopupFileEditorBoolean, (newValue) => { popupEditorEnabled.value = newValue; }, { immediate: true });
|
||||
watch(shareFileEditorTabsBoolean, (newValue) => { shareTabsEnabled.value = newValue; }, { immediate: true });
|
||||
@@ -296,8 +321,9 @@ export function useWorkspaceSettings() {
|
||||
watch(showQuickCommandTagsBoolean, (newValue) => { showQuickCommandTagsLocal.value = newValue; }, { immediate: true });
|
||||
watch(terminalScrollbackLimitNumber, (newValue) => { terminalScrollbackLimitLocal.value = newValue; }, { immediate: true });
|
||||
watch(fileManagerShowDeleteConfirmationBoolean, (newValue) => { fileManagerShowDeleteConfirmationLocal.value = newValue; }, { immediate: true });
|
||||
watch(terminalEnableRightClickPasteBoolean, (newValue) => { terminalEnableRightClickPasteLocal.value = newValue; }, { immediate: true });
|
||||
watch(terminalEnableRightClickPasteBoolean, (newValue) => { terminalEnableRightClickPasteLocal.value = newValue; }, { immediate: true });
|
||||
watch(showPopupFileManagerBoolean, (newValue) => { showPopupFileManagerLocal.value = newValue; }, { immediate: true }); // +++ Watch for popup file manager +++
|
||||
watch(statusMonitorShowIpBoolean, (newValue) => { statusMonitorShowIpEnabled.value = newValue; }, { immediate: true });
|
||||
|
||||
|
||||
return {
|
||||
@@ -367,5 +393,11 @@ export function useWorkspaceSettings() {
|
||||
showPopupFileManagerMessage,
|
||||
showPopupFileManagerSuccess,
|
||||
handleUpdateShowPopupFileManager,
|
||||
|
||||
statusMonitorShowIpEnabled,
|
||||
statusMonitorShowIpLoading,
|
||||
statusMonitorShowIpMessage,
|
||||
statusMonitorShowIpSuccess,
|
||||
handleUpdateStatusMonitorShowIpSetting,
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ref, readonly, reactive, computed, type Ref, type ComputedRef } from 'vue'; // 引入 reactive 和 computed
|
||||
import { ref, readonly, reactive, computed, type Ref, type ComputedRef } from 'vue';
|
||||
import type { FileListItem, FileAttributes, EditorFileContent, SftpReadFileSuccessPayload, SftpReadFileRequestPayload } from '../types/sftp.types';
|
||||
import type { WebSocketMessage, MessagePayload, MessageHandler } from '../types/websocket.types';
|
||||
// 导入 UI 通知 store
|
||||
import { useUiNotificationsStore } from '../stores/uiNotifications.store'; // 更正导入
|
||||
|
||||
import { useUiNotificationsStore } from '../stores/uiNotifications.store';
|
||||
|
||||
/**
|
||||
* @interface WebSocketDependencies
|
||||
|
||||
@@ -24,7 +24,7 @@ export function useSidebarResize({
|
||||
const handleMouseDown = (event: MouseEvent) => {
|
||||
console.log(`[useSidebarResize] handleMouseDown triggered for side: ${side}`, { sidebar: sidebarRef.value, handle: handleRef.value }); // +++ Add Log +++
|
||||
if (!sidebarRef.value || !handleRef.value) {
|
||||
console.log('[useSidebarResize] MouseDown ignored: sidebarRef or handleRef is null.'); // +++ Add Log +++
|
||||
console.log('[useSidebarResize] MouseDown ignored: sidebarRef or handleRef is null.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user