refactor(权限管理): 性能测试权限
This commit is contained in:
parent
e1eaecff17
commit
c04eeff4ec
|
@ -33,6 +33,7 @@ import io.metersphere.service.ScheduleService;
|
||||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
@ -47,7 +48,6 @@ import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/api/definition")
|
@RequestMapping(value = "/api/definition")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
|
||||||
public class ApiDefinitionController {
|
public class ApiDefinitionController {
|
||||||
@Resource
|
@Resource
|
||||||
private ScheduleService scheduleService;
|
private ScheduleService scheduleService;
|
||||||
|
@ -63,6 +63,7 @@ public class ApiDefinitionController {
|
||||||
private ApiTestEnvironmentService apiTestEnvironmentService;
|
private ApiTestEnvironmentService apiTestEnvironmentService;
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
|
@RequiresPermissions("PROJECT_API_DEFINITION:READ")
|
||||||
public Pager<List<ApiDefinitionResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
|
public Pager<List<ApiDefinitionResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||||
|
@ -84,6 +85,7 @@ public class ApiDefinitionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list/all")
|
@PostMapping("/list/all")
|
||||||
|
@RequiresPermissions("PROJECT_API_DEFINITION:READ")
|
||||||
public List<ApiDefinitionResult> list(@RequestBody ApiDefinitionRequest request) {
|
public List<ApiDefinitionResult> list(@RequestBody ApiDefinitionRequest request) {
|
||||||
return apiDefinitionService.list(request);
|
return apiDefinitionService.list(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.LoadTestReportLog;
|
import io.metersphere.base.domain.LoadTestReportLog;
|
||||||
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
|
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.dto.LogDetailDTO;
|
import io.metersphere.dto.LogDetailDTO;
|
||||||
|
@ -17,8 +16,7 @@ import io.metersphere.performance.controller.request.RenameReportRequest;
|
||||||
import io.metersphere.performance.controller.request.ReportRequest;
|
import io.metersphere.performance.controller.request.ReportRequest;
|
||||||
import io.metersphere.performance.dto.LoadTestExportJmx;
|
import io.metersphere.performance.dto.LoadTestExportJmx;
|
||||||
import io.metersphere.performance.service.PerformanceReportService;
|
import io.metersphere.performance.service.PerformanceReportService;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -33,7 +31,7 @@ public class PerformanceReportController {
|
||||||
private PerformanceReportService performanceReportService;
|
private PerformanceReportService performanceReportService;
|
||||||
|
|
||||||
@PostMapping("/recent/{count}")
|
@PostMapping("/recent/{count}")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
@RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ")
|
||||||
public List<ReportDTO> recentProjects(@PathVariable int count, @RequestBody ReportRequest request) {
|
public List<ReportDTO> recentProjects(@PathVariable int count, @RequestBody ReportRequest request) {
|
||||||
// 最近 `count` 个项目
|
// 最近 `count` 个项目
|
||||||
PageHelper.startPage(1, count);
|
PageHelper.startPage(1, count);
|
||||||
|
@ -47,7 +45,7 @@ public class PerformanceReportController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delete/{reportId}")
|
@PostMapping("/delete/{reportId}")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
@RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ+DELETE")
|
||||||
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#reportId)", msClass = PerformanceReportService.class)
|
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#reportId)", msClass = PerformanceReportService.class)
|
||||||
public void deleteReport(@PathVariable String reportId) {
|
public void deleteReport(@PathVariable String reportId) {
|
||||||
performanceReportService.deleteReport(reportId);
|
performanceReportService.deleteReport(reportId);
|
||||||
|
@ -131,7 +129,7 @@ public class PerformanceReportController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/batch/delete")
|
@PostMapping("/batch/delete")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
@RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ+DELETE")
|
||||||
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#reportRequest.ids)", msClass = PerformanceReportService.class)
|
@MsAuditLog(module = "performance_test_report", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#reportRequest.ids)", msClass = PerformanceReportService.class)
|
||||||
public void deleteReportBatch(@RequestBody DeleteReportRequest reportRequest) {
|
public void deleteReportBatch(@RequestBody DeleteReportRequest reportRequest) {
|
||||||
performanceReportService.deleteReportBatch(reportRequest);
|
performanceReportService.deleteReportBatch(reportRequest);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import io.metersphere.service.CheckPermissionService;
|
||||||
import io.metersphere.service.FileService;
|
import io.metersphere.service.FileService;
|
||||||
import io.metersphere.track.request.testplan.FileOperationRequest;
|
import io.metersphere.track.request.testplan.FileOperationRequest;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -36,7 +37,6 @@ import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "performance")
|
@RequestMapping(value = "performance")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
|
||||||
public class PerformanceTestController {
|
public class PerformanceTestController {
|
||||||
@Resource
|
@Resource
|
||||||
private PerformanceTestService performanceTestService;
|
private PerformanceTestService performanceTestService;
|
||||||
|
@ -52,12 +52,14 @@ public class PerformanceTestController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
|
||||||
public Pager<List<LoadTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
public Pager<List<LoadTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, performanceTestService.list(request));
|
return PageUtils.setPageInfo(page, performanceTestService.list(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/{projectId}")
|
@GetMapping("/list/{projectId}")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
|
||||||
public List<LoadTest> list(@PathVariable String projectId) {
|
public List<LoadTest> list(@PathVariable String projectId) {
|
||||||
checkPermissionService.checkProjectOwner(projectId);
|
checkPermissionService.checkProjectOwner(projectId);
|
||||||
return performanceTestService.getLoadTestByProjectId(projectId);
|
return performanceTestService.getLoadTestByProjectId(projectId);
|
||||||
|
@ -65,6 +67,7 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/state/get/{testId}")
|
@GetMapping("/state/get/{testId}")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
|
||||||
public LoadTest listByTestId(@PathVariable String testId) {
|
public LoadTest listByTestId(@PathVariable String testId) {
|
||||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||||
return performanceTestService.getLoadTestBytestId(testId);
|
return performanceTestService.getLoadTestBytestId(testId);
|
||||||
|
@ -72,6 +75,7 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
@PostMapping(value = "/save", consumes = {"multipart/form-data"})
|
@PostMapping(value = "/save", consumes = {"multipart/form-data"})
|
||||||
@MsAuditLog(module = "performance_test", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
@MsAuditLog(module = "performance_test", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+CREATE")
|
||||||
public String save(
|
public String save(
|
||||||
@RequestPart("request") SaveTestPlanRequest request,
|
@RequestPart("request") SaveTestPlanRequest request,
|
||||||
@RequestPart(value = "file") List<MultipartFile> files
|
@RequestPart(value = "file") List<MultipartFile> files
|
||||||
|
@ -83,6 +87,7 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
|
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
|
||||||
@MsAuditLog(module = "performance_test", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
@MsAuditLog(module = "performance_test", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+EDIT")
|
||||||
public String edit(
|
public String edit(
|
||||||
@RequestPart("request") EditTestPlanRequest request,
|
@RequestPart("request") EditTestPlanRequest request,
|
||||||
@RequestPart(value = "file", required = false) List<MultipartFile> files
|
@RequestPart(value = "file", required = false) List<MultipartFile> files
|
||||||
|
@ -131,6 +136,7 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@MsAuditLog(module = "performance_test", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
@MsAuditLog(module = "performance_test", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+DELETE")
|
||||||
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
||||||
checkPermissionService.checkPerformanceTestOwner(request.getId());
|
checkPermissionService.checkPerformanceTestOwner(request.getId());
|
||||||
performanceTestService.delete(request);
|
performanceTestService.delete(request);
|
||||||
|
@ -138,6 +144,7 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
@PostMapping("/run")
|
@PostMapping("/run")
|
||||||
@MsAuditLog(module = "performance_test", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
@MsAuditLog(module = "performance_test", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+RUN")
|
||||||
public String run(@RequestBody RunTestPlanRequest request) {
|
public String run(@RequestBody RunTestPlanRequest request) {
|
||||||
return performanceTestService.run(request);
|
return performanceTestService.run(request);
|
||||||
}
|
}
|
||||||
|
@ -179,21 +186,25 @@ public class PerformanceTestController {
|
||||||
|
|
||||||
@PostMapping(value = "/copy")
|
@PostMapping(value = "/copy")
|
||||||
@MsAuditLog(module = "performance_test", type = OperLogConstants.COPY, content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
@MsAuditLog(module = "performance_test", type = OperLogConstants.COPY, content = "#msClass.getLogDetails(#request.id)", msClass = PerformanceTestService.class)
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+COPY")
|
||||||
public void copy(@RequestBody SaveTestPlanRequest request) {
|
public void copy(@RequestBody SaveTestPlanRequest request) {
|
||||||
performanceTestService.copy(request);
|
performanceTestService.copy(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/schedule/create")
|
@PostMapping(value = "/schedule/create")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+SCHEDULE")
|
||||||
public void createSchedule(@RequestBody ScheduleRequest request) {
|
public void createSchedule(@RequestBody ScheduleRequest request) {
|
||||||
performanceTestService.createSchedule(request);
|
performanceTestService.createSchedule(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/schedule/update")
|
@PostMapping(value = "/schedule/update")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ+SCHEDULE")
|
||||||
public void updateSchedule(@RequestBody Schedule request) {
|
public void updateSchedule(@RequestBody Schedule request) {
|
||||||
performanceTestService.updateSchedule(request);
|
performanceTestService.updateSchedule(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list/schedule/{goPage}/{pageSize}")
|
@PostMapping("/list/schedule/{goPage}/{pageSize}")
|
||||||
|
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
|
||||||
public List<ScheduleDao> listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
public List<ScheduleDao> listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return performanceTestService.listSchedule(request);
|
return performanceTestService.listSchedule(request);
|
||||||
|
|
|
@ -12,15 +12,16 @@
|
||||||
{{ $t("i18n.home") }}
|
{{ $t("i18n.home") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item v-show="isNewVersion" :index="'/api/definition'">
|
<el-menu-item v-show="isNewVersion" :index="'/api/definition'" v-permission="['PROJECT_API_DEFINITION:READ']">
|
||||||
{{ $t("i18n.definition") }}
|
{{ $t("i18n.definition") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item v-show="isNewVersion" :index="'/api/automation'">
|
<el-menu-item v-show="isNewVersion" :index="'/api/automation'" v-permission="['PROJECT_API_SCENARIO:READ']">
|
||||||
{{ $t("i18n.automation") }}
|
{{ $t("i18n.automation") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item v-show="isNewVersion" :index="'/api/automation/report'">
|
<el-menu-item v-show="isNewVersion" :index="'/api/automation/report'"
|
||||||
|
v-permission="['PROJECT_API_REPORT:READ']">
|
||||||
{{ $t("i18n.report") }}
|
{{ $t("i18n.report") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ export default {
|
||||||
return '/api/test/edit/' + item.id;
|
return '/api/test/edit/' + item.id;
|
||||||
},
|
},
|
||||||
router: function (item) {
|
router: function (item) {
|
||||||
return {path: '/api/test/edit', query: {id: item.id}}
|
return {path: '/api/test/edit', query: {id: item.id}};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reportRecent: {
|
reportRecent: {
|
||||||
|
@ -93,7 +94,7 @@ export default {
|
||||||
isRouterAlive: true,
|
isRouterAlive: true,
|
||||||
apiTestProjectPath: '',
|
apiTestProjectPath: '',
|
||||||
currentProject: ''
|
currentProject: ''
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
|
@ -121,7 +122,7 @@ export default {
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
ApiEvent.$off(LIST_CHANGE);
|
ApiEvent.$off(LIST_CHANGE);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<ms-table-operator-button v-for="(btn, index) in buttons" :key="index" :isTesterPermission="isTesterPermission(btn)"
|
<ms-table-operator-button v-for="(btn, index) in buttons" :key="index"
|
||||||
|
v-permission="btn.meta.permissions"
|
||||||
:disabled="isDisable(btn)"
|
:disabled="isDisable(btn)"
|
||||||
:tip="btn.tip" :icon="btn.icon" :type="btn.type" :isDivButton="btn.isDivButton"
|
:tip="btn.tip" :icon="btn.icon" :type="btn.type" :isDivButton="btn.isDivButton"
|
||||||
@exec="click(btn)" @click.stop="clickStop(btn)"/>
|
@exec="click(btn)" @click.stop="clickStop(btn)"/>
|
||||||
|
@ -8,42 +9,42 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsTableOperatorButton from "./MsTableOperatorButton";
|
import MsTableOperatorButton from "./MsTableOperatorButton";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsTableOperators",
|
name: "MsTableOperators",
|
||||||
components: {MsTableOperatorButton},
|
components: {MsTableOperatorButton},
|
||||||
props: {
|
props: {
|
||||||
row: Object,
|
row: Object,
|
||||||
buttons: Array,
|
buttons: Array,
|
||||||
index: Number
|
index: Number
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click(btn) {
|
click(btn) {
|
||||||
if (btn.exec instanceof Function) {
|
if (btn.exec instanceof Function) {
|
||||||
btn.exec(this.row, this.index);
|
btn.exec(this.row, this.index);
|
||||||
}
|
|
||||||
},
|
|
||||||
clickStop(btn) {
|
|
||||||
if (btn.stop instanceof Function) {
|
|
||||||
btn.stop(this.row, this.index);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isDisable(btn) {
|
|
||||||
if (btn.isDisable) {
|
|
||||||
return btn.isDisable(this.row);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
clickStop(btn) {
|
||||||
isTesterPermission() {
|
if (btn.stop instanceof Function) {
|
||||||
return function (btn) {
|
btn.stop(this.row, this.index);
|
||||||
return btn.isTesterPermission !== false;
|
}
|
||||||
}
|
},
|
||||||
},
|
isDisable(btn) {
|
||||||
|
if (btn.isDisable) {
|
||||||
|
return btn.isDisable(this.row);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isTesterPermission() {
|
||||||
|
return function (btn) {
|
||||||
|
return btn.isTesterPermission !== false;
|
||||||
|
};
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -8,17 +8,18 @@
|
||||||
{{ $t("i18n.home") }}
|
{{ $t("i18n.home") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-submenu v-roles="['test_manager','test_user','test_viewer']"
|
<el-submenu v-permission="['PROJECT_PERFORMANCE_TEST:READ']"
|
||||||
index="4" popper-class="submenu">
|
index="4" popper-class="submenu">
|
||||||
<template v-slot:title>{{ $t('commons.test') }}</template>
|
<template v-slot:title>{{ $t('commons.test') }}</template>
|
||||||
<ms-recent-list ref="testRecent" :options="testRecent"/>
|
<ms-recent-list ref="testRecent" :options="testRecent"/>
|
||||||
<el-divider/>
|
<el-divider/>
|
||||||
<ms-show-all :index="'/performance/test/all'"/>
|
<ms-show-all :index="'/performance/test/all'"/>
|
||||||
<ms-create-button v-roles="['test_manager','test_user']" :index="'/performance/test/create'"
|
<ms-create-button v-permission="['PROJECT_PERFORMANCE_TEST:READ+CREATE']"
|
||||||
|
:index="'/performance/test/create'"
|
||||||
:title="$t('load_test.create')"/>
|
:title="$t('load_test.create')"/>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
|
|
||||||
<el-submenu v-roles="['test_manager','test_user','test_viewer']"
|
<el-submenu v-permission="['PROJECT_PERFORMANCE_REPORT:READ']"
|
||||||
index="5" popper-class="submenu">
|
index="5" popper-class="submenu">
|
||||||
<template v-slot:title>{{ $t('commons.report') }}</template>
|
<template v-slot:title>{{ $t('commons.report') }}</template>
|
||||||
<ms-recent-list ref="reportRecent" :options="reportRecent"/>
|
<ms-recent-list ref="reportRecent" :options="reportRecent"/>
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-row type="flex" justify="center">
|
<el-row type="flex" justify="center" v-permission="['PROJECT_PERFORMANCE_TEST:READ+CREATE']">
|
||||||
<ms-create-test :to="'/performance/test/create'"/>
|
<ms-create-test :to="'/performance/test/create'"/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<ms-test-heatmap :values="values"/>
|
<ms-test-heatmap :values="values"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<ms-schedule-list :group="'PERFORMANCE_TEST'"/>
|
<ms-schedule-list :group="'PERFORMANCE_TEST'" v-permission="['PROJECT_PERFORMANCE_TEST:READ+SCHEDULE']"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</ms-main-container>
|
</ms-main-container>
|
||||||
|
@ -23,47 +23,47 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsContainer from "../../common/components/MsContainer";
|
import MsContainer from "../../common/components/MsContainer";
|
||||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||||
import MsPerformanceTestRecentList from "./PerformanceTestRecentList"
|
import MsPerformanceTestRecentList from "./PerformanceTestRecentList";
|
||||||
import MsPerformanceReportRecentList from "./PerformanceReportRecentList"
|
import MsPerformanceReportRecentList from "./PerformanceReportRecentList";
|
||||||
import MsTestHeatmap from "../../common/components/MsTestHeatmap";
|
import MsTestHeatmap from "../../common/components/MsTestHeatmap";
|
||||||
import MsScheduleList from "../../api/home/ScheduleList";
|
import MsScheduleList from "../../api/home/ScheduleList";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PerformanceTestHome",
|
name: "PerformanceTestHome",
|
||||||
components: {
|
components: {
|
||||||
MsScheduleList,
|
MsScheduleList,
|
||||||
MsTestHeatmap,
|
MsTestHeatmap,
|
||||||
MsMainContainer,
|
MsMainContainer,
|
||||||
MsContainer,
|
MsContainer,
|
||||||
MsPerformanceTestRecentList,
|
MsPerformanceTestRecentList,
|
||||||
MsPerformanceReportRecentList
|
MsPerformanceReportRecentList
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
values: [],
|
values: [],
|
||||||
result: {},
|
result: {},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getValues();
|
this.getValues();
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.getValues();
|
this.getValues();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getValues() {
|
getValues() {
|
||||||
this.result = this.$get('/performance/dashboard/tests', response => {
|
this.result = this.$get('/performance/dashboard/tests', response => {
|
||||||
this.values = response.data;
|
this.values = response.data;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.el-row {
|
.el-row {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -108,7 +108,8 @@
|
||||||
@exec="handleView(scope.row)" type="primary"/>
|
@exec="handleView(scope.row)" type="primary"/>
|
||||||
<ms-table-operator-button :tip="$t('load_test.report.diff')" icon="el-icon-s-operation"
|
<ms-table-operator-button :tip="$t('load_test.report.diff')" icon="el-icon-s-operation"
|
||||||
@exec="handleDiff(scope.row)" type="warning"/>
|
@exec="handleDiff(scope.row)" type="warning"/>
|
||||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_report.delete')"
|
<ms-table-operator-button :tip="$t('api_report.delete')"
|
||||||
|
v-permission="['PROJECT_PERFORMANCE_REPORT:READ+DELETE']"
|
||||||
icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger"/>
|
icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<ms-schedule-config :schedule="test.schedule" :save="saveCronExpression" @scheduleChange="saveSchedule"
|
<ms-schedule-config :schedule="test.schedule" :save="saveCronExpression" @scheduleChange="saveSchedule"
|
||||||
|
v-permission="['PROJECT_PERFORMANCE_TEST:READ+SCHEDULE']"
|
||||||
:check-open="checkScheduleEdit" :test-id="testId" :custom-validate="durationValidate"/>
|
:check-open="checkScheduleEdit" :test-id="testId" :custom-validate="durationValidate"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
<ms-main-container>
|
<ms-main-container>
|
||||||
<el-card class="table-card" v-loading="result.loading">
|
<el-card class="table-card" v-loading="result.loading">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search"
|
<ms-table-header :condition.sync="condition" @search="search"
|
||||||
:title="$t('commons.test')"
|
:title="$t('commons.test')"
|
||||||
|
v-permission="['PROJECT_PERFORMANCE_TEST:READ+CREATE']"
|
||||||
@create="create" :createTip="$t('load_test.create')"/>
|
@create="create" :createTip="$t('load_test.create')"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -129,13 +130,16 @@ export default {
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||||
exec: this.handleEdit
|
exec: this.handleEdit,
|
||||||
|
meta: {permissions: ['PROJECT_PERFORMANCE_TEST:READ+EDIT']}
|
||||||
}, {
|
}, {
|
||||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||||
exec: this.handleCopy
|
exec: this.handleCopy,
|
||||||
|
meta: {permissions: ['PROJECT_PERFORMANCE_TEST:READ+COPY']}
|
||||||
}, {
|
}, {
|
||||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||||
exec: this.handleDelete
|
exec: this.handleDelete,
|
||||||
|
meta: {permissions: ['PROJECT_PERFORMANCE_TEST:READ+DELETE']}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
statusFilters: [
|
statusFilters: [
|
||||||
|
|
Loading…
Reference in New Issue