diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 0f9af0a97b..08b65d148b 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -179,6 +179,13 @@ public class UserController { return userService.getProjectMemberList(request); } + @GetMapping("/project/member/{projectId}") + public List getProjectMembers(@PathVariable String projectId) { + QueryMemberRequest request = new QueryMemberRequest(); + request.setProjectId(projectId); + return userService.getProjectMemberList(request); + } + @GetMapping("/project/member/option") public List getProjectMemberOption() { return userService.getProjectMemberOption(SessionUtils.getCurrentProjectId()); diff --git a/frontend/src/business/components/api/definition/components/complete/ApiTableList.vue b/frontend/src/business/components/api/definition/components/complete/ApiTableList.vue index 9f5eb413d1..4a841b85ef 100644 --- a/frontend/src/business/components/api/definition/components/complete/ApiTableList.vue +++ b/frontend/src/business/components/api/definition/components/complete/ApiTableList.vue @@ -126,7 +126,7 @@ import PriorityTableItem from "../../../../track/common/tableItems/planview/Prio import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import {getProtocolFilter} from "@/business/components/api/definition/api-definition"; -import {getProjectMember} from "@/network/user"; +import {getProjectMemberById} from "@/network/user"; import TableSelectCountBar from "@/business/components/api/automation/scenario/api/TableSelectCountBar"; import {hasLicense} from "@/common/js/utils"; @@ -185,11 +185,7 @@ export default { } }, created: function () { - getProjectMember((data) => { - this.userFilters = data.map(u => { - return {text: u.name, value: u.id}; - }); - }); + this.getUserFilter(); this.getProtocolFilter(); this.checkVersionEnable(); }, @@ -199,6 +195,7 @@ export default { }, projectId() { this.checkVersionEnable(); + this.getUserFilter(); } }, mounted() { @@ -254,6 +251,13 @@ export default { this.versionEnable = response.data; }); } + }, + getUserFilter() { + getProjectMemberById(this.projectId, (data) => { + this.userFilters = data.map(u => { + return {text: u.name, value: u.id}; + }); + }); } }, }; diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue index 1015ef6a51..30edb25748 100644 --- a/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue @@ -75,6 +75,7 @@ import {TEST_CASE_RELEVANCE_API_CASE_CONFIGS} from "@/business/components/common import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTag from "@/business/components/common/components/MsTag"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -137,6 +138,7 @@ export default { }, projectId() { this.condition.versionId = null; + this.getVersionOptions(); this.initTable(); } }, @@ -196,13 +198,9 @@ export default { } }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion) { this.condition.versionId = currentVersion || null; diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue index e4c2cc3625..43990314d3 100644 --- a/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue @@ -82,7 +82,7 @@ import MsTableAdvSearchBar from "@/business/components/common/components/search/ import {TEST_CASE_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; -import {hasLicense, getCurrentProjectID} from "@/common/js/utils"; +import {getVersionFilters} from "@/network/project"; export default { name: "TestCaseRelateLoadList", @@ -123,6 +123,7 @@ export default { watch: { projectId() { this.condition.versionId = null; + this.getVersionOptions(); this.initTable(); } }, @@ -170,14 +171,9 @@ export default { } }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion) { this.condition.versionId = currentVersion || null; diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue index 648cd0b010..5074d5cf1a 100644 --- a/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue @@ -85,7 +85,7 @@ import PlanStatusTableItem from "@/business/components/track/common/tableItems/p import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTag from "@/business/components/common/components/MsTag"; import {TEST_CASE_RELEVANCE_API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components"; -import {hasLicense, getCurrentProjectID} from "@/common/js/utils"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -139,6 +139,7 @@ export default { }, projectId() { this.condition.versionId = null; + this.getVersionOptions(); this.initTable(); } }, @@ -192,14 +193,9 @@ export default { } }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion) { this.condition.versionId = currentVersion || null; diff --git a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue index 68fcb61031..4d17cf3399 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue @@ -107,8 +107,8 @@ import { TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS } from "@/business/components/common/components/search/search-components"; import {ENV_TYPE} from "@/common/js/constants"; -import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import MsTable from "@/business/components/common/components/table/MsTable"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -179,6 +179,7 @@ export default { projectId() { this.condition.versionId = null; this.search(); + this.getVersionOptions(); }, }, created() { @@ -268,13 +269,9 @@ export default { this.search(); }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, filter(field) { this.condition.filters = field || null; diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestCaseApiRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestCaseApiRelevance.vue index 33e4cfca11..2cecafe938 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestCaseApiRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestCaseApiRelevance.vue @@ -64,7 +64,7 @@ import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase"; import MsApiModule from "../../../../../api/definition/components/module/ApiModule"; import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList"; import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList"; -import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -106,6 +106,9 @@ export default { planId() { this.condition.planId = this.planId; }, + projectId() { + this.getVersionOptions(); + } }, mounted() { this.getVersionOptions(); @@ -220,14 +223,9 @@ export default { }); }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion, type) { if (type == 'api') { diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue index 34fb983104..cfc012d4c6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue @@ -76,6 +76,9 @@ export default { planId() { this.condition.planId = this.planId; }, + projectId() { + this.getVersionOptions(); + } }, methods: { open() { diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalRelevance.vue index 706baf468d..a274926df6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalRelevance.vue @@ -109,6 +109,7 @@ import MsTag from "@/business/components/common/components/MsTag"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import MsCreateTimeColumn from "@/business/components/common/components/table/MsCreateTimeColumn"; import MsUpdateTimeColumn from "@/business/components/common/components/table/MsUpdateTimeColumn"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -191,6 +192,7 @@ export default { this.getProjectNode(); this.getTestCases(); this.getCustomNum(); + this.getVersionOptions(); } }, methods: { @@ -258,14 +260,9 @@ export default { this.getNodeTree(this); }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion) { this.page.condition.versionId = currentVersion || null; diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue index 4e6dc9cc56..aa4e34e4af 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue @@ -108,8 +108,8 @@ import MsPerformanceTestStatus from "@/business/components/performance/test/Perf import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import {_filter, buildBatchParam} from "@/common/js/tableUtils"; import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components"; -import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import MsTable from "@/business/components/common/components/table/MsTable"; +import {getVersionFilters} from "@/network/project"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -175,6 +175,10 @@ export default { reviewId() { this.condition.reviewId = this.reviewId; }, + projectId() { + this.condition.versionId = null; + this.getVersionOptions(); + } }, mounted() { this.getVersionOptions(); @@ -188,7 +192,6 @@ export default { this.$refs.baseRelevance.open(); }, setProject(projectId) { - this.condition.versionId = null; this.projectId = projectId; this.condition.projectId = this.projectId; this.getProjectNode(); @@ -318,14 +321,9 @@ export default { this.selectNodeIds = []; }, getVersionOptions() { - if (hasLicense()) { - this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); - }); - } + getVersionFilters(this.projectId, (data) => { + this.versionFilters = data; + }); }, changeVersion(currentVersion) { this.condition.versionId = currentVersion || null; diff --git a/frontend/src/network/project.js b/frontend/src/network/project.js index e6e4c59b86..125eca2f72 100644 --- a/frontend/src/network/project.js +++ b/frontend/src/network/project.js @@ -1,5 +1,5 @@ import {baseGet} from "@/network/base-network"; -import {getCurrentProjectID} from "@/common/js/utils"; +import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; export function getProject(projectId, callback) { return projectId ? baseGet('/project/get/' + projectId, callback) : {}; @@ -8,3 +8,15 @@ export function getProject(projectId, callback) { export function getCurrentProject(callback) { return getProject(getCurrentProjectID(), callback); } + +export function getVersionFilters(projectId, callback) { + return hasLicense() && projectId ? + baseGet('/project/version/get-project-versions/' + projectId, data => { + let versionFilters = data.map(u => { + return {text: u.name, value: u.id}; + }); + if (callback) { + callback(versionFilters); + } + }) : {}; +} diff --git a/frontend/src/network/user.js b/frontend/src/network/user.js index ffaf74fc3e..10a48ddd59 100644 --- a/frontend/src/network/user.js +++ b/frontend/src/network/user.js @@ -14,6 +14,10 @@ export function getProjectMember(callBack) { }); } +export function getProjectMemberById(projectId, callback) { + return projectId ? baseGet('/user/project/member/' + projectId, callback) : {}; +} + export function logout() { axios.get("/signout").then(response => { if (response.data.success) {