|
|
@ -63,44 +63,60 @@ |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('runtime.image')" prop="image"> |
|
|
|
|
|
|
|
<el-input v-model="runtime.image"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<div v-if="initParam"> |
|
|
|
<div v-if="initParam"> |
|
|
|
<el-form-item v-if="runtime.type === 'php'"> |
|
|
|
<div v-if="runtime.type === 'php'"> |
|
|
|
<el-alert :title="$t('runtime.buildHelper')" type="warning" :closable="false" /> |
|
|
|
<el-form-item :label="$t('runtime.image')" prop="image"> |
|
|
|
</el-form-item> |
|
|
|
<el-input v-model="runtime.image"></el-input> |
|
|
|
<Params |
|
|
|
</el-form-item> |
|
|
|
v-if="mode === 'create'" |
|
|
|
<el-form-item :label="$t('runtime.source')" prop="source"> |
|
|
|
v-model:form="runtime.params" |
|
|
|
<el-select v-model="runtime.source" filterable allow-create default-first-option> |
|
|
|
v-model:params="appParams" |
|
|
|
<el-option |
|
|
|
v-model:rules="rules" |
|
|
|
v-for="(source, index) in phpSources" |
|
|
|
></Params> |
|
|
|
:key="index" |
|
|
|
<EditParams |
|
|
|
:label="source.label + ' [' + source.value + ']'" |
|
|
|
v-if="mode === 'edit'" |
|
|
|
:value="source.value" |
|
|
|
v-model:form="runtime.params" |
|
|
|
></el-option> |
|
|
|
v-model:params="editParams" |
|
|
|
</el-select> |
|
|
|
v-model:rules="rules" |
|
|
|
<span class="input-help"> |
|
|
|
></EditParams> |
|
|
|
{{ $t('runtime.phpsourceHelper') }} |
|
|
|
<el-form-item v-if="runtime.type === 'php'"> |
|
|
|
</span> |
|
|
|
<el-alert type="info" :closable="false"> |
|
|
|
</el-form-item> |
|
|
|
<span>{{ $t('runtime.extendHelper') }}</span> |
|
|
|
|
|
|
|
<span v-html="$t('runtime.phpPluginHelper')"></span> |
|
|
|
<Params |
|
|
|
<br /> |
|
|
|
v-if="mode === 'create'" |
|
|
|
</el-alert> |
|
|
|
v-model:form="runtime.params" |
|
|
|
</el-form-item> |
|
|
|
v-model:params="appParams" |
|
|
|
<div v-if="runtime.type === 'php' && mode == 'edit'"> |
|
|
|
v-model:rules="rules" |
|
|
|
|
|
|
|
></Params> |
|
|
|
|
|
|
|
<EditParams |
|
|
|
|
|
|
|
v-if="mode === 'edit'" |
|
|
|
|
|
|
|
v-model:form="runtime.params" |
|
|
|
|
|
|
|
v-model:params="editParams" |
|
|
|
|
|
|
|
v-model:rules="rules" |
|
|
|
|
|
|
|
></EditParams> |
|
|
|
<el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-checkbox v-model="runtime.rebuild"> |
|
|
|
<el-alert :title="$t('runtime.buildHelper')" type="warning" :closable="false" /> |
|
|
|
{{ $t('runtime.rebuild') }} |
|
|
|
|
|
|
|
</el-checkbox> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-alert type="info" :closable="false"> |
|
|
|
<el-alert type="info" :closable="false"> |
|
|
|
<span>{{ $t('runtime.rebuildHelper') }}</span> |
|
|
|
<span>{{ $t('runtime.extendHelper') }}</span> |
|
|
|
|
|
|
|
<span v-html="$t('runtime.phpPluginHelper')"></span> |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
|
</el-alert> |
|
|
|
</el-alert> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<div v-if="mode == 'edit'"> |
|
|
|
|
|
|
|
<el-form-item> |
|
|
|
|
|
|
|
<el-checkbox v-model="runtime.rebuild"> |
|
|
|
|
|
|
|
{{ $t('runtime.rebuild') }} |
|
|
|
|
|
|
|
</el-checkbox> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item> |
|
|
|
|
|
|
|
<el-alert type="info" :closable="false"> |
|
|
|
|
|
|
|
<span>{{ $t('runtime.rebuildHelper') }}</span> |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
</el-alert> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -160,23 +176,59 @@ const appReq = reactive({ |
|
|
|
page: 1, |
|
|
|
page: 1, |
|
|
|
pageSize: 20, |
|
|
|
pageSize: 20, |
|
|
|
}); |
|
|
|
}); |
|
|
|
const runtime = ref<Runtime.RuntimeCreate>({ |
|
|
|
const initData = (type: string) => ({ |
|
|
|
name: '', |
|
|
|
name: '', |
|
|
|
appDetailId: undefined, |
|
|
|
appDetailId: undefined, |
|
|
|
image: '', |
|
|
|
image: '', |
|
|
|
params: {}, |
|
|
|
params: {}, |
|
|
|
type: 'php', |
|
|
|
type: type, |
|
|
|
resource: 'appstore', |
|
|
|
resource: 'appstore', |
|
|
|
rebuild: false, |
|
|
|
rebuild: false, |
|
|
|
|
|
|
|
source: 'mirrors.ustc.edu.cn', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let runtime = reactive<Runtime.RuntimeCreate>(initData('php')); |
|
|
|
|
|
|
|
|
|
|
|
const rules = ref<any>({ |
|
|
|
const rules = ref<any>({ |
|
|
|
name: [Rules.appName], |
|
|
|
name: [Rules.appName], |
|
|
|
resource: [Rules.requiredInput], |
|
|
|
resource: [Rules.requiredInput], |
|
|
|
appId: [Rules.requiredSelect], |
|
|
|
appId: [Rules.requiredSelect], |
|
|
|
version: [Rules.requiredInput, Rules.paramCommon], |
|
|
|
version: [Rules.requiredInput, Rules.paramCommon], |
|
|
|
image: [Rules.requiredInput, Rules.imageName], |
|
|
|
image: [Rules.requiredInput, Rules.imageName], |
|
|
|
|
|
|
|
source: [Rules.requiredSelect], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const phpSources = [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.ustc'), |
|
|
|
|
|
|
|
value: 'mirrors.ustc.edu.cn', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.netease'), |
|
|
|
|
|
|
|
value: 'mirrors.163.com', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.aliyun'), |
|
|
|
|
|
|
|
value: 'mirrors.aliyun.com', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.tsinghua'), |
|
|
|
|
|
|
|
value: 'mirrors.tuna.tsinghua.edu.cn', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.xtomhk'), |
|
|
|
|
|
|
|
value: 'mirrors.xtom.com.hk', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.xtom'), |
|
|
|
|
|
|
|
value: 'mirrors.xtom.com', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: i18n.global.t('runtime.default'), |
|
|
|
|
|
|
|
value: 'dl-cdn.alpinelinux.org', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
const em = defineEmits(['close']); |
|
|
|
const em = defineEmits(['close']); |
|
|
|
|
|
|
|
|
|
|
|
const handleClose = () => { |
|
|
|
const handleClose = () => { |
|
|
@ -186,12 +238,12 @@ const handleClose = () => { |
|
|
|
|
|
|
|
|
|
|
|
const changeResource = (resource: string) => { |
|
|
|
const changeResource = (resource: string) => { |
|
|
|
if (resource === 'local') { |
|
|
|
if (resource === 'local') { |
|
|
|
runtime.value.appDetailId = undefined; |
|
|
|
runtime.appDetailId = undefined; |
|
|
|
runtime.value.version = ''; |
|
|
|
runtime.version = ''; |
|
|
|
runtime.value.params = {}; |
|
|
|
runtime.params = {}; |
|
|
|
runtime.value.image = ''; |
|
|
|
runtime.image = ''; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
runtime.value.version = ''; |
|
|
|
runtime.version = ''; |
|
|
|
searchApp(null); |
|
|
|
searchApp(null); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -201,7 +253,7 @@ const searchApp = (appId: number) => { |
|
|
|
apps.value = res.data.items || []; |
|
|
|
apps.value = res.data.items || []; |
|
|
|
if (res.data && res.data.items && res.data.items.length > 0) { |
|
|
|
if (res.data && res.data.items && res.data.items.length > 0) { |
|
|
|
if (appId == null) { |
|
|
|
if (appId == null) { |
|
|
|
runtime.value.appId = res.data.items[0].id; |
|
|
|
runtime.appId = res.data.items[0].id; |
|
|
|
getApp(res.data.items[0].key, mode.value); |
|
|
|
getApp(res.data.items[0].key, mode.value); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
res.data.items.forEach((item) => { |
|
|
|
res.data.items.forEach((item) => { |
|
|
@ -227,10 +279,10 @@ const changeApp = (appId: number) => { |
|
|
|
const changeVersion = () => { |
|
|
|
const changeVersion = () => { |
|
|
|
loading.value = true; |
|
|
|
loading.value = true; |
|
|
|
initParam.value = false; |
|
|
|
initParam.value = false; |
|
|
|
GetAppDetail(runtime.value.appId, runtime.value.version, 'runtime') |
|
|
|
GetAppDetail(runtime.appId, runtime.version, 'runtime') |
|
|
|
.then((res) => { |
|
|
|
.then((res) => { |
|
|
|
runtime.value.appDetailId = res.data.id; |
|
|
|
runtime.appDetailId = res.data.id; |
|
|
|
runtime.value.image = res.data.image + ':' + runtime.value.version; |
|
|
|
runtime.image = res.data.image + ':' + runtime.version; |
|
|
|
appParams.value = res.data.params; |
|
|
|
appParams.value = res.data.params; |
|
|
|
initParam.value = true; |
|
|
|
initParam.value = true; |
|
|
|
}) |
|
|
|
}) |
|
|
@ -243,7 +295,7 @@ const getApp = (appkey: string, mode: string) => { |
|
|
|
GetApp(appkey).then((res) => { |
|
|
|
GetApp(appkey).then((res) => { |
|
|
|
appVersions.value = res.data.versions || []; |
|
|
|
appVersions.value = res.data.versions || []; |
|
|
|
if (res.data.versions.length > 0) { |
|
|
|
if (res.data.versions.length > 0) { |
|
|
|
runtime.value.version = res.data.versions[0]; |
|
|
|
runtime.version = res.data.versions[0]; |
|
|
|
if (mode === 'create') { |
|
|
|
if (mode === 'create') { |
|
|
|
changeVersion(); |
|
|
|
changeVersion(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -261,7 +313,7 @@ const submit = async (formEl: FormInstance | undefined) => { |
|
|
|
} |
|
|
|
} |
|
|
|
if (mode.value == 'create') { |
|
|
|
if (mode.value == 'create') { |
|
|
|
loading.value = true; |
|
|
|
loading.value = true; |
|
|
|
CreateRuntime(runtime.value) |
|
|
|
CreateRuntime(runtime) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
MsgSuccess(i18n.global.t('commons.msg.createSuccess')); |
|
|
|
MsgSuccess(i18n.global.t('commons.msg.createSuccess')); |
|
|
|
handleClose(); |
|
|
|
handleClose(); |
|
|
@ -271,7 +323,7 @@ const submit = async (formEl: FormInstance | undefined) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
loading.value = true; |
|
|
|
loading.value = true; |
|
|
|
UpdateRuntime(runtime.value) |
|
|
|
UpdateRuntime(runtime) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
MsgSuccess(i18n.global.t('commons.msg.updateSuccess')); |
|
|
|
MsgSuccess(i18n.global.t('commons.msg.updateSuccess')); |
|
|
|
handleClose(); |
|
|
|
handleClose(); |
|
|
@ -287,7 +339,7 @@ const getRuntime = async (id: number) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const res = await GetRuntime(id); |
|
|
|
const res = await GetRuntime(id); |
|
|
|
const data = res.data; |
|
|
|
const data = res.data; |
|
|
|
runtime.value = { |
|
|
|
Object.assign(runtime, { |
|
|
|
id: data.id, |
|
|
|
id: data.id, |
|
|
|
name: data.name, |
|
|
|
name: data.name, |
|
|
|
appDetailId: data.appDetailId, |
|
|
|
appDetailId: data.appDetailId, |
|
|
@ -298,7 +350,8 @@ const getRuntime = async (id: number) => { |
|
|
|
appId: data.appId, |
|
|
|
appId: data.appId, |
|
|
|
version: data.version, |
|
|
|
version: data.version, |
|
|
|
rebuild: true, |
|
|
|
rebuild: true, |
|
|
|
}; |
|
|
|
source: data.source, |
|
|
|
|
|
|
|
}); |
|
|
|
editParams.value = data.appParams; |
|
|
|
editParams.value = data.appParams; |
|
|
|
if (mode.value == 'create') { |
|
|
|
if (mode.value == 'create') { |
|
|
|
searchApp(data.appId); |
|
|
|
searchApp(data.appId); |
|
|
@ -312,16 +365,10 @@ const acceptParams = async (props: OperateRrops) => { |
|
|
|
mode.value = props.mode; |
|
|
|
mode.value = props.mode; |
|
|
|
initParam.value = false; |
|
|
|
initParam.value = false; |
|
|
|
if (props.mode === 'create') { |
|
|
|
if (props.mode === 'create') { |
|
|
|
runtime.value = { |
|
|
|
Object.assign(runtime, initData(props.type)); |
|
|
|
name: '', |
|
|
|
|
|
|
|
appDetailId: undefined, |
|
|
|
|
|
|
|
image: '', |
|
|
|
|
|
|
|
params: {}, |
|
|
|
|
|
|
|
type: props.type, |
|
|
|
|
|
|
|
resource: 'appstore', |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
searchApp(null); |
|
|
|
searchApp(null); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
searchApp(null); |
|
|
|
getRuntime(props.id); |
|
|
|
getRuntime(props.id); |
|
|
|
} |
|
|
|
} |
|
|
|
open.value = true; |
|
|
|
open.value = true; |
|
|
|