fix(接口测试): 修复首页跳转到协议后模块树没有跟着刷新的缺陷
--bug=1020480 --user=王孝刚 【接口测试】github #20341接口测试首页-未覆盖链接无法根据协议类型准确筛选并显示,很容易造成误解 https://www.tapd.cn/55049933/s/1355617
This commit is contained in:
parent
4d251ef8d3
commit
9287c06858
|
@ -153,11 +153,14 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
request.setProtocol(protocol);
|
request.setProtocol(protocol);
|
||||||
Map<String, List<String>> filters = new LinkedHashMap<>();
|
Map<String, List<String>> filters = new LinkedHashMap<>();
|
||||||
filters.put(ApiTestConstants.STATUS, ApiTestConstants.STATUS_ALL);
|
filters.put(ApiTestConstants.STATUS, ApiTestConstants.STATUS_ALL);
|
||||||
request.setFilters(filters);
|
if (MapUtils.isEmpty(request.getFilters()) || !request.getFilters().containsKey(ApiTestConstants.STATUS)) {
|
||||||
|
request.setFilters(filters);
|
||||||
|
}
|
||||||
request.setModuleIds(new ArrayList<>());
|
request.setModuleIds(new ArrayList<>());
|
||||||
if (StringUtils.isNotBlank(versionId)) {
|
if (StringUtils.isNotBlank(versionId)) {
|
||||||
request.setVersionId(versionId);
|
request.setVersionId(versionId);
|
||||||
}
|
}
|
||||||
|
apiDefinitionService.checkFilterHasCoverage(request);
|
||||||
List<ApiModuleDTO> countMNodes = extApiDefinitionMapper.moduleCountByCollection(request);
|
List<ApiModuleDTO> countMNodes = extApiDefinitionMapper.moduleCountByCollection(request);
|
||||||
return getNodeTrees(apiModules, getCountMap(countMNodes));
|
return getNodeTrees(apiModules, getCountMap(countMNodes));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
v-if="this.trashEnable"
|
v-if="this.trashEnable"
|
||||||
:label="$t('commons.delete_user')"
|
:label="$t('commons.delete_user')"
|
||||||
min-width="120" />
|
min-width="120"/>
|
||||||
<span v-for="item in fields" :key="item.key">
|
<span v-for="item in fields" :key="item.key">
|
||||||
<ms-table-column prop="num" label="ID" :field="item" min-width="100px" :fields-width="fieldsWidth" sortable>
|
<ms-table-column prop="num" label="ID" :field="item" min-width="100px" :fields-width="fieldsWidth" sortable>
|
||||||
<template slot-scope="scope" v-if="!trashEnable">
|
<template slot-scope="scope" v-if="!trashEnable">
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
sortable="custom"
|
sortable="custom"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
min-width="120"
|
min-width="120"
|
||||||
:field="item" />
|
:field="item"/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="status"
|
prop="status"
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
:label="$t('api_test.definition.api_status')">
|
:label="$t('api_test.definition.api_status')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<api-status :value="scope.row.status" />
|
<api-status :value="scope.row.status"/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
@ -110,13 +110,13 @@
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
:label="$t('api_test.definition.request.responsible')" />
|
:label="$t('api_test.definition.request.responsible')"/>
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="path"
|
prop="path"
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
:label="$t('api_test.definition.api_path')" />
|
:label="$t('api_test.definition.api_path')"/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="tags"
|
prop="tags"
|
||||||
|
@ -136,10 +136,10 @@
|
||||||
effect="plain"
|
effect="plain"
|
||||||
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
|
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
|
||||||
:content="itemName"
|
:content="itemName"
|
||||||
style="margin-left: 0px; margin-right: 2px" />
|
style="margin-left: 0px; margin-right: 2px"/>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span />
|
<span/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
:label="$t('api_test.definition.api_case_number')" />
|
:label="$t('api_test.definition.api_case_number')"/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
:field="item"
|
:field="item"
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
:label="$t('api_test.definition.api_case_status')">
|
:label="$t('api_test.definition.api_case_status')">
|
||||||
<template v-slot:default="{ row }">
|
<template v-slot:default="{ row }">
|
||||||
<ms-api-report-status :status="row.caseStatus" />
|
<ms-api-report-status :status="row.caseStatus"/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
|
@ -220,9 +220,9 @@
|
||||||
:change="initTable"
|
:change="initTable"
|
||||||
:current-page.sync="currentPage"
|
:current-page.sync="currentPage"
|
||||||
:page-size.sync="pageSize"
|
:page-size.sync="pageSize"
|
||||||
:total="total" />
|
:total="total"/>
|
||||||
</span>
|
</span>
|
||||||
<ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList" />
|
<ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/>
|
||||||
<!--批量编辑-->
|
<!--批量编辑-->
|
||||||
<ms-batch-edit
|
<ms-batch-edit
|
||||||
ref="batchEdit"
|
ref="batchEdit"
|
||||||
|
@ -261,8 +261,8 @@ import {
|
||||||
removeToGcByIds,
|
removeToGcByIds,
|
||||||
removeToGcByParams,
|
removeToGcByParams,
|
||||||
} from '@/api/definition';
|
} from '@/api/definition';
|
||||||
import { getMaintainer, getProject } from '@/api/project';
|
import {getMaintainer, getProject} from '@/api/project';
|
||||||
import { getProjectVersions, versionEnableByProjectId } from '@/api/xpack';
|
import {getProjectVersions, versionEnableByProjectId} from '@/api/xpack';
|
||||||
import MsTableHeader from 'metersphere-frontend/src/components/MsTableHeader';
|
import MsTableHeader from 'metersphere-frontend/src/components/MsTableHeader';
|
||||||
import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator';
|
import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator';
|
||||||
import MsTableOperatorButton from 'metersphere-frontend/src/components/MsTableOperatorButton';
|
import MsTableOperatorButton from 'metersphere-frontend/src/components/MsTableOperatorButton';
|
||||||
|
@ -275,16 +275,16 @@ import MsContainer from 'metersphere-frontend/src/components/MsContainer';
|
||||||
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
|
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
|
||||||
import MsBottomContainer from '../BottomContainer';
|
import MsBottomContainer from '../BottomContainer';
|
||||||
import MsBatchEdit from '../basis/BatchEdit';
|
import MsBatchEdit from '../basis/BatchEdit';
|
||||||
import { API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD } from '../../model/JsonData';
|
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from '../../model/JsonData';
|
||||||
import { downloadFile, operationConfirm } from 'metersphere-frontend/src/utils';
|
import {downloadFile, operationConfirm} from 'metersphere-frontend/src/utils';
|
||||||
import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token';
|
import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token';
|
||||||
import { hasLicense } from 'metersphere-frontend/src/utils/permission';
|
import {hasLicense} from 'metersphere-frontend/src/utils/permission';
|
||||||
import { API_LIST } from 'metersphere-frontend/src/utils/constants';
|
import {API_LIST} from 'metersphere-frontend/src/utils/constants';
|
||||||
import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover';
|
import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover';
|
||||||
import ApiStatus from '@/business/definition/components/list/ApiStatus';
|
import ApiStatus from '@/business/definition/components/list/ApiStatus';
|
||||||
import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar';
|
import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar';
|
||||||
import { API_DEFINITION_CONFIGS } from 'metersphere-frontend/src/components/search/search-components';
|
import {API_DEFINITION_CONFIGS} from 'metersphere-frontend/src/components/search/search-components';
|
||||||
import { API_DEFINITION_CONFIGS_TRASH, getProtocolFilter } from '@/business/definition/api-definition';
|
import {API_DEFINITION_CONFIGS_TRASH, getProtocolFilter} from '@/business/definition/api-definition';
|
||||||
import MsTipButton from 'metersphere-frontend/src/components/MsTipButton';
|
import MsTipButton from 'metersphere-frontend/src/components/MsTipButton';
|
||||||
import CaseBatchMove from '@/business/definition/components/basis/BatchMove';
|
import CaseBatchMove from '@/business/definition/components/basis/BatchMove';
|
||||||
import {
|
import {
|
||||||
|
@ -475,15 +475,15 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
statusFiltersTrash: [{ text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash' }],
|
statusFiltersTrash: [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}],
|
||||||
|
|
||||||
caseStatusFilters: [
|
caseStatusFilters: [
|
||||||
{
|
{
|
||||||
text: this.$t('api_test.home_page.detail_card.unexecute'),
|
text: this.$t('api_test.home_page.detail_card.unexecute'),
|
||||||
value: '未执行',
|
value: '未执行',
|
||||||
},
|
},
|
||||||
{ text: this.$t('test_track.review.pass'), value: '通过' },
|
{text: this.$t('test_track.review.pass'), value: '通过'},
|
||||||
{ text: this.$t('test_track.review.un_pass'), value: '未通过' },
|
{text: this.$t('test_track.review.un_pass'), value: '未通过'},
|
||||||
],
|
],
|
||||||
methodFilters: [],
|
methodFilters: [],
|
||||||
userFilters: [],
|
userFilters: [],
|
||||||
|
@ -560,7 +560,7 @@ export default {
|
||||||
moduleOptionsNew() {
|
moduleOptionsNew() {
|
||||||
let moduleOptions = [];
|
let moduleOptions = [];
|
||||||
this.moduleOptions.forEach((node) => {
|
this.moduleOptions.forEach((node) => {
|
||||||
buildNodePath(node, { path: '' }, moduleOptions);
|
buildNodePath(node, {path: ''}, moduleOptions);
|
||||||
});
|
});
|
||||||
return moduleOptions;
|
return moduleOptions;
|
||||||
},
|
},
|
||||||
|
@ -571,23 +571,25 @@ export default {
|
||||||
}
|
}
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
this.tableOperatorButtons = this.tableTrashOperatorButtons;
|
this.tableOperatorButtons = this.tableTrashOperatorButtons;
|
||||||
this.condition.filters = { status: ['Trash'] };
|
this.condition.filters = {status: ['Trash']};
|
||||||
} else {
|
} else {
|
||||||
this.tableOperatorButtons = this.tableUsualOperatorButtons;
|
this.tableOperatorButtons = this.tableUsualOperatorButtons;
|
||||||
this.condition.filters = { status: ['Prepare', 'Underway', 'Completed'] };
|
this.condition.filters = {status: ['Prepare', 'Underway', 'Completed']};
|
||||||
}
|
}
|
||||||
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
||||||
// 切换tab之后版本查询
|
// 切换tab之后版本查询
|
||||||
this.condition.versionId = this.currentVersion;
|
this.condition.versionId = this.currentVersion;
|
||||||
let protocol;
|
let protocol;
|
||||||
if (this.$route && this.$route.params && this.$route.params.type) {
|
if (this.$route && this.$route.params && this.$route.params.type) {
|
||||||
protocol = this.$route.params.type;
|
protocol = this.$route.params.type;
|
||||||
}
|
}
|
||||||
this.initTable(protocol);
|
this.initTable(protocol);
|
||||||
this.getMaintainerOptions();
|
this.getMaintainerOptions();
|
||||||
this.getVersionOptions();
|
this.getVersionOptions();
|
||||||
this.checkVersionEnable();
|
this.checkVersionEnable();
|
||||||
this.getProtocolFilter();
|
this.getProtocolFilter();
|
||||||
|
//为了跳转的时候把参数传递到模块
|
||||||
|
this.$EventBus.$emit('apiConditionBus', this.condition);
|
||||||
|
|
||||||
// 通知过来的数据跳转到编辑
|
// 通知过来的数据跳转到编辑
|
||||||
if (this.$route.query.resourceId) {
|
if (this.$route.query.resourceId) {
|
||||||
|
@ -625,7 +627,7 @@ export default {
|
||||||
trashEnable() {
|
trashEnable() {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
this.tableOperatorButtons = this.tableTrashOperatorButtons;
|
this.tableOperatorButtons = this.tableTrashOperatorButtons;
|
||||||
this.condition.filters = { status: ['Trash'] };
|
this.condition.filters = {status: ['Trash']};
|
||||||
this.condition.moduleIds = [];
|
this.condition.moduleIds = [];
|
||||||
} else {
|
} else {
|
||||||
this.tableOperatorButtons = this.tableUsualOperatorButtons;
|
this.tableOperatorButtons = this.tableUsualOperatorButtons;
|
||||||
|
@ -642,7 +644,7 @@ export default {
|
||||||
setAdvSearchParam() {
|
setAdvSearchParam() {
|
||||||
let comp = this.condition.components.find((c) => c.key === 'moduleIds');
|
let comp = this.condition.components.find((c) => c.key === 'moduleIds');
|
||||||
if (comp) {
|
if (comp) {
|
||||||
comp.options.params = { protocol: this.currentProtocol };
|
comp.options.params = {protocol: this.currentProtocol};
|
||||||
}
|
}
|
||||||
let method = this.condition.components.find((c) => c.key === 'method');
|
let method = this.condition.components.find((c) => c.key === 'method');
|
||||||
if (method) {
|
if (method) {
|
||||||
|
@ -699,7 +701,7 @@ export default {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
if (currentProtocol && ["HTTP", "DUBBO", "SQL", "TCP"].includes(currentProtocol)) {
|
if (currentProtocol && ["HTTP", "DUBBO", "SQL", "TCP"].includes(currentProtocol)) {
|
||||||
this.condition.protocol = currentProtocol;
|
this.condition.protocol = currentProtocol;
|
||||||
}else if (this.currentProtocol != null) {
|
} else if (this.currentProtocol != null) {
|
||||||
this.condition.protocol = this.currentProtocol;
|
this.condition.protocol = this.currentProtocol;
|
||||||
}
|
}
|
||||||
this.enableOrderDrag = !(this.condition.orders && this.condition.orders.length > 0);
|
this.enableOrderDrag = !(this.condition.orders && this.condition.orders.length > 0);
|
||||||
|
@ -862,7 +864,7 @@ export default {
|
||||||
getMaintainer().then((response) => {
|
getMaintainer().then((response) => {
|
||||||
this.valueArr.userId = response.data;
|
this.valueArr.userId = response.data;
|
||||||
this.userFilters = response.data.map((u) => {
|
this.userFilters = response.data.map((u) => {
|
||||||
return { text: u.name, value: u.id };
|
return {text: u.name, value: u.id};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -873,11 +875,11 @@ export default {
|
||||||
this.versionFilters = response.data
|
this.versionFilters = response.data
|
||||||
.filter((u) => u.id === currentVersion)
|
.filter((u) => u.id === currentVersion)
|
||||||
.map((u) => {
|
.map((u) => {
|
||||||
return { text: u.name, value: u.id };
|
return {text: u.name, value: u.id};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.versionFilters = response.data.map((u) => {
|
this.versionFilters = response.data.map((u) => {
|
||||||
return { text: u.name, value: u.id };
|
return {text: u.name, value: u.id};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -957,7 +959,7 @@ export default {
|
||||||
},
|
},
|
||||||
reductionApi(row) {
|
reductionApi(row) {
|
||||||
let tmp = JSON.parse(JSON.stringify(row));
|
let tmp = JSON.parse(JSON.stringify(row));
|
||||||
let rows = { ids: [tmp.id] };
|
let rows = {ids: [tmp.id]};
|
||||||
rows.projectId = getCurrentProjectID();
|
rows.projectId = getCurrentProjectID();
|
||||||
rows.protocol = this.currentProtocol;
|
rows.protocol = this.currentProtocol;
|
||||||
definitionReduction(rows).then(() => {
|
definitionReduction(rows).then(() => {
|
||||||
|
|
Loading…
Reference in New Issue