mirror of https://github.com/1Panel-dev/1Panel
fix: 解决 compose 创建失败的问题
parent
a94e78d31e
commit
5a3a123be7
|
@ -129,7 +129,7 @@ type ComposeContainer struct {
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
}
|
}
|
||||||
type ComposeCreate struct {
|
type ComposeCreate struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name"`
|
||||||
From string `json:"from" validate:"required,oneof=edit path template"`
|
From string `json:"from" validate:"required,oneof=edit path template"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
|
|
|
@ -170,7 +170,7 @@ func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error {
|
||||||
global.LOG.Infof("docker-compose %s %s successful", req.Operation, req.Name)
|
global.LOG.Infof("docker-compose %s %s successful", req.Operation, req.Name)
|
||||||
if req.Operation == "down" {
|
if req.Operation == "down" {
|
||||||
_ = composeRepo.DeleteRecord(commonRepo.WithByName(req.Name))
|
_ = 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
|
return nil
|
||||||
|
|
|
@ -204,7 +204,7 @@ const onSubmit = async () => {
|
||||||
MsgError(i18n.global.t('commons.msg.fileNameErr'));
|
MsgError(i18n.global.t('commons.msg.fileNameErr'));
|
||||||
return;
|
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) {
|
if (!res.data) {
|
||||||
MsgError(i18n.global.t('commons.msg.fileExist'));
|
MsgError(i18n.global.t('commons.msg.fileExist'));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</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">
|
<el-input @input="changePath" v-model.trim="form.name">
|
||||||
<template #prepend>{{ $t('file.dir') }}</template>
|
<template #prepend>{{ $t('file.dir') }}</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
|
@ -83,6 +83,15 @@ const form = reactive({
|
||||||
});
|
});
|
||||||
|
|
||||||
const acceptParams = (): void => {
|
const acceptParams = (): void => {
|
||||||
|
form.name = '';
|
||||||
|
form.labelStr = '';
|
||||||
|
form.labels = [];
|
||||||
|
form.optionStr = '';
|
||||||
|
form.options = [];
|
||||||
|
form.driver = '';
|
||||||
|
form.subnet = '';
|
||||||
|
form.gateway = '';
|
||||||
|
form.scope = '';
|
||||||
drawerVisiable.value = true;
|
drawerVisiable.value = true;
|
||||||
};
|
};
|
||||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||||
|
@ -92,7 +101,7 @@ const handleClose = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
name: [Rules.requiredInput, Rules.imageName],
|
name: [Rules.requiredInput],
|
||||||
driver: [Rules.requiredSelect],
|
driver: [Rules.requiredSelect],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
:data="data"
|
:data="data"
|
||||||
@search="search"
|
@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('commons.table.name')" prop="name" min-width="60" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('container.downloadUrl')"
|
:label="$t('container.downloadUrl')"
|
||||||
|
@ -129,11 +128,6 @@ const search = async () => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function selectable(row) {
|
|
||||||
return !(row.name === 'Docker Hub');
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogRef = ref();
|
const dialogRef = ref();
|
||||||
const onOpenDialog = async (
|
const onOpenDialog = async (
|
||||||
title: string,
|
title: string,
|
||||||
|
|
|
@ -219,6 +219,7 @@ const submitStop = async () => {
|
||||||
await dockerOperate(param)
|
await dockerOperate(param)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
stopVisiable.value = false;
|
||||||
search();
|
search();
|
||||||
changeMode();
|
changeMode();
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
</template>
|
</template>
|
||||||
<span class="status-count">{{ dialogData.rowData!.targetDir }}</span>
|
<span class="status-count">{{ dialogData.rowData!.targetDir }}</span>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="currentRecord?.status! === 'Success'"
|
v-if="currentRecord?.status === 'Success'"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="margin-left: 10px"
|
style="margin-left: 10px"
|
||||||
link
|
link
|
||||||
|
|
Loading…
Reference in New Issue