From f4f4758c478160292d9b8bf34ee0acbed2b58f56 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 21 Nov 2022 14:41:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=88=97=E8=A1=A8=E5=B9=B3=E5=8F=B0=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=8B=89=E6=A1=86=E7=BC=BA=E5=B0=91Jira?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019953 --user=陈建星 【测试跟踪】上传jira插件-缺陷管理-平台状态-下拉框没有jira https://www.tapd.cn/55049933/s/1299346 --- .../frontend/src/api/platform-plugin.js | 1 - .../controller/IssuesController.java | 9 +++++++++ .../service/PlatformPluginService.java | 17 +++++++++++++++++ test-track/frontend/src/api/issue.js | 4 ++++ .../frontend/src/business/issue/IssueList.vue | 14 +++++++++++--- 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/system-setting/frontend/src/api/platform-plugin.js b/system-setting/frontend/src/api/platform-plugin.js index 6dbf5a6234..243b30a895 100644 --- a/system-setting/frontend/src/api/platform-plugin.js +++ b/system-setting/frontend/src/api/platform-plugin.js @@ -20,7 +20,6 @@ export function validateProjectConfig(pluginId, config) { export function getPlatformProjectOption(pluginId, request) { return post(BASE_URL + 'project/option', request); } - export function getPlatformOption() { return get(BASE_URL + 'platform/option'); } diff --git a/test-track/backend/src/main/java/io/metersphere/controller/IssuesController.java b/test-track/backend/src/main/java/io/metersphere/controller/IssuesController.java index 70beaa4505..2e56185b4f 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/IssuesController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/IssuesController.java @@ -15,6 +15,7 @@ import io.metersphere.dto.IssuesStatusCountDao; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.notice.annotation.SendNotice; +import io.metersphere.platform.domain.SelectOption; import io.metersphere.request.issues.IssueExportRequest; import io.metersphere.request.issues.IssueImportRequest; import io.metersphere.request.issues.PlatformIssueTypeRequest; @@ -22,6 +23,7 @@ import io.metersphere.request.testcase.AuthUserIssueRequest; import io.metersphere.request.testcase.IssuesCountRequest; import io.metersphere.service.BaseCheckPermissionService; import io.metersphere.service.IssuesService; +import io.metersphere.service.PlatformPluginService; import io.metersphere.service.issue.domain.zentao.ZentaoBuild; import io.metersphere.xpack.track.dto.*; import io.metersphere.xpack.track.dto.request.IssuesRequest; @@ -42,6 +44,8 @@ public class IssuesController { private IssuesService issuesService; @Resource private BaseCheckPermissionService baseCheckPermissionService; + @Resource + private PlatformPluginService platformPluginService; @PostMapping("/list/{goPage}/{pageSize}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_ISSUE_READ) @@ -199,6 +203,11 @@ public class IssuesController { return issuesService.getPlatformTransitions(request); } + @GetMapping("/platform/option") + public List getPlatformOptions() { + return platformPluginService.getPlatformOptions(); + } + @PostMapping("/check/third/project") public void checkThirdProjectExist(@RequestBody Project project) { issuesService.checkThirdProjectExist(project); diff --git a/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java b/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java index 6aac7f8ee1..2ff467a5a8 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/PlatformPluginService.java @@ -10,6 +10,7 @@ import io.metersphere.base.domain.ServiceIntegration; import io.metersphere.commons.constants.PluginScenario; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.platform.domain.PlatformRequest; +import io.metersphere.platform.domain.SelectOption; import io.metersphere.platform.loader.PlatformPluginManager; import io.metersphere.request.IntegrationRequest; import io.metersphere.utils.PluginManagerUtil; @@ -21,6 +22,7 @@ import javax.annotation.Resource; import java.io.InputStream; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) @@ -101,4 +103,19 @@ public class PlatformPluginService { } return true; } + + public List getPlatformOptions() { + List options = pluginManager.getPluginMetaInfoList() + .stream() + .map(pluginMetaInfo -> new SelectOption(pluginMetaInfo.getLabel(), pluginMetaInfo.getKey())) + .collect(Collectors.toList()); + List integrations = baseIntegrationService.getAll(SessionUtils.getCurrentWorkspaceId()); + // 过滤掉服务集成中没有的选项 + return options.stream() + .filter(option -> + integrations.stream() + .filter(integration -> StringUtils.equals(integration.getPlatform(), option.getValue())) + .collect(Collectors.toList()).size() > 0 + ).collect(Collectors.toList()); + } } diff --git a/test-track/frontend/src/api/issue.js b/test-track/frontend/src/api/issue.js index a636bc79ab..22cb17e5ad 100644 --- a/test-track/frontend/src/api/issue.js +++ b/test-track/frontend/src/api/issue.js @@ -248,3 +248,7 @@ export function getIssuePartTemplateWithProject(callback) { }); }); } + +export function getPlatformOption() { + return get(BASE_URL + 'platform/option'); +} diff --git a/test-track/frontend/src/business/issue/IssueList.vue b/test-track/frontend/src/business/issue/IssueList.vue index bd329f54de..b088bc4f23 100644 --- a/test-track/frontend/src/business/issue/IssueList.vue +++ b/test-track/frontend/src/business/issue/IssueList.vue @@ -195,7 +195,7 @@ import { getIssues, syncIssues, deleteIssue, - getIssuesById, batchDeleteIssue + getIssuesById, batchDeleteIssue, getPlatformOption } from "@/api/issue"; import { getCustomFieldValue, @@ -268,7 +268,8 @@ export default { isThirdPart: false, creatorFilters: [], loading: false, - dataSelectRange: "" + dataSelectRange: "", + platformOptions: [] }; }, watch: { @@ -297,10 +298,17 @@ export default { }); this.getIssues(); }); + + getPlatformOption() + .then((r) => { + this.platformOptions = r.data; + }); }, computed: { platformFilters() { - return ISSUE_PLATFORM_OPTION; + let options = [...ISSUE_PLATFORM_OPTION]; + options.push(...this.platformOptions); + return options; }, issueStatusMap() { return ISSUE_STATUS_MAP;