代码质量分析

This commit is contained in:
herman94 2022-07-11 11:45:44 +08:00
parent f47fdbb1e8
commit 4e5a851484
5 changed files with 77 additions and 3 deletions

View File

@ -285,8 +285,8 @@ class App extends Component {
this.gettablogourlnull();
});
};
render() {
console.log('props',this.props);
const { pathType, pathName } = this.state;
return (
<Provider store={store}>

View File

@ -71,6 +71,12 @@ const MergeIndexDetail = Loadable({
loading: Loading,
})
//合并请求
const QualityAnalyse = Loadable({
loader: () => import('../Quality/index'),
loading: Loading,
})
const CreateMerge = Loadable({
loader: () => import('../Merge/CreateMerge'),
loading: Loading,
@ -770,10 +776,15 @@ class Detail extends Component {
}
></Route>
{/* 动态 */}
<Route path="/:owner/:projectsId/activity"
{/* <Route path="/:owner/:projectsId/activity"
render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route> */}
<Route path="/:owner/:projectsId/sonar"
render={
(props) => (<QualityAnalyse {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 代码Index */}
<Route path="/:owner/:projectsId/issues"

View File

@ -14,6 +14,7 @@ const ProjectDetail = Loadable({
});
export default withRouter(
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props) => {
console.log('props',props)
return (
<Switch>
<Route

View File

@ -32,7 +32,7 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
}
}).catch(error=>{})
}
console.log('路径名称',pathname,owner,projectsId,state,history);
return(
<div className="f-wrap-between mt25">
<QuitBox visible={visible} onCancel={()=>setVisible(false)} name={projectDetail && projectDetail.name} onSuccess={onSuccess}/>
@ -150,6 +150,15 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
</Link>
</li>
}
{
item.menu_name === "sonar" &&
<li className={pathname==="sonar" ? "quality" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/sonar`, state }}>
<i className={pathname==="sonar" ? "iconfont icon-dongtaiicon color-grey-3 mr5 font-14":"iconfont icon-dongtaiicon color-grey-6 font-14 mr5"}></i>
<span>质量分析</span>
</Link>
</li>
}
{
item.menu_name === "settings" && platform &&
<li className={pathname === "settings" ? "active" : ""}>

View File

@ -0,0 +1,53 @@
import React, { Component, useEffect, useState } from "react";
import axios from "axios";
function Quality(props){
const { projectsId , owner } = props.match.params;
const [sonarList,setSonarList] = useState({}) //问题列表分析
const [detection,setDetection] = useState('') //是否检测
const [taskId,setTaskId] = useState('') //任务ID
useEffect(()=>{
getTask()
},[])
const getTask = () => {
axios.get(`/${owner}/${projectsId}/sonar_tasks.json`)
.then(({data:{data,message,status}}) => {
if(status===-1){
getTaskData()
}
if(status === 0){
setSonarList(data)
getTaskDetail(data.task_id)
setTaskId()
}
}).catch(function (error) {
console.log(error);
});
}
const getTaskData = (task_id) => {
axios.post(`/${owner}/${projectsId}/sonar_tasks/type_detail.json?task_id=${task_id}`)
.then(result => {
console.log('请求的结果',result);
}).catch(function (error) {
console.log(error);
});
}
const getTaskDetail = () => {
}
return (
<React.Fragment>
<div className="main">
1231321
</div>
</React.Fragment>
);
}
export default Quality;