|
|
@@ -25,9 +25,9 @@
|
|
|
|
|
|
<div v-show="active === 1">
|
|
|
<div v-if="form.type === 'docker'">
|
|
|
- <el-form-item label="docker 仓库" prop="dockerRegistry">
|
|
|
+ <el-form-item label="docker 仓库" prop="dockerRegistryId">
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
- <el-select v-model="form.dockerRegistry" placeholder="请选择 docker 仓库" style="width: 100%">
|
|
|
+ <el-select v-model="form.dockerRegistryId" placeholder="请选择 docker 仓库" style="width: 100%">
|
|
|
<el-option
|
|
|
v-for="(item, index) in registryList"
|
|
|
:key="index"
|
|
|
@@ -60,10 +60,10 @@
|
|
|
<el-input v-model="form.artifactPath" placeholder="例如 dist/" clearable />
|
|
|
<div class="form-tip">源码根目录下的相对路径</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="阿里云 OSS" prop="ossEndpoint">
|
|
|
+ <el-form-item label="阿里云 OSS" prop="ossEndpointId">
|
|
|
<div class="oss-select-wrapper">
|
|
|
<el-select
|
|
|
- v-model="form.ossEndpoint"
|
|
|
+ v-model="form.ossEndpointId"
|
|
|
placeholder="请选择阿里云 OSS"
|
|
|
style="flex: 1"
|
|
|
filterable
|
|
|
@@ -122,7 +122,7 @@
|
|
|
>
|
|
|
<registry-add-card
|
|
|
@close="showAddRegistryDialog = false"
|
|
|
- @success="onAddSuccess"
|
|
|
+ @success="onAddRegistrySuccess"
|
|
|
/>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
@@ -135,7 +135,7 @@
|
|
|
>
|
|
|
<aliyun-add-card
|
|
|
@close="showAddOssDialog = false"
|
|
|
- @success="onAddSuccess"
|
|
|
+ @success="onAddOssSuccess"
|
|
|
/>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -160,9 +160,8 @@ export default {
|
|
|
type: '',
|
|
|
name: '',
|
|
|
artifactPath: '',
|
|
|
- dockerRegistryId: '',
|
|
|
- ossEndpoint: '',
|
|
|
- targetPath: ''
|
|
|
+ dockerRegistryId: null,
|
|
|
+ ossEndpointId: null
|
|
|
},
|
|
|
packTypes: [],
|
|
|
registryList: [],
|
|
|
@@ -177,16 +176,18 @@ export default {
|
|
|
const baseRules = {
|
|
|
type: [{ required: true, message: '请选择仓库类型', trigger: 'blur' }],
|
|
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
|
- authType: [{ required: true, message: '请选择认证类型', trigger: 'blur' }]
|
|
|
}
|
|
|
- // 根据选择的类型增加特定规则
|
|
|
- if (this.form.authType === 'ssh') {
|
|
|
- baseRules.rsaPrikey = [{ required: true, message: 'ssh 认证类型必须填写 RSA 私钥', trigger: 'blur' }]
|
|
|
- baseRules.rsaPubkey = [{ required: true, message: 'ssh 认证类型必须填写 RSA 公钥', trigger: 'blur' }]
|
|
|
- } else if (this.form.authType === 'http') {
|
|
|
- baseRules.username = [{ required: true, message: 'http 认证类型必须填写 username', trigger: 'blur' }]
|
|
|
- baseRules.password = [{ required: true, message: 'http 认证类型必须填写 password', trigger: 'blur' }]
|
|
|
+
|
|
|
+ if (this.form.type === 'zip' || this.form.type === 'ossStatic') {
|
|
|
+ baseRules.artifactPath = [{ required: true, message: '必须填写编译产物相对路径', trigger: 'blur' }]
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.type === 'docker') {
|
|
|
+ baseRules.dockerRegistryId = [{ required: true, message: 'docker 打包类型必须选择 docker 仓库', trigger: 'change' }]
|
|
|
+ } else if (this.form.type === 'ossStatic') {
|
|
|
+ baseRules.ossEndpointId = [{ required: true, message: 'ossStatic 打包类型必须选择阿里云 oss', trigger: 'change' }]
|
|
|
}
|
|
|
+
|
|
|
return baseRules
|
|
|
}
|
|
|
},
|
|
|
@@ -234,13 +235,15 @@ export default {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
addPacker(this.form).then(resp => {
|
|
|
- this.$message.info(resp.msg)
|
|
|
- // this.$refs.form.resetFields();
|
|
|
- this.$emit('success', resp)
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.$emit('success', resp)
|
|
|
+ } else {
|
|
|
+ this.$message.warning(resp.msg)
|
|
|
+ this.$emit('fail', resp)
|
|
|
+ }
|
|
|
}).catch(error => {
|
|
|
this.$message.error(error.message)
|
|
|
- this.$emit('fail', error)
|
|
|
- }).finally(() => {
|
|
|
+ this.$emit('error', error)
|
|
|
})
|
|
|
} else {
|
|
|
return false
|
|
|
@@ -250,11 +253,18 @@ export default {
|
|
|
goToAddRegistry() {
|
|
|
this.showAddRegistryDialog = true
|
|
|
},
|
|
|
+ onAddRegistrySuccess() {
|
|
|
+ this.showAddRegistryDialog = false
|
|
|
+ this.getPackTypesWrapper()
|
|
|
+ },
|
|
|
goToAddOss() {
|
|
|
this.showAddOssDialog = true
|
|
|
},
|
|
|
- onAddSuccess() {
|
|
|
- this.showAddRegistryDialog = false
|
|
|
+ onAddOssSuccess() {
|
|
|
+ this.showAddOssDialog = false
|
|
|
+ this.getPackTypesWrapper()
|
|
|
+ },
|
|
|
+ getPackTypesWrapper() {
|
|
|
getPackTypes().then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
this.packTypes = resp.data.packTypes
|