fix: compose file edit env (#8833)

Refs: #8826
This commit is contained in:
2025-05-26 17:34:17 +08:00 committed by GitHub
parent 1716e42ffe
commit 5d25f972ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 8 deletions

View file

@ -302,6 +302,8 @@ export namespace Container {
name: string; name: string;
path: string; path: string;
content: string; content: string;
env: Array<string>;
createdBy: string;
} }
export interface TemplateCreate { export interface TemplateCreate {

View file

@ -73,21 +73,19 @@ const onSubmitEdit = async () => {
name: name.value, name: name.value,
path: path.value, path: path.value,
content: content.value, content: content.value,
env: environmentStr.value,
createdBy: createdBy.value, createdBy: createdBy.value,
env: environmentStr.value?.split('\n') || [],
}; };
if (environmentStr.value != undefined) {
param.env = environmentStr.value.split('\n');
emit('search');
}
loading.value = true; loading.value = true;
await composeUpdate(param) await composeUpdate(param)
.then(() => { .then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
composeVisible.value = false; composeVisible.value = false;
if (environmentStr.value) {
emit('search');
}
}) })
.catch(() => { .finally(() => {
loading.value = false; loading.value = false;
}); });
}; };

View file

@ -85,7 +85,7 @@
</template> </template>
</LayoutContent> </LayoutContent>
<EditDialog ref="dialogEditRef" /> <EditDialog ref="dialogEditRef" @search="search" />
<CreateDialog @search="search" ref="dialogRef" /> <CreateDialog @search="search" ref="dialogRef" />
<DeleteDialog @search="search" ref="dialogDelRef" /> <DeleteDialog @search="search" ref="dialogDelRef" />
</div> </div>
@ -190,6 +190,8 @@ const onEdit = async (row: Container.ComposeInfo) => {
name: row.name, name: row.name,
path: row.path, path: row.path,
content: res.data, content: res.data,
env: row.env,
createdBy: row.createdBy,
}; };
dialogEditRef.value!.acceptParams(params); dialogEditRef.value!.acceptParams(params);
}; };