diff --git a/src/resources/api/deploy/application-config/application-config.js b/src/resources/api/deploy/application-config/application-config.js index df6f118e26cf0f437150c713f0ed315708e33124..93d4b969e0b8a62dbe428d326cb139e907603ad1 100644 --- a/src/resources/api/deploy/application-config/application-config.js +++ b/src/resources/api/deploy/application-config/application-config.js @@ -84,6 +84,10 @@ const applicationConfig = { // 保存环境实例 return axios.post('/api/rest/deploy/app/config/instance/save', params); }, + deleteEnvInstance(params) { + // 删除环境实例 + return axios.post('/api/rest/deploy/app/config/instance/delete', params); + }, saveAppTree(params) { // 保存应用配置树(应用层) return axios.post('/api/rest/deploy/app/config/app/save', params); @@ -155,6 +159,10 @@ const applicationConfig = { saveInstanceBlueGreen(params) { // 保存蓝绿集 return axios.post('/api/rest/deploy/app/instance/bluegreen/save', params); + }, + batchSaveInstanceBlueGreen(params) { + // 保存蓝绿集 + return axios.post('/api/rest/deploy/app/instance/bluegreen/batchsave', params); } }; diff --git a/src/views/pages/deploy/application-config/config/env/env-instance-bluegreen-dialog.vue b/src/views/pages/deploy/application-config/config/env/env-instance-bluegreen-dialog.vue index 1d34884eba1aedd2ebd96e5eac5f468804706038..dbffa3784c8dee50396e628299e56730c935c573 100644 --- a/src/views/pages/deploy/application-config/config/env/env-instance-bluegreen-dialog.vue +++ b/src/views/pages/deploy/application-config/config/env/env-instance-bluegreen-dialog.vue @@ -33,6 +33,7 @@ export default { } }, instanceId: { type: Number}, + instanceIdList: { type: Array}, blueGreenId: {type: Number} }, data() { @@ -79,20 +80,45 @@ export default { if (!this.$refs.bluesetForm.valid()) { return false; } - let data = { - blueGreenId: this.$refs.bluesetForm.value, - resourceId: this.instanceId, - ...this.params - }; - this.$api.deploy.applicationConfig.saveInstanceBlueGreen(data).then(res => { - if (res && res.Status == 'OK') { - this.$t('message.savesuccess'); - this.closeDialog(); + let blueGreenId = this.$refs.bluesetForm.value; + if (this.instanceId) { + let data = { + blueGreenId: blueGreenId, + resourceId: this.instanceId, + appSystemId: this.params.appSystemId, + appModuleId: this.params.appModuleId, + envId: this.params.envId + }; + this.$api.deploy.applicationConfig.saveInstanceBlueGreen(data).then(res => { + if (res && res.Status == 'OK') { + this.$t('message.savesuccess'); + this.closeDialog(true); + } + }); + } else if (this.instanceIdList && this.instanceIdList.length > 0) { + if (blueGreenId) { + let data = { + blueGreenId: blueGreenId, + resourceIdList: this.instanceIdList, + appSystemId: this.params.appSystemId, + appModuleId: this.params.appModuleId, + envId: this.params.envId + }; + this.$api.deploy.applicationConfig.batchSaveInstanceBlueGreen(data).then(res => { + if (res && res.Status == 'OK') { + this.$t('message.savesuccess'); + this.closeDialog(true); + } + }); + } else { + this.closeDialog(false); } - }); + } else { + this.closeDialog(false); + } }, - closeDialog() { - this.$emit('close'); + closeDialog(needRefresh) { + this.$emit('close', needRefresh); } }, filter: {}, diff --git a/src/views/pages/deploy/application-config/config/env/env-instance-edit.vue b/src/views/pages/deploy/application-config/config/env/env-instance-edit.vue index 595bd670742693ecaf3a946e5141c0c314641d79..b297b05fa6e899226a119df11713659152db2774 100644 --- a/src/views/pages/deploy/application-config/config/env/env-instance-edit.vue +++ b/src/views/pages/deploy/application-config/config/env/env-instance-edit.vue @@ -3,7 +3,7 @@ {} + }, + isEdit: { + type: Boolean, + default: false + }, + instanceData: { + type: Object, + default: () => {} } }, data() { return { loadingShow: true, + dialogTitle: this.isEdit == true ? this.$t('dialog.title.edittarget', {target: this.$t('page.instance')}) : this.$t('dialog.title.addtarget', {target: this.$t('page.instance')}), formValue: {}, formList: [], exampleList: [ @@ -47,9 +56,10 @@ export default { name: 'instance', type: 'radio', label: this.$t('page.instance'), + disabled: this.isEdit, dataList: [ { - text: this.$t('dialog.title.addtarget', {target: this.$t('page.instance')}), + text: this.isEdit == true ? this.$t('dialog.title.edittarget', {target: this.$t('page.instance')}) : this.$t('dialog.title.addtarget', {target: this.$t('page.instance')}), value: 1 }, { @@ -83,6 +93,7 @@ export default { transfer: true, textName: 'label', valueName: 'id', + disabled: this.isEdit, dataList: [] } ], @@ -109,6 +120,16 @@ export default { await this.getAppInstanceCiAttrList(); this.formList = this.exampleList.concat(this.addformList); this.$set(this.formValue, 'instance', 1); + if (this.isEdit == true && this.instanceData) { + this.$set(this.formValue, 'ciId', this.instanceData.ciId); + this.$set(this.formValue, 'id', this.instanceData.id); + this.$set(this.formValue, 'name', this.instanceData.name); + this.$set(this.formValue, 'ip', this.instanceData.ip); + this.$set(this.formValue, 'port', this.instanceData.port); + if (this.instanceData.maintenanceWindow) { + this.$set(this.formValue, 'maintenanceWindow', this.handleMaintenanceWindowValue([this.instanceData.maintenanceWindow])); + } + } this.getCiList(); }, beforeUpdate() {}, @@ -182,6 +203,9 @@ export default { if (formValue && formValue.maintenanceWindow) { params.maintenanceWindow = this.setMaintenanceWindowValue(formValue.maintenanceWindow); } + if (this.isEdit == true) { + params.id = this.instanceData.id; + } this.$api.deploy.applicationConfig.saveEnvInstance(params).then((res) => { if (res && res.Status == 'OK') { this.$Message.success(this.$t('message.savesuccess')); diff --git a/src/views/pages/deploy/application-config/config/env/env-instance-list.vue b/src/views/pages/deploy/application-config/config/env/env-instance-list.vue index 7d25cec92af949018e0f5b850ea3ae0c30274581..52b054969fdf7b3c50f8dfe25ce438ca03a060d5 100644 --- a/src/views/pages/deploy/application-config/config/env/env-instance-list.vue +++ b/src/views/pages/deploy/application-config/config/env/env-instance-list.vue @@ -3,8 +3,8 @@
-
    -
  • {{ $t('page.instance') }}
  • +
      +
    • {{ $t('page.instance') }}
    • +
    • {{ $t('term.deploy.blueSet') }}
    @@ -40,6 +41,8 @@ v-if="hasInstance" :tbodyList="tbodyList" :theadList="theadList" + :multiple="true" + @getSelected="getSelected" >