Merge remote-tracking branch 'origin/v1.7' into v1.7

This commit is contained in:
song.tianyang 2021-02-04 15:26:25 +08:00
commit aadf243399
38 changed files with 386 additions and 309 deletions

View File

@ -13,13 +13,13 @@ public class MsAssertionJSR223 extends MsAssertionType {
private String desc;
private String name;
private String script;
private String language;
private String scriptLanguage;
public MsAssertionJSR223() {
setType(MsAssertionType.JSR223);
}
public boolean isValid() {
return StringUtils.isNotBlank(script) && StringUtils.isNotBlank(language);
return StringUtils.isNotBlank(script) && StringUtils.isNotBlank(scriptLanguage);
}
}

View File

@ -130,7 +130,7 @@ public class MsAssertions extends MsTestElement {
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
assertion.setProperty("cacheKey", "true");
assertion.setProperty("scriptLanguage", assertionJSR223.getLanguage());
assertion.setProperty("scriptLanguage", assertionJSR223.getScriptLanguage());
assertion.setProperty("script", assertionJSR223.getScript());
return assertion;
}

View File

@ -290,6 +290,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
Arguments arguments = new Arguments();
list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> {
HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), StringUtils.isNotEmpty(keyValue.getValue()) && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue());
if (keyValue.getValue() == null) {
httpArgument.setValue("");
}
httpArgument.setAlwaysEncoded(keyValue.isEncode());
if (StringUtils.isNotBlank(keyValue.getContentType())) {
httpArgument.setContentType(keyValue.getContentType());

View File

@ -0,0 +1,37 @@
package io.metersphere.performance.job;
import com.fit2cloud.quartz.anno.QuartzScheduled;
import io.metersphere.base.domain.LoadTestReport;
import io.metersphere.base.domain.LoadTestReportDetailExample;
import io.metersphere.base.domain.LoadTestReportExample;
import io.metersphere.base.mapper.LoadTestReportDetailMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
public class LoadTestReportDetailCleanJob {
@Resource
private LoadTestReportDetailMapper loadTestReportDetailMapper;
@Resource
private LoadTestReportMapper loadTestReportMapper;
/**
* 每天处理一次清理任务
*/
@QuartzScheduled(cron = "0 0 1 * * ?")
public void cleanCompletedTestDetail() {
LoadTestReportExample example = new LoadTestReportExample();
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
loadTestReports.forEach(report -> {
// 清理文件
LoadTestReportDetailExample example2 = new LoadTestReportDetailExample();
example2.createCriteria().andReportIdEqualTo(report.getId());
loadTestReportDetailMapper.deleteByExample(example2);
});
}
}

View File

@ -387,7 +387,7 @@ public class JmeterDocumentParser implements DocumentParser {
element.appendChild(createStringProp(document, "HTTPSampler.contentEncoding", ""));
element.appendChild(createStringProp(document, "HTTPSampler.path", ""));
element.appendChild(createStringProp(document, "HTTPSampler.concurrentPool", "6"));
element.appendChild(createStringProp(document, "HTTPSampler.connect_timeout", ""));
element.appendChild(createStringProp(document, "HTTPSampler.connect_timeout", "60000"));
element.appendChild(createStringProp(document, "HTTPSampler.response_timeout", ""));
hashTree.appendChild(element);
// 空的 hashTree

View File

@ -83,13 +83,14 @@ import MsTableHeader from "../../../common/components/MsTableHeader";
import MsContainer from "../../../common/components/MsContainer";
import MsMainContainer from "../../../common/components/MsMainContainer";
import MsApiReportStatus from "./ApiReportStatus";
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID} from "@/common/js/utils";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import ReportTriggerModeItem from "../../../common/tableItem/ReportTriggerModeItem";
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import ShowMoreBtn from "../../../track/case/components/ShowMoreBtn";
import MsApiReportDetail from "./ApiReportDetail";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
components: {

View File

@ -155,7 +155,7 @@
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../common/components/MsTag";
import {_filter, _sort, getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
@ -169,6 +169,7 @@
import {WORKSPACE_ID} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "MsApiScenarioList",

View File

@ -88,10 +88,9 @@ import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonDa
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils";
export default {
name: "RelevanceApiList",

View File

@ -77,10 +77,9 @@ import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonDa
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _handleSelect, _handleSelectAll, _sort} from "@/common/js/tableUtils";
export default {
name: "RelevanceCaseList",

View File

@ -244,7 +244,7 @@
getFails() {
this.error = 0;
this.success = 0;
if (this.requestResult.scenarios) {
if (this.requestResult.scenarios && this.requestResult.scenarios != null) {
this.requestResult.scenarios.forEach((scenario) => {
if (scenario.requestResults) {
scenario.requestResults.forEach(item => {
@ -255,7 +255,7 @@
})
}
})
this.success = this.requestResult.scenarios.length - this.error;
this.success = this.requestResult.scenarios && this.requestResult.scenarios != null ? this.requestResult.scenarios.length - this.error : 0;
}
},
getReport() {
@ -267,6 +267,9 @@
if (this.isNotRunning) {
try {
this.requestResult = JSON.parse(this.report.content);
if (!this.requestResult) {
this.requestResult = {scenarios: []};
}
this.controller.requestResult = this.requestResult;
switch (this.controller.loopType) {
case "LOOP_COUNT":
@ -282,14 +285,11 @@
break;
}
this.getFails();
if (!this.requestResult) {
this.requestResult = {scenarios: []};
}
} catch (e) {
throw e;
}
this.loading = false;
this.activeName = this.requestResult && this.requestResult.scenarios ? this.requestResult.scenarios[0].name : "";
this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios != null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : "";
} else {
setTimeout(this.getReport, 2000)
}

View File

@ -142,13 +142,15 @@
import MsTableOperator from "../../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../../../track/common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../../../track/common/tableItems/plan/PlanStageTableItem";
import {_filter, _sort, checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import TestReportTemplateList from "../../../../track/plan/view/comonents/TestReportTemplateList";
import TestCaseReportView from "../../../../track/plan/view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../../common/components/search/search-components";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../../common/js/utils";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestPlanList",

View File

@ -66,7 +66,7 @@
import MsEditRandom from "./EditRandom";
import MsEditListValue from "./EditListValue";
import MsEditCsv from "./EditCsv";
import {_filter, getUUID} from "@/common/js/utils";
import {getUUID} from "@/common/js/utils";
export default {
name: "MsVariableList",
@ -188,6 +188,8 @@
} else {
item.hidden = undefined;
}
} else {
item.hidden = undefined;
}
datas.push(item);
})
@ -202,12 +204,8 @@
}
</script>
<style scoped>
<style>
.ms-variable-hidden-row {
display: none;
}
/deep/ .el-dialog__body {
padding: 10px 10px;
}
</style>

View File

@ -132,18 +132,16 @@ import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD,
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
import MsSetEnvironment from "@/business/components/api/definition/components/basis/SetEnvironment";
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
// import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils";
export default {
name: "ApiCaseSimpleList",

View File

@ -187,8 +187,8 @@ import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD, TCP_METHOD, SQL_METHOD, DUBBO_METHOD} from "../../model/JsonData";
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import {WORKSPACE_ID} from '@/common/js/constants';
import ApiListContainer from "./ApiListContainer";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
@ -197,6 +197,8 @@ import MsTableAdvSearchBar from "@/business/components/common/components/search/
import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTipButton from "@/business/components/common/components/MsTipButton";
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "ApiList",

View File

@ -1,5 +1,6 @@
import {
Arguments,
ConstantTimer as JMXConstantTimer,
CookieManager,
DNSCacheManager,
DubboSample,
@ -10,6 +11,7 @@ import {
HTTPSamplerArguments,
HTTPsamplerFiles,
HTTPSamplerProxy,
IfController as JMXIfController,
JDBCDataSource,
JDBCSampler,
JSONPathAssertion,
@ -20,12 +22,11 @@ import {
ResponseCodeAssertion,
ResponseDataAssertion,
ResponseHeadersAssertion,
TCPSampler,
TestElement,
TestPlan,
ThreadGroup,
XPath2Extractor,
IfController as JMXIfController,
ConstantTimer as JMXConstantTimer, TCPSampler,
} from "./JMX";
import Mock from "mockjs";
import {funcFilters} from "@/common/js/func-filter";
@ -807,12 +808,12 @@ export class AssertionJSR223 extends AssertionType {
this.name = undefined;
this.script = undefined;
this.language = "beanshell";
this.scriptLanguage = "beanshell";
this.set(options);
}
isValid() {
return !!this.script && !!this.language;
return !!this.script && !!this.scriptLanguage;
}
}

View File

@ -63,12 +63,12 @@ import MsTableHeader from "../../common/components/MsTableHeader";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsApiReportStatus from "./ApiReportStatus";
import {_filter, _sort} from "@/common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import ShowMoreBtn from "../../track/case/components/ShowMoreBtn";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
components: {

View File

@ -69,11 +69,11 @@
import MsMainContainer from "../../common/components/MsMainContainer";
import MsApiTestStatus from "./ApiTestStatus";
import MsTableOperators from "../../common/components/MsTableOperators";
import {_filter, _sort} from "@/common/js/utils";
import {TEST_CONFIGS} from "../../common/components/search/search-components";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import ApiCopyDialog from "./components/ApiCopyDialog";
import MsUpgrade from "./Upgrade";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
components: {

View File

@ -2,7 +2,8 @@
<el-dialog width="50%" :close-on-click-modal="false" :title="$t('api_test.jar_config.title')" :visible.sync="visible" class="jar-import" @close="close">
<div v-loading="result.loading">
<ms-jar-config-from :config="currentConfig" :callback="saveConfig" ref="jarConfigFrom" :read-only="isReadOnly"/>
<ms-jar-search-bar @refresh="getJarConfigs" :table-data="configs" ref="jarSearchBar"/>
<ms-jar-search-bar v-if="(!isSearchBarQuery && configs.length > 0) || isSearchBarQuery" :condition="condition"
@search="getJarConfigs" :table-data="configs" ref="jarSearchBar"/>
<ms-jar-config-list @refresh="getJarConfigs" v-if="configs.length > 0" @rowSelect="rowSelect" :table-data="configs" ref="jarConfigList"/>
</div>
</el-dialog>
@ -14,6 +15,7 @@
import MsJarConfigList from "./JarConfigList";
import MsJarConfigFrom from "./JarConfigFrom";
import MsJarSearchBar from "./JarSearchBar";
export default {
name: "MsJarConfig",
components: {MsJarConfigFrom, MsJarSearchBar, MsJarConfigList, MsDialogFooter},
@ -22,7 +24,9 @@
visible: false,
result: {},
currentConfig: {},
configs: []
configs: [],
condition: {},
isSearchBarQuery: false
}
},
props: {
@ -34,6 +38,8 @@
methods: {
open() {
this.visible = true;
this.condition = {};
this.getJarConfigs();
listenGoBack(this.close);
},
@ -54,8 +60,11 @@
this.getJarConfigs();
});
},
getJarConfigs(condition) {
this.result = this.$post("/jar/list", {name: condition}, response => {
getJarConfigs(isSearchBarQuery) {
if (isSearchBarQuery) {
this.isSearchBarQuery = isSearchBarQuery;
}
this.result = this.$post("/jar/list", this.condition, response => {
this.configs = response.data;
this.currentConfig = {};
});

View File

@ -1,10 +1,10 @@
<template>
<el-input class="jar-header-search"
v-model="searchCondition"
v-model="condition.name"
type="text"
size="small"
prefix-icon="el-icon-search"
@keyup.enter.native="search"
@blur="search"
:placeholder="$t('project.search_by_name_jar')" clearable/>
</template>
@ -19,19 +19,9 @@
},
},
},
data() {
return {
searchCondition: this.condition
};
},
watch: {
inputCondition(value) {
this.searchCondition = value;
}
},
methods: {
search() {
this.$emit('refresh', this.searchCondition);
this.$emit('search', true);
}
},
}

View File

@ -93,13 +93,15 @@ import MsTablePagination from "../../common/pagination/TablePagination";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceReportStatus from "./PerformanceReportStatus";
import {_filter, _sort, getCurrentProjectID} from "../../../../common/js/utils";
import {getCurrentProjectID} from "../../../../common/js/utils";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
import MsTableHeader from "../../common/components/MsTableHeader";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import ShowMoreBtn from "../../track/case/components/ShowMoreBtn";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "PerformanceTestReport",

View File

@ -89,11 +89,12 @@ import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceTestStatus from "./PerformanceTestStatus";
import MsTableOperators from "../../common/components/MsTableOperators";
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID} from "@/common/js/utils";
import MsTableHeader from "../../common/components/MsTableHeader";
import {TEST_CONFIGS} from "../../common/components/search/search-components";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import {WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
components: {

View File

@ -128,7 +128,7 @@ export default {
components: {MsTableOperatorButton},
data() {
return {
timeout: 2000,
timeout: 60000,
responseTimeout: null,
statusCode: [],
domains: [],

View File

@ -98,7 +98,7 @@
import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import {_sort, getCurrentProjectID, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
@ -108,6 +108,8 @@
import {PROJECT_ID} from "@/common/js/constants";
import MsJarConfig from "../../api/test/components/jar/JarConfig";
import MsTableButton from "../../common/components/MsTableButton";
import {_sort} from "@/common/js/tableUtils";
export default {
name: "MsProject",
components: {

View File

@ -145,7 +145,7 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column fixed="right"
<el-table-column
:label="$t('commons.operating')" min-width="150">
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -187,7 +187,6 @@ import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableButton from "../../../common/components/MsTableButton";
import {_filter, _sort} from "@/common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
import ShowMoreBtn from "./ShowMoreBtn";
import BatchEdit from "./BatchEdit";
@ -198,7 +197,15 @@ import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsTag from "@/business/components/common/components/MsTag";
import {_handleSelect, _handleSelectAll} from "../../../../../common/js/tableUtils";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
getSelectDataCounts,
setUnSelectIds,
toggleAllSelection
} from "@/common/js/tableUtils";
import BatchMove from "./BatchMove";
export default {
@ -432,13 +439,14 @@ export default {
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
this.setUnSelectIds();
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
this.setUnSelectIds();
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
importTestCase() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
@ -545,23 +553,9 @@ export default {
},
isSelectDataAll(data) {
this.condition.selectAll = data;
this.setUnSelectIds();
//
if (this.selectRows.size != this.tableData.length) {
this.$refs.table.toggleAllSelection(true);
}
},
setUnSelectIds() {
let ids = Array.from(this.selectRows).map(o => o.id);
let allIDs = this.tableData.map(o => o.id);
this.condition.unSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1
});
if (this.condition.selectAll) {
this.selectDataCounts = this.total - this.condition.unSelectIds.length;
} else {
this.selectDataCounts = this.selectRows.size;
}
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
},
headerDragend(newWidth,oldWidth,column,event){
let finalWidth = newWidth;

View File

@ -158,7 +158,7 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import {_filter, _sort, checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
@ -166,6 +166,8 @@ import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-compon
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestPlanList",

View File

@ -132,13 +132,15 @@ import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/d
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {_filter, _sort, getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
import TestPlanCaseListHeader from "./TestPlanCaseListHeader";
import MsRun from "../../../../../api/definition/components/Run";
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestPlanApiCaseList",

View File

@ -250,21 +250,21 @@ import MsTableButton from '../../../../../common/components/MsTableButton';
import NodeBreadcrumb from '../../../../common/NodeBreadcrumb';
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort, checkoutTestManagerOrTestUser, hasRoles} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser, hasRoles} from "@/common/js/utils";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem";
import MethodTableItem from "../../../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import TestReportTemplateList from "../TestReportTemplateList";
import TestCaseReportView from "../report/TestCaseReportView";
import {TEST_CASE_CONFIGS} from "../../../../../common/components/search/search-components";
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
import BatchEdit from "../../../../case/components/BatchEdit";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import {hub} from "@/business/components/track/plan/event-bus";
import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "FunctionalTestCaseList",

View File

@ -79,7 +79,8 @@
import {TEST_CASE_CONFIGS} from "../../../../../common/components/search/search-components";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import {_filter} from "../../../../../../../common/js/utils";
import {_filter} from "@/common/js/tableUtils";
export default {
name: "TestCaseFunctionalRelevance",

View File

@ -115,11 +115,11 @@
import TestPlanLoadCaseListHeader
from "@/business/components/track/plan/view/comonents/load/TestPlanLoadCaseListHeader";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import {_filter, _sort} from "@/common/js/utils";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestPlanLoadCaseList",

View File

@ -64,7 +64,7 @@ import MsTablePagination from '../../../../components/common/pagination/TablePag
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableOperator from "../../../common/components/MsTableOperator";
import {_filter, _sort, checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {TEST_PLAN_REPORT_CONFIGS} from "../../../common/components/search/search-components";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import TestPlanReportView from "@/business/components/track/report/components/TestPlanReportView";
@ -72,6 +72,8 @@ import ReportTriggerModeItem from "@/business/components/common/tableItem/Report
import MsTag from "@/business/components/common/components/MsTag";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTableSelectAll from "@/business/components/common/components/table/MsTableSelectAll";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestPlanReportList",

View File

@ -88,12 +88,11 @@ import MsTableHeader from "../../../common/components/MsTableHeader";
import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination";
import {
_filter,
_sort,
checkoutTestManagerOrTestUser,
getCurrentProjectID,
getCurrentWorkspaceId
} from "../../../../../common/js/utils";
import {_filter, _sort} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
export default {

View File

@ -103,10 +103,11 @@
import MsTableHeader from "../../../../common/components/MsTableHeader";
import SwitchProject from "../../../case/components/SwitchProject";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {_filter} from "../../../../../../common/js/utils";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectMenu from "../../../common/SelectMenu";
import {_filter} from "@/common/js/tableUtils";
export default {
name: "TestReviewRelevance",

View File

@ -169,11 +169,12 @@ import MsTableButton from "../../../../common/components/MsTableButton";
import ShowMoreBtn from "../../../case/components/ShowMoreBtn";
import BatchEdit from "../../../case/components/BatchEdit";
import MsTablePagination from '../../../../common/pagination/TablePagination';
import {_filter, _sort, checkoutTestManagerOrTestUser, hasRoles} from "../../../../../../common/js/utils";
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../../../common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort} from "@/common/js/tableUtils";
export default {
name: "TestReviewTestCaseList",
@ -264,9 +265,7 @@ export default {
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
}
if (this.reviewId) {
this.result = this.$post(this.buildPagePath('/test/review/case/list'), this.condition, response => {
let data = response.data;

View File

@ -1,3 +1,4 @@
import {humpToLine} from "@/common/js/utils";
export function _handleSelectAll(component, selection, tableData, selectRows) {
if (selection.length > 0) {
@ -33,3 +34,73 @@ export function _handleSelect(component, selection, row, selectRows) {
component.$set(row, "showMore", true);
})
}
// 设置 unSelectIds 查询条件,返回当前选中的条数
export function setUnSelectIds(tableData, condition, selectRows) {
let ids = Array.from(selectRows).map(o => o.id);
let allIDs = tableData.map(o => o.id);
condition.unSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1
});
}
export function getSelectDataCounts(condition, total, selectRows) {
if (condition.selectAll) {
return total - condition.unSelectIds.length;
} else {
return selectRows.size;
}
}
// 全选操作
export function toggleAllSelection(table, tableData, selectRows) {
//如果已经全选,不需要再操作了
if (selectRows.size != tableData.length) {
table.toggleAllSelection(true);
}
}
//表格数据过滤
export function _filter(filters, condition) {
if (!condition.filters) {
condition.filters = {};
}
for (let filter in filters) {
if (filters.hasOwnProperty(filter)) {
if (filters[filter] && filters[filter].length > 0) {
condition.filters[humpToLine(filter)] = filters[filter];
} else {
condition.filters[humpToLine(filter)] = null;
}
}
}
}
//表格数据排序
export function _sort(column, condition) {
column.prop = humpToLine(column.prop);
if (column.order === 'descending') {
column.order = 'desc';
} else {
column.order = 'asc';
}
if (!condition.orders) {
condition.orders = [];
}
let hasProp = false;
condition.orders.forEach(order => {
if (order.name === column.prop) {
order.type = column.order;
hasProp = true;
}
});
if (!hasProp) {
condition.orders.push({name: column.prop, type: column.order});
}
}

View File

@ -1,13 +1,13 @@
import {
LicenseKey,
PROJECT_ID,
REFRESH_SESSION_USER_URL,
ROLE_ADMIN,
ROLE_ORG_ADMIN,
ROLE_TEST_MANAGER,
ROLE_TEST_USER,
ROLE_TEST_VIEWER,
TokenKey,
PROJECT_ID
TokenKey
} from "./constants";
import axios from "axios";
import {jsPDF} from "jspdf";
@ -138,45 +138,6 @@ export function humpToLine(name) {
return name.replace(/([A-Z])/g, "_$1").toLowerCase();
}
//表格数据过滤
export function _filter(filters, condition) {
if (!condition.filters) {
condition.filters = {};
}
for (let filter in filters) {
if (filters.hasOwnProperty(filter)) {
if (filters[filter] && filters[filter].length > 0) {
condition.filters[humpToLine(filter)] = filters[filter];
} else {
condition.filters[humpToLine(filter)] = null;
}
}
}
}
//表格数据排序
export function _sort(column, condition) {
column.prop = humpToLine(column.prop);
if (column.order === 'descending') {
column.order = 'desc';
} else {
column.order = 'asc';
}
if (!condition.orders) {
condition.orders = [];
}
let hasProp = false;
condition.orders.forEach(order => {
if (order.name === column.prop) {
order.type = column.order;
hasProp = true;
}
});
if (!hasProp) {
condition.orders.push({name: column.prop, type: column.order});
}
}
export function downloadFile(name, content) {
const blob = new Blob([content]);
if ("download" in document.createElement("a")) {

View File

@ -537,12 +537,12 @@ export default {
},
request: {
grade_info: "Filter by rank",
grade_order_asc: "from high to low by use case level",
grade_order_desc: "from low to high by use case level,",
grade_order_asc: "from low to high by use case level",
grade_order_desc: "from high to low by use case level",
create_time_order_asc: "by creation time from front to back",
create_time_order_desc: "from back to front by creation time,",
create_time_order_desc: "from back to front by creation time",
update_time_order_asc: "by update time from front to back",
update_time_order_desc: "from back to front by update time,",
update_time_order_desc: "from back to front by update time",
run_env: "Operating environment",
select_case: "Search use cases",
case: "Case",

View File

@ -537,8 +537,8 @@ export default {
},
request: {
grade_info: "按等级筛选",
grade_order_asc: "按用例等级从高到低",
grade_order_desc: "按用例等级从低到高",
grade_order_asc: "按用例等级从到高",
grade_order_desc: "按用例等级从到低",
create_time_order_asc: "按创建时间从前到后",
create_time_order_desc: "按创建时间从后到前",
update_time_order_asc: "按更新时间从前到后",

View File

@ -536,8 +536,8 @@ export default {
},
request: {
grade_info: "按等級篩選",
grade_order_asc: "按用例等級從高到低",
grade_order_desc: "按用例等級從低到高",
grade_order_asc: "按用例等級從到高",
grade_order_desc: "按用例等級從到低",
create_time_order_asc: "按創建時間從前到後",
create_time_order_desc: "按創建時間從後到前",
update_time_order_asc: "按更新時間從前到後",