fix: jira 提交缺陷失败的问题

This commit is contained in:
shiziyuan9527 2020-08-28 18:16:27 +08:00
parent a7a53241ba
commit b88e3d5bff
5 changed files with 35 additions and 8 deletions

View File

@ -224,6 +224,10 @@ public class IssuesService {
String account = object.getString("account"); String account = object.getString("account");
String password = object.getString("password"); String password = object.getString("password");
String url = object.getString("url"); String url = object.getString("url");
String issuetype = object.getString("issuetype");
if (StringUtils.isBlank(issuetype)) {
MSException.throwException("Jira 问题类型为空");
}
String auth = EncryptUtils.base64Encoding(account + ":" + password); String auth = EncryptUtils.base64Encoding(account + ":" + password);
String testCaseId = issuesRequest.getTestCaseId(); String testCaseId = issuesRequest.getTestCaseId();
@ -252,8 +256,7 @@ public class IssuesService {
" \"summary\":\"" + issuesRequest.getTitle() + "\",\n" + " \"summary\":\"" + issuesRequest.getTitle() + "\",\n" +
" \"description\": " + JSON.toJSONString(desc) + ",\n" + " \"description\": " + JSON.toJSONString(desc) + ",\n" +
" \"issuetype\":{\n" + " \"issuetype\":{\n" +
" \"id\":\"10009\",\n" + " \"name\":\"" + issuetype + "\"\n" +
" \"name\":\"Defect\"\n" +
" }\n" + " }\n" +
" }\n" + " }\n" +
"}"; "}";

View File

@ -25,6 +25,9 @@
<el-form-item :label="$t('organization.integration.jira_url')" prop="url" v-if="platform === 'Jira'"> <el-form-item :label="$t('organization.integration.jira_url')" prop="url" v-if="platform === 'Jira'">
<el-input v-model="form.url" :placeholder="$t('organization.integration.input_jira_url')"/> <el-input v-model="form.url" :placeholder="$t('organization.integration.input_jira_url')"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype" v-if="platform === 'Jira'">
<el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/>
</el-form-item>
</el-form> </el-form>
</div> </div>
@ -43,10 +46,13 @@
<div class="defect-tip"> <div class="defect-tip">
<div>{{$t('organization.integration.use_tip')}}</div> <div>{{$t('organization.integration.use_tip')}}</div>
<div> <div>
1. {{$t('organization.integration.use_tip_one')}} 1. {{$t('organization.integration.use_tip_tapd')}}
</div> </div>
<div> <div>
2. {{$t('organization.integration.use_tip_two')}} 2. {{$t('organization.integration.use_tip_jira')}}
</div>
<div>
3. {{$t('organization.integration.use_tip_two')}}
<router-link to="/track/project/all" style="margin-left: 5px"> <router-link to="/track/project/all" style="margin-left: 5px">
{{$t('organization.integration.link_the_project_now')}} {{$t('organization.integration.link_the_project_now')}}
</router-link> </router-link>
@ -85,6 +91,11 @@
required: true, required: true,
message: this.$t('organization.integration.input_jira_url'), message: this.$t('organization.integration.input_jira_url'),
trigger: ['change', 'blur'] trigger: ['change', 'blur']
},
issuetype: {
required: true,
message: this.$t('organization.integration.input_jira_issuetype'),
trigger: ['change', 'blur']
} }
}, },
} }
@ -105,6 +116,7 @@
this.$set(this.form, 'account', config.account); this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password); this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url); this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else { } else {
this.clear(); this.clear();
} }
@ -153,7 +165,8 @@
let auth = { let auth = {
account: this.form.account, account: this.form.account,
password: this.form.password, password: this.form.password,
url: this.form.url url: this.form.url,
issuetype: this.form.issuetype
}; };
param.organizationId = getCurrentUser().lastOrganizationId; param.organizationId = getCurrentUser().lastOrganizationId;
param.platform = this.platform; param.platform = this.platform;
@ -188,6 +201,7 @@
this.$set(this.form, 'account', config.account); this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password); this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url); this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else { } else {
this.clear(); this.clear();
} }
@ -197,6 +211,7 @@
this.$set(this.form, 'account', ''); this.$set(this.form, 'account', '');
this.$set(this.form, 'password', ''); this.$set(this.form, 'password', '');
this.$set(this.form, 'url', ''); this.$set(this.form, 'url', '');
this.$set(this.form, 'issuetype', '');
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
}); });

View File

@ -186,11 +186,14 @@ export default {
api_account: 'API account', api_account: 'API account',
api_password: 'API password', api_password: 'API password',
jira_url: 'JIRA url', jira_url: 'JIRA url',
jira_issuetype: 'JIRA issuetype',
input_api_account: 'please enter account', input_api_account: 'please enter account',
input_api_password: 'Please enter password', input_api_password: 'Please enter password',
input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/', input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/',
input_jira_issuetype: 'Please enter the question type',
use_tip: 'Usage guidelines:', use_tip: 'Usage guidelines:',
use_tip_one: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"', use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"',
use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)',
use_tip_two: 'After saving the Basic Auth account information, you need to manually associate the ID/key in the Metersphere project', use_tip_two: 'After saving the Basic Auth account information, you need to manually associate the ID/key in the Metersphere project',
link_the_project_now: 'Link the project now', link_the_project_now: 'Link the project now',
cancel_edit: 'Cancel edit', cancel_edit: 'Cancel edit',

View File

@ -187,11 +187,14 @@ export default {
api_account: 'API 账号', api_account: 'API 账号',
api_password: 'API 口令', api_password: 'API 口令',
jira_url: 'JIRA 地址', jira_url: 'JIRA 地址',
jira_issuetype: '问题类型',
input_api_account: '请输入账号', input_api_account: '请输入账号',
input_api_password: '请输入口令', input_api_password: '请输入口令',
input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/', input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '请输入问题类型',
use_tip: '使用指引:', use_tip: '使用指引:',
use_tip_one: 'Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询', use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询',
use_tip_jira: 'Jira software server 认证信息为 账号密码Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)',
use_tip_two: '保存 Basic Auth 账号信息后,需要在 Metersphere 项目中手动关联 ID/key', use_tip_two: '保存 Basic Auth 账号信息后,需要在 Metersphere 项目中手动关联 ID/key',
link_the_project_now: '马上关联项目', link_the_project_now: '马上关联项目',
cancel_edit: '取消编辑', cancel_edit: '取消编辑',

View File

@ -185,11 +185,14 @@ export default {
api_account: 'API 賬號', api_account: 'API 賬號',
api_password: 'API 口令', api_password: 'API 口令',
jira_url: 'JIRA 地址', jira_url: 'JIRA 地址',
jira_issuetype: '問題類型',
input_api_account: '請輸入賬號', input_api_account: '請輸入賬號',
input_api_password: '請輸入口令', input_api_password: '請輸入口令',
input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/', input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '請輸入問題類型',
use_tip: '使用指引:', use_tip: '使用指引:',
use_tip_one: 'Basic Auth 賬號信息在"公司管理-安全與集成-開放平台"中查詢', use_tip_tapd: 'Basic Auth 賬號信息在"公司管理-安全與集成-開放平台"中查詢',
use_tip_jira: 'Jira software server 認證信息為 賬號密碼Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)',
use_tip_two: '保存 Basic Auth 賬號信息後,需要在 Metersphere 項目中手動關聯 ID/key', use_tip_two: '保存 Basic Auth 賬號信息後,需要在 Metersphere 項目中手動關聯 ID/key',
link_the_project_now: '馬上關聯項目', link_the_project_now: '馬上關聯項目',
cancel_edit: '取消編輯', cancel_edit: '取消編輯',