Skip to content

Commit d64ed8c

Browse files
authored
fix: Fix the issue of the container creation not popping up the task box (#7989)
1 parent 79b8d17 commit d64ed8c

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

agent/app/service/container.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,7 @@ func (u *ContainerService) StreamLogs(ctx *gin.Context, params dto.StreamLog) {
804804
select {
805805
case msg, ok := <-messageChan:
806806
if !ok {
807-
if msg == "" {
808-
return true
809-
}
810-
return false
807+
return msg == ""
811808
}
812809
_, err := fmt.Fprintf(w, "data: %v\n\n", msg)
813810
if err != nil {
@@ -1495,12 +1492,12 @@ func loadContainerPortForInfo(itemPorts []types.Port) []dto.PortHelper {
14951492
var exposedPorts []dto.PortHelper
14961493
samePortMap := make(map[string]dto.PortHelper)
14971494
ports := transPortToStr(itemPorts)
1498-
var itemPort dto.PortHelper
14991495
for _, item := range ports {
15001496
itemStr := strings.Split(item, "->")
15011497
if len(itemStr) < 2 {
15021498
continue
15031499
}
1500+
var itemPort dto.PortHelper
15041501
lastIndex := strings.LastIndex(itemStr[0], ":")
15051502
if lastIndex == -1 {
15061503
itemPort.HostPort = itemStr[0]

frontend/src/api/interface/container.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export namespace Container {
4949
memory: number;
5050
}
5151
export interface ContainerHelper {
52+
taskID: string;
5253
containerID: string;
5354
name: string;
5455
image: string;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@
7575
</el-button>
7676
<el-button-group>
7777
<el-button :disabled="checkStatus('start', null)" @click="onOperate('start', null)">
78-
{{ $t('app.start') }}
78+
{{ $t('commons.operate.start') }}
7979
</el-button>
8080
<el-button :disabled="checkStatus('stop', null)" @click="onOperate('stop', null)">
81-
{{ $t('app.stop') }}
81+
{{ $t('commons.operate.stop') }}
8282
</el-button>
8383
<el-button :disabled="checkStatus('restart', null)" @click="onOperate('restart', null)">
8484
{{ $t('commons.button.restart') }}
@@ -158,13 +158,13 @@
158158
:disabled="checkStatus('start', row)"
159159
@click="onOperate('start', row)"
160160
>
161-
{{ $t('app.start') }}
161+
{{ $t('commons.operate.start') }}
162162
</el-dropdown-item>
163163
<el-dropdown-item
164164
:disabled="checkStatus('stop', row)"
165165
@click="onOperate('stop', row)"
166166
>
167-
{{ $t('app.stop') }}
167+
{{ $t('commons.operate.stop') }}
168168
</el-dropdown-item>
169169
<el-dropdown-item
170170
:disabled="checkStatus('restart', row)"

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
<el-tab-pane :label="$t('container.mount')">
197197
<el-form-item>
198198
<el-table v-if="form.volumes.length !== 0" :data="form.volumes">
199-
<el-table-column :label="$t('container.server')" min-width="120">
199+
<el-table-column :label="$t('container.server')" min-width="150">
200200
<template #default="{ row }">
201201
<el-radio-group v-model="row.type">
202202
<el-radio-button value="volume">
@@ -234,7 +234,7 @@
234234
<el-input v-else v-model="row.sourceDir" />
235235
</template>
236236
</el-table-column>
237-
<el-table-column :label="$t('container.mode')" min-width="120">
237+
<el-table-column :label="$t('container.mode')" min-width="130">
238238
<template #default="{ row }">
239239
<el-radio-group v-model="row.mode">
240240
<el-radio value="rw">{{ $t('container.modeRW') }}</el-radio>
@@ -425,6 +425,7 @@
425425
</LayoutContent>
426426
<Command ref="commandRef" />
427427
<Confirm ref="confirmRef" @submit="submit" />
428+
<TaskLog ref="taskLogRef" width="70%" />
428429
</div>
429430
</template>
430431

@@ -446,14 +447,16 @@ import {
446447
loadContainerInfo,
447448
} from '@/api/modules/container';
448449
import { Container } from '@/api/interface/container';
449-
import { MsgError, MsgSuccess } from '@/utils/message';
450-
import { checkIpV4V6, checkPort } from '@/utils/util';
450+
import { MsgError } from '@/utils/message';
451+
import TaskLog from '@/components/task-log/index.vue';
452+
import { checkIpV4V6, checkPort, newUUID } from '@/utils/util';
451453
import router from '@/routers';
452454
453455
const loading = ref(false);
454456
const isCreate = ref();
455457
const confirmRef = ref();
456458
const form = reactive<Container.ContainerHelper>({
459+
taskID: '',
457460
containerID: '',
458461
name: '',
459462
image: '',
@@ -557,6 +560,7 @@ const search = async () => {
557560
};
558561
559562
const commandRef = ref();
563+
const taskLogRef = ref();
560564
const images = ref();
561565
const volumes = ref();
562566
const networks = ref();
@@ -654,6 +658,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
654658
};
655659
const submit = async () => {
656660
form.cmd = [];
661+
form.taskID = newUUID();
657662
if (form.cmdStr) {
658663
let itemCmd = splitStringIgnoringQuotes(form.cmdStr);
659664
for (const item of itemCmd) {
@@ -682,8 +687,7 @@ const submit = async () => {
682687
await createContainer(form)
683688
.then(() => {
684689
loading.value = false;
685-
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
686-
goBack();
690+
openTaskLog(form.taskID);
687691
})
688692
.catch(() => {
689693
loading.value = false;
@@ -692,8 +696,7 @@ const submit = async () => {
692696
await updateContainer(form)
693697
.then(() => {
694698
loading.value = false;
695-
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
696-
goBack();
699+
openTaskLog(form.taskID);
697700
})
698701
.catch(() => {
699702
updateContainerID();
@@ -702,6 +705,10 @@ const submit = async () => {
702705
}
703706
};
704707
708+
const openTaskLog = (taskID: string) => {
709+
taskLogRef.value.openWithTaskID(taskID);
710+
};
711+
705712
const updateContainerID = async () => {
706713
let params = {
707714
page: 1,

0 commit comments

Comments
 (0)