Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6f22435be4
|
@ -158,7 +158,7 @@ public class ApiScenarioExecuteService {
|
|||
if (request.isRerun()) {
|
||||
ApiScenarioReportWithBLOBs report = new ApiScenarioReportWithBLOBs();
|
||||
report.setId(serialReportId);
|
||||
report.setStatus(ApiReportStatus.RUNNING.name());
|
||||
report.setStatus(ApiReportStatus.RERUNNING.name());
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
} else {
|
||||
LoggerUtil.info("Scenario run-执行脚本装载-初始化集成报告:" + serialReportId);
|
||||
|
|
|
@ -16,11 +16,6 @@ import io.metersphere.api.exec.api.ApiExecuteService;
|
|||
import io.metersphere.api.exec.generator.JSONSchemaGenerator;
|
||||
import io.metersphere.api.exec.queue.ExecThreadPoolExecutor;
|
||||
import io.metersphere.api.parse.api.ApiDefinitionImport;
|
||||
import io.metersphere.dto.BaseCase;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.service.definition.ApiTestCaseService;
|
||||
import io.metersphere.service.definition.EsbApiParamService;
|
||||
import io.metersphere.service.definition.EsbImportService;
|
||||
import io.metersphere.base.domain.ApiDefinition;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
|
@ -28,15 +23,19 @@ import io.metersphere.commons.constants.NoticeConstants;
|
|||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.OperLogModule;
|
||||
import io.metersphere.commons.constants.PermissionConstants;
|
||||
import io.metersphere.commons.utils.JSONToDocumentUtil;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.dto.BaseCase;
|
||||
import io.metersphere.dto.MsExecResponseDTO;
|
||||
import io.metersphere.dto.RelationshipEdgeDTO;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.request.ResetOrderRequest;
|
||||
import io.metersphere.commons.utils.JSONToDocumentUtil;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.service.definition.EsbApiParamService;
|
||||
import io.metersphere.service.definition.EsbImportService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -326,7 +325,7 @@ public class ApiDefinitionController {
|
|||
return apiDefinitionService.getRelationshipApi(id, relationshipType);
|
||||
}
|
||||
|
||||
@GetMapping("/relationship/count/{id}/")
|
||||
@GetMapping("/relationship/count/{id}")
|
||||
public int getRelationshipApi(@PathVariable("id") String id) {
|
||||
return apiDefinitionService.getRelationshipCount(id);
|
||||
}
|
||||
|
|
|
@ -297,10 +297,6 @@ public class ApiScenarioReportService {
|
|||
if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals("CASE")) {
|
||||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
// UI 调试类型报告不记录更新状态
|
||||
if (report.getExecuteType().equals(ExecuteType.Debug.name()) && report.getReportType().equals(ReportTypeConstants.UI_INDEPENDENT.name())) {
|
||||
return report;
|
||||
}
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
return report;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.api.dto.automation.RunScenarioRequest;
|
|||
import io.metersphere.api.exec.api.ApiCaseExecuteService;
|
||||
import io.metersphere.api.exec.scenario.ApiScenarioExecuteService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportResultMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
|
@ -28,10 +28,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -79,7 +76,8 @@ public class ApiScenarioRerunService {
|
|||
if (CollectionUtils.isNotEmpty(reportResults)) {
|
||||
List<String> resourceIds = reportResults.stream().map(ApiDefinitionExecResult::getResourceId).collect(Collectors.toList());
|
||||
// 执行资源
|
||||
Map<String, ApiDefinitionExecResultWithBLOBs> map = reportResults.stream().collect(Collectors.toMap(ApiDefinitionExecResult::getResourceId, api -> api));
|
||||
LinkedHashMap<String, ApiDefinitionExecResultWithBLOBs> map = reportResults.stream().collect(
|
||||
Collectors.toMap(ApiDefinitionExecResultWithBLOBs::getResourceId, order -> order, (k1, k2) -> k1, LinkedHashMap::new));
|
||||
|
||||
ApiCaseRunRequest request = new ApiCaseRunRequest();
|
||||
request.setRerun(true);
|
||||
|
|
|
@ -424,14 +424,18 @@ public class ApiScenarioService {
|
|||
* @param scenario
|
||||
*/
|
||||
public void deleteUpdateBodyFile(ApiScenarioWithBLOBs scenario, ApiScenarioWithBLOBs oldScenario) {
|
||||
Set<String> newRequestIds = getRequestIds(scenario.getScenarioDefinition());
|
||||
MsTestElement msTestElement = GenerateHashTreeUtil.parseScenarioDefinition(oldScenario.getScenarioDefinition());
|
||||
List<MsHTTPSamplerProxy> oldRequests = MsHTTPSamplerProxy.findHttpSampleFromHashTree(msTestElement);
|
||||
oldRequests.forEach(item -> {
|
||||
if (item.isCustomizeReq() && !newRequestIds.contains(item.getId())) {
|
||||
FileUtils.deleteBodyFiles(item.getId());
|
||||
}
|
||||
});
|
||||
try {
|
||||
Set<String> newRequestIds = getRequestIds(scenario.getScenarioDefinition());
|
||||
MsTestElement msTestElement = GenerateHashTreeUtil.parseScenarioDefinition(oldScenario.getScenarioDefinition());
|
||||
List<MsHTTPSamplerProxy> oldRequests = MsHTTPSamplerProxy.findHttpSampleFromHashTree(msTestElement);
|
||||
oldRequests.forEach(item -> {
|
||||
if (item.isCustomizeReq() && !newRequestIds.contains(item.getId())) {
|
||||
FileUtils.deleteBodyFiles(item.getId());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("Historical data processing exception");
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getRequestIds(String scenarioDefinition) {
|
||||
|
@ -707,6 +711,7 @@ public class ApiScenarioService {
|
|||
if (scenarioWithBLOBs != null && StringUtils.isNotEmpty(scenarioWithBLOBs.getScenarioDefinition())) {
|
||||
JSONObject element = JSONUtil.parseObject(scenarioWithBLOBs.getScenarioDefinition());
|
||||
hashTreeService.dataFormatting(element);
|
||||
ElementUtil.dataFormatting(element);
|
||||
scenarioWithBLOBs.setScenarioDefinition(element.toString());
|
||||
}
|
||||
return scenarioWithBLOBs;
|
||||
|
@ -1376,6 +1381,8 @@ public class ApiScenarioService {
|
|||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
ApiScenarioWithBLOBs item = data.get(i);
|
||||
JSONObject jsonObject = JSONUtil.parseObject(JSON.toJSONString(item));
|
||||
ElementUtil.dataFormatting(jsonObject);
|
||||
if (StringUtils.isBlank(item.getName())) {
|
||||
MSException.throwException(Translator.get("scenario_name_is_null"));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<!-- content header chart -->
|
||||
<ms-metric-chart :content="content" :totalTime="totalTime" :report="report"/>
|
||||
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick" style="min-width: 1000px">
|
||||
<!-- all step-->
|
||||
<el-tab-pane label="All" name="total">
|
||||
<ms-scenario-results
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
@select-all="handleSelectAll"
|
||||
@select="handleSelect"
|
||||
:height="screenHeight"
|
||||
@filter-change="filter" @row-click="handleView">
|
||||
@filter-change="filter" @row-click="handleView" v-if="loadIsOver">
|
||||
<el-table-column
|
||||
type="selection"/>
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
|
@ -227,7 +227,7 @@ export default {
|
|||
selectDataCounts: 0,
|
||||
screenHeight: 'calc(100vh - 160px)',
|
||||
trashActiveDom: 'left',
|
||||
userFilters: []
|
||||
userFilters: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -274,12 +274,12 @@ export default {
|
|||
}
|
||||
if (this.trashActiveDom === 'left') {
|
||||
this.reportTypeFilters = this.reportScenarioFilters;
|
||||
getReportPage(this.currentPage, this.pageSize, this.condition).then(res => {
|
||||
this.result = getReportPage(this.currentPage, this.pageSize, this.condition).then(res => {
|
||||
this.setData(res);
|
||||
})
|
||||
} else {
|
||||
this.reportTypeFilters = this.reportCaseFilters;
|
||||
getApiReportPage(this.currentPage, this.pageSize, this.condition).then(res => {
|
||||
this.result = getApiReportPage(this.currentPage, this.pageSize, this.condition).then(res => {
|
||||
this.setData(res);
|
||||
})
|
||||
}
|
||||
|
@ -288,17 +288,12 @@ export default {
|
|||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
this.tableData.forEach(item => {
|
||||
if (item.status === 'STOP') {
|
||||
item.status = 'stopped'
|
||||
}
|
||||
})
|
||||
this.selectRows.clear();
|
||||
this.unSelection = data.listObject.map(s => s.id);
|
||||
},
|
||||
handleView(report) {
|
||||
this.reportId = report.id;
|
||||
if (report.status === 'Running' || report.status === 'Rerunning') {
|
||||
if (report.status === 'RUNNING' || report.status === 'RERUNNING') {
|
||||
this.$warning(this.$t('commons.run_warning'))
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -227,4 +227,7 @@ export default {
|
|||
.report-name {
|
||||
border-bottom: 1px solid var(--primary_color);
|
||||
}
|
||||
.report-header{
|
||||
min-width: 1000px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -6,13 +6,15 @@
|
|||
<el-collapse-transition>
|
||||
<el-tabs v-model="activeName" style="margin: 20px">
|
||||
<el-tab-pane :label="$t('commons.remark')" name="remark" class="pane">
|
||||
<form-rich-text-item class="remark-item" :disabled="readOnly && !hasPermissions" :data="api" prop="remark" label-width="0"/>
|
||||
<form-rich-text-item class="remark-item" :disabled="readOnly && !hasPermissions" :data="api" prop="remark"
|
||||
label-width="0"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('commons.relationship.name')" name="dependencies" class="pane">
|
||||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('commons.relationship.name')" :count="relationshipCount"/>
|
||||
</template>
|
||||
<dependencies-list @setCount="setCount" :read-only="readOnly" :resource-id="api.id" resource-type="API" ref="dependencies"/>
|
||||
<dependencies-list @setCount="setCount" :read-only="readOnly" :resource-id="api.id" resource-type="API"
|
||||
ref="dependencies"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-collapse-transition>
|
||||
|
@ -29,10 +31,11 @@ import FormRichTextItem from "@/business/commons/FormRichTextItem";
|
|||
import {hasPermissions} from "metersphere-frontend/src/utils/permission";
|
||||
import TabPaneCount from "@/business/commons/TabPaneCount";
|
||||
import {getRelationshipCountApi} from "@/api/definition";
|
||||
|
||||
export default {
|
||||
name: "ApiOtherInfo",
|
||||
components: {TabPaneCount, FormRichTextItem, DependenciesList, ApiInfoContainer, MsFormDivider},
|
||||
props: ['api','readOnly'],
|
||||
props: ['api', 'readOnly'],
|
||||
data() {
|
||||
return {
|
||||
activeName: 'remark',
|
||||
|
@ -46,20 +49,27 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
activeName() {
|
||||
if (this.activeName === 'dependencies') {
|
||||
if (this.activeName === 'dependencies') {
|
||||
this.$refs.dependencies.open();
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
getRelationshipCountApi(this.api.id, (data) => {
|
||||
this.relationshipCount = data;
|
||||
this.$nextTick(() => {
|
||||
this.initRelationshipCount();
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
setCount(count) {
|
||||
this.relationshipCount = count;
|
||||
},
|
||||
initRelationshipCount() {
|
||||
getRelationshipCountApi(this.api.id).then(rsp => {
|
||||
let data = rsp.data;
|
||||
this.relationshipCount = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
:before-close="close">
|
||||
<el-form>
|
||||
<el-form-item :label="$t('commons.name')">
|
||||
<el-input v-model="data.name" maxlength="60" show-word-limit></el-input>
|
||||
<el-input v-model="data.name" :maxlength="maxLength" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
@ -28,6 +28,12 @@ export default {
|
|||
data: {}
|
||||
};
|
||||
},
|
||||
props: {
|
||||
maxLength: {
|
||||
type: Number,
|
||||
default: 60
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(data) {
|
||||
this.dialogVisible = true;
|
||||
|
|
|
@ -171,6 +171,7 @@ export default {
|
|||
{id: 'STARTING', label: 'Starting'},
|
||||
{id: 'PENDING', label: 'Pending'},
|
||||
{id: 'RUNNING', label: 'Running'},
|
||||
{id: 'RERUNNING', label: 'Rerunning'},
|
||||
{id: 'REPORTING', label: 'Reporting'},
|
||||
{id: 'SUCCESS', label: 'Success'},
|
||||
{id: "FAKE_ERROR", label: 'FakeError'},
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE load_test_report
|
||||
MODIFY name VARCHAR(255) NOT NULL;
|
||||
|
||||
ALTER TABLE load_test_report
|
||||
MODIFY test_name VARCHAR(255) NULL;
|
|
@ -149,7 +149,7 @@
|
|||
</el-card>
|
||||
</ms-main-container>
|
||||
<same-test-reports ref="compareReports"/>
|
||||
<ms-rename-report-dialog ref="renameDialog" @submit="rename"></ms-rename-report-dialog>
|
||||
<ms-rename-report-dialog ref="renameDialog" @submit="rename" :max-length="255"></ms-rename-report-dialog>
|
||||
|
||||
</ms-container>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue