diff --git a/package.json b/package.json index 7a1c3232d..d6b36ce01 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,7 @@ "eslintConfig": { "extends": "react-app" }, - "proxy": "http://172.20.32.202:9999", + "proxy": "http://172.20.32.202:4000", "port": "3007", "devDependencies": { "@babel/core": "^7.23.6", diff --git a/src/AppConfig.js b/src/AppConfig.js index e102edbe1..308ff1a6a 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) { // 判断网络是否连接 initOnlineOfflineListener(); - var proxy = "https://testforgeplus.trustie.net"; + var proxy = "http://172.20.32.202:4000/"; // var proxy = "https://www.gitlink.org.cn"; //响应前的设置 diff --git a/src/forge/Server/api.js b/src/forge/Server/api.js index d5daf53de..52dc9dca4 100644 --- a/src/forge/Server/api.js +++ b/src/forge/Server/api.js @@ -35,3 +35,10 @@ export function getProblemData(component, keys) { }); } +// 初始化sonar +export function initSonar(open, owner, repo) { + return fetch({ + url: `/api/v1/${owner}/${repo}/sonarqubes/sonar_initialize.json?has_actions=${ open }`, + method: 'post', + }); +} \ No newline at end of file diff --git a/src/forge/Server/quality/index.jsx b/src/forge/Server/quality/index.jsx index f1b4de18d..f1fae6bec 100644 --- a/src/forge/Server/quality/index.jsx +++ b/src/forge/Server/quality/index.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, Fragment } from "react"; -import { getList, getCodeSnippets, getProblemDetail, getProblemData } from "../api"; +import { getList, getCodeSnippets, getProblemDetail, getProblemData, initSonar } from "../api"; import './detail.scss'; import ProblemDetail from "./component/ProblemDetail"; import { issueType, maintainability, issueTypeIcon, maintainabilityIcon } from "../constants/quality"; @@ -25,6 +25,7 @@ function IssueList(props) { const [selectedTag, setSelectedTag] = useState([]); const [pageNum, setPageNum] = useState(1); const [pageSize, setPageSize] = useState(10); + const [isopen, setIsopen] = useState(false); const { projectDetail, history } = props; const metricKeys = 'lines,coverage,lines_to_cover,duplicated_lines_density,maintainability_issues,vulnerabilities,bugs,code_smells'; const facets = 'impactSeverities,tags,types'; @@ -157,6 +158,10 @@ function IssueList(props) { }) } + const openAnalysis = () => { + initSonar(true, owner, projectsId) + } + return (
欢迎使用代码质量分析工具
代码分析结果