fix: 缺陷平台校验报错 (#4251)

Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
--bug=1004724 --user=陈建星 【服务集成】第三方缺陷平台,测试连接失败 https://www.tapd.cn/55049933/s/1023875
This commit is contained in:
metersphere-bot 2021-07-01 15:32:14 +08:00 committed by GitHub
parent 80538d49ae
commit a215a418b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 32 deletions

View File

@ -54,9 +54,9 @@ public class IssuesController {
return issuesService.getIssues(id);
}
@GetMapping("/auth/{platform}")
public void testAuth(@PathVariable String platform) {
issuesService.testAuth(platform);
@GetMapping("/auth/{orgId}/{platform}")
public void testAuth(@PathVariable String orgId, @PathVariable String platform) {
issuesService.testAuth(orgId, platform);
}
@GetMapping("/close/{id}")

View File

@ -72,8 +72,10 @@ public class IssuesService {
@Resource
private TestCaseMapper testCaseMapper;
public void testAuth(String platform) {
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
public void testAuth(String orgId, String platform) {
IssuesRequest issuesRequest = new IssuesRequest();
issuesRequest.setOrganizationId(orgId);
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, issuesRequest);
abstractPlatform.testAuth();
}

View File

@ -58,7 +58,7 @@
<script>
import BugManageBtn from "@/business/components/settings/organization/components/BugManageBtn";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentOrganizationId, getCurrentUser} from "@/common/js/utils";
import {JIRA} from "@/common/js/constants";
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
@ -167,7 +167,7 @@ export default {
},
testConnection() {
if (this.form.account && this.form.password) {
this.$parent.result = this.$get("issues/auth/" + JIRA, () => {
this.$parent.result = this.$get("issues/auth/" + getCurrentOrganizationId() + '/' + JIRA, () => {
this.$success(this.$t('organization.integration.verified'));
});
} else {

View File

@ -39,7 +39,7 @@
<script>
import BugManageBtn from "@/business/components/settings/organization/components/BugManageBtn";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentOrganizationId, getCurrentUser} from "@/common/js/utils";
import {TAPD} from "@/common/js/constants";
export default {
@ -123,7 +123,7 @@ export default {
},
testConnection() {
if (this.form.account && this.form.password) {
this.$parent.result = this.$get("issues/auth/" + TAPD, () => {
this.$parent.result = this.$get("issues/auth/" + getCurrentOrganizationId() + '/' + TAPD, () => {
this.$success(this.$t('organization.integration.verified'));
});
} else {

View File

@ -42,7 +42,7 @@
<script>
import BugManageBtn from "@/business/components/settings/organization/components/BugManageBtn";
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentOrganizationId, getCurrentUser} from "@/common/js/utils";
import {ZEN_TAO} from "@/common/js/constants";
export default {
@ -139,7 +139,7 @@ export default {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.account && this.form.password) {
this.$parent.result = this.$get("issues/auth/" + ZEN_TAO, () => {
this.$parent.result = this.$get("issues/auth/" + getCurrentOrganizationId() + '/' + ZEN_TAO, () => {
this.$success(this.$t('organization.integration.verified'));
});
} else {

View File

@ -84,26 +84,26 @@
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="createVisible" destroy-on-close
@close="handleClose">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="80px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-form-item :label-width="labelWidth" :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('用例模板')" prop="caseTemplateId">
<el-form-item :label-width="labelWidth" :label="$t('用例模板')" prop="caseTemplateId">
<template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/>
</el-form-item>
<el-form-item :label="$t('缺陷模板')" prop="issueTemplateId">
<el-form-item :label-width="labelWidth" :label="$t('缺陷模板')" prop="issueTemplateId">
<template-select :data="form" scene="ISSUE" prop="issueTemplateId" ref="issueTemplate"/>
</el-form-item>
<el-form-item :label="$t('commons.description')" prop="description">
<el-form-item :label-width="labelWidth" :label="$t('commons.description')" prop="description">
<el-input :autosize="{ minRows: 2, maxRows: 4}" type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item :label="$t('project.tapd_id')" v-if="tapd">
<el-form-item :label-width="labelWidth" :label="$t('project.tapd_id')" v-if="tapd">
<el-input v-model="form.tapdId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('project.jira_key')" v-if="jira">
<el-form-item :label-width="labelWidth" :label="$t('project.jira_key')" v-if="jira">
<el-input v-model="form.jiraKey" autocomplete="off"/>
<ms-instructions-icon effect="light">
<template>
@ -111,16 +111,16 @@
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label="$t('project.zentao_id')" v-if="zentao">
<el-form-item :label-width="labelWidth" :label="$t('project.zentao_id')" v-if="zentao">
<el-input v-model="form.zentaoId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('project.repeatable')" prop="repeatable">
<el-form-item :label-width="labelWidth" :label="$t('project.repeatable')" prop="repeatable">
<el-switch v-model="form.repeatable"></el-switch>
</el-form-item>
<el-form-item label="测试用例自定义ID" prop="customNum">
<el-form-item :label-width="labelWidth" label="测试用例自定义ID" prop="customNum">
<el-switch v-model="form.customNum"></el-switch>
</el-form-item>
<el-form-item label="场景自定义ID" prop="scenarioCustomNum">
<el-form-item :label-width="labelWidth" label="场景自定义ID" prop="scenarioCustomNum">
<el-switch v-model="form.scenarioCustomNum"></el-switch>
</el-form-item>
</el-form>
@ -215,6 +215,7 @@ export default {
// issueTemplateId: [{required: true}],
},
screenHeight: 'calc(100vh - 255px)',
labelWidth: '150px'
};
},
props: {

View File

@ -90,26 +90,26 @@
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="createVisible" destroy-on-close
@close="handleClose">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="80px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-form-item :label-width="labelWidth" :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('用例模板')" prop="caseTemplateId">
<el-form-item :label-width="labelWidth" :label="$t('用例模板')" prop="caseTemplateId">
<template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/>
</el-form-item>
<el-form-item :label="$t('缺陷模板')" prop="issueTemplateId">
<el-form-item :label-width="labelWidth" :label="$t('缺陷模板')" prop="issueTemplateId">
<template-select :data="form" scene="ISSUE" prop="issueTemplateId" ref="issueTemplate"/>
</el-form-item>
<el-form-item :label="$t('commons.description')" prop="description">
<el-form-item :label-width="labelWidth" :label="$t('commons.description')" prop="description">
<el-input :autosize="{ minRows: 2, maxRows: 4}" type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item :label="$t('project.tapd_id')" v-if="tapd">
<el-form-item :label-width="labelWidth" :label="$t('project.tapd_id')" v-if="tapd">
<el-input v-model="form.tapdId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('project.jira_key')" v-if="jira">
<el-form-item :label-width="labelWidth" :label="$t('project.jira_key')" v-if="jira">
<el-input v-model="form.jiraKey" autocomplete="off"/>
<ms-instructions-icon effect="light">
<template>
@ -117,16 +117,16 @@
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label="$t('project.zentao_id')" v-if="zentao">
<el-form-item :label-width="labelWidth" :label="$t('project.zentao_id')" v-if="zentao">
<el-input v-model="form.zentaoId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label="$t('project.repeatable')" prop="repeatable">
<el-form-item :label-width="labelWidth" :label="$t('project.repeatable')" prop="repeatable">
<el-switch v-model="form.repeatable"></el-switch>
</el-form-item>
<el-form-item label="测试用例自定义ID" prop="customNum">
<el-form-item :label-width="labelWidth" label="测试用例自定义ID" prop="customNum">
<el-switch v-model="form.customNum"></el-switch>
</el-form-item>
<el-form-item label="场景自定义ID" prop="scenarioCustomNum">
<el-form-item :label-width="labelWidth" label="场景自定义ID" prop="scenarioCustomNum">
<el-switch v-model="form.scenarioCustomNum"></el-switch>
</el-form-item>
</el-form>
@ -305,7 +305,8 @@ export default {
dialogPageSize: 10,
dialogTotal: 0,
currentProjectId: "",
userList: []
userList: [],
labelWidth: '150px'
};
},
props: {