From 13dc94aca58a56febc6f322ad478b913d3521587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 11 Jun 2025 21:38:38 +0800 Subject: [PATCH] feat: Create a container and use a terminal to execute commands (#9022) Refs: #8795 --- .../src/views/container/container/operate/index.vue | 12 ++++++------ .../views/host/file-management/terminal/index.vue | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/container/container/operate/index.vue b/frontend/src/views/container/container/operate/index.vue index 43e73f2d0..a84293bc6 100644 --- a/frontend/src/views/container/container/operate/index.vue +++ b/frontend/src/views/container/container/operate/index.vue @@ -24,7 +24,7 @@ - + {{ $t('container.commandInput') }} @@ -423,9 +423,9 @@ - + @@ -434,7 +434,6 @@ import { reactive, ref } from 'vue'; import { Rules, checkFloatNumberRange, checkNumberRange } from '@/global/form-rules'; import i18n from '@/lang'; import { ElForm } from 'element-plus'; -import Command from '@/views/container/container/command/index.vue'; import Confirm from '@/views/container/container/operate/confirm.vue'; import { listImage, @@ -451,6 +450,7 @@ import { MsgError } from '@/utils/message'; import TaskLog from '@/components/log/task/index.vue'; import { checkIpV4V6, checkPort, newUUID } from '@/utils/util'; import router from '@/routers'; +import TerminalDialog from '@/views/host/file-management/terminal/index.vue'; const loading = ref(false); const isCreate = ref(); @@ -559,7 +559,6 @@ const search = async () => { loadNetworkOptions(); }; -const commandRef = ref(); const taskLogRef = ref(); const images = ref(); const volumes = ref(); @@ -584,8 +583,9 @@ const goBack = () => { router.push({ name: 'ContainerItem' }); }; -const openDialog = () => { - commandRef.value.acceptParams(); +const dialogTerminalRef = ref(); +const toTerminal = () => { + dialogTerminalRef.value!.acceptParams({ cwd: '$HOME', command: '/bin/sh' }); }; const handlePortsAdd = () => { diff --git a/frontend/src/views/host/file-management/terminal/index.vue b/frontend/src/views/host/file-management/terminal/index.vue index 5df3f1962..76cb9be0d 100644 --- a/frontend/src/views/host/file-management/terminal/index.vue +++ b/frontend/src/views/host/file-management/terminal/index.vue @@ -1,5 +1,11 @@