update
This commit is contained in:
@@ -155,11 +155,11 @@ const componentProps = computed(() => {
|
||||
// WorkspaceConnectionList 需要转发 connect-request 等事件
|
||||
return {
|
||||
class: 'pane-content',
|
||||
// 绑定内部处理器以转发事件 (修正为 kebab-case)
|
||||
// 绑定内部处理器以转发事件 (除了 request-add-connection)
|
||||
onConnectRequest: (id: number) => emit('connect-request', id),
|
||||
onOpenNewSession: (id: number) => emit('open-new-session', id),
|
||||
onRequestAddConnection: () => emit('request-add-connection'),
|
||||
onRequestEditConnection: (conn: any) => emit('request-edit-connection', conn), // 使用 any 避免类型问题
|
||||
// onRequestAddConnection: () => { ... }, // 移除,将在模板中处理
|
||||
onRequestEditConnection: (conn: any) => emit('request-edit-connection', conn),
|
||||
};
|
||||
case 'commandHistory':
|
||||
case 'quickCommands':
|
||||
@@ -234,7 +234,10 @@ const handlePaneResize = (eventData: { panes: Array<{ size: number; [key: string
|
||||
@save-editor-tab="emit('saveEditorTab', $event)"
|
||||
@connect-request="emit('connect-request', $event)"
|
||||
@open-new-session="emit('open-new-session', $event)"
|
||||
@request-add-connection="emit('request-add-connection')"
|
||||
@request-add-connection="() => { // 添加日志
|
||||
console.log(`[LayoutRenderer ${props.layoutNode.id}] Received recursive 'request-add-connection', emitting upwards.`);
|
||||
emit('request-add-connection');
|
||||
}"
|
||||
@request-edit-connection="emit('request-edit-connection', $event)"
|
||||
/>
|
||||
</pane>
|
||||
@@ -297,7 +300,22 @@ const handlePaneResize = (eventData: { panes: Array<{ size: number; [key: string
|
||||
</template>
|
||||
<!-- 其他面板正常渲染 (不依赖 activeSession 的) -->
|
||||
<template v-else-if="currentComponent">
|
||||
<component :is="currentComponent" v-bind="componentProps" />
|
||||
<!-- 特别处理 connections 组件以添加事件监听器 -->
|
||||
<component
|
||||
v-if="layoutNode.component === 'connections'"
|
||||
:is="currentComponent"
|
||||
v-bind="componentProps"
|
||||
@request-add-connection="() => {
|
||||
console.log(`[LayoutRenderer ${props.layoutNode.id}] Template received 'request-add-connection', emitting upwards.`);
|
||||
emit('request-add-connection');
|
||||
}"
|
||||
/>
|
||||
<!-- 渲染其他组件 -->
|
||||
<component
|
||||
v-else
|
||||
:is="currentComponent"
|
||||
v-bind="componentProps"
|
||||
/>
|
||||
</template>
|
||||
<!-- 如果找不到组件 -->
|
||||
<div v-else class="pane-placeholder error">
|
||||
|
||||
@@ -27,7 +27,12 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['activate-session', 'close-session', 'open-layout-configurator']); // 添加新事件
|
||||
const emit = defineEmits([
|
||||
'activate-session',
|
||||
'close-session',
|
||||
'open-layout-configurator',
|
||||
'request-add-connection-from-popup' // 新增:声明从弹窗发出的添加请求事件
|
||||
]);
|
||||
|
||||
const activateSession = (sessionId: string) => {
|
||||
if (sessionId !== props.activeSessionId) {
|
||||
@@ -57,6 +62,13 @@ const handlePopupConnect = (connectionId: number) => {
|
||||
showConnectionListPopup.value = false; // 关闭弹出窗口
|
||||
};
|
||||
|
||||
// 新增:处理从弹窗内部发出的添加连接请求
|
||||
const handleRequestAddFromPopup = () => {
|
||||
console.log('[TabBar] Received request-add-connection from popup component.');
|
||||
showConnectionListPopup.value = false; // 关闭弹窗
|
||||
emit('request-add-connection-from-popup'); // 向上发出事件
|
||||
};
|
||||
|
||||
// --- 新增:布局菜单处理 ---
|
||||
const toggleLayoutMenu = () => {
|
||||
console.log('Toggling layout menu visibility. Current state:', showLayoutMenu.value); // 添加日志
|
||||
@@ -151,6 +163,7 @@ const handleTogglePane = (paneName: PaneName) => {
|
||||
<WorkspaceConnectionListComponent
|
||||
@connect-request="handlePopupConnect"
|
||||
@open-new-session="handlePopupConnect"
|
||||
@request-add-connection="handleRequestAddFromPopup"
|
||||
class="popup-connection-list"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -197,7 +197,13 @@ const handleOpenInNewTab = (connectionId: number) => {
|
||||
:placeholder="t('workspaceConnectionList.searchPlaceholder')"
|
||||
class="search-input"
|
||||
/>
|
||||
<!-- Add button removed -->
|
||||
<button
|
||||
class="add-button"
|
||||
@click="handleMenuAction('add')"
|
||||
:title="t('connections.addConnection')"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 连接列表区域 -->
|
||||
|
||||
@@ -64,8 +64,9 @@ onBeforeUnmount(() => {
|
||||
sessionStore.cleanupAllSessions();
|
||||
});
|
||||
|
||||
// --- 本地方法 (仅处理 UI 状态) ---
|
||||
// --- 本地方法 (仅处理 UI 状态) ---
|
||||
const handleRequestAddConnection = () => {
|
||||
console.log('[WorkspaceView] handleRequestAddConnection 被调用!'); // 添加日志确认事件到达
|
||||
connectionToEdit.value = null;
|
||||
showAddEditForm.value = true;
|
||||
};
|
||||
@@ -249,6 +250,7 @@ onBeforeUnmount(() => {
|
||||
@activate-session="sessionStore.activateSession"
|
||||
@close-session="sessionStore.closeSession"
|
||||
@open-layout-configurator="handleOpenLayoutConfigurator"
|
||||
@request-add-connection-from-popup="handleRequestAddConnection"
|
||||
/>
|
||||
|
||||
<div class="main-content-area">
|
||||
|
||||
Reference in New Issue
Block a user