fix(接口测试): 修复点击场景报告跳转链接没有跳转到对应项目的缺陷
--bug=1021249 --user=王孝刚 【测试跟踪】github#20887,报告链接点击跳转后,没有跳转到对应的项目 https://www.tapd.cn/55049933/s/1319759
This commit is contained in:
parent
d464bcc253
commit
ce55c0acac
|
@ -9,4 +9,5 @@ import java.util.List;
|
||||||
public interface ExtApiProjectMapper {
|
public interface ExtApiProjectMapper {
|
||||||
List<ProjectDTO> getUserProject(@Param("proRequest") ApiProjectRequest request);
|
List<ProjectDTO> getUserProject(@Param("proRequest") ApiProjectRequest request);
|
||||||
|
|
||||||
|
ProjectDTO getProject(String scenarioId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,12 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getProject" resultType="io.metersphere.dto.ProjectDTO">
|
||||||
|
SELECT p.* , w.name as workspaceName
|
||||||
|
from project p LEFT JOIN workspace w
|
||||||
|
on p.workspace_id = w.id
|
||||||
|
left join api_scenario a
|
||||||
|
on a.project_id = p.id where a.id = #{scenarioId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -59,4 +59,9 @@ public class ExtProjectController {
|
||||||
public List<ProjectDTO> getUserProject(@RequestBody ApiProjectRequest request) {
|
public List<ProjectDTO> getUserProject(@RequestBody ApiProjectRequest request) {
|
||||||
return extProjectApplicationService.getUserProject(request);
|
return extProjectApplicationService.getUserProject(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/api/project/get/{id}")
|
||||||
|
public ProjectDTO getProject(@PathVariable String id) {
|
||||||
|
return extProjectApplicationService.getProject(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,4 +179,8 @@ public class ExtProjectApplicationService {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
return extApiProjectMapper.getUserProject(request);
|
return extApiProjectMapper.getUserProject(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectDTO getProject(String id) {
|
||||||
|
return extApiProjectMapper.getProject(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,3 +54,9 @@ export function projectRelated(params) {
|
||||||
export function apiProjectRelated(params) {
|
export function apiProjectRelated(params) {
|
||||||
return post('/api/project/list/related', params);
|
return post('/api/project/list/related', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function apiProjectByScenarioId(scenarioId) {
|
||||||
|
return get('/api/project/get/' + scenarioId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,10 +114,11 @@
|
||||||
import { generateShareInfoWithExpired, getShareRedirectUrl } from '../../../api/share';
|
import { generateShareInfoWithExpired, getShareRedirectUrl } from '../../../api/share';
|
||||||
import { getCurrentProjectID, getCurrentWorkspaceId } from 'metersphere-frontend/src/utils/token';
|
import { getCurrentProjectID, getCurrentWorkspaceId } from 'metersphere-frontend/src/utils/token';
|
||||||
import MsTag from 'metersphere-frontend/src/components/MsTag';
|
import MsTag from 'metersphere-frontend/src/components/MsTag';
|
||||||
import { getProjectApplicationConfig } from '../../../api/project';
|
import {apiProjectByScenarioId, getProjectApplicationConfig} from '../../../api/project';
|
||||||
import { apiTestReRun } from '../../../api/xpack';
|
import { apiTestReRun } from '../../../api/xpack';
|
||||||
import { getUUID } from 'metersphere-frontend/src/utils';
|
import { getUUID } from 'metersphere-frontend/src/utils';
|
||||||
import { getApiScenarioIdByPlanScenarioId } from '@/api/test-plan';
|
import { getApiScenarioIdByPlanScenarioId } from '@/api/test-plan';
|
||||||
|
import {getScenarioReport} from '../../../api/scenario-report';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MsApiReportViewHeader',
|
name: 'MsApiReportViewHeader',
|
||||||
|
@ -189,13 +190,19 @@ export default {
|
||||||
let resourceId = this.scenarioId;
|
let resourceId = this.scenarioId;
|
||||||
getApiScenarioIdByPlanScenarioId(this.scenarioId).then((res) => {
|
getApiScenarioIdByPlanScenarioId(this.scenarioId).then((res) => {
|
||||||
resourceId = res.data;
|
resourceId = res.data;
|
||||||
this.showDetails(resourceId);
|
apiProjectByScenarioId(resourceId).then((response) =>{
|
||||||
|
if (response.data) {
|
||||||
|
let projectId = response.data.id;
|
||||||
|
let workspaceId = response.data.workspaceId;
|
||||||
|
let projectName = response.data.name;
|
||||||
|
let workspaceName = response.data.workspaceName;
|
||||||
|
this.showDetails(resourceId, projectId, projectName, workspaceId, workspaceName);
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showDetails(resourceId) {
|
showDetails(resourceId, projectId, projectName, workspaceId, workspaceName) {
|
||||||
let uuid = getUUID().substring(1, 5);
|
let uuid = getUUID().substring(1, 5);
|
||||||
let projectId = getCurrentProjectID();
|
|
||||||
let workspaceId = getCurrentWorkspaceId();
|
|
||||||
let prefix = '/#';
|
let prefix = '/#';
|
||||||
if (
|
if (
|
||||||
this.$route &&
|
this.$route &&
|
||||||
|
@ -205,7 +212,7 @@ export default {
|
||||||
) {
|
) {
|
||||||
prefix = '';
|
prefix = '';
|
||||||
}
|
}
|
||||||
let path = `${prefix}/api/automation/?redirectID=${uuid}&dataType=scenario&projectId=${projectId}&workspaceId=${workspaceId}&resourceId=${resourceId}`;
|
let path = `${prefix}/api/automation/?redirectID=${uuid}&dataType=scenario&projectId=${projectId}&workspaceId=${workspaceId}&resourceId=${resourceId}&projectName=${projectName}&workspaceName=${workspaceName}`;
|
||||||
let data = this.$router.resolve({
|
let data = this.$router.resolve({
|
||||||
path: path,
|
path: path,
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,6 +34,7 @@ import MsShowAll from 'metersphere-frontend/src/components/head/ShowAll';
|
||||||
import MsCreateButton from 'metersphere-frontend/src/components/head/CreateButton';
|
import MsCreateButton from 'metersphere-frontend/src/components/head/CreateButton';
|
||||||
import ProjectChange from 'metersphere-frontend/src/components/head/ProjectSwitch';
|
import ProjectChange from 'metersphere-frontend/src/components/head/ProjectSwitch';
|
||||||
import MsHeaderRightMenus from 'metersphere-frontend/src/components/layout/HeaderRightMenus';
|
import MsHeaderRightMenus from 'metersphere-frontend/src/components/layout/HeaderRightMenus';
|
||||||
|
import { PROJECT_ID, PROJECT_NAME, WORKSPACE, WORKSPACE_ID } from 'metersphere-frontend/src/utils/constants';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MsApiHeaderMenus',
|
name: 'MsApiHeaderMenus',
|
||||||
|
@ -56,6 +57,16 @@ export default {
|
||||||
$route: {
|
$route: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(to) {
|
handler(to) {
|
||||||
|
if (to.path === "/api/automation/") {
|
||||||
|
if (to.query.projectName && to.query.projectId) {
|
||||||
|
sessionStorage.setItem(PROJECT_NAME, to.query.projectName);
|
||||||
|
sessionStorage.setItem(PROJECT_ID, to.query.projectId);
|
||||||
|
}
|
||||||
|
if (to.query.workspaceName && to.query.workspaceId) {
|
||||||
|
sessionStorage.setItem(WORKSPACE, to.query.workspaceName);
|
||||||
|
sessionStorage.setItem(WORKSPACE_ID, to.query.workspaceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
let path = to.path.split('/', 4);
|
let path = to.path.split('/', 4);
|
||||||
this.currentPath = '/' + path[1] + '/' + path[2];
|
this.currentPath = '/' + path[1] + '/' + path[2];
|
||||||
if (path[3] === 'report') {
|
if (path[3] === 'report') {
|
||||||
|
|
Loading…
Reference in New Issue