From 7972de5f33de3116285b7e7396b57764a578d096 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:58:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=B9=E5=99=A8=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=89=B9=E6=9D=83=E6=A8=A1=E5=BC=8F=20(#3021?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/container.go | 1 + backend/app/service/container.go | 1 + frontend/src/api/interface/container.ts | 1 + frontend/src/lang/modules/en.ts | 3 +++ frontend/src/lang/modules/tw.ts | 2 ++ frontend/src/lang/modules/zh.ts | 2 ++ frontend/src/views/container/container/operate/index.vue | 6 ++++++ 7 files changed, 16 insertions(+) diff --git a/backend/app/dto/container.go b/backend/app/dto/container.go index 767edfc62..b2364e1e1 100644 --- a/backend/app/dto/container.go +++ b/backend/app/dto/container.go @@ -52,6 +52,7 @@ type ContainerOperate struct { CPUShares int64 `json:"cpuShares"` NanoCPUs float64 `json:"nanoCPUs"` Memory float64 `json:"memory"` + Privileged bool `json:"privileged"` AutoRemove bool `json:"autoRemove"` Volumes []VolumeHelper `json:"volumes"` Labels []string `json:"labels"` diff --git a/backend/app/service/container.go b/backend/app/service/container.go index c5dc18f43..c9d188404 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -937,6 +937,7 @@ func loadConfigInfo(isCreate bool, req dto.ContainerOperate, oldContainer *types networkConf = network.NetworkingConfig{} } + hostConf.Privileged = req.Privileged hostConf.AutoRemove = req.AutoRemove hostConf.CPUShares = req.CPUShares hostConf.PublishAllPorts = req.PublishAllPorts diff --git a/frontend/src/api/interface/container.ts b/frontend/src/api/interface/container.ts index 4b8d7d003..e348c3ddd 100644 --- a/frontend/src/api/interface/container.ts +++ b/frontend/src/api/interface/container.ts @@ -40,6 +40,7 @@ export namespace Container { cpuShares: number; memory: number; volumes: Array; + privileged: boolean; autoRemove: boolean; labels: Array; labelsStr: string; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 35270652d..111dd2129 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -576,6 +576,9 @@ const message = { custom: 'Custom', emptyUser: 'When empty, you will log in as default', containerTerminal: 'Terminal', + privileged: 'Privileged', + privilegedHelper: + 'Allows the container to perform certain privileged operations on the host, which may increase container risks. Use with caution!', upgradeHelper: 'This operation only supports upgrading container versions.', ignoreCompare: 'Force Upgrade', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index aa1010042..b5a800bbc 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -560,6 +560,8 @@ const message = { custom: '自定義', containerTerminal: '終端', emptyUser: '為空時,將使用容器默認的用戶登錄', + privileged: '特權模式', + privilegedHelper: '允許容器在主機上執行某些特權操作,可能會增加容器風險,請謹慎開啟!', upgradeHelper: '該操作僅支持容器版本升級', ignoreCompare: '強製升級', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 774e812fb..eb94800ff 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -561,6 +561,8 @@ const message = { custom: '自定义', containerTerminal: '终端', emptyUser: '为空时,将使用容器默认的用户登录', + privileged: '特权模式', + privilegedHelper: '允许容器在主机上执行某些特权操作,可能会增加容器风险,谨慎开启!', upgradeHelper: '该操作仅支持容器版本升级', ignoreCompare: '强制升级', diff --git a/frontend/src/views/container/container/operate/index.vue b/frontend/src/views/container/container/operate/index.vue index 1a5ebf90a..7960916ae 100644 --- a/frontend/src/views/container/container/operate/index.vue +++ b/frontend/src/views/container/container/operate/index.vue @@ -184,6 +184,12 @@ {{ $t('container.autoRemove') }} + + + {{ $t('commons.button.start') }} + + {{ $t('container.privilegedHelper') }} + {{ $t('container.tty') }}