Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
46d52334
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46d52334
编写于
8月 18, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 测试计划测试用例列表显示缺陷数
上级
c8c53a90
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
88 addition
and
10 deletion
+88
-10
backend/src/main/java/io/metersphere/commons/utils/RestTemplateUtils.java
.../java/io/metersphere/commons/utils/RestTemplateUtils.java
+4
-2
backend/src/main/java/io/metersphere/service/IssuesService.java
...d/src/main/java/io/metersphere/service/IssuesService.java
+29
-4
backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java
...etersphere/track/controller/TestCaseIssuesController.java
+5
-0
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
...onents/track/plan/view/comonents/TestPlanTestCaseEdit.vue
+20
-4
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue
...onents/track/plan/view/comonents/TestPlanTestCaseList.vue
+30
-0
未找到文件。
backend/src/main/java/io/metersphere/commons/utils/RestTemplateUtils.java
浏览文件 @
46d52334
...
...
@@ -23,7 +23,8 @@ public class RestTemplateUtils {
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
return
responseEntity
.
getBody
();
}
catch
(
Exception
e
)
{
MSException
.
throwException
(
"接口调用失败:"
+
e
.
getMessage
());
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"Tapd接口调用失败:"
+
e
.
getMessage
());
return
null
;
}
}
...
...
@@ -36,7 +37,8 @@ public class RestTemplateUtils {
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
return
responseEntity
.
getBody
();
}
catch
(
Exception
e
)
{
MSException
.
throwException
(
"接口调用失败:"
+
e
.
getMessage
());
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"Tapd接口调用失败:"
+
e
.
getMessage
());
return
null
;
}
...
...
backend/src/main/java/io/metersphere/service/IssuesService.java
浏览文件 @
46d52334
...
...
@@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.client.HttpClientErrorException
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
...
...
@@ -63,7 +64,6 @@ public class IssuesService {
RestTemplate
restTemplate
=
new
RestTemplate
();
restTemplate
.
exchange
(
"https://api.tapd.cn/quickstart/testauth"
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"验证失败!"
);
}
...
...
@@ -275,7 +275,14 @@ public class IssuesService {
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
json
,
requestHeaders
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//post
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
+
"/rest/api/2/issue"
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
ResponseEntity
<
String
>
responseEntity
=
null
;
try
{
responseEntity
=
restTemplate
.
exchange
(
url
+
"/rest/api/2/issue"
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"调用Jira接口创建缺陷失败"
);
}
return
responseEntity
.
getBody
();
}
...
...
@@ -336,8 +343,15 @@ public class IssuesService {
issues
.
setDescription
(
description
);
issues
.
setStatus
(
status
);
issues
.
setPlatform
(
IssuesManagePlatform
.
Jira
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
HttpClientErrorException
.
NotFound
e
)
{
LogUtil
.
error
(
e
.
getStackTrace
(),
e
);
return
new
Issues
();
}
catch
(
HttpClientErrorException
.
Unauthorized
e
)
{
LogUtil
.
error
(
e
.
getStackTrace
(),
e
);
MSException
.
throwException
(
"获取Jira缺陷失败,检查Jira配置信息"
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
MSException
.
throwException
(
"调用Jira接口获取缺陷失败"
);
}
return
issues
;
...
...
@@ -445,7 +459,11 @@ public class IssuesService {
}
public
List
<
Issues
>
getLocalIssues
(
String
caseId
)
{
return
extIssuesMapper
.
getIssues
(
caseId
,
IssuesManagePlatform
.
Local
.
toString
());
List
<
Issues
>
list
=
extIssuesMapper
.
getIssues
(
caseId
,
IssuesManagePlatform
.
Local
.
toString
());
List
<
Issues
>
issues
=
list
.
stream
()
.
filter
(
l
->
!
StringUtils
.
equals
(
l
.
getStatus
(),
"closed"
))
.
collect
(
Collectors
.
toList
());
return
issues
;
}
public
String
getTapdProjectId
(
String
testCaseId
)
{
...
...
@@ -471,4 +489,11 @@ public class IssuesService {
return
StringUtils
.
isNotBlank
(
integration
.
getId
());
}
public
void
closeLocalIssue
(
String
issueId
)
{
Issues
issues
=
new
Issues
();
issues
.
setId
(
issueId
);
issues
.
setStatus
(
"closed"
);
issuesMapper
.
updateByPrimaryKeySelective
(
issues
);
}
}
backend/src/main/java/io/metersphere/track/controller/TestCaseIssuesController.java
浏览文件 @
46d52334
...
...
@@ -30,4 +30,9 @@ public class TestCaseIssuesController {
issuesService
.
testAuth
(
platform
);
}
@GetMapping
(
"/close/{id}"
)
public
void
closeLocalIssue
(
@PathVariable
String
id
)
{
issuesService
.
closeLocalIssue
(
id
);
}
}
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
浏览文件 @
46d52334
...
...
@@ -207,11 +207,22 @@
<el-row>
<el-col
:span=
"20"
:offset=
"1"
class=
"issues-edit"
>
<el-table
border
class=
"adjust-table"
:data=
"issues"
style=
"width: 100%"
>
<el-table-column
prop=
"id"
label=
"缺陷ID"
/>
<el-table-column
prop=
"id"
label=
"缺陷ID"
show-overflow-tooltip
/>
<el-table-column
prop=
"title"
label=
"缺陷标题"
/>
<el-table-column
prop=
"status"
label=
"缺陷状态"
/>
<el-table-column
prop=
"description"
label=
"缺陷描述"
show-overflow-tooltip
/>
<el-table-column
prop=
"status"
label=
"缺陷状态"
/>
<el-table-column
prop=
"platform"
label=
"平台"
/>
<el-table-column
label=
"操作"
>
<
template
v-slot:default=
"scope"
>
<el-tooltip
content=
"关闭缺陷"
placement=
"right"
>
<el-button
type=
"danger"
icon=
"el-icon-circle-close"
size=
"mini"
circle
v-if=
"scope.row.platform === 'Local'"
@
click=
"closeIssue(scope.row)"
/>
</el-tooltip>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
...
...
@@ -475,11 +486,16 @@
})
},
getIssues
(
caseId
)
{
this
.
result
=
this
.
$get
(
"
/issues/get/
"
+
caseId
,
response
=>
{
this
.
result
=
this
.
$get
(
"
/issues/get/
"
+
caseId
,
response
=>
{
let
data
=
response
.
data
;
this
.
issues
=
data
;
console
.
log
(
data
);
})
},
closeIssue
(
row
)
{
this
.
result
=
this
.
$get
(
"
/issues/close/
"
+
row
.
id
,
()
=>
{
this
.
getIssues
(
this
.
testCase
.
caseId
);
this
.
$success
(
"
关闭成功
"
);
});
}
}
}
...
...
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue
浏览文件 @
46d52334
...
...
@@ -102,6 +102,28 @@
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop=
"nodePath"
label=
"缺陷"
show-overflow-tooltip
>
<
template
v-slot:default=
"scope"
>
<el-popover
placement=
"right"
width=
"400"
trigger=
"hover"
>
<el-table
border
class=
"adjust-table"
:data=
"scope.row.issuesContent"
style=
"width: 100%"
>
<!--
<el-table-column
prop=
"id"
label=
"缺陷ID"
show-overflow-tooltip
/>
-->
<el-table-column
prop=
"title"
label=
"缺陷标题"
/>
<el-table-column
prop=
"description"
label=
"缺陷描述"
show-overflow-tooltip
/>
<!--
<el-table-column
prop=
"status"
label=
"缺陷状态"
/>
-->
<el-table-column
prop=
"platform"
label=
"平台"
/>
</el-table>
<el-button
slot=
"reference"
type=
"text"
>
{{
scope
.
row
.
issuesSize
}}
</el-button>
</el-popover>
</
template
>
</el-table-column>
<el-table-column
prop=
"executorName"
:label=
"$t('test_track.plan_view.executor')"
>
...
...
@@ -317,6 +339,14 @@
let
data
=
response
.
data
;
this
.
total
=
data
.
itemCount
;
this
.
tableData
=
data
.
listObject
;
for
(
let
i
=
0
;
i
<
this
.
tableData
.
length
;
i
++
)
{
this
.
$set
(
this
.
tableData
[
i
],
"
issuesSize
"
,
0
);
this
.
$get
(
"
/issues/get/
"
+
this
.
tableData
[
i
].
caseId
,
response
=>
{
let
issues
=
response
.
data
;
this
.
$set
(
this
.
tableData
[
i
],
"
issuesSize
"
,
issues
.
length
);
this
.
$set
(
this
.
tableData
[
i
],
"
issuesContent
"
,
issues
);
})
}
// this.selectIds.clear();
this
.
selectRows
.
clear
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录