This commit is contained in:
Baobhan Sith
2025-04-25 00:59:15 +08:00
parent 625a01b7d2
commit 1e77d82535
5 changed files with 48 additions and 13 deletions
@@ -191,7 +191,7 @@ const saveLayout = async () => { // Make async
} catch (error) { } catch (error) {
console.error('[LayoutConfigurator] Error saving layout:', error); console.error('[LayoutConfigurator] Error saving layout:', error);
// Optionally notify the user about the error // Optionally notify the user about the error
alert(t('layoutConfigurator.saveError', '保存布局时出错,请稍后再试。')); alert(t('layoutConfigurator.saveError', '保存布局时出错,请稍后再试。')); // Keep default text for now
} }
}; };
@@ -277,7 +277,7 @@ function findAndRemoveNode(node: LayoutNode | null, parentNodeId: string | undef
const handleNodeRemove = (payload: { parentNodeId: string | undefined; nodeIndex: number }) => { const handleNodeRemove = (payload: { parentNodeId: string | undefined; nodeIndex: number }) => {
console.log('[LayoutConfigurator] Received node remove request:', payload); console.log('[LayoutConfigurator] Received node remove request:', payload);
if (payload.parentNodeId === undefined && payload.nodeIndex === 0) { if (payload.parentNodeId === undefined && payload.nodeIndex === 0) {
if (confirm(t('layoutConfigurator.confirmClearLayout', '确定要清空整个布局吗?所有面板将返回可用列表。'))) { if (confirm(t('layoutConfigurator.confirmClearLayout', '确定要清空整个布局吗?所有面板将返回可用列表。'))) { // Keep default text for now
// Add all panes from the tree back to available list before clearing - REMOVED, no longer needed // Add all panes from the tree back to available list before clearing - REMOVED, no longer needed
// const usedInTree = getMainLayoutUsedPaneNames(localLayoutTree.value); // const usedInTree = getMainLayoutUsedPaneNames(localLayoutTree.value);
// usedInTree.forEach(paneName => addPaneToAvailableList(paneName)); // usedInTree.forEach(paneName => addPaneToAvailableList(paneName));
@@ -132,19 +132,19 @@ const handleChildRemove = (payload: { parentNodeId: string | undefined; nodeInde
<!-- 节点控制栏 --> <!-- 节点控制栏 -->
<div class="node-controls"> <div class="node-controls">
<span class="node-info"> <span class="node-info">
{{ node.type === 'pane' ? (props.paneLabels[node.component!] || node.component) : `容器 (${node.direction === 'horizontal' ? '水平' : '垂直'})` }} {{ node.type === 'pane' ? (props.paneLabels[node.component!] || node.component) : t('layoutNodeEditor.containerLabel', { direction: node.direction === 'horizontal' ? t('layoutNodeEditor.horizontal') : t('layoutNodeEditor.vertical') }) }}
</span> </span>
<div class="node-actions"> <div class="node-actions">
<button v-if="node.type === 'container'" @click="toggleDirection" title="切换方向" class="action-button"> <button v-if="node.type === 'container'" @click="toggleDirection" :title="t('layoutNodeEditor.toggleDirection')" class="action-button">
<i class="fas fa-sync-alt"></i> <i class="fas fa-sync-alt"></i>
</button> </button>
<button v-if="node.type === 'container'" @click="addHorizontalContainer" title="添加水平容器" class="action-button"> <button v-if="node.type === 'container'" @click="addHorizontalContainer" :title="t('layoutNodeEditor.addHorizontalContainer')" class="action-button">
<i class="fas fa-columns"></i> H <i class="fas fa-columns"></i> H
</button> </button>
<button v-if="node.type === 'container'" @click="addVerticalContainer" title="添加垂直容器" class="action-button"> <button v-if="node.type === 'container'" @click="addVerticalContainer" :title="t('layoutNodeEditor.addVerticalContainer')" class="action-button">
<i class="fas fa-bars"></i> V <i class="fas fa-bars"></i> V
</button> </button>
<button @click="removeSelf" title="移除此节点" class="action-button remove-button"> <button @click="removeSelf" :title="t('layoutNodeEditor.removeNode')" class="action-button remove-button">
<i class="fas fa-trash-alt"></i> <i class="fas fa-trash-alt"></i>
</button> </button>
</div> </div>
@@ -165,7 +165,7 @@ const handleChildRemove = (payload: { parentNodeId: string | undefined; nodeInde
> >
<template #item="{ element: childNode, index }"> <template #item="{ element: childNode, index }">
<div class="child-node-wrapper" :key="childNode.id"> <div class="child-node-wrapper" :key="childNode.id">
<i class="fas fa-grip-vertical drag-handle-node" title="拖拽调整顺序或移动"></i> <i class="fas fa-grip-vertical drag-handle-node" :title="t('layoutNodeEditor.dragHandle')"></i>
<LayoutNodeEditor <LayoutNodeEditor
:node="childNode" :node="childNode"
@@ -180,7 +180,7 @@ const handleChildRemove = (payload: { parentNodeId: string | undefined; nodeInde
<!-- 容器为空时的占位符 --> <!-- 容器为空时的占位符 -->
<template #footer> <template #footer>
<div v-if="!childrenList || childrenList.length === 0" class="empty-container-placeholder"> <div v-if="!childrenList || childrenList.length === 0" class="empty-container-placeholder">
将面板或容器拖拽到此处 {{ t('layoutNodeEditor.dropHere') }}
</div> </div>
</template> </template>
</draggable> </draggable>
@@ -182,7 +182,7 @@ const toggleButtonTitle = computed(() => {
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /> <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg> </svg>
</button> </button>
<h3 class="text-lg font-semibold text-center mb-4">选择要连接的服务器</h3> <h3 class="text-lg font-semibold text-center mb-4">{{ t('terminalTabBar.selectServerTitle') }}</h3>
<div class="flex-grow overflow-y-auto border border-border rounded"> <div class="flex-grow overflow-y-auto border border-border rounded">
<WorkspaceConnectionListComponent <WorkspaceConnectionListComponent
@connect-request="handlePopupConnect" @connect-request="handlePopupConnect"
+20 -1
View File
@@ -629,7 +629,23 @@
"layoutPreview": "Layout Preview", "layoutPreview": "Layout Preview",
"resetDefault": "Reset to Default", "resetDefault": "Reset to Default",
"noAvailablePanes": "All panes are already in the layout", "noAvailablePanes": "All panes are already in the layout",
"emptyLayout": "Layout is empty. Drag panes from the left or add a container." "emptyLayout": "Layout is empty. Drag panes from the left or add a container.",
"leftSidebar": "Left Sidebar Panes",
"rightSidebar": "Right Sidebar Panes",
"dropHere": "Drop panes from available list here",
"saveError": "Error saving layout. Please try again later.",
"confirmClearLayout": "Are you sure you want to clear the entire layout? All panes will return to the available list."
},
"layoutNodeEditor": {
"containerLabel": "Container ({direction})",
"horizontal": "Horizontal",
"vertical": "Vertical",
"toggleDirection": "Toggle Direction",
"addHorizontalContainer": "Add Horizontal Container",
"addVerticalContainer": "Add Vertical Container",
"removeNode": "Remove this node",
"dragHandle": "Drag to reorder or move",
"dropHere": "Drop panes or containers here"
}, },
"auditLog": { "auditLog": {
"title": "Audit Logs", "title": "Audit Logs",
@@ -835,5 +851,8 @@
"recentActivity": "Recent Activity", "recentActivity": "Recent Activity",
"noRecentActivity": "No recent activity records", "noRecentActivity": "No recent activity records",
"viewFullAuditLog": "View Full Audit Log" "viewFullAuditLog": "View Full Audit Log"
},
"terminalTabBar": {
"selectServerTitle": "Select server to connect"
} }
} }
+17 -1
View File
@@ -634,7 +634,20 @@
"rightSidebar": "右侧栏面板", "rightSidebar": "右侧栏面板",
"dropHere": "从可用面板拖拽到此处", "dropHere": "从可用面板拖拽到此处",
"confirmClose": "有未保存的更改,确定要关闭吗?", "confirmClose": "有未保存的更改,确定要关闭吗?",
"confirmReset": "确定要恢复默认布局和侧栏配置吗?当前更改将丢失。" "confirmReset": "确定要恢复默认布局和侧栏配置吗?当前更改将丢失。",
"saveError": "保存布局时出错,请稍后再试。",
"confirmClearLayout": "确定要清空整个布局吗?所有面板将返回可用列表。"
},
"layoutNodeEditor": {
"containerLabel": "容器 ({direction})",
"horizontal": "水平",
"vertical": "垂直",
"toggleDirection": "切换方向",
"addHorizontalContainer": "添加水平容器",
"addVerticalContainer": "添加垂直容器",
"removeNode": "移除此节点",
"dragHandle": "拖拽调整顺序或移动",
"dropHere": "将面板或容器拖拽到此处"
}, },
"auditLog": { "auditLog": {
"title": "审计日志", "title": "审计日志",
@@ -840,5 +853,8 @@
"recentActivity": "最近活动", "recentActivity": "最近活动",
"noRecentActivity": "没有最近活动记录", "noRecentActivity": "没有最近活动记录",
"viewFullAuditLog": "查看完整审计日志" "viewFullAuditLog": "查看完整审计日志"
},
"terminalTabBar": {
"selectServerTitle": "选择要连接的服务器"
} }
} }