Skip to content

Commit eb571b9

Browse files
fix(website): Fix Issue with Switching PHP Runtime Environment
1 parent 53e91a8 commit eb571b9

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

backend/app/service/website.go

+8
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,14 @@ func (w WebsiteService) ChangePHPVersion(req request.WebsitePHPVersionReq) error
13431343
if runtime.Resource == constant.ResourceLocal || oldRuntime.Resource == constant.ResourceLocal {
13441344
return buserr.New("ErrPHPResource")
13451345
}
1346+
client, err := docker.NewDockerClient()
1347+
if err != nil {
1348+
return err
1349+
}
1350+
defer client.Close()
1351+
if !checkImageExist(client, runtime.Image) {
1352+
return buserr.WithName("ErrImageNotExist", runtime.Name)
1353+
}
13461354
appInstall, err := appInstallRepo.GetFirst(commonRepo.WithByID(website.AppInstallID))
13471355
if err != nil {
13481356
return err

frontend/src/views/website/website/config/php/config/index.vue

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<div v-loading="loading">
33
<el-form :model="form" :rules="variablesRules" ref="phpFormRef" label-position="top">
44
<el-row v-loading="loading">
5-
<el-col :span="1"><br /></el-col>
65
<el-col :span="9">
76
<el-form-item label="short_open_tag" prop="short_open_tag">
87
<el-select v-model="form.short_open_tag">

frontend/src/views/website/website/config/php/function/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div>
33
<el-row>
4-
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8" :offset="1">
4+
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8">
55
<el-form :model="form" :rules="rules" ref="formRef">
66
<el-form-item prop="funcs">
77
<el-input

frontend/src/views/website/website/config/php/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Upload :id="id" v-if="index == '2'"></Upload>
1111
</el-tab-pane>
1212
<el-tab-pane :label="$t('runtime.version')" name="3">
13-
<Version :id="id" :runtimeID="runtimeID" v-if="index == '3'"></Version>
13+
<Version :id="id" v-if="index == '3'"></Version>
1414
</el-tab-pane>
1515
</el-tabs>
1616
</template>

frontend/src/views/website/website/config/php/upload/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div v-loading="loading">
33
<el-row>
4-
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8" :offset="1">
4+
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8">
55
<el-form :model="form" :rules="rules" ref="phpFormRef">
66
<el-form-item prop="uploadSize">
77
<el-input clearable type="number" v-model.number="form.uploadSize" maxlength="15">

frontend/src/views/website/website/config/php/version/index.vue

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div v-loading="loading">
33
<el-row>
4-
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8" :offset="1">
4+
<el-col :xs="20" :sm="12" :md="10" :lg="10" :xl="8">
55
<el-form>
66
<el-form-item :label="$t('runtime.version')">
77
<el-select v-model="versionReq.runtimeID" style="width: 100%">
@@ -33,18 +33,14 @@ import { SearchRuntimes } from '@/api/modules/runtime';
3333
import { onMounted, reactive, ref } from 'vue';
3434
import { Runtime } from '@/api/interface/runtime';
3535
import { Website } from '@/api/interface/website';
36-
import { ChangePHPVersion } from '@/api/modules/website';
36+
import { ChangePHPVersion, GetWebsite } from '@/api/modules/website';
3737
import i18n from '@/lang';
3838
import { MsgSuccess } from '@/utils/message';
3939
const props = defineProps({
4040
id: {
4141
type: Number,
4242
default: 0,
4343
},
44-
runtimeID: {
45-
type: Number,
46-
default: 0,
47-
},
4844
});
4945
5046
const runtimeReq = reactive<Runtime.RuntimeReq>({ page: 1, pageSize: 200, type: 'php' });
@@ -92,16 +88,23 @@ const submit = async () => {
9288
try {
9389
await ChangePHPVersion(versionReq);
9490
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
91+
getWebsiteDetail();
9592
} catch (error) {}
9693
loading.value = false;
9794
});
9895
} catch (error) {}
9996
};
10097
98+
const getWebsiteDetail = async () => {
99+
const res = await GetWebsite(props.id);
100+
versionReq.runtimeID = res.data.runtimeID;
101+
oldRuntimeID.value = res.data.runtimeID;
102+
};
103+
101104
onMounted(() => {
102-
versionReq.runtimeID = props.runtimeID;
103105
versionReq.websiteID = props.id;
104-
oldRuntimeID.value = props.runtimeID;
106+
107+
getWebsiteDetail();
105108
getRuntimes();
106109
});
107110
</script>

0 commit comments

Comments
 (0)