Skip to content

Commit 4e27397

Browse files
committed
refactor: 应用卡片打开容器终端,适配多个容器情况
1 parent a836758 commit 4e27397

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

frontend/src/views/app-store/installed/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@ const openLog = (row: any) => {
731731
};
732732
733733
const openTerminal = (row: any) => {
734-
dialogTerminalRef.value!.acceptParams({ containerID: row.container, container: row.container });
734+
const title = i18n.global.t('app.app') + ' ' + row.name;
735+
dialogTerminalRef.value!.acceptParams({ containerID: row.container, title: title });
735736
};
736737
737738
const getConfig = async () => {

frontend/src/views/container/compose/detail/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ const onMonitor = (row: any) => {
298298
299299
const dialogTerminalRef = ref();
300300
const onTerminal = (row: any) => {
301-
dialogTerminalRef.value!.acceptParams({ containerID: row.containerID, container: row.name });
301+
const title = i18n.global.t('menu.container') + ' ' + row.name;
302+
dialogTerminalRef.value!.acceptParams({ containerID: row.containerID, title: title });
302303
};
303304
304305
const buttons = [

frontend/src/views/container/container/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ const onMonitor = (row: any) => {
614614
615615
const dialogTerminalRef = ref();
616616
const onTerminal = (row: any) => {
617-
dialogTerminalRef.value!.acceptParams({ containerID: row.containerID, container: row.name });
617+
const title = i18n.global.t('menu.container') + ' ' + row.name;
618+
dialogTerminalRef.value!.acceptParams({ containerID: row.containerID, title: title });
618619
};
619620
620621
const onInspect = async (id: string) => {

frontend/src/views/container/container/terminal/index.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
>
1010
<template #content>
1111
<el-form ref="formRef" :model="form" label-position="top">
12+
<el-form-item :label="$t('menu.container')" prop="containerID" v-if="form.containerIDList.length > 1">
13+
<el-select placeholder="container" clearable v-model="form.containerID">
14+
<el-option v-for="item in form.containerIDList" :key="item" :label="item" :value="item" />
15+
</el-select>
16+
</el-form-item>
1217
<el-form-item :label="$t('commons.table.user')" prop="user">
1318
<el-input placeholder="root" clearable v-model="form.user" />
1419
</el-form-item>
@@ -67,18 +72,20 @@ const form = reactive({
6772
command: '',
6873
user: '',
6974
containerID: '',
75+
containerIDList: [],
7076
});
7177
const formRef = ref();
7278
const terminalRef = ref<InstanceType<typeof Terminal> | null>(null);
7379
7480
interface DialogProps {
7581
containerID: string;
76-
container: string;
82+
title: string;
7783
}
7884
const acceptParams = async (params: DialogProps): Promise<void> => {
7985
terminalVisible.value = true;
80-
form.containerID = params.containerID;
81-
title.value = params.container;
86+
form.containerIDList = params.containerID.split(',');
87+
form.containerID = form.containerIDList[0];
88+
title.value = params.title;
8289
form.isCustom = false;
8390
form.user = '';
8491
form.command = '/bin/sh';

0 commit comments

Comments
 (0)