refactor(系统设置): 创建环境时全局前后置脚本不展示变更历史

This commit is contained in:
junhong 2022-02-15 16:16:24 +08:00 committed by 刘瑞斌
parent 861ebc2e37
commit b9983880ea
2 changed files with 18 additions and 4 deletions

View File

@ -7,7 +7,7 @@
:env-add-permission="['PROJECT_ENVIRONMENT:READ+CREATE']"
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
<environment-edit :environment="currentEnvironment" ref="environmentEdit" @close="close" :is-read-only="isReadOnly"/>
<environment-edit :if-create="ifCreate" :environment="currentEnvironment" ref="environmentEdit" @close="close" :is-read-only="isReadOnly"/>
</el-container>
</el-dialog>
</template>
@ -50,7 +50,8 @@
permissions: ['PROJECT_ENVIRONMENT:READ+DELETE']
}
],
selectEnvironmentId: ''
selectEnvironmentId: '',
ifCreate: false, //
}
},
computed: {
@ -67,6 +68,7 @@
listenGoBack(this.close);
},
deleteEnvironment(environment, index) {
this.ifCreate = false;
if (environment.id) {
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
this.$success(this.$t('commons.delete_success'));
@ -78,6 +80,7 @@
}
},
copyEnvironment(environment) {
this.ifCreate = false;
this.currentEnvironment = environment;
if (!environment.id) {
this.$warning(this.$t('commons.please_save'));
@ -110,6 +113,7 @@
return name;
},
addEnvironment() {
this.ifCreate = true;
let newEnvironment = new Environment({
projectId: this.projectId
});
@ -147,6 +151,9 @@
getEnvironment(environment) {
parseEnvironment(environment);
this.currentEnvironment = environment;
if(this.currentEnvironment.name){
this.ifCreate = false;
}
},
close() {
this.$emit('close');

View File

@ -7,7 +7,7 @@
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
:env-add-permission="ENV_CREATE"
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
<environment-edit :project-id="projectId" :environment="currentEnvironment" ref="environmentEdit" :is-read-only="isReadOnly"
<environment-edit :if-create="ifCreate" :project-id="projectId" :environment="currentEnvironment" ref="environmentEdit" :is-read-only="isReadOnly"
@close="close"/>
</el-container>
</el-dialog>
@ -53,7 +53,8 @@
['PROJECT_ENVIRONMENT:READ+DELETE'] : ['WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE']
}
],
selectEnvironmentId: ''
selectEnvironmentId: '',
ifCreate: false, //
}
},
props: {
@ -88,6 +89,7 @@
listenGoBack(this.close);
},
deleteEnvironment(environment, index) {
this.ifCreate = false;
if (environment.id) {
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
this.$success(this.$t('commons.delete_success'));
@ -99,6 +101,7 @@
}
},
copyEnvironment(environment) {
this.ifCreate = false;
//
this.environmentSelected(environment);
this.currentEnvironment = environment;
@ -133,6 +136,7 @@
return name;
},
addEnvironment() {
this.ifCreate = true;
let newEnvironment = new Environment({
projectId: this.projectId
});
@ -170,6 +174,9 @@
getEnvironment(environment) {
parseEnvironment(environment);
this.currentEnvironment = environment;
if(this.currentEnvironment.name){
this.ifCreate = false;
}
},
close() {
this.$emit('close');