feat: support custom extension sources for PHP runtime (#10539)

This commit is contained in:
CityFun 2025-09-29 14:23:01 +08:00 committed by GitHub
parent 464ca8d272
commit f4a649dc2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 25 deletions

View file

@ -381,6 +381,9 @@ func (r *RuntimeService) Get(id uint) (*response.RuntimeDTO, error) {
appParam.Value = []string{}
} else {
appParam.Value = strings.Split(v, ",")
if strSlice, ok := appParam.Value.([]string); ok && len(strSlice) > 0 && strSlice[0] == "" {
appParam.Value = strSlice[1:]
}
}
} else {
for _, fv := range form.Values {

View file

@ -95,7 +95,7 @@
:rules="rules.params.CONTAINER_PACKAGE_URL"
v-if="runtime.params['PHP_VERSION'] != '5.6.40' && formFields['CONTAINER_PACKAGE_URL']"
>
<el-select v-model="runtime.source" filterable default-first-option>
<el-select v-model="runtime.source" filterable default-first-option allow-create>
<el-option
v-for="source in phpSources"
:key="source.label"
@ -391,32 +391,26 @@ const getApp = (appkey: string, mode: string) => {
const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
await formEl.validate((valid) => {
await formEl.validate(async (valid) => {
if (!valid) {
return;
}
if (mode.value == 'create') {
loading.value = true;
CreateRuntime(runtime)
.then((res) => {
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
handleClose();
em('submit', res.data.id);
})
.finally(() => {
loading.value = false;
});
} else {
loading.value = true;
UpdateRuntime(runtime)
.then(() => {
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
handleClose();
em('submit', runtime.id);
})
.finally(() => {
loading.value = false;
});
try {
let res;
if (mode.value == 'create') {
loading.value = true;
res = await CreateRuntime(runtime);
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
} else {
loading.value = true;
res = await UpdateRuntime(runtime);
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
}
handleClose();
em('submit', res.data.id);
} catch (error) {
} finally {
loading.value = false;
}
});
};
@ -447,7 +441,9 @@ const getRuntime = async (id: number) => {
}
formFields.value = forms;
if (data.params['PHP_EXTENSIONS'] != '') {
runtime.params['PHP_EXTENSIONS'] = runtime.params['PHP_EXTENSIONS'].split(',');
runtime.params['PHP_EXTENSIONS'] = runtime.params['PHP_EXTENSIONS']
.split(',')
.filter((item) => item !== '');
}
initParam.value = true;
} catch (error) {}