Merge pull request '202110151541 release' (#179) from pre_develop_dev into pre_develop

This commit is contained in:
baladiwei 2021-10-15 16:03:59 +08:00
commit 3e3e9f3681
12 changed files with 104 additions and 61 deletions

View File

@ -2456,7 +2456,7 @@ a.hoverLine:hover{
.color-grey-9 { .color-grey-9 {
color: #333333 !important; color: #999 !important;
} }
a:hover{ a:hover{

View File

@ -10,6 +10,10 @@ import ActivityItem from './ActivityItem';
import axios from 'axios'; import axios from 'axios';
const LIMIT = 15; const LIMIT = 15;
const ARRAY = [ const ARRAY = [
{
id:"",
name:'全部'
},
{ {
id:1, id:1,
name:'1天' name:'1天'
@ -32,10 +36,15 @@ class Activity extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
time:'30', time:undefined,
type:undefined, type:undefined,
state:undefined, state:undefined,
page:1, page:1,
pr_count:undefined,
new_pr_count:undefined,
close_issues_count:undefined,
open_issues_count:undefined,
pr_all_count:undefined,issues_count:undefined,
data:undefined, data:undefined,
project_trends:undefined, project_trends:undefined,
@ -63,8 +72,15 @@ class Activity extends Component{
this.setState({ this.setState({
data:result.data, data:result.data,
project_trends:result.data.project_trends, project_trends:result.data.project_trends,
isSpin:false isSpin:false,
pr_count:result.data.pr_count,
new_pr_count:result.data.new_pr_count,
close_issues_count:result.data.close_issues_count,
open_issues_count:result.data.open_issues_count,
pr_all_count:result.data.pr_all_count,
issues_count:result.data.issues_count,
}) })
window.scrollTo(0,0);
} }
}).catch(error=>{ }).catch(error=>{
console.log(error); console.log(error);
@ -74,19 +90,19 @@ class Activity extends Component{
// 切换周期 // 切换周期
changeTime=(e)=>{ changeTime=(e)=>{
this.setState({ this.setState({
time:e.key, time:e.key ==="item_0"?undefined:e.key,
isSpin:true isSpin:true
}) })
const { type,status,page } = this.state; const { type,status,page } = this.state;
this.getInfo(e.key,type,status,page); this.getInfo(e.key ==="item_0"?undefined:e.key,type,status,page);
} }
//筛选 //筛选
changeTrends=(type,status)=>{ changeTrends=(type,status)=>{
this.setState({ this.setState({
type,status type,status,page:1
}) })
const {time,page}=this.state; const {time}=this.state;
this.getInfo(time,type,status,page); this.getInfo(time,type,status,1);
} }
// 分页 // 分页
ChangePage=(page)=>{ ChangePage=(page)=>{
@ -108,12 +124,14 @@ class Activity extends Component{
</Menu> </Menu>
) )
render(){ render(){
const { time , data , page , project_trends , isSpin } = this.state; const { time , data , page , project_trends , isSpin , pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count } = this.state;
let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}];
let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ; const first_per = pr_all_count > 0 ? `${parseFloat(pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; const second_per =pr_all_count > 0 ? `${parseFloat(new_pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; const third_per =issues_count > 0 ?`${parseFloat(close_issues_count/issues_count).toFixed(2)*100}%` :"50%";
const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%'; const fourth_per =issues_count > 0 ?`${parseFloat(open_issues_count/issues_count).toFixed(2)*100}%` :"50%";
return( return(
<div className="main"> <div className="main">
@ -122,7 +140,7 @@ class Activity extends Component{
<div className="orderInfo"> <div className="orderInfo">
<div> <div>
<div className="percentLine prPercent"> <div className="percentLine prPercent">
<p className="percent_purple" style={{width:'100%'}}></p> <p className="percent_purple" style={{width:first_per}}></p>
<p className="percent_green resetStyle" style={{width:`${second_per}`}}></p> <p className="percent_green resetStyle" style={{width:`${second_per}`}}></p>
</div> </div>
<span>{data && data.pr_all_count}合并请求</span> <span>{data && data.pr_all_count}合并请求</span>
@ -132,25 +150,25 @@ class Activity extends Component{
<p className="percent_red" style={{width:`${third_per}`}}></p> <p className="percent_red" style={{width:`${third_per}`}}></p>
<p className="percent_green" style={{width:`${fourth_per}`}}></p> <p className="percent_green" style={{width:`${fourth_per}`}}></p>
</div> </div>
<span>{data && data.issues_count}任务</span> <span>{data && data.issues_count}易修</span>
</div> </div>
</div> </div>
<ul className="percentBox"> <ul className="percentBox">
<li> <li>
<span className="purple">{data && data.pr_count}</span> <span className="purple">{data && data.pr_count}</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","close")}>已处理的合并请求</span> <span className="change" onClick={()=>this.changeTrends("PullRequest","delay")}>已处理的合并请求</span>
</li> </li>
<li> <li>
<span className="green">{data && data.new_pr_count}</span> <span className="green">{data && data.new_pr_count}</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","create")}>未处理的合并请求</span> <span className="change" onClick={()=>this.changeTrends("PullRequest","not_delay")}>未处理的合并请求</span>
</li> </li>
<li> <li>
<span className="red">{data && data.close_issues_count}</span> <span className="red">{data && data.close_issues_count}</span>
<span className="change" onClick={()=>this.changeTrends("Issue","close")}>已关闭的任务</span> <span className="change" onClick={()=>this.changeTrends("Issue","delay")}>已关闭的易修</span>
</li> </li>
<li> <li>
<span className="green">{data && data.open_issues_count}</span> <span className="green">{data && data.open_issues_count}</span>
<span className="change" onClick={()=>this.changeTrends("Issue","create")}>未处理的任务</span> <span className="change" onClick={()=>this.changeTrends("Issue","not_delay")}>未处理的易修</span>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -557,7 +557,7 @@ class Detail extends Component {
<span className="detail_tag_btn" loading={forkSpin}> <span className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom"> <Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}> <a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3 font-16"></i><span></span> <i className="iconfont icon-fork color-grey-9 mr3 font-16"></i><span>(Fork)</span>
</a> </a>
</Tooltip> </Tooltip>
{ {

View File

@ -21,8 +21,8 @@ const Infos = styled.div`
& .markdown-body table{ & .markdown-body table{
background: #f1f8ff; background: #f1f8ff;
} }
& .f-wrap-between{ & .btnblue{
align-items: center; margin-top: 12px;
} }
& .task-hide{ & .task-hide{
width: 65rem; width: 65rem;

View File

@ -480,7 +480,7 @@
} }
} }
.ant-anchor-wrapper{ .ant-anchor-wrapper{
padding-left: 2px; padding-left: 2px!important;
.ant-anchor-ink::before{ .ant-anchor-ink::before{
background-color: #fff; background-color: #fff;
} }
@ -490,8 +490,8 @@
margin:0px auto; margin:0px auto;
} }
.griditemAnchor{ .griditemAnchor{
margin-left: 0px; margin-left: 0px!important;
padding: 0px; padding: 0px!important;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
.ant-anchor{ .ant-anchor{
display: flex; display: flex;

View File

@ -50,7 +50,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
<Link to={{ pathname: `/${owner}/${projectsId}/issues`, state }}> <Link to={{ pathname: `/${owner}/${projectsId}/issues`, state }}>
<Tooltip title="易修是Issue的中文名即问题列表" placement="bottom"> <Tooltip title="易修是Issue的中文名即问题列表" placement="bottom">
<i className={"iconfont icon-yixiuicon1 color-grey-3 mr5 font-14"}></i> <i className={"iconfont icon-yixiuicon1 color-grey-3 mr5 font-14"}></i>
<span>易修</span> <span>易修(Issue)</span>
</Tooltip> </Tooltip>
{projectDetail && projectDetail.issues_count ? <span className="num">{numFormat(projectDetail.issues_count)}</span> : ""} {projectDetail && projectDetail.issues_count ? <span className="num">{numFormat(projectDetail.issues_count)}</span> : ""}
</Link> </Link>

View File

@ -121,15 +121,15 @@ function Tags(props) {
<SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/> <SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/>
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div className="tagSpin"> <div className="tagSpin">
{ {
source && source.length > 0 && source && source.length > 0 &&
<Table <Table
className="tagTable" className="tagTable"
dataSource={source} columns={columns} pagination={false}></Table> dataSource={source} columns={columns} pagination={false}></Table>
} }
{ {
source && source.length === 0 && <Nonedata _html={'暂无数据~'}/> source && source.length === 0 && <Nonedata _html={'暂无数据~'}/>
} }
</div> </div>
</Spin> </Spin>
</div> </div>

View File

@ -96,7 +96,6 @@ class CreateMerge extends Component {
// 再获取对应的仓库列表、分支列表 // 再获取对应的仓库列表、分支列表
// 再调用比较接口 // 再调用比较接口
const branchParams = getBranchParams(this.props.location.pathname); const branchParams = getBranchParams(this.props.location.pathname);
console.log('componentDidMount branchParams', branchParams);
this.getMergeInfo(branchParams); this.getMergeInfo(branchParams);
}; };
@ -106,7 +105,6 @@ class CreateMerge extends Component {
const newPathname = this.props.location.pathname; const newPathname = this.props.location.pathname;
if (oldPathname !== newPathname) { if (oldPathname !== newPathname) {
const branchParams = getBranchParams(newPathname); const branchParams = getBranchParams(newPathname);
console.log('componentDidUpdate branchParams', branchParams);
this.getMergeInfo(branchParams); this.getMergeInfo(branchParams);
} }
}; };
@ -142,22 +140,29 @@ class CreateMerge extends Component {
pull: pullBranch, pull: pullBranch,
}); });
if (!noMergeBranch && !noPullBranch) { //判断源分支是否存在
this.compareProject(result.data.id, branchParams); if(noPullBranch){
} else {
const _message = [];
noMergeBranch && _message.push('目标分支不存在');
noPullBranch && _message.push('源分支不存在');
this.setState({ this.setState({
showMessage: true, showMessage: true,
defaultMessage: _message.join(' , '), defaultMessage:'源分支不存在',
isCompareSpin: false, isCompareSpin: false,
}); });
}else{
if(pullOwner === mergeOwner){
if (!noMergeBranch) {
this.compareProject(result.data.id, branchParams);
} else {
this.setState({
showMessage: true,
defaultMessage:'目标分支不存在',
isCompareSpin: false,
});
}
}else{
this.getBranchList(branchParams);
}
} }
} }
if (pullOwner !== mergeOwner) {
this.getBranchList(branchParams);
}
this.setState({ isSpin: false }); this.setState({ isSpin: false });
}) })
.catch((error) => { .catch((error) => {
@ -225,7 +230,9 @@ class CreateMerge extends Component {
.length === 0; .length === 0;
this.setState({ this.setState({
mergeBranches: result.data, mergeBranches: result.data,
merge: noMergeBranch ? 'master' : mergeBranch, showMessage: noMergeBranch,
defaultMessage: '目标分支不存在',
isCompareSpin: false,
}); });
} }
this.setState({ isSpin: false }); this.setState({ isSpin: false });

View File

@ -285,12 +285,16 @@ class Index extends Component {
if(value.indexOf("/") > -1){ if(value.indexOf("/") > -1){
let arr = value.split("/"); let arr = value.split("/");
let first = arr[arr.length-1]; let first = arr[arr.length-1];
if(first.indexOf(".git") > -1){ if(first.indexOf(".") > -1){
let second = first.split('.')[0]; let second = first.split('.')[0];
if(!second)return; if(!second)return;
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
repository_name:second repository_name:second
}) })
}else{
this.props.form.setFieldsValue({
repository_name:first
})
} }
} }
} }
@ -351,7 +355,7 @@ class Index extends Component {
required: true, message: '请填写镜像版本库地址' required: true, message: '请填写镜像版本库地址'
}], }],
})( })(
<Input placeholder="请输入需要导入到本项目的仓库地址" onChange={this.ChangeAddr} /> <Input placeholder="请输入需要导入到本项目的仓库地址" onBlur={this.ChangeAddr} />
)} )}
</Form.Item> </Form.Item>
<p className="formTip color-orange">示例https://github.com/facebook/reack.git</p> <p className="formTip color-orange">示例https://github.com/facebook/reack.git</p>

View File

@ -1,5 +1,7 @@
import React, { Component } from "react"; import React, { Component } from "react";
import Editor from "react-monaco-editor"; import Editor from "react-monaco-editor";
// import {UnControlled as CodeMirror} from 'react-codemirror2'
import UserSubmitComponent from "./UserSubmitComponent"; import UserSubmitComponent from "./UserSubmitComponent";
import "./index.css"; import "./index.css";
@ -103,6 +105,17 @@ class m_editor extends Component {
editorWillMount={this.editorWillMount} editorWillMount={this.editorWillMount}
editorDidMount={handleEditorMount} editorDidMount={handleEditorMount}
/> />
{/* <CodeMirror
value={editorValue}
options={{
theme: 'monokai',
mode: 'JavaScript',
extraKeys: {"Ctrl": "autocomplete"},//ctrl可以弹出提示
styleActiveLine: true,
lineNumbers: true,
readOnly:true
}}
/> */}
</div> </div>
{!readOnly && ( {!readOnly && (
<div className="editorBorderSubmitBox" style={{marginTop:"20px",padding:"20px"}}> <div className="editorBorderSubmitBox" style={{marginTop:"20px",padding:"20px"}}>

View File

@ -157,19 +157,18 @@ class Setting extends Component {
...values, ...values,
}).then((result) => { }).then((result) => {
if (result) { if (result) {
this.setState({
loading:false
})
this.props.showNotification(`仓库信息修改成功!`); this.props.showNotification(`仓库信息修改成功!`);
// if(values.project_identifier !== projectsId){ if(values.project_identifier !== projectsId){
// this.props.history.push(`/${owner}/${values.project_identifier}/settings`); this.props.history.push(`/${owner}/${values.project_identifier}/settings`);
// }else{ }else{
// }
const { getDetail } = this.props; const { getDetail } = this.props;
getDetail && getDetail(); getDetail && getDetail();
}
} }
this.setState({
loading:false
})
}).catch((error) => { }).catch((error) => {
console.log(error);
this.setState({ this.setState({
loading:false loading:false
}) })
@ -288,7 +287,9 @@ class Setting extends Component {
)} )}
</Form.Item> </Form.Item>
</div> </div>
{/* <Form.Item label=" (url)"> <Form.Item
label={<span>项目标识 <span className="color-grey-9">(项目url标识部分更改项目标识将导致原仓库地址失效)</span></span>}
>
{getFieldDecorator("project_identifier", { {getFieldDecorator("project_identifier", {
rules: [ rules: [
{ {
@ -299,7 +300,7 @@ class Setting extends Component {
})( })(
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" /> <Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" />
)} )}
</Form.Item> */} </Form.Item>
<Form.Item label="项目简介"> <Form.Item label="项目简介">
{getFieldDecorator("project_description", { {getFieldDecorator("project_description", {
rules: [], rules: [],

View File

@ -298,7 +298,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
.CodeMirror-scroll { .CodeMirror-scroll {
overflow: scroll !important; overflow: scroll !important;
margin-bottom: -30px; margin-bottom: -30px;
margin-right: -30px; margin-right: -30px!important;
padding-bottom: 30px; padding-bottom: 30px;
height: 100%; height: 100%;
outline: none; outline: none;