refactor: 优化插件获取缺陷接口
This commit is contained in:
parent
893de5af32
commit
0aac4ed341
|
@ -210,6 +210,11 @@ public class IssuesController {
|
||||||
return issuesService.getPlatformTransitions(request);
|
return issuesService.getPlatformTransitions(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/platform/status")
|
||||||
|
public List<PlatformStatusDTO> getPlatformStatus(@RequestBody PlatformIssueTypeRequest request) {
|
||||||
|
return issuesService.getPlatformStatus(request);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/platform/option")
|
@GetMapping("/platform/option")
|
||||||
public List<SelectOption> getPlatformOptions() {
|
public List<SelectOption> getPlatformOptions() {
|
||||||
return platformPluginService.getPlatformOptions();
|
return platformPluginService.getPlatformOptions();
|
||||||
|
|
|
@ -1449,16 +1449,45 @@ public class IssuesService {
|
||||||
return extIssuesMapper.getIssues(request);
|
return extIssuesMapper.getIssues(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PlatformStatusDTO> getPlatformStatus(PlatformIssueTypeRequest request) {
|
||||||
|
List<PlatformStatusDTO> platformStatusDTOS = new ArrayList<>();
|
||||||
|
Project project = baseProjectService.getProjectById(request.getProjectId());
|
||||||
|
String projectConfig = PlatformPluginService.getCompatibleProjectConfig(project);
|
||||||
|
String platform = project.getPlatform();
|
||||||
|
if (PlatformPluginService.isPluginPlatform(platform)) {
|
||||||
|
return platformPluginService.getPlatform(platform)
|
||||||
|
.getStatusList(projectConfig)
|
||||||
|
.stream().map(item -> {
|
||||||
|
// 全部插件化后简化
|
||||||
|
PlatformStatusDTO platformStatusDTO = new PlatformStatusDTO();
|
||||||
|
platformStatusDTO.setLabel(item.getLabel());
|
||||||
|
platformStatusDTO.setValue(item.getValue());
|
||||||
|
return platformStatusDTO;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<String> platforms = getPlatforms(project);
|
||||||
|
if (CollectionUtils.isEmpty(platforms)) {
|
||||||
|
return platformStatusDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
IssuesRequest issuesRequest = getDefaultIssueRequest(request.getProjectId(), request.getWorkspaceId());
|
||||||
|
return IssueFactory.createPlatform(platform, issuesRequest).getTransitions(request.getPlatformKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<PlatformStatusDTO> getPlatformTransitions(PlatformIssueTypeRequest request) {
|
public List<PlatformStatusDTO> getPlatformTransitions(PlatformIssueTypeRequest request) {
|
||||||
List<PlatformStatusDTO> platformStatusDTOS = new ArrayList<>();
|
List<PlatformStatusDTO> platformStatusDTOS = new ArrayList<>();
|
||||||
|
|
||||||
if (!StringUtils.isBlank(request.getPlatformKey())) {
|
if (!StringUtils.isBlank(request.getPlatformKey())) {
|
||||||
Project project = baseProjectService.getProjectById(request.getProjectId());
|
Project project = baseProjectService.getProjectById(request.getProjectId());
|
||||||
|
String projectConfig = PlatformPluginService.getCompatibleProjectConfig(project);
|
||||||
String platform = project.getPlatform();
|
String platform = project.getPlatform();
|
||||||
if (PlatformPluginService.isPluginPlatform(platform)) {
|
if (PlatformPluginService.isPluginPlatform(platform)) {
|
||||||
return platformPluginService.getPlatform(platform)
|
return platformPluginService.getPlatform(platform)
|
||||||
.getStatusList(request.getPlatformKey())
|
.getTransitions(projectConfig, request.getPlatformKey())
|
||||||
.stream().map(item -> {
|
.stream().map(item -> {
|
||||||
|
// 全部插件化后简化
|
||||||
PlatformStatusDTO platformStatusDTO = new PlatformStatusDTO();
|
PlatformStatusDTO platformStatusDTO = new PlatformStatusDTO();
|
||||||
platformStatusDTO.setLabel(item.getLabel());
|
platformStatusDTO.setLabel(item.getLabel());
|
||||||
platformStatusDTO.setValue(item.getValue());
|
platformStatusDTO.setValue(item.getValue());
|
||||||
|
|
|
@ -212,6 +212,10 @@ export function getPlatformStatus(param) {
|
||||||
return post('/issues/platform/status', param);
|
return post('/issues/platform/status', param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPlatformTransitions(param) {
|
||||||
|
return post('/issues/platform/transitions', param);
|
||||||
|
}
|
||||||
|
|
||||||
export function enableThirdPartTemplate(projectId) {
|
export function enableThirdPartTemplate(projectId) {
|
||||||
return get(BASE_URL + 'third/part/template/enable/' + projectId);
|
return get(BASE_URL + 'third/part/template/enable/' + projectId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,13 +200,11 @@ import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||||
import {
|
import {
|
||||||
enableThirdPartTemplate,
|
enableThirdPartTemplate,
|
||||||
getIssuePartTemplateWithProject,
|
getIssuePartTemplateWithProject,
|
||||||
getPlatformStatus,
|
|
||||||
getIssuesById,
|
|
||||||
saveOrUpdateIssue,
|
saveOrUpdateIssue,
|
||||||
saveFollow,
|
saveFollow,
|
||||||
getFollow,
|
getFollow,
|
||||||
getComments,
|
getComments,
|
||||||
getTapdUser
|
getTapdUser, getPlatformTransitions
|
||||||
} from "@/api/issue";
|
} from "@/api/issue";
|
||||||
import {
|
import {
|
||||||
uploadIssueAttachment,
|
uploadIssueAttachment,
|
||||||
|
@ -433,7 +431,7 @@ export default {
|
||||||
projectId: getCurrentProjectID(),
|
projectId: getCurrentProjectID(),
|
||||||
workspaceId: getCurrentWorkspaceId()
|
workspaceId: getCurrentWorkspaceId()
|
||||||
}
|
}
|
||||||
getPlatformStatus(data).then(response => {
|
getPlatformTransitions(data).then(response => {
|
||||||
if (response.data.length > 0) {
|
if (response.data.length > 0) {
|
||||||
this.platformTransitions = response.data;
|
this.platformTransitions = response.data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,15 +65,14 @@
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
|
|
||||||
<span v-if="item.id === 'platformStatus'">
|
<span v-if="item.id === 'platformStatus'">
|
||||||
<span v-if="scope.row.platform ==='Zentao'">
|
<span v-if="scope.row.platform === 'Tapd'">
|
||||||
{{
|
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
|
||||||
scope.row.platformStatus ? issueStatusMap[scope.row.platformStatus] : '--'
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span v-else-if="scope.row.platform ==='Local'">
|
||||||
v-else-if="scope.row.platform ==='Tapd'">{{
|
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
|
||||||
scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--'
|
</span>
|
||||||
}}
|
<span v-else-if="platformStatusMap && platformStatusMap.get(scope.row.platformStatus)">
|
||||||
|
{{ platformStatusMap.get(scope.row.platformStatus) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.platformStatus ? scope.row.platformStatus : '--' }}
|
{{ scope.row.platformStatus ? scope.row.platformStatus : '--' }}
|
||||||
|
@ -161,7 +160,7 @@ import {
|
||||||
getIssues,
|
getIssues,
|
||||||
syncIssues,
|
syncIssues,
|
||||||
deleteIssue,
|
deleteIssue,
|
||||||
getIssuesById, batchDeleteIssue, getPlatformOption, syncAllIssues
|
getIssuesById, batchDeleteIssue, getPlatformOption, syncAllIssues, getPlatformStatus
|
||||||
} from "@/api/issue";
|
} from "@/api/issue";
|
||||||
import {
|
import {
|
||||||
getCustomFieldValue,
|
getCustomFieldValue,
|
||||||
|
@ -240,6 +239,8 @@ export default {
|
||||||
loading: false,
|
loading: false,
|
||||||
dataSelectRange: "",
|
dataSelectRange: "",
|
||||||
platformOptions: [],
|
platformOptions: [],
|
||||||
|
platformStatus: [],
|
||||||
|
platformStatusMap: new Map(),
|
||||||
hasLicense: false,
|
hasLicense: false,
|
||||||
columns: {
|
columns: {
|
||||||
num: {
|
num: {
|
||||||
|
@ -303,6 +304,17 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.hasLicense = hasLicense();
|
this.hasLicense = hasLicense();
|
||||||
|
|
||||||
|
getPlatformStatus( {
|
||||||
|
projectId: getCurrentProjectID(),
|
||||||
|
workspaceId: getCurrentWorkspaceId()
|
||||||
|
}).then((r) => {
|
||||||
|
this.platformStatus = r.data;
|
||||||
|
this.platformStatusMap = new Map();
|
||||||
|
this.platformStatus.forEach(item => {
|
||||||
|
this.platformStatusMap.set(item.value, item.label);
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
platformFilters() {
|
platformFilters() {
|
||||||
|
|
Loading…
Reference in New Issue