diff --git a/backend/app/api/v1/container.go b/backend/app/api/v1/container.go index d6acae97d..89029b8fe 100644 --- a/backend/app/api/v1/container.go +++ b/backend/app/api/v1/container.go @@ -189,7 +189,11 @@ func (b *BaseApi) ContainerExec(c *gin.Context) { if wshandleError(wsConn, errors.WithMessage(err, "New docker client failed.")) { return } - conf := types.ExecConfig{Tty: true, Cmd: []string{command}, AttachStderr: true, AttachStdin: true, AttachStdout: true, User: user} + + conf := types.ExecConfig{Tty: true, Cmd: []string{command}, AttachStderr: true, AttachStdin: true, AttachStdout: true} + if len(user) != 0 { + conf.User = user + } ir, err := client.ContainerExecCreate(context.TODO(), containerID, conf) if wshandleError(wsConn, errors.WithMessage(err, "failed to set exec conf.")) { return diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index a1de7a993..46360aa8d 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -301,6 +301,7 @@ export default { last10Min: 'Last 10 Minutes', custom: 'Custom', + emptyUser: 'When empty, you will log in with the default user of container', containerTerminal: 'Container terminal', containerCreate: 'Container create', @@ -610,6 +611,9 @@ export default { safeEntranceHelper: 'Panel management portal. You can log in to the panel only through a specified security portal, for example: onepanel', expirationTime: 'Expiration Time', + unSetting: 'Not set', + noneSetting: + 'Set the expiration time for the panel password. After the expiration, you need to reset the password', days: 'Expiration Days', expiredHelper: 'The current password has expired. Please change the password again.', timeoutHelper: diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 23d74be7e..26479ff24 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -307,6 +307,7 @@ export default { custom: '自定义', containerTerminal: '容器终端', + emptyUser: '为空时,将使用容器默认的用户登录', containerCreate: '容器创建', port: '端口', @@ -625,6 +626,8 @@ export default { safeEntrance: '安全入口', safeEntranceHelper: '面板管理入口,设置后只能通过指定安全入口登录面板,如: onepanel', expirationTime: '密码过期时间', + unSetting: '未设置', + noneSetting: '为面板密码设置过期时间,过期后需要重新设置密码', days: '过期天数', expiredHelper: '当前密码已过期,请重新修改密码:', timeoutHelper: '【 {0} 天后 】面板密码即将过期,过期后需要重新设置密码', diff --git a/frontend/src/routers/modules/host.ts b/frontend/src/routers/modules/host.ts index 85c45f3b3..c15199927 100644 --- a/frontend/src/routers/modules/host.ts +++ b/frontend/src/routers/modules/host.ts @@ -10,14 +10,6 @@ const hostRouter = { title: 'menu.host', }, children: [ - // { - // path: '/hosts/security', - // name: 'Security', - // component: () => import('@/views/host/security/index.vue'), - // meta: { - // title: 'menu.security', - // }, - // }, { path: '/hosts/files', name: 'File', @@ -35,9 +27,29 @@ const hostRouter = { }, }, { - path: '/host/terminal', + path: '/hosts/terminal', name: 'Terminal', - component: () => import('@/views/host/terminal/index.vue'), + component: () => import('@/views/host/terminal/terminal/index.vue'), + meta: { + title: 'menu.terminal', + keepAlive: true, + }, + }, + { + path: '/hosts/host', + name: 'TerminalHost', + hidden: true, + component: () => import('@/views/host/terminal/host/index.vue'), + meta: { + title: 'menu.terminal', + keepAlive: true, + }, + }, + { + path: '/hosts/command', + name: 'TerminalCommand', + hidden: true, + component: () => import('@/views/host/terminal/command/index.vue'), meta: { title: 'menu.terminal', keepAlive: true, diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index bb8dbeaec..dc805e149 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -67,32 +67,7 @@ - - - - - + (), { filters: '', }); -const detailVisiable = ref(false); const detailInfo = ref(); +const mydetail = ref(); + const extensions = [javascript(), oneDark]; const logVisiable = ref(false); const logInfo = ref(); @@ -275,7 +252,11 @@ const onTerminal = (containerID: string) => { const onInspect = async (id: string) => { const res = await inspect({ id: id, type: 'container' }); detailInfo.value = JSON.stringify(JSON.parse(res.data), null, 2); - detailVisiable.value = true; + let param = { + header: i18n.global.t('commons.button.view'), + detailInfo: detailInfo.value, + }; + mydetail.value!.acceptParams(param); }; const onLog = async (row: Container.ContainerInfo) => { @@ -336,14 +317,14 @@ const checkStatus = (operation: string) => { return false; case 'stop': for (const item of selects.value) { - if (item.state === 'stopped') { + if (item.state === 'stopped' || item.state === 'exited') { return true; } } return false; case 'pause': for (const item of selects.value) { - if (item.state === 'paused') { + if (item.state === 'paused' || item.state === 'exited') { return true; } } diff --git a/frontend/src/views/container/container/terminal/index.vue b/frontend/src/views/container/container/terminal/index.vue index 91a8a94da..aca275b91 100644 --- a/frontend/src/views/container/container/terminal/index.vue +++ b/frontend/src/views/container/container/terminal/index.vue @@ -12,8 +12,9 @@ - - + + + {{ $t('container.emptyUser') }} @@ -77,7 +78,7 @@ const acceptParams = async (params: DialogProps): Promise => { terminalVisiable.value = true; form.containerID = params.containerID; form.isCustom = false; - form.user = 'root'; + form.user = ''; form.command = '/bin/bash'; terminalOpen.value = false; window.addEventListener('resize', changeTerminalSize); diff --git a/frontend/src/views/container/repo/index.vue b/frontend/src/views/container/repo/index.vue index 689966058..5509dbff6 100644 --- a/frontend/src/views/container/repo/index.vue +++ b/frontend/src/views/container/repo/index.vue @@ -58,9 +58,8 @@ const search = async () => { pageSize: paginationConfig.pageSize, }; await searchImageRepo(params).then((res) => { - if (res.data) { - data.value = res.data.items; - } + data.value = res.data.items || []; + paginationConfig.total = res.data.total; }); }; diff --git a/frontend/src/views/host/terminal/command/index.vue b/frontend/src/views/host/terminal/command/index.vue index 6f6d3f59c..35028744c 100644 --- a/frontend/src/views/host/terminal/command/index.vue +++ b/frontend/src/views/host/terminal/command/index.vue @@ -1,18 +1,20 @@