fix: 解决 compose 创建失败的问题

pull/205/head
ssongliu 2023-03-13 18:36:47 +08:00 committed by ssongliu
parent a94e78d31e
commit 5a3a123be7
8 changed files with 16 additions and 12 deletions

View File

@ -129,7 +129,7 @@ type ComposeContainer struct {
State string `json:"state"`
}
type ComposeCreate struct {
Name string `json:"name" validate:"required"`
Name string `json:"name"`
From string `json:"from" validate:"required,oneof=edit path template"`
File string `json:"file"`
Path string `json:"path"`

View File

@ -170,7 +170,7 @@ func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error {
global.LOG.Infof("docker-compose %s %s successful", req.Operation, req.Name)
if req.Operation == "down" {
_ = composeRepo.DeleteRecord(commonRepo.WithByName(req.Name))
_ = os.RemoveAll(strings.ReplaceAll(req.Path, req.Name+"/docker-compose.yml", ""))
_ = os.RemoveAll(strings.ReplaceAll(req.Path, "/docker-compose.yml", ""))
}
return nil

View File

@ -204,7 +204,7 @@ const onSubmit = async () => {
MsgError(i18n.global.t('commons.msg.fileNameErr'));
return;
}
const res = await CheckFile(baseDir.value + '/' + uploaderFiles.value[0]!.raw.name);
const res = await CheckFile(baseDir.value + uploaderFiles.value[0]!.raw.name);
if (!res.data) {
MsgError(i18n.global.t('commons.msg.fileExist'));
return;

View File

@ -24,7 +24,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item v-if="form.from === 'edit'" prop="name">
<el-form-item v-if="form.from === 'edit' || form.from === 'template'" prop="name">
<el-input @input="changePath" v-model.trim="form.name">
<template #prepend>{{ $t('file.dir') }}</template>
</el-input>

View File

@ -83,6 +83,15 @@ const form = reactive({
});
const acceptParams = (): void => {
form.name = '';
form.labelStr = '';
form.labels = [];
form.optionStr = '';
form.options = [];
form.driver = '';
form.subnet = '';
form.gateway = '';
form.scope = '';
drawerVisiable.value = true;
};
const emit = defineEmits<{ (e: 'search'): void }>();
@ -92,7 +101,7 @@ const handleClose = () => {
};
const rules = reactive({
name: [Rules.requiredInput, Rules.imageName],
name: [Rules.requiredInput],
driver: [Rules.requiredSelect],
});

View File

@ -39,7 +39,6 @@
:data="data"
@search="search"
>
<el-table-column type="selection" :selectable="selectable" fix />
<el-table-column :label="$t('commons.table.name')" prop="name" min-width="60" />
<el-table-column
:label="$t('container.downloadUrl')"
@ -129,11 +128,6 @@ const search = async () => {
loading.value = false;
});
};
function selectable(row) {
return !(row.name === 'Docker Hub');
}
const dialogRef = ref();
const onOpenDialog = async (
title: string,

View File

@ -219,6 +219,7 @@ const submitStop = async () => {
await dockerOperate(param)
.then(() => {
loading.value = false;
stopVisiable.value = false;
search();
changeMode();
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));

View File

@ -134,7 +134,7 @@
</template>
<span class="status-count">{{ dialogData.rowData!.targetDir }}</span>
<el-button
v-if="currentRecord?.status! === 'Success'"
v-if="currentRecord?.status === 'Success'"
type="primary"
style="margin-left: 10px"
link