mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 12:39:12 +08:00
fix(接口测试): 同步1.20的缺陷
This commit is contained in:
parent
b028f4eab7
commit
c1fd1017a5
@ -37,6 +37,7 @@ import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.service.definition.FunctionRunService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -179,7 +180,7 @@ public class ApiDefinitionController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/debug", consumes = {"multipart/form-data"})
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_DEBUG)
|
||||
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_DEFINITION_READ_DEBUG, PermissionConstants.PROJECT_API_DEFINITION_READ_RUN}, logical = Logical.OR)
|
||||
@MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.DEBUG, title = "#request.name", project = "#request.projectId")
|
||||
public MsExecResponseDTO runDebug(@RequestPart("request") RunDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return apiDefinitionService.run(request, bodyFiles);
|
||||
|
@ -12,11 +12,13 @@ import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.MockExpectConfig;
|
||||
import io.metersphere.base.domain.MockExpectConfigWithBLOBs;
|
||||
import io.metersphere.commons.constants.OperLogModule;
|
||||
import io.metersphere.commons.constants.PermissionConstants;
|
||||
import io.metersphere.commons.utils.mock.MockApiUtils;
|
||||
import io.metersphere.commons.utils.mock.MockTestDataUtil;
|
||||
import io.metersphere.log.annotation.MsRequestLog;
|
||||
import io.metersphere.service.MockConfigService;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -39,12 +41,14 @@ public class MockConfigController {
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
|
||||
@PostMapping("/gen")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_MOCK)
|
||||
public MockConfigResponse genMockConfig(@RequestBody MockConfigRequest request) {
|
||||
return mockConfigService.genMockConfig(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update/form", consumes = {"multipart/form-data"})
|
||||
@MsRequestLog(module = OperLogModule.API_DEFINITION)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_MOCK)
|
||||
public MockExpectConfig updateMockExpectConfig(@RequestPart("request") MockExpectConfigRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return mockConfigService.updateMockExpectConfig(request, bodyFiles);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class ApiScenarioController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/debug")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ_DEBUG)
|
||||
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_SCENARIO_READ_DEBUG, PermissionConstants.PROJECT_API_SCENARIO_READ_RUN}, logical = Logical.OR)
|
||||
@MsAuditLog(module = OperLogModule.API_AUTOMATION, type = OperLogConstants.DEBUG, title = "#request.scenarioName", sourceId = "#request.scenarioId", project = "#request.projectId")
|
||||
public String runDebug(@RequestPart("request") RunDefinitionRequest request, @RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
|
||||
try {
|
||||
@ -283,7 +283,7 @@ public class ApiScenarioController {
|
||||
}
|
||||
|
||||
@PostMapping("/batch/copy")
|
||||
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_SCENARIO_READ_CREATE, PermissionConstants.PROJECT_API_SCENARIO_READ_COPY}, logical = Logical.OR)
|
||||
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_SCENARIO_READ_CREATE, PermissionConstants.PROJECT_API_SCENARIO_READ_BATCH_COPY}, logical = Logical.OR)
|
||||
@MsAuditLog(module = OperLogModule.API_AUTOMATION, type = OperLogConstants.BATCH_ADD, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiScenarioService.class)
|
||||
public void batchCopy(@RequestBody ApiScenarioBatchRequest request) {
|
||||
apiAutomationService.batchCopy(request);
|
||||
@ -386,7 +386,7 @@ public class ApiScenarioController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/export/jmx")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ_EXPORT_SCENARIO)
|
||||
@RequiresPermissions(value = {PermissionConstants.PROJECT_API_SCENARIO_READ_EXPORT_SCENARIO, PermissionConstants.PROJECT_API_SCENARIO_READ_CREATE_PERFORMANCE , PermissionConstants.PROJECT_API_SCENARIO_READ_CREATE_PERFORMANCE_BATCH}, logical = Logical.OR)
|
||||
@MsAuditLog(module = OperLogModule.API_AUTOMATION, type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId")
|
||||
public ScenarioToPerformanceInfoDTO exportJmx(@RequestBody ApiScenarioBatchRequest request) {
|
||||
return apiAutomationService.exportJmx(request);
|
||||
|
@ -678,9 +678,6 @@ export default {
|
||||
name: this.$t('api_test.create_performance_test_batch'),
|
||||
handleClick: this.batchCreatePerformance,
|
||||
permissions: ['PROJECT_API_SCENARIO:READ+CREATE_PERFORMANCE_BATCH'],
|
||||
isDisable() {
|
||||
return !hasPermission('PROJECT_PERFORMANCE_TEST:READ+CREATE');
|
||||
},
|
||||
},
|
||||
],
|
||||
typeArr: [
|
||||
@ -1597,6 +1594,10 @@ export default {
|
||||
this.$emit('selection', selection);
|
||||
},
|
||||
batchCreatePerformance() {
|
||||
if (!hasPermission('PROJECT_PERFORMANCE_TEST:READ+CREATE')) {
|
||||
this.$warning(this.$t('api_test.create_performance_test_tips'));
|
||||
return;
|
||||
}
|
||||
this.$alert(this.$t('api_test.definition.request.batch_to_performance_confirm') + ' ?', '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
|
@ -153,9 +153,6 @@
|
||||
size="mini"
|
||||
@command="handleCommand"
|
||||
v-permission="[
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
'PROJECT_API_SCENARIO:READ+COPY',
|
||||
'PROJECT_API_SCENARIO:READ+DEBUG',
|
||||
'PROJECT_API_SCENARIO:READ+RUN'
|
||||
]">
|
||||
|
@ -30,6 +30,7 @@
|
||||
:class="{ active: showMock }"
|
||||
@click="changeTab('mock')"
|
||||
size="small"
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+MOCK']"
|
||||
v-if="currentProtocol === 'HTTP' || currentProtocol === 'TCP'">
|
||||
MOCK
|
||||
</el-button>
|
||||
|
@ -46,7 +46,12 @@
|
||||
@checkout="checkout"
|
||||
@create="create"
|
||||
@del="del"/>
|
||||
<el-button type="primary" size="small" @click="saveApi" v-prevent-re-click title="ctrl + s">{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="saveApi" v-prevent-re-click title="ctrl + s"
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
'PROJECT_API_DEFINITION:READ+COPY_API'
|
||||
]">{{ $t('commons.save') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -52,7 +52,11 @@
|
||||
@click="saveApi"
|
||||
v-prevent-re-click
|
||||
title="ctrl + s"
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']"
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
'PROJECT_API_DEFINITION:READ+COPY_API'
|
||||
]"
|
||||
>{{ $t('commons.save') }}
|
||||
</el-button>
|
||||
<el-dropdown
|
||||
|
@ -46,7 +46,12 @@
|
||||
@create="create"
|
||||
@setLatest="setLatest"
|
||||
@del="del" />
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click>{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
'PROJECT_API_DEFINITION:READ+COPY_API'
|
||||
]">{{ $t('commons.save') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -46,7 +46,12 @@
|
||||
@create="create"
|
||||
@setLatest="setLatest"
|
||||
@del="del" />
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click>{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
'PROJECT_API_DEFINITION:READ+COPY_API'
|
||||
]">{{ $t('commons.save') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -35,19 +35,20 @@
|
||||
@command="handleCommand"
|
||||
size="small"
|
||||
v-if="!runLoading"
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API', 'PROJECT_API_DEFINITION:READ+CREATE_CASE']">
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API', 'PROJECT_API_DEFINITION:READ+CREATE_CASE', 'PROJECT_API_DEFINITION:READ+RUN']">
|
||||
{{ $t('commons.test') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="load_case"
|
||||
>{{ $t('api_test.definition.request.load_case') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as_case"
|
||||
<el-dropdown-item command="save_as_case" v-permission="['PROJECT_API_DEFINITION:READ+CREATE_CASE']"
|
||||
>{{ $t('api_test.definition.request.save_as_case') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="update_api"
|
||||
<el-dropdown-item command="update_api" v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']"
|
||||
>{{ $t('api_test.definition.request.update_api') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as_api">{{ $t('api_test.definition.request.save_as') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="save_as_api" v-permission="['PROJECT_API_DEFINITION:READ+CREATE_API']"
|
||||
>{{ $t('api_test.definition.request.save_as') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
@ -155,6 +155,7 @@ public class PermissionConstants {
|
||||
public static final String PROJECT_API_SCENARIO_READ_EDIT = "PROJECT_API_SCENARIO:READ+EDIT";
|
||||
public static final String PROJECT_API_SCENARIO_READ_DELETE = "PROJECT_API_SCENARIO:READ+DELETE";
|
||||
public static final String PROJECT_API_SCENARIO_READ_COPY = "PROJECT_API_SCENARIO:READ+COPY";
|
||||
public static final String PROJECT_API_SCENARIO_READ_BATCH_COPY = "PROJECT_API_SCENARIO:READ+BATCH_COPY";
|
||||
public static final String PROJECT_API_SCENARIO_READ_RUN = "PROJECT_API_SCENARIO:READ+RUN";
|
||||
public static final String PROJECT_API_SCENARIO_READ_DEBUG = "PROJECT_API_SCENARIO:READ+DEBUG";
|
||||
public static final String PROJECT_API_SCENARIO_READ_SCHEDULE = "PROJECT_API_SCENARIO:READ+SCHEDULE";
|
||||
|
Loading…
Reference in New Issue
Block a user