This commit is contained in:
Baobhan Sith
2025-05-13 10:24:02 +08:00
parent ee8659ae73
commit fea90fb6ab
10 changed files with 1 additions and 27 deletions
@@ -447,7 +447,6 @@ const handleQuickCommandExecute = (command: string) => {
v-if="showPopupFileManagerBoolean"
@click="openFileManagerModal"
class="flex-shrink-0 flex items-center justify-center w-8 h-8 border border-border/50 rounded-lg text-text-secondary transition-colors duration-200 hover:bg-border hover:text-foreground"
:title="t('fileManager.title', '文件管理器')"
>
<i class="fas fa-folder text-base"></i>
</button>
@@ -456,7 +455,6 @@ const handleQuickCommandExecute = (command: string) => {
v-if="showPopupFileEditorBoolean"
@click="openFileEditorModal"
class="flex-shrink-0 flex items-center justify-center w-8 h-8 border border-border/50 rounded-lg text-text-secondary transition-colors duration-200 hover:bg-border hover:text-foreground"
:title="t('fileEditor.title', '文件编辑器')"
>
<i class="fas fa-edit text-base"></i>
</button>
@@ -148,14 +148,12 @@ const handleContextMenuPaste = async (event: MouseEvent) => {
const addContextMenuListener = () => {
if (terminalRef.value) {
terminalRef.value.addEventListener('contextmenu', handleContextMenuPaste);
console.log(`[Terminal ${props.sessionId}] Right-click paste listener added.`);
}
};
const removeContextMenuListener = () => {
if (terminalRef.value) {
terminalRef.value.removeEventListener('contextmenu', handleContextMenuPaste);
console.log(`[Terminal ${props.sessionId}] Right-click paste listener removed.`);
}
};
// --- 右键粘贴功能结束 ---
@@ -245,7 +243,6 @@ onMounted(() => {
setTimeout(() => {
// Re-check if still active and terminal exists
if (props.isActive && terminal && terminalRef.value && terminalRef.value.offsetHeight > 0) {
console.log(`[Terminal ${props.sessionId}] Executing delayed fit and resize.`);
fitAndEmitResizeNow(terminal);
// Also ensure focus when becoming active
terminal.focus();
@@ -90,7 +90,6 @@ export function createSshTerminalManager(sessionId: string, wsDeps: SshTerminalD
console.log(`[SSH ${sessionId}] handleTerminalResize called with:`, dimensions);
// 只有在连接状态下才发送 resize 命令给后端
if (isConnected.value) {
console.log(`[SSH ${sessionId}] Sending ssh:resize to backend:`, dimensions);
sendMessage({ type: 'ssh:resize', sessionId, payload: dimensions });
} else {
console.log(`[SSH ${sessionId}] WebSocket not connected, skipping ssh:resize.`);
@@ -101,13 +101,6 @@ export const useAppearanceStore = defineStore('appearance', () => {
]);
appearanceSettings.value = settingsResponse.data;
allTerminalThemes.value = themesResponse.data; // 更新 allTerminalThemes
console.log('[AppearanceStore LOG] 外观设置已加载 (原始数据):', JSON.stringify(settingsResponse.data)); // 添加原始数据日志
console.log(`[AppearanceStore LOG] 从后端加载的 terminalBackgroundEnabled 原始值: ${settingsResponse.data.terminalBackgroundEnabled}`); // 专门记录该值
console.log('[AppearanceStore] 所有终端主题列表已加载:', allTerminalThemes.value);
// --- 后端返回的 activeTerminalThemeId 已经是 number | null ---
// 前端不再需要设置默认主题 ID 的逻辑,后端初始化时会保证它不为 NULL
// 如果后端返回 null (理论上不应发生,除非初始化失败),则 currentTerminalTheme 计算属性会回退到 defaultXtermTheme
// 应用加载的 UI 主题
applyUiTheme(currentUiTheme.value);
@@ -486,7 +479,6 @@ export const useAppearanceStore = defineStore('appearance', () => {
for (const [key, value] of Object.entries(theme)) {
root.style.setProperty(key, value);
}
console.log('[AppearanceStore] UI 主题已应用:', theme);
}
/**
@@ -67,7 +67,6 @@ export const useCommandHistoryStore = defineStore('commandHistory', () => {
try {
const cachedData = localStorage.getItem(cacheKey);
if (cachedData) {
console.log('[CmdHistoryStore] Loading history from cache.');
historyList.value = JSON.parse(cachedData); // 缓存中已是降序
isLoading.value = false; // 先显示缓存
} else {
@@ -26,7 +26,6 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
try {
const cachedData = localStorage.getItem(cacheKey);
if (cachedData) {
console.log('[QuickCmdTagStore] Loading quick command tags from cache.');
tags.value = JSON.parse(cachedData);
isLoading.value = false;
} else {
@@ -41,7 +40,6 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
// 2. 后台获取最新数据
isLoading.value = true;
try {
console.log('[QuickCmdTagStore] Fetching latest quick command tags from server...');
// 使用新的 API 端点
const response = await apiClient.get<QuickCommandTag[]>('/quick-command-tags');
const freshData = response.data;
@@ -50,11 +48,9 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
// 3. 对比并更新
const currentDataString = JSON.stringify(tags.value);
if (currentDataString !== freshDataString) {
console.log('[QuickCmdTagStore] Tags data changed, updating state and cache.');
tags.value = freshData;
localStorage.setItem(cacheKey, freshDataString);
} else {
console.log('[QuickCmdTagStore] Tags data is up-to-date.');
}
error.value = null;
return true;
@@ -250,7 +250,6 @@ export const useQuickCommandsStore = defineStore('quickCommands', () => {
try {
const cachedData = localStorage.getItem(cacheKey);
if (cachedData) {
console.log(`[QuickCmdStore] Loading commands from cache.`);
// 确保解析后的数据符合 QuickCommandFE 结构 (特别是 tagIds)
const parsedData = JSON.parse(cachedData) as QuickCommandFE[];
// 基本验证,确保 tagIds 是数组
@@ -291,7 +290,6 @@ export const useQuickCommandsStore = defineStore('quickCommands', () => {
quickCommandsList.value = freshData;
localStorage.setItem(cacheKey, freshDataString); // 更新缓存
} else {
console.log('[QuickCmdStore] Commands data is up-to-date.');
}
error.value = null;
} catch (err: any) {
@@ -208,7 +208,6 @@ export const useSettingsStore = defineStore('settings', () => {
try {
if (settings.value.fileManagerColWidths) {
loadedFmWidths = JSON.parse(settings.value.fileManagerColWidths);
console.log(`[SettingsStore] Successfully parsed fileManagerColWidths JSON: ${JSON.stringify(loadedFmWidths)}`);
if (typeof loadedFmWidths !== 'object' || loadedFmWidths === null) {
console.warn('[SettingsStore] Invalid fileManagerColWidths format loaded, resetting.');
loadedFmWidths = {};
@@ -24,7 +24,6 @@ export const useTagsStore = defineStore('tags', () => {
try {
const cachedData = localStorage.getItem(cacheKey);
if (cachedData) {
console.log('[TagsStore] Loading tags from cache.');
tags.value = JSON.parse(cachedData);
isLoading.value = false; // 先显示缓存
} else {
@@ -39,7 +38,6 @@ export const useTagsStore = defineStore('tags', () => {
// 2. 后台获取最新数据
isLoading.value = true; // 标记正在后台获取
try {
console.log('[TagsStore] Fetching latest tags from server...');
const response = await apiClient.get<TagInfo[]>('/tags');
const freshData = response.data;
const freshDataString = JSON.stringify(freshData);
@@ -47,7 +45,6 @@ export const useTagsStore = defineStore('tags', () => {
// 3. 对比并更新
const currentDataString = JSON.stringify(tags.value);
if (currentDataString !== freshDataString) {
console.log('[TagsStore] Tags data changed, updating state and cache.');
tags.value = freshData;
localStorage.setItem(cacheKey, freshDataString); // 更新缓存
} else {
@@ -325,7 +325,6 @@ const unsubscribeFromWorkspaceEvents = useWorkspaceEventOff();
// ( Terminal)
// LayoutRenderer Terminal emit('terminal-resize', sessionId, dims)
const handleTerminalResize = (payload: { sessionId: string; dims: { cols: number; rows: number } }) => {
console.log(`[工作区视图 ${payload.sessionId}] 收到 resize 事件:`, payload.dims);
sessionStore.sessions.get(payload.sessionId)?.terminalManager.handleTerminalResize(payload.dims);
};
@@ -803,7 +802,7 @@ const closeFileManagerModal = () => {
<div v-show="showFileManagerModal && currentFileManagerSessionId && fileManagerPropsMap.get(currentFileManagerSessionId)" class="fixed inset-0 flex items-center justify-center z-50 p-4" :style="{ backgroundColor: 'var(--overlay-bg-color)' }" @click.self="closeFileManagerModal">
<div class="bg-background rounded-lg shadow-xl w-full max-w-4xl h-[85vh] flex flex-col overflow-hidden border border-border">
<div class="flex justify-between items-center p-3 border-b border-border flex-shrink-0 bg-header">
<h2 class="text-lg font-semibold text-foreground">{{ t('fileManager.modalTitle', '文件管理器') }} ({{ currentFileManagerSessionId }})</h2>
<h2 class="text-lg font-semibold text-foreground">{{ t('fileManager.modalTitle', '文件管理器') }} ({{ currentFileManagerSessionId ? (sessionStore.sessions.get(currentFileManagerSessionId)?.connectionName || currentFileManagerSessionId) : '未知会话' }})</h2>
<button @click="closeFileManagerModal" class="text-text-secondary hover:text-foreground transition-colors">
<i class="fas fa-times text-xl"></i>
</button>