mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-18 22:22:59 +08:00
feat: 创建一键部署网站和运行环境增加高级设置 (#1064)
This commit is contained in:
parent
36db30471c
commit
1f65d2243e
@ -14,16 +14,20 @@ type AppSearch struct {
|
||||
}
|
||||
|
||||
type AppInstallCreate struct {
|
||||
AppDetailId uint `json:"appDetailId" validate:"required"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
Services map[string]string `json:"services"`
|
||||
Advanced bool `json:"advanced"`
|
||||
CpuQuota float64 `json:"cpuQuota"`
|
||||
MemoryLimit float64 `json:"memoryLimit"`
|
||||
MemoryUnit string `json:"memoryUnit"`
|
||||
ContainerName string `json:"containerName"`
|
||||
AllowPort bool `json:"allowPort"`
|
||||
AppDetailId uint `json:"appDetailId" validate:"required"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
Services map[string]string `json:"services"`
|
||||
AppContainerConfig
|
||||
}
|
||||
|
||||
type AppContainerConfig struct {
|
||||
Advanced bool `json:"advanced"`
|
||||
CpuQuota float64 `json:"cpuQuota"`
|
||||
MemoryLimit float64 `json:"memoryLimit"`
|
||||
MemoryUnit string `json:"memoryUnit"`
|
||||
ContainerName string `json:"containerName"`
|
||||
AllowPort bool `json:"allowPort"`
|
||||
}
|
||||
|
||||
type AppInstalledSearch struct {
|
||||
|
@ -37,6 +37,8 @@ type NewAppInstall struct {
|
||||
Name string `json:"name"`
|
||||
AppDetailId uint `json:"appDetailID"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
|
||||
AppContainerConfig
|
||||
}
|
||||
|
||||
type WebsiteInstallCheckReq struct {
|
||||
|
@ -206,6 +206,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
|
||||
req.Name = create.AppInstall.Name
|
||||
req.AppDetailId = create.AppInstall.AppDetailId
|
||||
req.Params = create.AppInstall.Params
|
||||
req.AppContainerConfig = create.AppInstall.AppContainerConfig
|
||||
tx, installCtx := getTxAndContext()
|
||||
install, err = NewIAppService().Install(installCtx, req)
|
||||
if err != nil {
|
||||
@ -243,6 +244,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
|
||||
req.AppDetailId = create.AppInstall.AppDetailId
|
||||
req.Params = create.AppInstall.Params
|
||||
req.Params["IMAGE_NAME"] = runtime.Image
|
||||
req.AppContainerConfig = create.AppInstall.AppContainerConfig
|
||||
nginxInstall, err = getAppInstallByKey(constant.AppOpenresty)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -126,7 +126,7 @@ const submitModel = ref<any>({});
|
||||
const canEdit = ref(false);
|
||||
|
||||
const acceptParams = async (props: ParamProps) => {
|
||||
canEdit.value = false;
|
||||
canEdit.value = true;
|
||||
submitModel.value.installId = props.id;
|
||||
params.value = [];
|
||||
paramData.value.id = props.id;
|
||||
|
@ -186,6 +186,58 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item
|
||||
prop="advanced"
|
||||
v-if="
|
||||
website.type === 'runtime' || (website.type === 'deployment' && website.appType === 'new')
|
||||
"
|
||||
>
|
||||
<el-checkbox v-model="website.appinstall.advanced" :label="$t('app.advanced')" size="large" />
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="website.appinstall.advanced">
|
||||
<el-form-item :label="$t('app.containerName')" prop="containerName">
|
||||
<el-input
|
||||
v-model.trim="website.appinstall.containerName"
|
||||
:placeholder="$t('app.conatinerNameHelper')"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('container.cpuQuota')" prop="cpuQuota">
|
||||
<el-input
|
||||
type="number"
|
||||
style="width: 40%"
|
||||
v-model.number="website.appinstall.cpuQuota"
|
||||
maxlength="5"
|
||||
>
|
||||
<template #append>{{ $t('app.cpuCore') }}</template>
|
||||
</el-input>
|
||||
<span class="input-help">{{ $t('container.limitHelper') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('container.memoryLimit')" prop="memoryLimit">
|
||||
<el-input style="width: 40%" v-model.number="website.appinstall.memoryLimit" maxlength="10">
|
||||
<template #append>
|
||||
<el-select
|
||||
v-model="website.appinstall.memoryUnit"
|
||||
placeholder="Select"
|
||||
style="width: 85px"
|
||||
>
|
||||
<el-option label="KB" value="K" />
|
||||
<el-option label="MB" value="M" />
|
||||
<el-option label="GB" value="G" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
<span class="input-help">{{ $t('container.limitHelper') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item prop="allowPort">
|
||||
<el-checkbox
|
||||
v-model="website.appinstall.allowPort"
|
||||
:label="$t('app.allowPort')"
|
||||
size="large"
|
||||
/>
|
||||
<span class="input-help">{{ $t('app.allowPortHelper') }}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item :label="$t('website.primaryDomain')" prop="primaryDomain">
|
||||
<el-input
|
||||
v-model.trim="website.primaryDomain"
|
||||
@ -278,6 +330,13 @@ const website = ref({
|
||||
params: {},
|
||||
version: '',
|
||||
appkey: '',
|
||||
|
||||
advanced: false,
|
||||
cpuQuota: 0,
|
||||
memoryLimit: 0,
|
||||
memoryUnit: 'MB',
|
||||
containerName: '',
|
||||
allowPort: false,
|
||||
},
|
||||
proxyType: 'tcp',
|
||||
port: 9000,
|
||||
|
Loading…
Reference in New Issue
Block a user