Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
747ddc14
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,发现更多精彩内容 >>
提交
747ddc14
编写于
4月 19, 2021
作者:
S
song-tianyang
提交者:
刘瑞斌
4月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复接口自动变化表格的全选功能问题
修复接口自动变化表格的全选功能问题
上级
f7cfa4ae
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
105 addition
and
20 deletion
+105
-20
backend/src/main/java/io/metersphere/api/controller/MockApiController.java
...java/io/metersphere/api/controller/MockApiController.java
+8
-0
backend/src/main/java/io/metersphere/api/dto/automation/RunTestPlanScenarioRequest.java
...sphere/api/dto/automation/RunTestPlanScenarioRequest.java
+40
-0
backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java
...tersphere/api/dto/automation/TestPlanScenarioRequest.java
+10
-0
backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java
...here/track/controller/TestPlanScenarioCaseController.java
+2
-2
backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java
...etersphere/track/service/TestPlanScenarioCaseService.java
+17
-10
frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue
...ss/components/api/automation/scenario/ApiScenarioList.vue
+11
-2
frontend/src/business/components/api/homepage/ApiTestHomePage.vue
.../src/business/components/api/homepage/ApiTestHomePage.vue
+9
-1
frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue
...track/plan/view/comonents/api/TestPlanApiScenarioList.vue
+8
-5
未找到文件。
backend/src/main/java/io/metersphere/api/controller/MockApiController.java
浏览文件 @
747ddc14
...
...
@@ -4,6 +4,7 @@ import io.metersphere.api.dto.mockconfig.response.MockConfigResponse;
import
io.metersphere.api.dto.mockconfig.response.MockExpectConfigResponse
;
import
io.metersphere.api.service.ApiDefinitionService
;
import
io.metersphere.api.service.MockConfigService
;
import
io.metersphere.controller.handler.annotation.NoResultHolder
;
import
org.springframework.messaging.handler.annotation.Payload
;
import
org.springframework.messaging.rsocket.RSocketRequester
;
import
org.springframework.messaging.rsocket.annotation.ConnectMapping
;
...
...
@@ -30,6 +31,7 @@ public class MockApiController {
private
ApiDefinitionService
apiDefinitionService
;
@PostMapping
(
"/{apiId}/**"
)
@NoResultHolder
public
String
postRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getPostParamMap
(
request
);
String
returnStr
=
""
;
...
...
@@ -46,6 +48,7 @@ public class MockApiController {
}
@GetMapping
(
"/{apiId}/**"
)
@NoResultHolder
public
String
getRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getGetParamMap
(
request
,
apiId
);
String
returnStr
=
""
;
...
...
@@ -62,6 +65,7 @@ public class MockApiController {
}
@PutMapping
(
"/{apiId}/**"
)
@NoResultHolder
public
String
putRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getPostParamMap
(
request
);
...
...
@@ -79,6 +83,7 @@ public class MockApiController {
}
@PatchMapping
(
"/{apiId}/**"
)
@NoResultHolder
public
String
patchRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getPostParamMap
(
request
);
String
returnStr
=
""
;
...
...
@@ -95,6 +100,7 @@ public class MockApiController {
}
@DeleteMapping
(
"/{apiId}/**"
)
@NoResultHolder
public
String
deleteRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getGetParamMap
(
request
,
apiId
);
...
...
@@ -113,6 +119,7 @@ public class MockApiController {
}
@RequestMapping
(
value
=
"/{apiId}/**"
,
method
=
RequestMethod
.
OPTIONS
)
@NoResultHolder
public
String
optionsRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMapPost
=
mockConfigService
.
getPostParamMap
(
request
);
...
...
@@ -136,6 +143,7 @@ public class MockApiController {
}
@RequestMapping
(
value
=
"/{apiId}/**"
,
method
=
RequestMethod
.
HEAD
)
@NoResultHolder
public
void
headRequest
(
@PathVariable
String
apiId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
paramMap
=
mockConfigService
.
getGetParamMap
(
request
,
apiId
);
String
returnStr
=
""
;
...
...
backend/src/main/java/io/metersphere/api/dto/automation/RunTestPlanScenarioRequest.java
0 → 100644
浏览文件 @
747ddc14
package
io.metersphere.api.dto.automation
;
import
io.metersphere.base.domain.ApiScenarioWithBLOBs
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
import
java.util.Map
;
@Setter
@Getter
public
class
RunTestPlanScenarioRequest
extends
ApiScenarioWithBLOBs
{
private
String
reportId
;
private
String
environmentId
;
private
String
triggerMode
;
private
String
executeType
;
private
String
runMode
;
/**
* 测试情景和测试计划的关联ID
*/
private
String
planScenarioId
;
private
List
<
String
>
planCaseIds
;
private
List
<
String
>
ids
;
private
String
reportUserID
;
private
Map
<
String
,
String
>
scenarioTestPlanIdMap
;
private
TestPlanScenarioRequest
condition
;
private
RunModeConfig
config
;
}
backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java
浏览文件 @
747ddc14
...
...
@@ -26,4 +26,14 @@ public class TestPlanScenarioRequest {
private
Map
<
String
,
Object
>
combine
;
private
List
<
String
>
ids
;
private
String
reviewId
;
/**
* 是否选中所有数据
*/
private
boolean
selectAll
;
/**
* 全选之后取消选中的id
*/
private
List
<
String
>
unSelectIds
;
}
backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java
浏览文件 @
747ddc14
...
...
@@ -51,13 +51,13 @@ public class TestPlanScenarioCaseController {
}
@PostMapping
(
value
=
"/run"
)
public
String
run
(
@RequestBody
RunScenarioRequest
request
)
{
public
String
run
(
@RequestBody
Run
TestPlan
ScenarioRequest
request
)
{
request
.
setExecuteType
(
ExecuteType
.
Completed
.
name
());
return
testPlanScenarioCaseService
.
run
(
request
);
}
@PostMapping
(
value
=
"/jenkins/run"
)
public
String
runByRun
(
@RequestBody
RunScenarioRequest
request
)
{
public
String
runByRun
(
@RequestBody
Run
TestPlan
ScenarioRequest
request
)
{
request
.
setExecuteType
(
ExecuteType
.
Saved
.
name
());
request
.
setTriggerMode
(
ApiRunMode
.
API
.
name
());
request
.
setRunMode
(
ApiRunMode
.
SCENARIO
.
name
());
...
...
backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java
浏览文件 @
747ddc14
package
io.metersphere.track.service
;
import
com.alibaba.fastjson.JSON
;
import
io.metersphere.api.dto.automation.ApiScenarioDTO
;
import
io.metersphere.api.dto.automation.ApiScenarioRequest
;
import
io.metersphere.api.dto.automation.RunScenarioRequest
;
import
io.metersphere.api.dto.automation.TestPlanScenarioRequest
;
import
io.metersphere.api.dto.automation.*
;
import
io.metersphere.api.service.ApiAutomationService
;
import
io.metersphere.api.service.ApiScenarioReportService
;
import
io.metersphere.base.domain.TestPlanApiScenario
;
...
...
@@ -91,18 +88,28 @@ public class TestPlanScenarioCaseService {
testPlanApiScenarioMapper
.
deleteByExample
(
example
);
}
public
String
run
(
Run
ScenarioRequest
r
equest
)
{
public
String
run
(
Run
TestPlanScenarioRequest
testPlanScenarioR
equest
)
{
StringBuilder
idStr
=
new
StringBuilder
();
request
.
getPlanCaseIds
().
forEach
(
item
->
{
List
<
String
>
planCaseIdList
=
testPlanScenarioRequest
.
getPlanCaseIds
();
if
(
testPlanScenarioRequest
.
getCondition
()
!=
null
&&
testPlanScenarioRequest
.
getCondition
().
isSelectAll
())
{
planCaseIdList
=
this
.
selectIds
(
testPlanScenarioRequest
.
getCondition
());
if
(
testPlanScenarioRequest
.
getCondition
().
getUnSelectIds
()
!=
null
)
{
planCaseIdList
.
removeAll
(
testPlanScenarioRequest
.
getCondition
().
getUnSelectIds
());
}
}
testPlanScenarioRequest
.
setPlanCaseIds
(
planCaseIdList
);
planCaseIdList
.
forEach
(
item
->
{
idStr
.
append
(
"\""
).
append
(
item
).
append
(
"\""
).
append
(
","
);
});
List
<
TestPlanApiScenario
>
testPlanApiScenarioList
=
extTestPlanScenarioCaseMapper
.
selectByIds
(
idStr
.
toString
().
substring
(
0
,
idStr
.
toString
().
length
()
-
1
),
"\""
+
org
.
apache
.
commons
.
lang3
.
StringUtils
.
join
(
r
equest
.
getPlanCaseIds
(),
","
)
+
"\""
);
List
<
TestPlanApiScenario
>
testPlanApiScenarioList
=
extTestPlanScenarioCaseMapper
.
selectByIds
(
idStr
.
toString
().
substring
(
0
,
idStr
.
toString
().
length
()
-
1
),
"\""
+
org
.
apache
.
commons
.
lang3
.
StringUtils
.
join
(
testPlanScenarioR
equest
.
getPlanCaseIds
(),
","
)
+
"\""
);
List
<
String
>
scenarioIds
=
new
ArrayList
<>();
Map
<
String
,
String
>
scenarioIdApiScarionMap
=
new
HashMap
<>();
for
(
TestPlanApiScenario
apiScenario:
testPlanApiScenarioList
)
{
Map
<
String
,
String
>
scenarioIdApiScarionMap
=
new
HashMap
<>();
for
(
TestPlanApiScenario
apiScenario
:
testPlanApiScenarioList
)
{
scenarioIds
.
add
(
apiScenario
.
getApiScenarioId
());
scenarioIdApiScarionMap
.
put
(
apiScenario
.
getApiScenarioId
(),
apiScenario
.
getId
());
scenarioIdApiScarionMap
.
put
(
apiScenario
.
getApiScenarioId
(),
apiScenario
.
getId
());
}
RunScenarioRequest
request
=
new
RunScenarioRequest
();
request
.
setIds
(
scenarioIds
);
request
.
setScenarioTestPlanIdMap
(
scenarioIdApiScarionMap
);
request
.
setRunMode
(
ApiRunMode
.
SCENARIO_PLAN
.
name
());
...
...
frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue
浏览文件 @
747ddc14
...
...
@@ -618,10 +618,19 @@
},
isSelectDataAll
(
data
)
{
// this.condition.selectAll = data;
// setUnSelectIds(this.tableData, this.condition, this.selectRows);
// this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
// toggleAllSelection(this.$refs.scenarioTable, this.tableData, this.selectRows);
this
.
condition
.
selectAll
=
data
;
setUnSelectIds
(
this
.
tableData
,
this
.
condition
,
this
.
selectRows
);
this
.
selectDataCounts
=
getSelectDataCounts
(
this
.
condition
,
this
.
total
,
this
.
selectRows
);
//设置勾选
toggleAllSelection
(
this
.
$refs
.
scenarioTable
,
this
.
tableData
,
this
.
selectRows
);
//显示隐藏菜单
_handleSelectAll
(
this
,
this
.
tableData
,
this
.
tableData
,
this
.
selectRows
);
//设置未选择ID(更新)
this
.
condition
.
unSelectIds
=
[];
//更新统计信息
this
.
selectDataCounts
=
getSelectDataCounts
(
this
.
condition
,
this
.
total
,
this
.
selectRows
);
},
edit
(
row
)
{
let
data
=
JSON
.
parse
(
JSON
.
stringify
(
row
));
...
...
frontend/src/business/components/api/homepage/ApiTestHomePage.vue
浏览文件 @
747ddc14
...
...
@@ -3,7 +3,7 @@
<el-header
height=
"0"
>
<div
style=
"float: right"
>
<div
v-if=
"tipsType==='1'"
>
🤔️ 天凉了,保温杯买了吗?
{{
seasonTips
}}
</div>
<div
v-else-if=
"tipsType==='2'"
>
😔 觉得MeterSphere不好用就来
...
...
@@ -85,6 +85,7 @@ export default {
interfaceCoverage
:
"
waitting...
"
,
tipsType
:
"
1
"
,
result
:
{},
seasonTips
:
"
🤔️ 天热了,小风扇买了吗?
"
,
}
},
activated
()
{
...
...
@@ -97,6 +98,13 @@ export default {
checkTipsType
()
{
var
random
=
Math
.
floor
(
Math
.
random
()
*
(
4
-
1
+
1
))
+
1
;
this
.
tipsType
=
random
+
""
;
let
today
=
new
Date
();
let
month
=
today
.
getMonth
();
if
(
month
>
9
&&
month
<
3
)
{
this
.
seasonTips
=
"
🤔️ 天热了,小风扇买了吗?
"
;
}
else
{
this
.
seasonTips
=
"
🤔️ 天凉了,保温杯买了吗?
"
;
}
},
search
()
{
...
...
frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue
浏览文件 @
747ddc14
...
...
@@ -17,7 +17,7 @@
:total=
"total"
@
selectPageAll=
"isSelectDataAll(false)"
@
selectAll=
"isSelectDataAll(true)"
/>
<el-table-column
width=
"
2
0"
:resizable=
"false"
align=
"center"
>
<el-table-column
width=
"
4
0"
:resizable=
"false"
align=
"center"
>
<
template
v-slot:default=
"{row}"
>
<show-more-btn
:is-show=
"isSelect(row)"
:buttons=
"buttons"
:size=
"selectDataCounts"
/>
</
template
>
...
...
@@ -110,7 +110,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import
MsTablePagination
from
"
@/business/components/common/pagination/TablePagination
"
;
import
ShowMoreBtn
from
"
@/business/components/track/case/components/ShowMoreBtn
"
;
import
MsTag
from
"
../../../../../common/components/MsTag
"
;
import
{
getUUID
,
strMapToObj
}
from
"
@/common/js/utils
"
;
import
{
get
CurrentProjectID
,
get
UUID
,
strMapToObj
}
from
"
@/common/js/utils
"
;
import
MsApiReportDetail
from
"
../../../../../api/automation/report/ApiReportDetail
"
;
import
MsTableMoreBtn
from
"
../../../../../api/automation/scenario/TableMoreBtn
"
;
import
MsScenarioExtendButtons
from
"
@/business/components/api/automation/scenario/ScenarioExtendBtns
"
;
...
...
@@ -305,11 +305,14 @@ export default {
this
.
$post
(
"
/test/case/review/scenario/case/run
"
,
param
,
response
=>
{});
}
if
(
this
.
planId
)
{
let
param
=
{
config
:
config
,
planCaseIds
:[]};
let
selectParam
=
buildBatchParam
(
this
);
let
param
=
{
config
:
config
,
planCaseIds
:
[]};
this
.
selectRows
.
forEach
(
row
=>
{
this
.
buildExecuteParam
(
param
,
row
);
this
.
buildExecuteParam
(
param
,
row
);
});
param
.
condition
=
selectParam
.
condition
;
this
.
$post
(
"
/test/plan/scenario/case/run
"
,
param
,
response
=>
{
});
this
.
$post
(
"
/test/plan/scenario/case/run
"
,
param
,
response
=>
{});
}
this
.
$message
(
'
任务执行中,请稍后刷新查看结果
'
);
this
.
search
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录