fix(测试跟踪): 获取不到版本选项

This commit is contained in:
chenjianxing 2022-10-14 13:42:28 +08:00 committed by jianxing
parent 7c2f40a25c
commit 191dac3505
20 changed files with 54 additions and 85 deletions

View File

@ -1,10 +1,10 @@
import {get} from "../plugins/request"
import {hasLicense} from "../utils/permission";
export function getProjectVersions(projectId) {
return get(`/project/version/get-project-versions/${projectId}`);
}
export function getProjectMembers() {
return get('/user/project/member/list');
}
@ -12,3 +12,15 @@ export function getProjectMembers() {
export function isProjectVersionEnable(projectId) {
return get(`/project/version/enable/${projectId}`)
}
export function getVersionFilters(projectId) {
return hasLicense() && projectId ? new Promise((resolve) => {
getProjectVersions(projectId)
.then((r) => {
let versionFilters = r.data.map(u => {
return {text: u.name, value: u.id};
});
resolve({data: versionFilters});
});
}) : new Promise(resolve => resolve({}));
}

View File

@ -14,13 +14,6 @@ export function getCurrentProject(callback) {
return getProject(getCurrentProjectID(), callback);
}
export function getVersionFilters(projectId) {
if (projectId) {
return get('/project/version/get-project-versions/' + projectId);
}
return {};
}
export function getOwnerProjectIds() {
let url = '/api/project/get/owner/ids';
@ -32,9 +25,9 @@ export function getMaintainer() {
return get(url);
}
export function getProjectVersions(projectId) {
return get('/project/version/get-project-versions/' + projectId);
}
// export function getProjectVersions(projectId) {
// return get('/project/version/get-project-versions/' + projectId);
// }
export function versionEnableByProjectId(projectId) {
return get('/project/version/enable/' + projectId);

View File

@ -257,7 +257,8 @@ import RelationshipGraphDrawer from "metersphere-frontend/src/components/graph/M
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
import {mapState} from "pinia";
import {useStore} from "@/store"
import {getProject, getProjectVersions} from "@/api/project";
import {getProject} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {getProjectApplicationConfig} from "@/api/project-application";
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
@ -1062,12 +1063,8 @@ export default {
},
getVersionOptions() {
if (hasLicense()) {
getProjectVersions(getCurrentProjectID())
.then(response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
getVersionFilters(getCurrentProjectID())
.then(r => this.versionFilters = r.data);
}
},
generateColumnKey

View File

@ -75,7 +75,7 @@ import {TEST_CASE_RELEVANCE_API_CASE_CONFIGS} from "metersphere-frontend/src/com
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getTestCaseRelevanceApiList} from "@/api/testCase";
@ -199,9 +199,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;

View File

@ -81,7 +81,7 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
import {TEST_CASE_RELEVANCE_LOAD_CASE} from "metersphere-frontend/src/components/search/search-components";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {getTestCaseRelevanceLoadList} from "@/api/testCase";
export default {
@ -172,9 +172,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;

View File

@ -86,7 +86,7 @@ import PlanStatusTableItem from "@/business/common/tableItems/plan/PlanStatusTab
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {TEST_CASE_RELEVANCE_API_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getTestCaseRelevanceScenarioList} from "@/api/testCase";
@ -195,9 +195,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;

View File

@ -103,7 +103,7 @@ import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTa
import TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS from "metersphere-frontend/src/components/search/search-components";
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getOwnerProjects} from "@/business/utils/sdk-utils";
import {getProjectApplicationConfig} from "@/api/project-application";
@ -273,9 +273,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
filter(field) {
this.condition.filters = field || null;

View File

@ -64,13 +64,13 @@
<script>
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import {getVersionFilters} from "@/api/project";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {apiDefinitionListBatch, apiDefinitionRelevance} from "@/api/remote/api/api-definition";
import {apiTestCaseListBlobs, apiTestCaseRelevance} from "@/api/remote/api/api-case";
import RelevanceApiList from "@/business/plan/view/comonents/api/RelevanceApiList";
import RelevanceCaseList from "@/business/plan/view/comonents/api/RelevanceCaseList";
import MsApiModule from "@/business/plan/view/comonents/api/module/ApiModule";
import {getVersionFilters} from "@/business/utils/sdk-utils";
export default {
name: "TestCaseApiRelevance",
@ -227,9 +227,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion, type) {
if (type == 'api') {

View File

@ -36,7 +36,7 @@ import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import RelevanceScenarioList from "./RelevanceScenarioList";
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
import {getCurrentProjectID, hasLicense, strMapToObj} from "@/business/utils/sdk-utils";
import {getProjectVersions} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {testPlanAutoCheck} from "@/api/remote/plan/test-plan";
import {scenarioRelevance} from "@/api/remote/plan/test-plan-scenario";
import MsApiScenarioModule from "@/business/plan/view/comonents/api/module/ApiScenarioModule";
@ -175,12 +175,8 @@ export default {
},
getVersionOptions() {
if (hasLicense()) {
getProjectVersions(getCurrentProjectID())
.then(response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
getVersionFilters(getCurrentProjectID())
.then(r => this.versionFilters = r.data);
}
},
}

View File

@ -205,7 +205,6 @@ import MsPlanRunMode from "@/business/plan/common/PlanRunModeWithEnv";
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
import {editTestPlanApiCaseOrder, testPlanAutoCheck} from "@/api/remote/plan/test-plan";
import {getProjectVersions} from "@/api/project";
import {getProjectMemberUserFilter} from "@/api/user";
import {apiTestCaseGet, apiTestCaseReduction} from "@/api/remote/api/api-case";
import {
@ -217,6 +216,7 @@ import {
import {apiDefinitionPlanReportGetByCaseId} from "@/api/remote/api/api-definition-report";
import {reportSocket, run} from "@/api/remote/plan/test-plan";
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
import {getProjectVersions} from "@/business/utils/sdk-utils";
export default {
name: "TestPlanApiCaseList",

View File

@ -232,10 +232,10 @@ import {
testPlanScenarioList
} from "@/api/remote/plan/test-plan-scenario";
import {environmentGroupGetProjectMapName} from "@/api/environment-group";
import {getProjectVersions} from "@/api/project";
import {apiAutomationReduction} from "@/api/remote/api/api-automation";
import MicroApp from "metersphere-frontend/src/components/MicroApp";
import MsTestPlanApiStatus from "@/business/plan/view/comonents/api/TestPlanApiStatus";
import {getVersionFilters} from "@/business/utils/sdk-utils";
export default {
name: "MsTestPlanApiScenarioList",
@ -566,12 +566,8 @@ export default {
},
getVersionOptions() {
if (hasLicense()) {
getProjectVersions(getCurrentProjectID())
.then(response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
getVersionFilters(getCurrentProjectID())
.then(r => this.versionFilters = r.data);
}
},
openById(item) {

View File

@ -114,7 +114,6 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta
import MsTag from "metersphere-frontend/src/components/MsTag";
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
import {getVersionFilters} from "@/api/project";
import StatusTableItem from "@/business/common/tableItems/planview/StatusTableItem";
import ReviewStatus from "@/business/case/components/ReviewStatus";
import TestCaseReviewStatusTableItem from "@/business/common/tableItems/TestCaseReviewStatusTableItem";
@ -122,6 +121,7 @@ import TestPlanCaseStatusTableItem from "@/business/common/tableItems/TestPlanCa
import {TEST_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getProjectApplicationConfig} from "@/api/project-application";
import {getVersionFilters} from "@/business/utils/sdk-utils";
export default {
name: "FunctionalRelevance",
@ -281,9 +281,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion) {
this.page.condition.versionId = currentVersion || null;

View File

@ -305,8 +305,7 @@ import {
import {SYSTEM_FIELD_NAME_MAP} from "metersphere-frontend/src/utils/table-constants";
import {getTestPlanTestCase} from "@/api/testCase";
import TestPlanCaseIssueItem from "@/business/plan/view/comonents/functional/TestPlanCaseIssueItem";
import {getProjectVersions} from "@/api/project";
import {getCustomFieldValueForTrack, getProjectMemberOption} from "@/business/utils/sdk-utils";
import {getCustomFieldValueForTrack, getProjectMemberOption, getProjectVersions} from "@/business/utils/sdk-utils";
import {
testPlanTestCaseBatchDelete,
testPlanTestCaseBatchEdit,

View File

@ -109,7 +109,7 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta
import {_filter, buildBatchParam} from "metersphere-frontend/src/utils/tableUtils";
import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "metersphere-frontend/src/components/search/search-components";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import MsPerformanceTestStatus from "@/business/performance/PerformanceTestStatus";
import {testPlanLoadRelevance, testPlanLoadRelevanceList} from "@/api/remote/plan/test-plan-load-case";
@ -288,9 +288,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;

View File

@ -165,14 +165,13 @@ import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpda
import LoadCaseConfig from "@/business/plan/view/comonents/load/LoadCaseConfig";
import MsTaskCenter from "metersphere-frontend/src/components/task/TaskCenter";
import {editTestPlanLoadCaseOrder, testPlanAutoCheck, testPlanLoadCaseEditStatus} from "@/api/remote/plan/test-plan";
import {hasLicense} from "@/business/utils/sdk-utils";
import {getProjectVersions, hasLicense} from "@/business/utils/sdk-utils";
import {
testPlanLoadCaseBatchDelete,
testPlanLoadCaseDelete, testPlanLoadCaseReportExist, testPlanLoadCaseRun,
testPlanLoadCaseRunBatch,
testPlanLoadCaseSelectAllTableRows, testPlanLoadCaseUpdate, testPlanLoadList
} from "@/api/remote/plan/test-plan-load-case";
import {getProjectVersions} from "@/api/project";
import MicroApp from "metersphere-frontend/src/components/MicroApp";

View File

@ -81,8 +81,7 @@ import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTa
import TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS from "metersphere-frontend/src/components/search/search-components";
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import {getVersionFilters} from "@/api/project";
import {getApiScenarioEnvByProjectId} from "@/api/remote/api/api-automation";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {getOwnerProjects} from "@/business/utils/sdk-utils";
import {getProjectApplicationConfig} from "@/api/project-application";
import {testPlanUiScenarioRelevanceList} from "@/api/remote/ui/test-plan-ui-scenario-case";
@ -232,9 +231,7 @@ export default {
},
getVersionOptions() {
getVersionFilters(this.projectId)
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
},
filter(field) {
this.condition.filters = field || null;

View File

@ -212,7 +212,7 @@ import {
testPlanUiScenarioCaseRun, testPlanUiScenarioCaseSelectAllTableRows, testPlanUiScenarioEnv,
testPlanUiScenarioList
} from "@/api/remote/ui/test-plan-ui-scenario-case";
import {getVersionFilters} from "@/api/project";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {uiAutomationReduction, uiAutomationVerifySeleniumServer} from "@/api/remote/ui/api-scenario";
import {environmentGroupGetProjectMapName} from "@/api/environment-group";
import i18n from "@/i18n";
@ -646,9 +646,7 @@ export default {
getVersionOptions() {
if (hasLicense()) {
getVersionFilters(getCurrentProjectID())
.then((data) => {
this.versionFilters = data;
});
.then(r => this.versionFilters = r.data);
}
},
}

View File

@ -130,10 +130,10 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta
import MsDialogHeader from "metersphere-frontend/src/components/MsDialogHeader";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import TableSelectCountBar from "metersphere-frontend/src/components/table/TableSelectCountBar";
import {getVersionFilters, projectRelated} from "@/api/project";
import VersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getTestCaseReviewRelevance, getTestCaseReviewsCasePage} from "@/api/test-review";
import {testCaseNodeListReviewRelate} from "@/api/test-case-node";
import {getVersionFilters} from "@/business/utils/sdk-utils";
export default {
name: "TestReviewRelevance",
@ -360,9 +360,8 @@ export default {
this.selectNodeIds = [];
},
getVersionOptions() {
getVersionFilters(this.projectId, (data) => {
this.versionFilters = data;
});
getVersionFilters(this.projectId)
.then(r => this.versionFilters = r.data);
},
changeVersion(version) {
this.condition.versionId = version || null;

View File

@ -204,13 +204,14 @@ import {editTestReviewTestCaseOrder, getTestReviewTestCase} from "@/api/testCase
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {hasLicense} from "metersphere-frontend/src/utils/permission";
import TestCaseReviewStatusTableItem from "@/business/common/tableItems/TestCaseReviewStatusTableItem";
import {getProjectConfig, getVersionFilters} from "@/api/project";
import {getProjectConfig} from "@/api/project";
import {
batchDeleteTestReviewCase,
batchEditTestReviewCaseStatus,
deleteTestReviewCase, getTesReviewById
} from "@/api/test-review";
import {useStore} from "@/store";
import {getVersionFilters} from "@/business/utils/sdk-utils";
export default {
name: "TestReviewTestCaseList",
@ -563,11 +564,7 @@ export default {
getVersionOptions() {
if (hasLicense()) {
getVersionFilters(getCurrentProjectID())
.then((response) => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
})
.then(r => this.versionFilters = r.data);
}
},
}

View File

@ -15,7 +15,7 @@ export {deleteMarkDownImgByName} from "metersphere-frontend/src/api/img";
export {getApiDefinitionById, getApiTestCasePages} from "metersphere-frontend/src/api/environment";
export {getOwnerProjects, getProjectListAll} from "metersphere-frontend/src/api/project";
export {deleteRelationshipEdge} from "metersphere-frontend/src/api/relationship-edge";
export {isProjectVersionEnable} from "metersphere-frontend/src/api/version";
export {isProjectVersionEnable, getProjectVersions, getVersionFilters} from "metersphere-frontend/src/api/version";
import {