Browse Source

feat: 容器编辑增加提示信息 (#2529)

pull/2537/head
ssongliu 1 year ago committed by GitHub
parent
commit
1f92324a45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      frontend/src/lang/modules/en.ts
  2. 1
      frontend/src/lang/modules/tw.ts
  3. 1
      frontend/src/lang/modules/zh.ts
  4. 35
      frontend/src/views/container/container/operate/index.vue

2
frontend/src/lang/modules/en.ts

@ -546,6 +546,8 @@ const message = {
cpuShareHelper:
'The default CPU share for a container is 1024, which can be increased to give the container more CPU time.',
containerFromAppHelper:
'Detected that this container originates from the app store. App operations may cause current edits to be invalidated.',
command: 'Command',
console: 'Console Interaction',
tty: 'TTY (-t)',

1
frontend/src/lang/modules/tw.ts

@ -532,6 +532,7 @@ const message = {
cpuShare: 'CPU 權重',
cpuShareHelper: '容器默認份額為 1024 CPU增大可使當前容器獲得更多的 CPU 時間',
containerFromAppHelper: '檢測到該容器來源於應用商店應用操作可能會導致當前編輯失效',
command: '命令',
console: '控製臺交互',
tty: '偽終端 ( -t )',

1
frontend/src/lang/modules/zh.ts

@ -532,6 +532,7 @@ const message = {
cpuShare: 'CPU 权重',
cpuShareHelper: '容器默认份额为 1024 CPU增大可使当前容器获得更多的 CPU 时间',
containerFromAppHelper: '检测到该容器来源于应用商店应用操作可能会导致当前编辑失效',
command: '命令',
console: '控制台交互',
tty: '伪终端 ( -t )',

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

@ -24,6 +24,13 @@
>
<el-row type="flex" justify="center">
<el-col :span="22">
<el-alert
v-if="dialogData.title === 'edit'"
:title="$t('container.containerFromAppHelper')"
class="common-prompt"
:closable="false"
type="error"
/>
<el-form-item :label="$t('commons.table.name')" prop="name">
<el-input clearable v-model.trim="dialogData.rowData!.name" />
</el-form-item>
@ -171,7 +178,7 @@
<el-form-item label="Command" prop="cmdStr">
<el-input v-model="dialogData.rowData!.cmdStr" :placeholder="$t('container.cmdHelper')" />
</el-form-item>
<el-form-item label="Entrypoint" prop="entrypoint">
<el-form-item label="Entrypoint" prop="entrypointStr">
<el-input
v-model="dialogData.rowData!.entrypointStr"
:placeholder="$t('container.entrypointHelper')"
@ -295,9 +302,14 @@ const acceptParams = (params: DialogProps): void => {
itemCmd += `'${item}' `;
}
dialogData.value.rowData.cmdStr = itemCmd ? itemCmd.substring(0, itemCmd.length - 1) : '';
if (dialogData.value.rowData.entrypoint) {
dialogData.value.rowData.entrypointStr = dialogData.value.rowData.entrypoint.join(' ');
let itemEntrypoint = '';
for (const item of dialogData.value.rowData.entrypoint) {
itemEntrypoint += `'${item}' `;
}
dialogData.value.rowData.entrypointStr = itemEntrypoint
? itemEntrypoint.substring(0, itemEntrypoint.length - 1)
: '';
dialogData.value.rowData.labels = dialogData.value.rowData.labels || [];
dialogData.value.rowData.env = dialogData.value.rowData.env || [];
dialogData.value.rowData.labelsStr = dialogData.value.rowData.labels.join('\n');
@ -435,8 +447,21 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
}
}
}
if (dialogData.value.rowData!.entrypointStr) {
dialogData.value.rowData!.entrypoint = dialogData.value.rowData!.entrypointStr.split(' ');
dialogData.value.rowData!.entrypoint = [];
if (dialogData.value.rowData?.entrypointStr) {
if (dialogData.value.rowData?.entrypointStr.indexOf(`'`) !== -1) {
let itemEntrypoint = dialogData.value.rowData!.entrypointStr.split(`'`);
for (const entry of itemEntrypoint) {
if (entry && entry !== ' ') {
dialogData.value.rowData!.entrypoint.push(entry);
}
}
} else {
let itemEntrypoint = dialogData.value.rowData!.entrypointStr.split(` `);
for (const entry of itemEntrypoint) {
dialogData.value.rowData!.entrypoint.push(entry);
}
}
}
if (dialogData.value.rowData!.publishAllPorts) {
dialogData.value.rowData!.exposedPorts = [];

Loading…
Cancel
Save