Merge branch 'develop'

This commit is contained in:
caishi 2021-07-21 10:10:53 +08:00
commit d31b932efe
25 changed files with 220 additions and 116 deletions

View File

@ -3409,7 +3409,7 @@ a.user_bluebg_btn {
} }
.cdefault { .cdefault {
cursor: default cursor: default!important;
} }

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2340181 */ font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1623836536204') format('woff2'), src: url('iconfont.woff2?t=1625800786751') format('woff2'),
url('iconfont.woff?t=1623836536204') format('woff'), url('iconfont.woff?t=1625800786751') format('woff'),
url('iconfont.ttf?t=1623836536204') format('truetype'); url('iconfont.ttf?t=1625800786751') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-file-submodule:before {
content: "\e866";
}
.icon-nv1:before { .icon-nv1:before {
content: "\e864"; content: "\e864";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "17575494",
"name": "file-submodule",
"font_class": "file-submodule",
"unicode": "e866",
"unicode_decimal": 59494
},
{ {
"icon_id": "7539612", "icon_id": "7539612",
"name": "nv", "name": "nv",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -78,6 +78,10 @@ const Search = Loadable({
loading: Loading, loading: Loading,
}) })
const ProjectIndex = Loadable({
loader: () => import("./forge/Index"),
loading: Loading,
});
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -103,30 +107,9 @@ class App extends Component {
Addcoursestypes: false Addcoursestypes: false
}) })
}; };
ModalCancelsy = () => {
this.setState({
mydisplay: false,
})
window.location.href = "/";
};
ModalshowCancelsy = () => {
this.setState({
mydisplay: true,
})
};
disableVideoContextMenu = () => {
window.$("body").on("mousedown", "video", function (event) {
if (event.which === 3) {
window.$('video').bind('contextmenu', function () { return false; });
} else {
window.$('video').unbind('contextmenu');
}
});
}
componentDidMount() { componentDidMount() {
document.title = "loading..."; document.title = "loading...";
this.disableVideoContextMenu();
initAxiosInterceptors(this.props); initAxiosInterceptors(this.props);
this.getAppdata(); this.getAppdata();
@ -204,6 +187,8 @@ class App extends Component {
}; };
render() { render() {
const { mygetHelmetapi } = this.state;
let personal = mygetHelmetapi && mygetHelmetapi.personal;
return ( return (
<Provider store={store}> <Provider store={store}>
<ConfigProvider locale={zhCN}> <ConfigProvider locale={zhCN}>
@ -265,7 +250,10 @@ class App extends Component {
<Route exact path="/" <Route exact path="/"
render={ render={
(props) => ( (props) => (
<Projects {...this.props} {...props} {...this.state}></Projects> personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
) )
} }
/> />

View File

@ -9,20 +9,7 @@ class Loading extends Component {
} }
render() { render() {
return ( return ""
<div className="App" style={{ minHeight: '800px', width: "100%" }}>
<style>
{
`
.margintop{
margin-top:20%;
}
`
}
</style>
<Spin size="large" className={"margintop"} />
</div>
);
} }
} }

View File

@ -4,6 +4,12 @@ import './Component.scss';
import axios from 'axios'; import axios from 'axios';
const { TreeNode , DirectoryTree } = Tree; const { TreeNode , DirectoryTree } = Tree;
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , list}){ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , list}){
const [ treeData , setTreeData ] = useState(undefined); const [ treeData , setTreeData ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true); const [ isSpin , setIsSpin ] = useState(true);
@ -71,7 +77,8 @@ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , li
let dataref = event.node.props.dataRef; let dataref = event.node.props.dataRef;
if(dataref.type==="file"){ if(dataref.type==="file"){
onClose(); onClose();
history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}/${dataref.path}`); let value = turnbar(branch);
history.push(`/projects/${owner}/${projectsId}/tree/${value}/${dataref.path}`);
} }
} }

View File

@ -10,6 +10,12 @@ import { Link } from 'react-router-dom';
// killed:"", // killed:"",
// pending:"" // pending:""
// } // }
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
function renderTableStatus(status) { function renderTableStatus(status) {
switch (status) { switch (status) {
case "running": case "running":
@ -65,8 +71,9 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
width:"15%", width:"15%",
ellipsis:true, ellipsis:true,
render:(value,item)=>{ render:(value,item)=>{
let v = turnbar(item.branch);
return( return(
<Link to={`/projects/${owner}/${projectsId}/tree/${item.branch.replaceAll("/","%2F")}/${value}`} className="color-blue">{value}</Link> <Link to={`/projects/${owner}/${projectsId}/tree/${v}/${value}`} className="color-blue">{value}</Link>
) )
} }
}, },

View File

@ -26,10 +26,6 @@ const ProjectDetail = Loadable({
loading: Loading, loading: Loading,
}); });
const Infos = Loadable({
loader: () => import("./users/Infos"),
loading: Loading,
});
class Index extends Component { class Index extends Component {
componentDidUpdate=()=>{ componentDidUpdate=()=>{
@ -74,12 +70,8 @@ class Index extends Component {
)} )}
></Route> ></Route>
<Route <Route
exact
path="/" path="/"
render={(props) => ( render={(props) => (
this.props.current_user && this.props.current_user.login ?
<Infos {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} /> <ProjectIndex {...this.props} {...props} />
)} )}
></Route> ></Route>

View File

@ -19,12 +19,27 @@ import LanguagePower from '../Component/LanguagePower';
import DrawerPanel from '../Component/DrawerPanel'; import DrawerPanel from '../Component/DrawerPanel';
import UpdateDescModal from './sub/UpdateDescModal'; import UpdateDescModal from './sub/UpdateDescModal';
import Nodata from '../Nodata'; import Nodata from '../Nodata';
import Invite from './sub/Invite';
/** /**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能) * projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/ */
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
function returnbar(str){
if(str && str.length>0 && str.indexOf("%2F")>-1){
return str.replaceAll('%2F','/');
}
return str;
}
function CoderDepot(props){ function CoderDepot(props){
const [ projectDetail , setProjectDetail ]= useState(undefined); const [ projectDetail , setProjectDetail ]= useState(undefined);
const [ inviteCode , setInviteCode ] = useState(undefined);
const [ treeValue , setTreeValue ] = useState(undefined); const [ treeValue , setTreeValue ] = useState(undefined);
const [ treeValuePath , setTreeValuePath ] = useState(undefined); const [ treeValuePath , setTreeValuePath ] = useState(undefined);
const [ lastCommit,setLastCommit ] = useState(undefined); const [ lastCommit,setLastCommit ] = useState(undefined);
@ -46,12 +61,13 @@ function CoderDepot(props){
const [ website , setWebsite ] = useState(undefined); const [ website , setWebsite ] = useState(undefined);
const [ lesson_url , setLessonUrl ] = useState(undefined); const [ lesson_url , setLessonUrl ] = useState(undefined);
const [ readme , setReadme ] = useState(undefined); const [ readme , setReadme ] = useState(undefined);
const [ defaultBranch , setDefaultBranch ] = useState(undefined) const [ defaultBranch , setDefaultBranch ] = useState(undefined);
const [ editReadme , setEditReadme ] = useState(false);
const owner = props.match.params.owner; const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId; const projectsId = props.match.params.projectsId;
let branchName = props.match.params.branchName; let branchName = props.match.params.branchName;
branchName = branchName && branchName.replaceAll("%2F",'/'); branchName = returnbar(branchName);
const details = props.projectDetail; const details = props.projectDetail;
let pathname = props.history.location.pathname; let pathname = props.history.location.pathname;
@ -62,6 +78,7 @@ function CoderDepot(props){
setWebsite(details.website); setWebsite(details.website);
setLessonUrl(details.lesson_url); setLessonUrl(details.lesson_url);
setDefaultBranch(details.default_branch); setDefaultBranch(details.default_branch);
setInviteCode(details.invite_code);
} }
},[details]) },[details])
@ -76,7 +93,7 @@ function CoderDepot(props){
useEffect(()=>{ useEffect(()=>{
if (projectsId && owner && defaultBranch){ if (projectsId && owner && defaultBranch){
let b = branchName && branchName.replaceAll("/","%2F"); let b = turnbar(branchName) ;
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) { if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) {
let url = pathname.split(`/tree/${b}/`)[1]; let url = pathname.split(`/tree/${b}/`)[1];
setTreeValue(url); setTreeValue(url);
@ -110,6 +127,7 @@ function CoderDepot(props){
setMainFlag(true); setMainFlag(true);
setReadOnly(true); setReadOnly(true);
setReadme(result.data.readme); setReadme(result.data.readme);
setEditReadme(false);
setHide(true); setHide(true);
} }
setTimeout(function(){setIsSpin(false);},500); setTimeout(function(){setIsSpin(false);},500);
@ -152,7 +170,7 @@ function CoderDepot(props){
setLastCommit(c && c.commit); setLastCommit(c && c.commit);
setLastCommitAuthor(c && c.committer); setLastCommitAuthor(c && c.committer);
setMainFlag(false); setMainFlag(false);
setReadOnly(true); setReadOnly(!editReadme);
setHide(true); setHide(true);
} }
setTimeout(function(){setIsSpin(false);},500) setTimeout(function(){setIsSpin(false);},500)
@ -161,17 +179,19 @@ function CoderDepot(props){
// //
function changeBranch(value){ function changeBranch(value){
let url = `/projects/${owner}/${projectsId}${value && `/tree/${value.replaceAll("/","%2F")}`}${treeValue ? `/${treeValue}`:""}`; let checkvalue = turnbar(value);
let url = `/projects/${owner}/${projectsId}${value && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`;
props.history.push(url); props.history.push(url);
} }
// //
function fileMenu(){ function fileMenu(){
let b = branchName || defaultBranch; let b = branchName || defaultBranch;
let checkvalue = turnbar(b);
return ( return (
<Menu> <Menu>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${b.replaceAll("/","%2F")}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item> <Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${checkvalue}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${b.replaceAll("/","%2F")}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item> <Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${checkvalue}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
</Menu> </Menu>
) )
} }
@ -189,28 +209,35 @@ function CoderDepot(props){
function returnMain(){ function returnMain(){
setTreeValue(undefined); setTreeValue(undefined);
let branch = branchName || defaultBranch; let branch = branchName || defaultBranch;
props.history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}`); let checkvalue = turnbar(branch);
props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}`);
}; };
// //
function returnUlr(url){ function returnUlr(url){
let enBranch = branchName && branchName.replaceAll("/","%2F"); let enBranch = turnbar(branchName);
props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`); props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`);
} }
// //
function goToSubRoot(path,type,filename){ function goToSubRoot(path,type,filename){
let enBranch = branchName || defaultBranch; if(type!=="submodule"){
setType(type); let enBranch = branchName || defaultBranch;
props.history.push(`/projects/${owner}/${projectsId}${`/tree/${enBranch.replaceAll("/","%2F")}`}${path?`/${path}`:""}`); let checkvalue = turnbar(enBranch);
setType(type);
props.history.push(`/projects/${owner}/${projectsId}${`/tree/${checkvalue}`}${path?`/${path}`:""}`);
}
} }
function onEdit(readOnly){ function onEdit(readOnly){
setReadOnly(readOnly); setReadOnly(readOnly);
setEditReadme(false);
} }
function ChangeFile(path, readOnly){ function ChangeFile(path, readOnly){
// //
props.history.push(`/projects/${owner}/${projectsId}/tree/${branchName || defaultBranch}/${path}`); let enBranch = branchName || defaultBranch;
let checkvalue = turnbar(enBranch);
props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}/${path}`);
setType("file"); setType("file");
setReadOnly(readOnly); setEditReadme(true);
}; };
function changeHide(hide){ function changeHide(hide){
@ -255,7 +282,7 @@ function CoderDepot(props){
const mdFlag = n && n.substring(n.length-3,n.length) === ".md"; const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
const { current_user } = props; const { current_user } = props;
const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && (projectDetail.permission !=="Reporter" || (current_user && current_user.admin)); const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
return( return(
<WhiteBack> <WhiteBack>
<UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/> <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
@ -430,6 +457,13 @@ function CoderDepot(props){
</p> </p>
} }
</div> </div>
{
inviteCode &&
<div>
<Divider />
<Invite code={inviteCode} className={"detailsCode"}/>
</div>
}
{ {
lesson_url && lesson_url &&
<div> <div>

View File

@ -2,12 +2,18 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { truncateCommitId } from '../common/util'; import { truncateCommitId } from '../common/util';
const typeIco = {
"submodule":"icon-file-submodule font-17",
"file":'icon-wenjia font-15',
"dir":"icon-wenjianjia1 font-15"
}
function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId }){ function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId }){
return( return(
<li> <li>
<span> <span>
<a onClick={()=>goToSubRoot(item.path,item.type,item.name)}> <a onClick={()=>goToSubRoot(item.path,item.type,item.name)} className={item.type === "submodule" && "submoduleStyle"}>
<i className={item.type === 'dir' ? "iconfont icon-wenjianjia1 color-green-file font-15 mr5":"iconfont icon-wenjia color-green-file font-15 mr5"}></i>{item.name} <i className={`iconfont ${typeIco[`${item.type}`]} color-green-file mr5`}></i>{item.name}
</a> </a>
</span> </span>
<span title="init project"> <span title="init project">

View File

@ -6,6 +6,12 @@ import { getBranch } from '../GetData/getData';
import Nodata from '../Nodata'; import Nodata from '../Nodata';
import './list.css'; import './list.css';
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
export default ((props)=>{ export default ((props)=>{
const [ data , setData ] =useState(undefined); const [ data , setData ] =useState(undefined);
const [ isSpin , setIsSpin ] =useState(true); const [ isSpin , setIsSpin ] =useState(true);
@ -32,7 +38,7 @@ export default ((props)=>{
return( return(
<li key={key}> <li key={key}>
<div> <div>
<Link to={`/projects/${owner}/${projectsId}/tree/${item.name.replaceAll("/","%2F")}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link> <Link to={`/projects/${owner}/${projectsId}/tree/${turnbar(item.name)}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<p className="f-wrap-alignCenter mt15"> <p className="f-wrap-alignCenter mt15">
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.last_commit.sha}`)}`} className="mr5 commitKey" style={{marginLeft:0}}>{item.last_commit && truncateCommitId(item.last_commit.sha)}</Link> <Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.last_commit.sha}`)}`} className="mr5 commitKey" style={{marginLeft:0}}>{item.last_commit && truncateCommitId(item.last_commit.sha)}</Link>
<span className="color-grey-3 hide-1 messages leftPoint">{item.last_commit && item.last_commit.message}</span> <span className="color-grey-3 hide-1 messages leftPoint">{item.last_commit && item.last_commit.message}</span>

View File

@ -1,9 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Spin, Tooltip } from 'antd'; import { Spin, Tooltip , Button } from 'antd';
import { Link, Route, Switch } from 'react-router-dom'; import { Link, Route, Switch } from 'react-router-dom';
import { Content , FlexAJ , AlignTop } from '../Component/layout'; import { Content , AlignTop } from '../Component/layout';
import DetailBanner from './sub/DetailBanner'; import DetailBanner from './sub/DetailBanner';
import Invite from './sub/Invite';
import '../css/index.scss' import '../css/index.scss'
import './list.css'; import './list.css';
@ -177,6 +176,7 @@ class Detail extends Component {
firstSync:false, firstSync:false,
secondSync:false, secondSync:false,
open_devops:false, open_devops:false,
forkSpin:false,
// 默认分支 // 默认分支
defaultBranch:undefined, defaultBranch:undefined,
@ -359,6 +359,9 @@ class Detail extends Component {
forkFunc = () => { forkFunc = () => {
const { platform } = this.state; const { platform } = this.state;
if(!platform)return; if(!platform)return;
this.setState({
forkSpin:true
})
const { current_user } = this.props const { current_user } = this.props
const { projectsId , owner } = this.props.match.params; const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/forks.json`; const url = `/${owner}/${projectsId}/forks.json`;
@ -367,8 +370,13 @@ class Detail extends Component {
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`); this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`);
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
} }
this.setState({
forkSpin:false
})
}).catch(error => { }).catch(error => {
console.log(error); this.setState({
forkSpin:false
})
}) })
} }
@ -406,7 +414,7 @@ class Detail extends Component {
const { projectDetail, watchers_count, praises_count, const { projectDetail, watchers_count, praises_count,
forked_count, firstSync , secondSync , forked_count, firstSync , secondSync ,
isManager, watched, praised, isManager, watched, praised,
project , open_devops , platform , defaultBranch , bannerList } = this.state; project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state;
const url = this.props.history.location.pathname; const url = this.props.history.location.pathname;
const urlArr = url.split("/"); const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3); const urlFlag = (urlArr.length === 3);
@ -459,7 +467,7 @@ class Detail extends Component {
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ? ((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : "" <a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
} }
<span className="detail_tag_btn"> <Button className="detail_tag_btn">
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.focusFunc(watched)}> <a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.focusFunc(watched)}>
<i className={watched ? "iconfont icon-shixing color-orange font-16 mr3":"iconfont icon-kongxing color-grey-9 font-16 mr3"}></i> <i className={watched ? "iconfont icon-shixing color-orange font-16 mr3":"iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
<span>{watched ? '取消关注' : '关注'}</span> <span>{watched ? '取消关注' : '关注'}</span>
@ -474,8 +482,8 @@ class Detail extends Component {
<span className="detail_tag_btn_count">{watchers_count}</span> <span className="detail_tag_btn_count">{watchers_count}</span>
:"" :""
} }
</span> </Button>
<span className="detail_tag_btn"> <Button className="detail_tag_btn">
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.pariseFunc(praised)}> <a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.pariseFunc(praised)}>
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3":"iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i> <i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3":"iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i>
<span>{praised ? '取消点赞' : '点赞'}</span> <span>{praised ? '取消点赞' : '点赞'}</span>
@ -489,8 +497,8 @@ class Detail extends Component {
<span className="detail_tag_btn_count">{praises_count}</span> <span className="detail_tag_btn_count">{praises_count}</span>
:"" :""
} }
</span> </Button>
<span className="detail_tag_btn"> <Button 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"></i> <i className="iconfont icon-fork color-grey-9 mr3"></i>
@ -506,13 +514,9 @@ class Detail extends Component {
<span className="detail_tag_btn_count">{forked_count}</span> <span className="detail_tag_btn_count">{forked_count}</span>
:"" :""
} }
</span> </Button>
</span> </span>
} }
{
projectDetail && projectDetail.invite_code &&
<Invite code={projectDetail.invite_code} className={"mt8 textRight"}/>
}
</div> </div>
</AlignTop> </AlignTop>
{ {

View File

@ -360,4 +360,13 @@
span{ span{
margin-top: 1px; margin-top: 1px;
} }
}
.submoduleStyle{
cursor: default;
i{
cursor: default;
}
&:hover{
color: #05101a;
}
} }

View File

@ -264,7 +264,10 @@
border:1px solid #f1f1f1; border:1px solid #f1f1f1;
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 30px margin-left: 30px;
padding:0px;
background-color: transparent;
box-shadow: none;
} }
.ant-tooltip { .ant-tooltip {
max-width: fit-content!important; max-width: fit-content!important;

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { Tooltip , message } from 'antd'; import { Tooltip , message } from 'antd';
import './sub.scss';
function Invite({code,className}) { function Invite({code,className}) {
@ -14,10 +15,13 @@ function Invite({code,className}) {
} }
return( return(
<div className={className}> <div className={className}>
<span>邀请码: <span id="devitecode">{code}</span></span> <span className="font-16 color-grey-6">邀请码</span>
<Tooltip title={<p className="edu-txt-center">可以通过邀请码邀请成员加入项目<br/>点击复制邀请码</p>} placement={"bottom"}> <div>
<i className="iconfont icon-fuzhi2 font-16 color-blue ml8" onClick={()=>jsCopy("#devitecode")}></i> <span id="devitecode">{code}</span>
</Tooltip> <Tooltip title={<p className="edu-txt-center">可以通过邀请码邀请成员加入项目<br/>点击复制邀请码</p>} placement={"bottom"}>
<i className="iconfont icon-fuzhi2 font-16 color-blue ml8" onClick={()=>jsCopy("#devitecode")}></i>
</Tooltip>
</div>
</div> </div>
) )
} }

View File

@ -22,4 +22,9 @@
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
} }
}
.detailsCode{
display: flex;
justify-content: space-between;
} }

View File

@ -5,6 +5,12 @@ import { AlignCenter } from '../Component/layout';
import { getImageUrl } from "educoder"; import { getImageUrl } from "educoder";
import "./merge.css"; import "./merge.css";
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
class MergeItem extends Component { class MergeItem extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -103,7 +109,7 @@ class MergeItem extends Component {
item.pull_request_head && item.pull_request_head &&
<Tag className="pr-branch-tag"> <Tag className="pr-branch-tag">
<Link <Link
to={`/projects/${item.is_original ? item.fork_project_user : owner}/${ item.is_original ? item.fork_project_identifier : projectsId }/tree/${item.pull_request_head.replaceAll("/","%2F")}`} to={`/projects/${item.is_original ? item.fork_project_user : owner}/${ item.is_original ? item.fork_project_identifier : projectsId }/tree/${turnbar(item.pull_request_head)}`}
className="maxW200px hide-1 ver-middle" className="maxW200px hide-1 ver-middle"
> >
{item.is_original {item.is_original
@ -127,7 +133,7 @@ class MergeItem extends Component {
item.pull_request_base && item.pull_request_base &&
<Tag className="pr-branch-tag"> <Tag className="pr-branch-tag">
<Link <Link
to={`/projects/${owner}/${projectsId}/tree/${item.pull_request_base.replaceAll("/","%2F")}`} to={`/projects/${owner}/${projectsId}/tree/${turnbar(item.pull_request_base)}`}
className="maxW200px hide-1 ver-middle" className="maxW200px hide-1 ver-middle"
> >
{/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */} {/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}

View File

@ -24,6 +24,12 @@ import MergeFooter from "./merge_footer";
const Option = Select.Option; const Option = Select.Option;
const TextArea = Input.TextArea; const TextArea = Input.TextArea;
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
class MessageCount extends Component { class MessageCount extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -355,10 +361,10 @@ class MessageCount extends Component {
<div className="mt15"> <div className="mt15">
<Tag className="pr-branch-tag"> <Tag className="pr-branch-tag">
<Link <Link
to={`/projects/${data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}/${data.pull_request.is_original?data.project_identifier:projectsId}/tree/${data.pull_request.head && data.pull_request.head.replaceAll("/","%2F")}`} to={`/projects/${data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}/${data.pull_request.is_original?data.project_identifier:projectsId}/tree/${turnbar(data.pull_request && data.pull_request.head)}`}
className="ver-middle" className="ver-middle"
> >
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head && data.pull_request.head.replaceAll("/","%2F")} {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: {turnbar(data.pull_request && data.pull_request.head)}
</Link> </Link>
</Tag> </Tag>
<span className="mr8 ver-middle"> <span className="mr8 ver-middle">

View File

@ -105,6 +105,18 @@ class NewMerge extends Component {
} }
axios.get(url).then(result=>{ axios.get(url).then(result=>{
if(result){ if(result){
if (result.data.status === 0) {
this.setState({
isSpin: false,
show_message: false,
});
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: result.data.message,
});
}
this.setState({ this.setState({
comparesData:result.data comparesData:result.data
}) })
@ -143,7 +155,7 @@ class NewMerge extends Component {
merge:"master" merge:"master"
}) })
} }
this.ischeckmerge(); // this.ischeckmerge();
} }
} }
@ -169,7 +181,7 @@ class NewMerge extends Component {
selectBrach = (type, value) => { selectBrach = (type, value) => {
const { projectsId , owner } = this.props.match.params; const { projectsId , owner } = this.props.match.params;
this.state[type] = value; this.state[type] = value;
this.ischeckmerge(); // this.ischeckmerge();
let { id ,merge , pull } = this.state; let { id ,merge , pull } = this.state;
if(type==="pull"){ if(type==="pull"){
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new/${pull}`) this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new/${pull}`)
@ -199,7 +211,6 @@ class NewMerge extends Component {
}; };
//判断2分支是否可以合并 //判断2分支是否可以合并
ischeckmerge = () => { ischeckmerge = () => {
this.setState({ isSpin: true }); this.setState({ isSpin: true });
const { projectsId , owner } = this.props.match.params; const { projectsId , owner } = this.props.match.params;

View File

@ -68,24 +68,30 @@ class Index extends Component {
getOwner=()=>{ getOwner=()=>{
const { OIdentifier } = this.props.match.params; const { OIdentifier } = this.props.match.params;
const { user_id } = this.props && this.props.current_user;
const url = `/owners.json`; const url = `/owners.json`;
axios.get(url).then(result=>{ axios.get(url).then(result=>{
if(result && result.data){ if(result && result.data){
let owner = result.data.owners; let owner = result.data.owners;
this.setState({
OwnerList: owner,
})
if(OIdentifier){ if(OIdentifier){
owner = owner.filter(item=>item.name === OIdentifier); owner = owner.filter(item=>item.name === OIdentifier);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
user_id:OIdentifier user_id:OIdentifier
}) })
owner && this.setState({ }else if(user_id){
owners_id:owner[0].id, owner = owner.filter(item=>item.id === user_id);
owners_name:owner[0].name this.props.form.setFieldsValue({
user_id:owner && owner[0].name
}) })
} }
this.setOptionsList(owner, 'owners'); owner && this.setState({
this.setState({ owners_id:owner[0].id,
OwnerList: owner, owners_name:owner[0].name
}) })
this.setOptionsList(owner, 'owners');
} }
}).catch(error=>{}) }).catch(error=>{})
} }
@ -175,14 +181,12 @@ class Index extends Component {
ignore_id, ignore_id,
user_id:owners_id user_id:owners_id
}).then((result) => { }).then((result) => {
if (result) { if (result && result.data.id) {
if (result.data.id) { this.setState({
this.setState({ isSpin: false
isSpin: false })
}) this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`);
this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`); this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`);
this.props.history.push(`/projects/${owners_name}/${result.data.identifier}`);
}
} }
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({

View File

@ -6,6 +6,20 @@ import "./index.css";
import axios from "axios"; import axios from "axios";
const TextArea = Input.TextArea; const TextArea = Input.TextArea;
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
function returnbar(str){
if(str && str.length>0 && str.indexOf("%2F")>-1){
return str.replaceAll('%2F','/');
}
return str;
}
class UserSubmitComponent extends Component { class UserSubmitComponent extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -59,7 +73,7 @@ class UserSubmitComponent extends Component {
const url = `/${owner}/${projectsId}/create_file.json`; const url = `/${owner}/${projectsId}/create_file.json`;
axios.post(url, { axios.post(url, {
filepath: filename ? filename : path, filepath: filename ? filename : path,
branch: branch && branch.replaceAll("%2F","/"), branch: returnbar(branch),
new_branch: submitType === "1" ? values.branchname : undefined, new_branch: submitType === "1" ? values.branchname : undefined,
content, content,
message: values.desc, message: values.desc,
@ -72,7 +86,7 @@ class UserSubmitComponent extends Component {
const { getTopCount } = this.props; const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname); getTopCount && getTopCount(values.branchname);
} }
let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}`: (branch ? `/tree/${branch.replaceAll('/',"%2F")}` : "")}`; let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;
this.props.history.push(url); this.props.history.push(url);
} }
}) })
@ -99,7 +113,7 @@ class UserSubmitComponent extends Component {
axios axios
.put(url, { .put(url, {
filepath: detail.path, filepath: detail.path,
branch: submitType === "1" ? undefined : b.replaceAll('%2F',"/"), branch: submitType === "1" ? undefined : returnbar(b),
new_branch: submitType === "1" ? values.branchname : undefined, new_branch: submitType === "1" ? values.branchname : undefined,
content: content, content: content,
sha: detail.sha, sha: detail.sha,
@ -109,7 +123,7 @@ class UserSubmitComponent extends Component {
this.setState({ isSpin: false }); this.setState({ isSpin: false });
if (result.data && result.data.status === 1) { if (result.data && result.data.status === 1) {
let b = currentBranch || branch; let b = currentBranch || branch;
let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}` : (b ? `/tree/${b.replaceAll('/',"%2F")}`:""))}`; let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${turnbar(values.branchname)}` : (b ? `/tree/${turnbar(b)}`:""))}`;
this.props.history.push(url); this.props.history.push(url);
this.props.showNotification("文件修改成功!"); this.props.showNotification("文件修改成功!");
} }
@ -191,7 +205,7 @@ class UserSubmitComponent extends Component {
> >
<Radio value="0" className="mb10"> <Radio value="0" className="mb10">
<i className="iconfont icon-banbenku font-16 mr5"></i> <i className="iconfont icon-banbenku font-16 mr5"></i>
直接提交至<span className="color-orange">{b.replaceAll('%2F',"/")}</span> 直接提交至<span className="color-orange">{returnbar(b)}</span>
</Radio> </Radio>
<Radio value="1"> <Radio value="1">
<Icon type="pull-request" className="mr5" /> <Icon type="pull-request" className="mr5" />