Merge pull request 'router修改' (#33) from tongChong/forgeplus-react:feature_router into feature_router

This commit is contained in:
baladiwei 2021-09-01 09:41:00 +08:00
commit 9655cd5105
151 changed files with 1341 additions and 1145 deletions

View File

@ -3,7 +3,7 @@ import './App.css';
import { ConfigProvider } from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN';
import {
BrowserRouter as Router,
// BrowserRouter as Router,
Route,
Switch
} from 'react-router-dom';
@ -100,6 +100,37 @@ class App extends Component {
mydisplay: false,
occupation: 0,
mygetHelmetapi: null,
pathType: null,
pathName:'',
}
}
UNSAFE_componentWillMount() {
initAxiosInterceptors(this.props);
let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
pathname && this.getPathnameType(pathname);
// 添加路由监听,决定组织还是个人
this.unlisten = this.props.history.listen((location) => {
let newPathname = location.pathname.split('/')[1];
if(this.state.pathName!==newPathname){
newPathname && this.getPathnameType(newPathname);
}
});
}
getPathnameType = (pathname) => {
let keyWord = ["Gitlink", "Trustie", "explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501"];
if (!keyWord.includes(pathname)) {
let url = `/owners/${pathname}.json`;
axios.get(url).then((response) => {
if (response && response.status === 200) {
this.setState({
pathType: response.data.type || '404',
pathName:pathname,
})
}
});
}
}
@ -119,13 +150,20 @@ class App extends Component {
componentDidMount() {
document.title = "loading...";
initAxiosInterceptors(this.props);
this.getAppdata();
window.addEventListener('error', (event) => {
const msg = `${event.type}: ${event.message}`;
});
}
componentWillUnmount() {
this.unlisten && this.unlisten(); // 执行解绑
}
//修改登录方法
Modifyloginvalue = () => {
this.setState({
@ -196,7 +234,7 @@ class App extends Component {
};
render() {
const { mygetHelmetapi } = this.state;
const { mygetHelmetapi, pathType } = this.state;
let personal = mygetHelmetapi && mygetHelmetapi.personal;
return (
<Provider store={store}>
@ -204,87 +242,131 @@ class App extends Component {
<MuiThemeProvider theme={theme}>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<SiderBar />
<Router>
<Switch>
{/* wiki预览 */}
<Route path="/projects/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
{/* <Router> */}
<Switch>
{/* wiki预览 */}
<Route path="/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
(props) => {
return (<WikiPreview {...this.props} {...props} {...this.state} />)
}
} />
{/*项目*/}
<Route
path={"/:owner/:projectId/devops/:opsId/detail"}
render={
(props) => {
return (<WikiPreview {...this.props} {...props} {...this.state} />)
return (<OpsDetail {...this.props} {...props} {...this.state} />)
}
} />
{/*项目*/}
<Route
path={"/projects/:owner/:projectId/devops/:opsId/detail"}
render={
(props) => {
return (<OpsDetail {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path={"/settings"}
render={
(props) => {
return (<Security {...this.props} {...props} {...this.state} />)
}
}>
</Route>
{/*项目*/}
<Route
path={"/projects"}
render={
(props) => {
return (<Projects {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path="/register"
render={
(props) => {
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route
path={"/settings"}
render={
(props) => {
return (<Security {...this.props} {...props} {...this.state} />)
}
/>
{/*403*/}
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
<Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route>
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 查询 */}
<Route path="/search" component={Search} />
{/* 个人主页 */}
<Route path="/users/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}></Route>
<Route exact path="/"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}>
</Route>
<Route
path="/register"
render={
(props) => {
return (<EducoderLogin {...this.props} {...props} {...this.state} />)
}
/>
<Route component={Shixunnopage} />
</Switch>
</Router>
}
/>
{/*403*/}
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500} />
{/*404*/}
<Route path="/nopage" component={Shixunnopage} />
{/* 查询 */}
<Route path="/search" component={Search} />
<Route exact path="/explore"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}
/>
{/* <Route
path={"/:owner/:projectsId"}
render={
(props) => {
return (<Projects {...this.props} {...props} {...this.state} />)
}
}>
</Route> */}
{/* 判断为用户/组织,并进入对应页面 */}
{
pathType === 'User' ?
<Route exact path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route> : pathType === '404' ? <Route path="/nopage" component={Shixunnopage} /> : <Route exact path="/"
render={
(props) => (
personal && personal.length > 0 ?
<InfosIndex {...this.props} {...props} />
:
<ProjectIndex {...this.props} {...props} />
)
}
/>
}
{/*项目*/}
<Route
path={"/projects"}
render={
(props) => {
return (<Projects {...this.props} {...props} {...this.state} />)
}
}>
</Route>
{/* 组织 */}
<Route path={"/organize"}
render={
(props) => {
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
}
}>
</Route>
{/* 个人主页 */}
<Route path="/:username"
render={
(props) => {
return (<InfosIndex {...this.props} {...this.state} />)
}
}></Route>
<Route component={Shixunnopage} />
</Switch>
{/* </Router> */}
</MuiThemeProvider>
</ConfigProvider>
</Provider>

View File

@ -11,9 +11,9 @@ broadcastChannelOnmessage('refreshPage', () => {
})
function locationurl(list) {
if (window.location.port !== "3007") {
// if (window.location.port !== "3007") {
window.location.href = list
}
// }
}
// TODO 开发期多个身份切换
let debugType = ""
@ -85,7 +85,10 @@ export function initAxiosInterceptors(props) {
}
if (response.data.status === 404) {
locationurl('/nopage');
let responseURL = response.data.request ? response.data.request.responseURL:'';
if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1) {
locationurl('/nopage');
}
}
if (response.data.status === 500) {

View File

@ -195,7 +195,7 @@ class College extends Component {
align: 'center',
className: "edu-txt-center font-14 maxnamewidth105",
render: (text, record) => (
<a href={`/users/${record.login}`} title={record.name} target="_blank" className="task-hide maxnamewidth105" style={{
<a href={`/${record.login}`} title={record.name} target="_blank" className="task-hide maxnamewidth105" style={{
color:'#007bff',
}}> {

View File

@ -107,7 +107,7 @@ export function timeAgo(backDate) {
try {
moment(backDate);
} catch (e) {
return;
return '刚刚';
}
if(typeof backDate ==='number'){
backDate=backDate*1000
@ -134,4 +134,5 @@ export function timeAgo(backDate) {
if (seconds) {
return seconds + "秒前";
}
return "刚刚";
}

View File

@ -435,11 +435,11 @@ class TPIContextProvider extends Component {
image_url: "avatars/User/1"
login: "innov"
name: "Coder"
user_url: "/users/innov"
user_url: "/innov"
*/
let user = resData.user;
user.username = resData.user.name;
user.user_url = `/users/${resData.user.login}`;
user.user_url = `/${resData.user.login}`;
// user.image_url = resData.image_url;
user.is_teacher = resData.is_teacher;
resData.user = user;

View File

@ -14,25 +14,25 @@ class ActivityItem extends Component {
{/* 如果是版本发布 */}
{item.trend_type === "VersionRelease" ?
<p className="itemLine">
<Link to={`/projects/${owner}/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<Link to={`/${owner}/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是任务
item.trend_type === "Issue" ?
<p className="itemLine">
<Link to={`/projects/${owner}/${projectsId}/issues/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<Link to={`/${owner}/${projectsId}/issues/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是合并请求
<p className="itemLine">
<Link to={`/projects/${owner}/${projectsId}/pulls/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<Link to={`/${owner}/${projectsId}/pulls/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
}
<p className="itemLine mt10">
<Link to={`/users/${item && item.user_login}`} className="show-user-link">
<Link to={`/${item && item.user_login}`} className="show-user-link">
<img alt="" src={getImageUrl(`/${item.user_avatar}`)} className="createImage" />
<span className="mr20">{item.user_name}</span>
</Link>

View File

@ -55,6 +55,7 @@ function AddGroup({organizeId,getGroupID}){
function addCollaborator(){
getGroupID && getGroupID(id);
setID(undefined);
}
return(

View File

@ -52,8 +52,8 @@ function Contributors({contributors,owner,projectsId}){
<Spin spinning={isSpin}>
<FlexAJ>
<AlignCenter>
<Link to={`/users/${data.login}`}><img src={getImageUrl(`/${data.image_url}`)} alt="" className="radius" width="38px" height="38px"/></Link>
<Link to={`/users/${data.login}`} className="ml10">{data.name}</Link>
<Link to={`/${data.login}`}><img src={getImageUrl(`/${data.image_url}`)} alt="" className="radius" width="38px" height="38px"/></Link>
<Link to={`/${data.login}`} className="ml10">{data.name}</Link>
</AlignCenter>
{
data.is_watch ? <a className="color-grey-9" onClick={()=>FocusFunc(false,data.login)}>取消关注</a>:<a className="color-blue" onClick={()=>FocusFunc(true,data.login)}>关注</a>
@ -137,7 +137,7 @@ function Contributors({contributors,owner,projectsId}){
<div className="halfs">
<FlexAJ>
<AlignCenter><span className="font-16 color-grey-6">贡献者</span>{ contributors && contributors.total_count > 0 && <span className="infoCount">{contributors.total_count}</span>}</AlignCenter>
<Link className="font-12 color-grey-9" to={`/projects/${owner}/${projectsId}/contribute`}>全部</Link>
<Link className="font-12 color-grey-9" to={`/${owner}/${projectsId}/contribute`}>全部</Link>
</FlexAJ>
<div className="attrPerson" onMouseLeave={()=>setVisibleFunc(false)}>
{
@ -145,7 +145,7 @@ function Contributors({contributors,owner,projectsId}){
list.map((item,key)=>{
return(
<Popover content={menu} visible={item.visible} overlayClassName="menuPanels" placement="top">
<Link key={key} to={`/users/${item.login}`}>
<Link key={key} to={`/${item.login}`}>
<img src={getImageUrl(`/${item.image_url}`)} alt="" onMouseOver={()=>setVisibleFunc(true,item.login,key)}/>
</Link>
</Popover>

View File

@ -0,0 +1,44 @@
import React, { useState, useCallback, memo } from 'react';
import { Tooltip } from 'antd';
CopyTool.defaultProps = {
beforeText: '复制', //
afterText: '复制成功', //
className: '', //svgclass
inputId: 'copyText', //ID
};
function CopyTool({ beforeText, afterText, className,inputId }) {
const [title, setTitle] = useState(() => {
return beforeText;
});
//
const copyUrl = useCallback(() => {
let inputDom = document.getElementById(inputId);
if (!inputDom) {
console.error("您的CopyTool未设置正确的inputId");
return;
}
inputDom.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
}
setTitle(afterText);
inputDom.blur();
}, []);
return (
<Tooltip
placement="top"
title={title}
onVisibleChange={() => { setTitle(beforeText) }}
>
<i className={`iconfont icon-fuzhiicon ${className}`} style={{ color: '#466aff' }} onClick={copyUrl}></i>
</Tooltip>
);
}
export default memo(CopyTool);

View File

@ -78,7 +78,7 @@ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , li
if(dataref.type==="file"){
onClose();
let value = turnbar(branch);
history.push(`/projects/${owner}/${projectsId}/tree/${value}/${dataref.path}`);
history.push(`/${owner}/${projectsId}/tree/${value}/${dataref.path}`);
}
}

View File

@ -45,9 +45,9 @@ const Div = styled.div`{
export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => {
return (
<Div>
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
<Link to={`/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
<div className="m-infos">
<Link to={`/users/${user && user.login}`}><Name>{name}</Name></Link>
<Link to={`/${user && user.login}`}><Name>{name}</Name></Link>
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>
{
is_current_user ?

View File

@ -11,9 +11,9 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
{ releaseVersions && releaseVersions.total_count > 0 && <span className="infoCount">{releaseVersions.total_count}</span>}
</AlignCenter>
{ (releaseVersions && releaseVersions.total_count > 0) || projectType ===2 ?
<Link className="font-12 color-grey-9" to={`/projects/${owner}/${projectsId}/releases`}>全部</Link>
<Link className="font-12 color-grey-9" to={`/${owner}/${projectsId}/releases`}>全部</Link>
:
baseOperate && <Link className="font-12 color-blue" to={`/projects/${owner}/${projectsId}/releases/new`}>新建</Link>
baseOperate && <Link className="font-12 color-blue" to={`/${owner}/${projectsId}/releases/new`}>新建</Link>
}
</FlexAJ>
{
@ -24,7 +24,7 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
<i className="iconfont icon-biaoqian3 color-grey-6 font-18 mr10"></i>
<div>
<p className="font-16 color-grey-6">
<Link to={`/projects/${owner}/${projectsId}/releases`}>{item.name}</Link>
<Link to={`/${owner}/${projectsId}/releases`}>{item.name}</Link>
<span className="font-12 laterest ml5">最新</span>
</p>
<p className="color-grey-9 font-13">{item.created_at}</p>

View File

@ -20,7 +20,7 @@ export default ({ url , name , column , id , login })=>{
`;
return(
id?
<Link to={`/users/${login}`}>
<Link to={`/${login}`}>
<Img>
{ url && <img src={url} alt=""/> }
<span>{name}</span>

View File

@ -149,7 +149,7 @@ function About(props, ref) {
axios.post(url).then(result=>{
setIsSpining(false);
if(result && result.data.status === 0){
props.history.push(`/projects/${owner}/${projectsId}/devops/dispose`);
props.history.push(`/${owner}/${projectsId}/devops/dispose`);
// open_devops
let { changeOpenDevops } = props;
changeOpenDevops && changeOpenDevops(true);

View File

@ -96,7 +96,7 @@ function Dispose(props){
setVisible(false);
if(result && result.data){
props.showNotification("流水线新增成功,请进行工作流配置!");
props.history.push(`/projects/${owner}/${projectsId}/devops/dispose/${result.data.id}`);
props.history.push(`/${owner}/${projectsId}/devops/dispose/${result.data.id}`);
}else{
props.showNotification("流水线新增失败,请稍后再试!");
}
@ -134,12 +134,12 @@ function Dispose(props){
//
function toModalManage(){
props.history.push(`/projects/${owner}/${projectsId}/devops/mould`);
props.history.push(`/${owner}/${projectsId}/devops/mould`);
}
//
function toparameter(){
props.history.push(`/projects/${owner}/${projectsId}/devops/params`);
props.history.push(`/${owner}/${projectsId}/devops/params`);
}
const operate = current_user && (permission && permission !== "Reporter");

View File

@ -73,7 +73,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
render:(value,item)=>{
let v = turnbar(item.branch);
return(
<Link to={`/projects/${owner}/${projectsId}/tree/${v}/${value}`} className="color-blue">{value}</Link>
<Link to={`/${owner}/${projectsId}/tree/${v}/${value}`} className="color-blue">{value}</Link>
)
}
},
@ -117,7 +117,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
return(
<span>
{ operate ?
<Link to={`/projects/${owner}/${projectsId}/devops/dispose/${item.id}`} className="mr10 color-grey-6">
<Link to={`/${owner}/${projectsId}/devops/dispose/${item.id}`} className="mr10 color-grey-6">
<i className="iconfont icon-zaibianji font-13 mr3"></i>编辑</Link> :""
}
{ operate ?
@ -125,7 +125,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
<a className="mr10 color-grey-6"><i className="iconfont icon-lajitong font-13 mr3"></i>删除</a>
</Popconfirm>:""
}
<Link to={`/projects/${owner}/${projectsId}/devops/list/${item.branch}`} className="color-grey-6"><i className="iconfont icon-yunhang font-13 mr3"></i>查看运行记录</Link>
<Link to={`/${owner}/${projectsId}/devops/list/${item.branch}`} className="color-grey-6"><i className="iconfont icon-yunhang font-13 mr3"></i>查看运行记录</Link>
</span>
)
}

View File

@ -36,37 +36,37 @@ export default ((props)=>{
return(
<WhiteBack className="opsPanel">
<Switch {...props}>
<Route path="/projects/:owner/:projectsId/devops/dispose/:disposeId"
<Route path="/:owner/:projectsId/devops/dispose/:disposeId"
render={
(p) => (<New {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/params"
<Route path="/:owner/:projectsId/devops/params"
render={
(p) => (<Params {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/mould"
<Route path="/:owner/:projectsId/devops/mould"
render={
(p) => (<Mould {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/dispose/new"
<Route path="/:owner/:projectsId/devops/dispose/new"
render={
(p) => (<New {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/dispose"
<Route path="/:owner/:projectsId/devops/dispose"
render={
(p) => (<Dispose {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/list/:branch"
<Route path="/:owner/:projectsId/devops/list/:branch"
render={
(p) => (<Stucture {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops"
<Route path="/:owner/:projectsId/devops"
render={
(p) => (<About {...props} {...p}/>)
}

View File

@ -26,7 +26,7 @@ export default ((props)=>{
return(
<div className="disposePanel">
<Banner>
{ permission !=="Reporter" && <Link to={`/projects/${owner}/${props.match.params.projectsId}/devops/dispose`}>工作流配置</Link>}
{ permission !=="Reporter" && <Link to={`/${owner}/${props.match.params.projectsId}/devops/dispose`}>工作流配置</Link>}
</Banner>
<Div>
<Dispost {...props}/>

View File

@ -104,7 +104,7 @@ function Params(props){
<Banner>
<FlexAJ>
<span className="font-18">工作流 - 参数管理</span>
<Link to={`/projects/${owner}/${projectsId}/devops/dispose`} className="font-14 color-grey-9 ml20">返回</Link>
<Link to={`/${owner}/${projectsId}/devops/dispose`} className="font-14 color-grey-9 ml20">返回</Link>
</FlexAJ>
</Banner>
<Div className="disposeList">

View File

@ -126,7 +126,7 @@ function Mould(props){
<div>
<New wrappedComponentRef={(f) => childRef.current = f} ref={childRef} visible={visible} onCancel={()=>setVisible(false)} onOk={onOk}></New>
<Banner>
<FlexAJ><span>工作流 - 模板管理</span><Link to={`/projects/${owner}/${projectsId}/devops/dispose`} className="font-14 color-grey-9">返回</Link></FlexAJ>
<FlexAJ><span>工作流 - 模板管理</span><Link to={`/${owner}/${projectsId}/devops/dispose`} className="font-14 color-grey-9">返回</Link></FlexAJ>
</Banner>
<Div className="disposeList">
<FlexAJ>

View File

@ -198,7 +198,7 @@ function Structure(props,ref){
}
function clickRows(event,e){
props.history.push(`/projects/${owner}/${projectsId}/devops/${e.number}/detail`);
props.history.push(`/${owner}/${projectsId}/devops/${e.number}/detail`);
}
const column = [
{
@ -290,7 +290,7 @@ function Structure(props,ref){
<Banner>
<FlexAJ>
<span>构建列表</span>
<Link to={`/projects/${owner}/${projectsId}/devops/dispose`} className="font-15 color-grey-9">返回</Link>
<Link to={`/${owner}/${projectsId}/devops/dispose`} className="font-15 color-grey-9">返回</Link>
</FlexAJ>
</Banner>
<Div>

View File

@ -275,7 +275,7 @@ function disposePipeline(props){
...params
}).then(result=>{
if(result){
props.history.push(`/projects/${owner}/${projectsId}/devops/dispose`);
props.history.push(`/${owner}/${projectsId}/devops/dispose`);
}
setLoading(false);
}).catch(error=>{

View File

@ -48,7 +48,7 @@ export default (props) => {
axios.post(url).then((result) => {
if (result && result.data) {
props.showNotification("工作流正在重新构建!");
props.history.push(`/projects/${owner}/${projectId}/devops/${result.data.number}/detail`);
props.history.push(`/${owner}/${projectId}/devops/${result.data.number}/detail`);
}
})
.catch((error) => {
@ -87,7 +87,7 @@ export default (props) => {
</AlignCenter>
<Link
style={{ color: "#ddd" }}
to={`/projects/${owner}/${projectId}/devops/dispose`}
to={`/${owner}/${projectId}/devops/dispose`}
>
<i className="iconfont icon-yiguanbi font-15 mr5"></i>退出
</Link>

View File

@ -104,7 +104,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
</ul>
:
<ul className="descUl">
<li>仓库仅可以转移到您已经加入的组织中不可以转移到未加入的组织中</li>
<li>仓库仅可以转移到您具有管理权限的组织中</li>
<li>涉及到仓库改名操作请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
<li>转移仓库到组织后你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
</ul>

View File

@ -385,16 +385,16 @@ class NewHeader extends Component {
if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) {
if (user_login) {
if (new_link.indexOf("courses") > -1) {
new_link = new_link.replace(/courses/g, "users/" + user_login + "/courses")
new_link = new_link.replace(/courses/g, user_login + "/courses")
} else if (new_link.indexOf("contests") > -1) {
new_link = new_link.replace(/contests/g, "users/" + user_login + "/contests")
new_link = new_link.replace(/contests/g, user_login + "/contests")
}
} else {
is_hidden = true
}
}
if (user_login && (new_link && new_link.indexOf("homes") > -1)) {
new_link = new_link.replace(/homes/g, "users/" + user_login + "/user_activities")
new_link = new_link.replace(/homes/g, user_login + "/user_activities")
}
var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) );
@ -442,7 +442,7 @@ class NewHeader extends Component {
</span>
:
<Dropdown placement={`bottomRight`} overlay={this.renderMenu(settings && settings.personal)}>
<a href={`/users/${this.props.current_user && this.props.current_user.login}`}>
<a href={`/${this.props.current_user && this.props.current_user.login}`}>
<img alt="头像" src={getImageUrl(`/${user.image_url}`)} className="currentImg"></img>
</a>
</Dropdown>

View File

@ -40,13 +40,13 @@ class Index extends Component {
<div className="newMain clearfix">
<Switch {...this.props}>
<Route
path="/projects/:projectsType/new/:OIdentifier"
path="/:projectsType/new/:OIdentifier"
render={(props) => (
<ProjectNew {...this.props} {...props} />
)}
></Route>
<Route
path="/projects/:projectsType/new"
path="/:projectsType/new"
render={(props) => (
<ProjectNew {...this.props} {...props} />
)}
@ -58,17 +58,17 @@ class Index extends Component {
)}
></Route>
<Route
path="/projects/:owner/:projectsId"
path="/:owner/:projectsId"
render={(props) => (
<ProjectDetail {...this.props} {...props} />
)}
></Route>
<Route
{/* <Route
path="/projects"
render={(props) => (
<ProjectIndex {...this.props} {...props} />
)}
></Route>
></Route> */}
<Route
path="/"
render={(props) => (
@ -80,9 +80,16 @@ class Index extends Component {
);
}
}
// export default withRouter(
// ImageLayerOfCommentHOC({
// imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
// parentSelector: ".newMain",
// })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
// );
export default withRouter(
ImageLayerOfCommentHOC({
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
parentSelector: ".newMain",
})(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
})(Index)
);

View File

@ -112,7 +112,7 @@ function CoderDepot(props){
useEffect(()=>{
if (projectsId && owner && defaultBranch){
let b = turnbar(branchName) ;
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) {
if(pathname.indexOf(`/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) {
let url = pathname.split(`/tree/${b}/`)[1];
setTreeValue(url);
getFileInfo(url,branchName);
@ -147,6 +147,7 @@ function CoderDepot(props){
setReadme(result.data.readme);
setEditReadme(false);
setHide(true);
console.log("dddd:",result.data.entries);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@ -198,7 +199,7 @@ function CoderDepot(props){
//
function changeBranch(value){
let checkvalue = turnbar(value);
let url = `/projects/${owner}/${projectsId}${value && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`;
let url = `/${owner}/${projectsId}${value && `/tree/${checkvalue}`}${treeValue ? `/${treeValue}`:""}`;
props.history.push(url);
}
@ -208,8 +209,8 @@ function CoderDepot(props){
let checkvalue = turnbar(b);
return (
<Menu>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${checkvalue}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/${checkvalue}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/${owner}/${projectsId}/${checkvalue}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件</a></Menu.Item>
<Menu.Item><a onClick={()=>urlLink(`/${owner}/${projectsId}/${checkvalue}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件</a></Menu.Item>
</Menu>
)
}
@ -228,12 +229,12 @@ function CoderDepot(props){
setTreeValue(undefined);
let branch = branchName || defaultBranch;
let checkvalue = turnbar(branch);
props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}`);
props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}`);
};
//
function returnUlr(url){
let enBranch = turnbar(branchName);
props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`);
props.history.push(`/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`);
}
//
function goToSubRoot(path,type,filename){
@ -241,7 +242,7 @@ function CoderDepot(props){
let enBranch = branchName || defaultBranch;
let checkvalue = turnbar(enBranch);
setType(type);
props.history.push(`/projects/${owner}/${projectsId}${`/tree/${checkvalue}`}${path?`/${path}`:""}`);
props.history.push(`/${owner}/${projectsId}${`/tree/${checkvalue}`}${path?`/${path}`:""}`);
}
}
@ -253,7 +254,7 @@ function CoderDepot(props){
//
let enBranch = branchName || defaultBranch;
let checkvalue = turnbar(enBranch);
props.history.push(`/projects/${owner}/${projectsId}/tree/${checkvalue}/${path}`);
props.history.push(`/${owner}/${projectsId}/tree/${checkvalue}/${path}`);
setType("file");
setEditReadme(true);
};
@ -345,13 +346,13 @@ function CoderDepot(props){
}
</div>
<AlignCenter className="mr20">
<Link to={`/projects/${owner}/${projectsId}/branchs`} className="color-grey-9">
<Link to={`/${owner}/${projectsId}/branchs`} className="color-grey-9">
<i className="iconfont icon-fenzhi2 font-18 color-grey-9 mr3"></i>
<span className="color-grey-6 mr3">{projectDetail && projectDetail.branches && projectDetail.branches.total_count}</span>分支
</Link>
</AlignCenter>
<AlignCenter className="mr20">
<Link to={`/projects/${owner}/${projectsId}/tag`} className="color-grey-9">
<Link to={`/${owner}/${projectsId}/tag`} className="color-grey-9">
<i className="iconfont icon-biaoqian3 font-16 color-grey-9 mr3"></i>
<span className="color-grey-6 mr3">{projectDetail && projectDetail.tags && projectDetail.tags.total_count}</span>标签
</Link>
@ -363,11 +364,11 @@ function CoderDepot(props){
<div className="mr20 addOptionBtn">
{
projectDetail.type !== 2 && pullsFlag &&
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
<a onClick={()=>urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
}
{
issuesFlag &&
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
<a onClick={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
}
</div>
}
@ -383,7 +384,7 @@ function CoderDepot(props){
</AlignCenter>
</FlexAJ>
{
dirInfo || fileInfo ?
(dirInfo && dirInfo.length>0) || fileInfo ?
<div className="listtable">
{
lastCommit &&
@ -395,7 +396,7 @@ function CoderDepot(props){
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
<span className="ml12 color-grey-9 mt3">{lastCommit && lastCommit.time_from_now}</span>
{ commitCount ? <Link to={`/projects/${owner}/${projectsId}/commits/branch/${turnbar(branchName || defaultBranch)}`} className="ml12 color-grey-9">
{ commitCount ? <Link to={`/${owner}/${projectsId}/commits/branch/${turnbar(branchName || defaultBranch)}`} className="ml12 color-grey-9">
<i className="iconfont icon-tijiao mr3 font-17 color-grey-9"></i>{commitCount}次提交
</Link>:"" }
</div>
@ -441,7 +442,7 @@ function CoderDepot(props){
: ""
}
{
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
(dirInfo && dirInfo.length === 0) && !fileInfo ? <Nodata _html="暂未发现文件"/> :""
}
{/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
@ -511,11 +512,11 @@ function CoderDepot(props){
}
{/* 贡献者 */}
{
projectDetail && projectDetail.contributors &&
projectDetail && projectDetail.contributors && projectDetail.contributors.length >0 &&
<Contributors contributors={projectDetail && projectDetail.contributors} owner={owner} projectsId={projectsId} />
}
{/* 语言 */}
{ projectDetail && projectDetail.languages &&
{ projectDetail && projectDetail.languages && projectDetail.languages.length >0 &&
<React.Fragment>
<Divider />
<LanguagePower languages={projectDetail.languages}/>

View File

@ -17,7 +17,7 @@ function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId }){
</a>
</span>
<span title="init project">
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.commit && item.commit.sha}`)}`} title={item.commit && item.commit.message}>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.commit && item.commit.sha}`)}`} title={item.commit && item.commit.message}>
{item.commit && item.commit.message}
</Link>
</span>

View File

@ -38,9 +38,9 @@ export default ((props)=>{
return(
<li key={key}>
<div>
<Link to={`/projects/${owner}/${projectsId}/tree/${turnbar(item.name)}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<Link to={`/${owner}/${projectsId}/tree/${turnbar(item.name)}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<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={`/${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-8 ml30">最后更新于{item.last_commit && item.last_commit.time_from_now}</span>
</p>
@ -48,7 +48,7 @@ export default ((props)=>{
<span>
{
(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) &&
<Link to={`/projects/${owner}/${projectsId}/pulls/new/${item.name}`} className="mr20 color-blue mr30">创建合并请求</Link>
<Link to={`/${owner}/${projectsId}/pulls/new/${item.name}`} className="mr20 color-blue mr30">创建合并请求</Link>
}
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="color-green-file">
<a className="ant-dropdown-link">

View File

@ -101,7 +101,7 @@ class CoderRootCommit extends Component{
// 切换分支 search:tag为根据标签搜索
changeBranch=(value)=>{
const { projectsId , owner } = this.props.match.params;
this.props.history.push(`/projects/${owner}/${projectsId}/commits/branch/${value}`);
this.props.history.push(`/${owner}/${projectsId}/commits/branch/${value}`);
}
ChangePage=(page)=>{
@ -141,13 +141,13 @@ class CoderRootCommit extends Component{
return(
<div key={k}>
<AlignTop>
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0,marginTop:"3px"}}>{truncateCommitId(`${item.sha}`)}</Link>
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitDesc">{item.message}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0,marginTop:"3px"}}>{truncateCommitId(`${item.sha}`)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitDesc">{item.message}</Link>
</AlignTop>
<p className="f-wrap-alignCenter mt15">
{
item.id ?
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</Link>:

View File

@ -149,7 +149,7 @@ class CoderRootFileDetail extends Component {
.then((result) => {
if (result) {
this.props.showNotification("删除成功!");
this.props.history.push(`/projects/${owner}/${projectsId}`);
this.props.history.push(`/${owner}/${projectsId}`);
}
})
.catch((error) => {

View File

@ -87,57 +87,57 @@ class CoderRootIndex extends Component{
<Top {...this.props} {...this.state}/>
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/projects/:owner/:projectsId/:branch/newfile/:path"
<Route path="/:owner/:projectsId/:branch/newfile/:path"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/:branch/uploadfile"
<Route path="/:owner/:projectsId/:branch/uploadfile"
render={
(props) => (<UploadFile {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/:branch/newfile"
<Route path="/:owner/:projectsId/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/commits/branch/:branchName"
<Route path="/:owner/:projectsId/commits/branch/:branchName"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/commits/:sha"
<Route path="/:owner/:projectsId/commits/:sha"
render={
(props) => (<Diff {...this.props} {...props} {...this.state}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/commits"
<Route path="/:owner/:projectsId/commits"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/releases/:versionId/update"
<Route path="/:owner/:projectsId/releases/:versionId/update"
render={
(props) => (<CoderRootVersionUpdate {...this.props} {...this.state} {...props} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/releases/new"
<Route path="/:owner/:projectsId/releases/new"
render={
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/releases"
<Route path="/:owner/:projectsId/releases"
render={
() => (<CoderRootVersion {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/tag"
<Route path="/:owner/:projectsId/tag"
render={
() => (<CoderRootTag {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/branchs"
<Route path="/:owner/:projectsId/branchs"
render={
() => (<CoderRootBranch {...this.props} {...this.state} />)
}

View File

@ -49,7 +49,7 @@ export default (( props, { projectDetail }) => {
<span className="font-16">{item.name}</span>
</span>
<span className="ul_tbody_third">
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`} className="commitKey" style={{ "marginLeft": 0 }}>{truncateCommitId(`${item.id}`)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`} className="commitKey" style={{ "marginLeft": 0 }}>{truncateCommitId(`${item.id}`)}</Link>
</span>
<span className="ul_tbody_forth">
<a href={item.tarball_url} style={{ color: "#4CC1DA" }} className="mr30"><i className="iconfont icon-TAR font-18 mr5"></i>TAR</a>

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Spin, Tooltip , Button } from 'antd';
import { Spin, Tooltip, Button } from 'antd';
import { Link, Route, Switch } from 'react-router-dom';
import { Content , AlignTop } from '../Component/layout';
import { Content, AlignTop } from '../Component/layout';
import DetailBanner from './sub/DetailBanner';
import '../css/index.scss'
import './list.css';
@ -103,12 +103,12 @@ const Contribute = Loadable({
})
const CoderRootCommit = Loadable({
loader: () => import('./CoderRootCommit'),
loading: Loading,
loader: () => import('./CoderRootCommit'),
loading: Loading,
})
const CoderDepot = Loadable({
loader: () => import('./CoderDepot'),
loading: Loading,
loader: () => import('./CoderDepot'),
loading: Loading,
})
const TrendsIndex = Loadable({
@ -139,28 +139,28 @@ const WikiEdit = Loadable({
/**
* permissionManager:管理员Reporter报告人员(只有读取权限)Developer开发人员除不能设置仓库信息外
*/
function checkPathname(projectsId,owner,pathname){
function checkPathname(projectsId, owner, pathname) {
let name = "";
if(pathname && pathname !== `/projects/${owner}/${projectsId}`){
let url = pathname.split(`/projects/${owner}/${projectsId}`)[1];
if(url.indexOf("/about")>-1){
name="about"
}else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){
if (pathname && pathname !== `/${owner}/${projectsId}`) {
let url = pathname.split(`/${owner}/${projectsId}`)[1];
if (url.indexOf("/about") > -1) {
name = "about"
} else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) {
name = "issues";
}else if(url.indexOf("/pulls")>-1){
name="pulls"
}else if(url.indexOf("/milestones")>-1){
name="milestones"
}else if(url.indexOf("/activity")>-1){
name="activity"
}else if(url.indexOf("/setting")>-1){
name="setting"
}else if(url.indexOf(`/devops`)>-1){
name="devops"
}else if(url.indexOf(`/source`)>-1){
name="source"
}else if(url.indexOf(`/wiki`)>-1){
name="wiki"
} else if (url.indexOf("/pulls") > -1) {
name = "pulls"
} else if (url.indexOf("/milestones") > -1) {
name = "milestones"
} else if (url.indexOf("/activity") > -1) {
name = "activity"
} else if (url.indexOf("/setting") > -1) {
name = "setting"
} else if (url.indexOf(`/devops`) > -1) {
name = "devops"
} else if (url.indexOf(`/source`) > -1) {
name = "source"
} else if (url.indexOf(`/wiki`) > -1) {
name = "wiki"
}
}
return name;
@ -183,15 +183,15 @@ class Detail extends Component {
branchs: undefined,
branchList: undefined,
project: null,
firstSync:false,
secondSync:false,
open_devops:false,
forkSpin:false,
firstSync: false,
secondSync: false,
open_devops: false,
forkSpin: false,
// 默认分支
defaultBranch:undefined,
defaultBranch: undefined,
// 非本平台项目
platform:false
platform: false
}
}
@ -208,36 +208,38 @@ class Detail extends Component {
}
getProject = (num) => {
const { projectsId , owner } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/simple.json`;
axios.get(url).then((result) => {
if (result && result.data) {
this.setState({
project: result.data,
open_devops:result.data.open_devops,
platform:result.data.platform && result.data.platform !== 'educoder'
open_devops: result.data.open_devops,
platform: result.data.platform && result.data.platform !== 'educoder'
})
if (result.data.type !== 0 && result.data.mirror_status === 1) {
console.log("--------start channel --------");
// 是镜像项目,且未完成迁移
this.canvasChannel();
if(num){
if (num) {
this.setState({
secondSync:true,
firstSync:false
secondSync: true,
firstSync: false
})
}else{
} else {
this.setState({
firstSync:true,
secondSync:false
firstSync: true,
secondSync: false
})
}
}else{
} else if (result.data.mirror_status === 2) {
this.deleteProjectBack();
} else {
this.getDetail();
this.setState({
firstSync:false,
secondSync:false
firstSync: false,
secondSync: false
})
}
}
@ -245,9 +247,9 @@ class Detail extends Component {
}
// 工作流激活后修改状态
changeOpenDevops=(flag)=>{
changeOpenDevops = (flag) => {
this.setState({
open_devops:flag
open_devops: flag
})
}
canvasChannel = () => {
@ -265,11 +267,15 @@ class Detail extends Component {
disconnected: () => { },
received: data => {
console.log(`###### ---received data--- ######`);
console.log(data);
if (data) {
if ( data.project && data.project.mirror_status === 2) {
this.deleteProjectBack();
}
this.getDetail();
this.setState({
firstSync:false,
secondSync:false
firstSync: false,
secondSync: false
});
cable.subscriptions.consumer.disconnect();
}
@ -277,8 +283,25 @@ class Detail extends Component {
})
}
deleteProjectBack = () => {
const { history } = this.props;
const { projectsId, owner } = this.props.match.params;
axios.delete(`/${owner}/${projectsId}.json`).then(res => {
let hash = '/projects/mirror/new';
if (res && res.data) {
history.push({
pathname: hash,
mirror_status: 2
});
}
else {
window.location.hash = hash;
}
});
}
getDetail = () => {
const { projectsId , owner } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
this.getBanner();
const url = `/${owner}/${projectsId}/detail.json`;
axios.get(url).then((result) => {
@ -295,29 +318,29 @@ class Detail extends Component {
watchers_count: result.data.watchers_count,
praises_count: result.data.praises_count,
forked_count: result.data.forked_count,
defaultBranch:result.data.default_branch
defaultBranch: result.data.default_branch
})
}
}).catch((error) => { })
}
// 获取动态导航栏菜单
getBanner(){
const { projectsId , owner } = this.props.match.params;
getBanner() {
const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/menu_list.json`;
axios.get(url).then(result=>{
if(result){
axios.get(url).then(result => {
if (result) {
this.setState({
bannerList:result.data
bannerList: result.data
})
}
}).catch(error=>{})
}).catch(error => { })
}
// 关注和取消关注
focusFunc = (flag) => {
const { platform } = this.state;
if(!platform)return;
if (!platform) return;
const { project_id } = this.state;
axios({
@ -332,15 +355,15 @@ class Detail extends Component {
this.setWatchersCount(result.data.watchers_count, result.data.watched);
}
})
.catch(error => {
console.log(error);
});
.catch(error => {
console.log(error);
});
}
// 点赞和取消点赞
pariseFunc = (flag) => {
const { platform } = this.state;
if(!platform)return;
if (!platform) return;
const { project_id } = this.state;
axios({
method: flag ? 'delete' : 'post',
@ -350,9 +373,9 @@ class Detail extends Component {
this.setPraisesCount(result.data.praises_count, result.data.praised)
}
})
.catch(error => {
console.log(error);
});
.catch(error => {
console.log(error);
});
}
setWatchersCount = (count, is_watched) => {
@ -372,24 +395,24 @@ class Detail extends Component {
// fork项目
forkFunc = () => {
const { platform } = this.state;
if(!platform)return;
if (!platform) return;
this.setState({
forkSpin:true
forkSpin: true
})
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`;
axios.post(url).then(result => {
if (result && result.data.status === 0) {
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`);
this.props.history.push(`/${current_user && current_user.login}/${result.data.identifier}`);
this.props.showNotification(result.data.message);
}
this.setState({
forkSpin:false
forkSpin: false
})
}).catch(error => {
this.setState({
forkSpin:false
forkSpin: false
})
})
}
@ -397,8 +420,8 @@ class Detail extends Component {
// 同步镜像
synchronismMirror = () => {
const { platform } = this.state;
if(!platform)return;
const { projectsId , owner } = this.props.match.params;
if (!platform) return;
const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/sync_mirror.json`;
axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) {
@ -412,344 +435,344 @@ class Detail extends Component {
})
}
textFunc = (forked_from_project_id,fork_info)=>{
textFunc = (forked_from_project_id, fork_info) => {
let type = fork_info && fork_info.fork_project_user_type;
return forked_from_project_id && fork_info ?
<div className="color-grey-9 df">
<span>复刻自</span>
<Link to={`${type ==="Organization" ? "/organize":'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
<Link to={`/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
<span> / </span>
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{maxWidth:"400px"}} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
<Link to={`/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{ maxWidth: "400px" }} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
</div> : ""
}
render() {
const { projectDetail, watchers_count, praises_count,
forked_count, firstSync , secondSync ,
isManager, watched, praised,
project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state;
const { projectDetail, watchers_count, praises_count,
forked_count, firstSync, secondSync,
isManager, watched, praised,
project, open_devops, platform, defaultBranch, bannerList, forkSpin } = this.state;
const url = this.props.history.location.pathname;
const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3);
const { projectsId , owner } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
const { current_user } = this.props;
let pathname = checkPathname(projectsId,owner,url);
let pathname = checkPathname(projectsId, owner, url);
const { state } = this.props.history.location;
const common = {
getDetail: this.getDetail,
changeOpenDevops:this.changeOpenDevops,
changeOpenDevops: this.changeOpenDevops,
defaultBranch
}
return (
<div>
<div className="detailHeader-wrapper">
<div className="normal">
<AlignTop style={{padding:"20px 0px 10px",justifyContent:"space-between"}}>
<AlignTop style={{ padding: "20px 0px 10px", justifyContent: "space-between" }}>
<div>
<AlignTop>
<div className="projectallName">
{project && project.author &&
<Link to={`${project.author.type ==="Organization" ? "/organize":'/users'}/${project.author.login}`}>{project.author.name}</Link>
<Link to={`/${project.author.login}`}>{project.author.name}</Link>
}
<span className="ml5 mr5">/</span>
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
<Link to={`/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
</div>
{ projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
{projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
</AlignTop>
<div className="mt8">
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
this.textFunc(projectDetail.forked_from_project_id,projectDetail.fork_info)
:""
this.textFunc(projectDetail.forked_from_project_id, projectDetail.fork_info)
: ""
}
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
:""
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
: ""
}
</div>
</div>
<div>
{
firstSync ? "":
<span className="df">
{
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
}
<Button className="detail_tag_btn">
<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>
<span>{watched ? '取消关注' : '关注'}</span>
</a>
firstSync ? "" :
<span className="df">
{
watchers_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{color:`${watched?"#2878FF":"#666"}`}} to={platform?{ pathname: `/projects/${owner}/${projectsId}/watchers`, state }:""}>
{watchers_count}
</Link>
:
<span className="detail_tag_btn_count">{watchers_count}</span>
:""
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
}
</Button>
<Button className="detail_tag_btn">
<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>
<span>{praised ? '取消点赞' : '点赞'}</span>
</a>
{
praises_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{color:`${praised?"#2878FF":"#666"}`}} to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
{praises_count}
</Link>:
<span className="detail_tag_btn_count">{praises_count}</span>
:""
}
</Button>
<Button className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3"></i>
<Button className="detail_tag_btn">
<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>
<span>{watched ? '取消关注' : '关注'}</span>
</a>
</Tooltip>
{
forked_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}>
{forked_count}
</Link>
:
<span className="detail_tag_btn_count">{forked_count}</span>
:""
}
</Button>
</span>
{
watchers_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{ color: `${watched ? "#2878FF" : "#666"}` }} to={platform ? { pathname: `/${owner}/${projectsId}/watchers`, state } : ""}>
{watchers_count}
</Link>
:
<span className="detail_tag_btn_count">{watchers_count}</span>
: ""
}
</Button>
<Button className="detail_tag_btn">
<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>
<span>{praised ? '取消点赞' : '点赞'}</span>
</a>
{
praises_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" style={{ color: `${praised ? "#2878FF" : "#666"}` }} to={{ pathname: `/${owner}/${projectsId}/stargazers`, state }}>
{praises_count}
</Link> :
<span className="detail_tag_btn_count">{praises_count}</span>
: ""
}
</Button>
<Button className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3"></i>
</a>
</Tooltip>
{
forked_count > 0 ?
platform ?
<Link className="detail_tag_btn_count" to={{ pathname: `/${owner}/${projectsId}/fork_users`, state }}>
{forked_count}
</Link>
:
<span className="detail_tag_btn_count">{forked_count}</span>
: ""
}
</Button>
</span>
}
</div>
</AlignTop>
{
firstSync ? "" :
<DetailBanner
history={this.props.history}
list={bannerList}
owner={owner}
projectsId={projectsId}
pathname={pathname}
state={state}
projectDetail={projectDetail}
open_devops={open_devops}
platform={platform}
urlFlag={urlFlag}
isManager={isManager}
/>
<DetailBanner
history={this.props.history}
list={bannerList}
owner={owner}
projectsId={projectsId}
pathname={pathname}
state={state}
projectDetail={projectDetail}
open_devops={open_devops}
platform={platform}
urlFlag={urlFlag}
isManager={isManager}
/>
}
</div>
</div>
{
firstSync ?
<Content className="spincontent">
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
</Content>
:
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
<Switch {...this.props}>
{/* 资源 */}
<Route path="/projects/:owner/:projectsId/source"
render={
() => (<Source {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 主页 */}
<Route path="/projects/:owner/:projectsId/about"
render={
() => (<DevAbout {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki新增文件 */}
<Route path="/projects/:owner/:projectsId/wiki/add"
render={
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki编辑文件 */}
<Route path="/projects/:owner/:projectsId/wiki/edit/:wikiName"
render={
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki */}
<Route path="/projects/:owner/:projectsId/wiki"
render={
() => (<Wiki {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 工作流 */}
<Route path="/projects/:owner/:projectsId/devops"
render={
() => (<DevIndex {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 标签列表 */}
<Route path="/projects/:owner/:projectsId/issues/tags"
render={
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 仓库设置 */}
<Route path="/projects/:owner/:projectsId/setting"
render={
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 任务详情 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/detail"
render={
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
}
></Route>
{/*修改里程碑*/}
<Route path="/projects/:owner/:projectsId/milestones/:meilid/edit"
render={
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建里程碑 */}
<Route path="/projects/:owner/:projectsId/milestones/new"
render={
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/*里程碑详情*/}
<Route path="/projects/:owner/:projectsId/milestones/:meilid"
render={
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 里程碑 */}
<Route path="/projects/:owner/:projectsId/milestones"
render={
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 里程碑页面新建任务 */}
<Route path="/projects/:owner/:projectsId/issues/:milepostId/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建任务 */}
<Route path="/projects/:owner/:projectsId/issues/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 修改详情 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail"
render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 复制详情 */}
<Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail"
render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 动态 */}
<Route path="/projects/:owner/:projectsId/activity"
render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 代码Index */}
<Route path="/projects/:owner/:projectsId/issues"
render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建合并请求 */}
<Route path="/projects/:owner/:projectsId/pulls/new/:branch"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Content className="spincontent">
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
</Content>
:
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
<Switch {...this.props}>
{/* 资源 */}
<Route path="/:owner/:projectsId/source"
render={
() => (<Source {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 主页 */}
<Route path="/:owner/:projectsId/about"
render={
() => (<DevAbout {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki新增文件 */}
<Route path="/:owner/:projectsId/wiki/add"
render={
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki编辑文件 */}
<Route path="/:owner/:projectsId/wiki/edit/:wikiName"
render={
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
}
></Route>
{/* wiki */}
<Route path="/:owner/:projectsId/wiki"
render={
() => (<Wiki {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 工作流 */}
<Route path="/:owner/:projectsId/devops"
render={
() => (<DevIndex {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 标签列表 */}
<Route path="/:owner/:projectsId/issues/tags"
render={
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 仓库设置 */}
<Route path="/:owner/:projectsId/setting"
render={
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 任务详情 */}
<Route path="/:owner/:projectsId/issues/:orderId/detail"
render={
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
}
></Route>
{/*修改里程碑*/}
<Route path="/:owner/:projectsId/milestones/:meilid/edit"
render={
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建里程碑 */}
<Route path="/:owner/:projectsId/milestones/new"
render={
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/*里程碑详情*/}
<Route path="/:owner/:projectsId/milestones/:meilid"
render={
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 里程碑 */}
<Route path="/:owner/:projectsId/milestones"
render={
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 里程碑页面新建任务 */}
<Route path="/:owner/:projectsId/issues/:milepostId/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建任务 */}
<Route path="/:owner/:projectsId/issues/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 修改详情 */}
<Route path="/:owner/:projectsId/issues/:orderId/updatedetail"
render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 复制详情 */}
<Route path="/:owner/:projectsId/issues/:orderId/copyetail"
render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 动态 */}
<Route path="/:owner/:projectsId/activity"
render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 代码Index */}
<Route path="/:owner/:projectsId/issues"
render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建合并请求 */}
<Route path="/:owner/:projectsId/pulls/new/:branch"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/Messagecount"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls"
render={
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/watchers"
render={
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/stargazers"
render={
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/fork_users"
render={
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 贡献者列表 */}
<Route path="/projects/:owner/:projectsId/contribute"
render={
() => (<Contribute {...this.props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls"
render={
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/watchers"
render={
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/stargazers"
render={
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/fork_users"
render={
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 贡献者列表 */}
<Route path="/:owner/:projectsId/contribute"
render={
() => (<Contribute {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 代码库----详情页面 */}
<Route path="/projects/:owner/:projectsId/commits/branch/:branchName"
render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/tree/:branchName"
render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/:subIndex"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId"
render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
</Switch>
</Spin>
{/* 代码库----详情页面 */}
<Route path="/:owner/:projectsId/commits/branch/:branchName"
render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/tree/:branchName"
render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/:subIndex"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId"
render={
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
</Switch>
</Spin>
}
</div>
)

View File

@ -12,19 +12,19 @@ class DetailTop extends Component {
{
platform ?
<React.Fragment>
<Link to={`/projects/${owner}/${projectsId}/commits`} className={pathname.indexOf("/commits") > 0 ? "active" : ""}>
<Link to={`/${owner}/${projectsId}/commits`} className={pathname.indexOf("/commits") > 0 ? "active" : ""}>
<i className="iconfont icon-tijiaojilu font-20 mr3 font-bd"></i>
<span>{(coderCount && coderCount.commits_count) || 0}</span>
</Link>
<Link to={`/projects/${owner}/${projectsId}/branchs`} className={pathname.indexOf("/branchs") > 0 ? "active" : ""}>
<Link to={`/${owner}/${projectsId}/branchs`} className={pathname.indexOf("/branchs") > 0 ? "active" : ""}>
<i className="iconfont icon-fenzhi1 font-18 mr3"></i>
<span>{(coderCount && coderCount.branches_count) || 0}</span>
</Link>
<Link to={`/projects/${owner}/${projectsId}/tag`} className={pathname.indexOf("/tag") > 0 ? "active" : ""}>
<Link to={`/${owner}/${projectsId}/tag`} className={pathname.indexOf("/tag") > 0 ? "active" : ""}>
<i className="iconfont icon-biaoqian3 font-18 mr3"></i>
<span>{(coderCount && coderCount.tags_count) || 0}</span>
</Link>
<Link to={`/projects/${owner}/${projectsId}/releases`} className={pathname.indexOf("/releases") > 0 ? "active" : ""}>
<Link to={`/${owner}/${projectsId}/releases`} className={pathname.indexOf("/releases") > 0 ? "active" : ""}>
<i className="iconfont icon-fahangban font-18 mr3"></i>
<span>{(coderCount && coderCount.version_releasesed_count) || 0}</span>
</Link>

View File

@ -59,7 +59,7 @@ export default ({ match , history }) => {
{commit && commit.message &&
<pre className="task-hide" style={{marginBottom:"0px",height:"28px",whiteSpace:"pre-wrap"}}>{commit.message}</pre>
}
<Button type="primary" onClick={()=>{history.push(`/projects/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="ml30">浏览代码</Button>
<Button type="primary" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="ml30">浏览代码</Button>
</div>
</div>
<div className="f-wrap-between" style={{ alignItems: "center" }}>

View File

@ -228,7 +228,7 @@ class Index extends Component {
}
getoDetail=(login,identifier)=>{
this.props.history.push(`/projects/${login}/${identifier}`);
this.props.history.push(`/${login}/${identifier}`);
}
// 选择语言类别

View File

@ -28,14 +28,14 @@ class IndexItem extends Component {
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
</a>
:
<Link to={item.author && (item.author.type === "Organization" ? `/organize/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
<Link to={item.author && item.author.login} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
</Link>
}
<div className="p-r-Infos">
<div className="p-r-name">
<AlignCenter>
<Link to={`/projects/${item.author.login}/${item.identifier}`} title={`${item.author.name}/${item.name}`} className="color-grey-3 font-18 task-hide " style={{maxWidth: 470 }}>
<Link to={`/${item.author.login}/${item.identifier}`} title={`${item.author.name}/${item.name}`} className="color-grey-3 font-18 task-hide " style={{maxWidth: 470 }}>
{item.author.name}/{item.name}
</Link>
{ !item.is_public && <span className="privateTag">私有</span> }

View File

@ -52,7 +52,7 @@ function Contribute(props){
<AlignCenter>
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`/${item.image_url}`)} width="50px" height="50px"/>
<div>
<Link to={`/users/${item.login}`} className="font-16">{item.name}</Link>
<Link to={`/${item.login}`} className="font-16">{item.name}</Link>
<p className="font-12 color-grey-9">提交{item.contributions}</p>
</div>
</AlignCenter>

View File

@ -10,7 +10,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
if(pathname && pathname==="source"){
let a = list.filter(item=>item.menu_name === "resources");
if(a && a.length === 0){
history.push(`/projects/${owner}/${projectsId}`);
history.push(`/${owner}/${projectsId}`);
}
}
setMenuName(list);
@ -28,7 +28,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "home" &&
<li className={pathname==="about" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/about`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/about`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-zhuye1 color-grey-3 mr5 font-14":"iconfont icon-zhuye1 color-grey-6 font-14 mr5"}></i>
<span>主页</span>
</Link>
@ -37,7 +37,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "code" &&
<li className={(pathname==="" || urlFlag) ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}`, state }}>
<i className={(pathname==="" || urlFlag) ? "iconfont icon-daimaku color-grey-3 mr5 font-14":"iconfont icon-daimaku color-grey-6 font-14 mr5"}></i>
<span>代码库</span>
</Link>
@ -47,7 +47,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
item.menu_name === "issues" &&
<li className={pathname==="issues" ? "active" : ""}>
<Tooltip title="易修是Issue的中文名即问题列表" placement="bottom">
<Link to={{ pathname: `/projects/${owner}/${projectsId}/issues`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/issues`, state }}>
<i className={pathname==="issues" ? "iconfont icon-renwu color-grey-3 mr5 font-14":"iconfont icon-renwu color-grey-6 font-14 mr5"}></i>
<span>易修</span>
{projectDetail && projectDetail.issues_count ? <span className="num">{projectDetail.issues_count}</span> : ""}
@ -58,7 +58,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "pulls" && projectDetail && parseInt(projectDetail.type) !== 2 && platform ?
<li className={pathname==="pulls" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/pulls`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/pulls`, state }}>
<i className={pathname==="pulls" ? "iconfont icon-hebingqingqiu1 color-grey-3 mr5 font-14":"iconfont icon-hebingqingqiu1 color-grey-6 font-14 mr5"}></i>
<span>合并请求</span>
{projectDetail && projectDetail.pull_requests_count ? <span className="num">{projectDetail.pull_requests_count}</span> : ""}
@ -68,7 +68,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "wiki" &&
<li className={pathname === "wiki" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/wiki`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/wiki`, state }}>
<i className={pathname==="wiki" ? "iconfont icon-wiki_icon color-grey-3 mr5 font-14":"iconfont icon-wiki_icon color-grey-6 font-14 mr5"}></i>
<span>Wiki</span>
</Link>
@ -77,7 +77,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "devops" && platform ?
<li className={pathname==="devops" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}>
<i className="iconfont icon-gongzuoliu font-13 mr8"></i>工作流(beta版)
{projectDetail && projectDetail.ops_count ? <span>{projectDetail.ops_count}</span> : ""}
</Link>
@ -85,19 +85,19 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
:""
}
{
item.menu_name === "resources" &&
<li className={pathname==="source" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/source`, state }}>
<i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i>
<span>资源库</span>
{projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
</Link>
</li>
// item.menu_name === "resources" &&
// <li className={pathname==="source" ? "active" : ""}>
// <Link to={{ pathname: `/${owner}/${projectsId}/source`, state }}>
// <i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i>
// <span></span>
// {projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
// </Link>
// </li>
}
{
item.menu_name === "versions" &&
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/milestones`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/milestones`, state }}>
<i className={pathname==="milestones" ? "iconfont icon-lichengbei color-grey-3 mr5 font-14":"iconfont icon-lichengbei color-grey-6 font-14 mr5"}></i>
<span>里程碑</span>
{projectDetail && projectDetail.versions_count ? <span className="num">{projectDetail.versions_count}</span> :""}
@ -107,7 +107,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "activity" &&
<li className={pathname==="activity" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/activity`, state }}>
<Link to={{ pathname: `/${owner}/${projectsId}/activity`, state }}>
<i className={pathname==="activity" ? "iconfont icon-tongzhi color-grey-3 mr5 font-14":"iconfont icon-tongzhi color-grey-6 font-14 mr5"}></i>
<span>动态</span>
</Link>
@ -116,7 +116,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{
item.menu_name === "setting" &&
<li className={pathname === "setting" ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/setting`}>
<Link to={`/${owner}/${projectsId}/setting`}>
<i className={url && url.indexOf("/setting") > 0 ? "iconfont icon-cangku color-grey-3 mr5 font-14":"iconfont icon-cangku color-grey-6 font-14 mr5"}></i>
<span>仓库设置</span>
</Link>

View File

@ -16,10 +16,10 @@ function Commits({ commits , projectsId , owner }){
<div className="prInfo">
<FlexAJ>
<AlignCenter>
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0}}>{truncateCommitId(`${item.sha}`)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0}}>{truncateCommitId(`${item.sha}`)}</Link>
<p className="ml15 font-16 color-grey-3 task-hide" style={{maxWidth:"700px"}}>{item.message}</p>
</AlignCenter>
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
</FlexAJ>
<AlignCenter className="mt15">
<User url={getImageUrl(`/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>提交于{item.time_from_now}</span>

View File

@ -47,7 +47,7 @@ function Files({data,history,owner,projectsId}){
<span>{item.name}</span>
</AlignCenter>
<span>
<Button className="mr20" onClick={()=>{history.push(`/projects/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}/${item.name}`)}}>查看文件</Button>
<Button className="mr20" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}/${item.name}`)}}>查看文件</Button>
<span className="color-green">+{item.addition}</span>
<span className="color-red ml20">-{item.deletion}</span>
</span>

View File

@ -228,7 +228,7 @@ class MergeDetail extends Component {
<div>
{
data && data.issue.user_permission ?
<Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
<Link to={`/${owner}/${projectsId}/pulls/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
: ''
}
</div>
@ -248,8 +248,8 @@ class MergeDetail extends Component {
<div className="detailHeader-wrapper">
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper">
<li className={url.indexOf("Messagecount") > 0 ? "active" : ""}><Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/Messagecount`}>对话内容</Link></li>
<li className={url.indexOf("MergeSubmit") > 0 ? "active" : ""}><Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/MergeSubmit`}>代码提交</Link></li>
<li className={url.indexOf("Messagecount") > 0 ? "active" : ""}><Link to={`/${owner}/${projectsId}/pulls/${mergeid}/Messagecount`}>对话内容</Link></li>
<li className={url.indexOf("MergeSubmit") > 0 ? "active" : ""}><Link to={`/${owner}/${projectsId}/pulls/${mergeid}/MergeSubmit`}>代码提交</Link></li>
</ul>
</div>
</div>

View File

@ -49,7 +49,7 @@ class MergeItem extends Component {
};
render() {
const { issues, project_name, project_author_name , user_admin_or_member} = this.props;
const { issues, project_name, project_author_name , user_admin_or_developer} = this.props;
const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props;
const renderList = () => {
@ -62,7 +62,7 @@ class MergeItem extends Component {
<p className="mb15 df" style={{ alignItems: "center" }}>
<i className={`iconfont icon-hebingqingqiu1 font-14 mr3 i_${status}`}></i>
<Link
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
style={{ maxWidth: "300px" }}
>
@ -78,7 +78,7 @@ class MergeItem extends Component {
</p>
<p className="grid-item font-13">
<Link
to={`/users/${item && item.author_login}`}
to={`/${item && item.author_login}`}
className="show-user-link"
>
<img
@ -91,7 +91,7 @@ class MergeItem extends Component {
</Link>
<AlignCenter>
<Link
to={`/users/${item && item.author_login}`}
to={`/${item && item.author_login}`}
className="show-user-link color-grey-8 ml5"
>
{item && item.author_name}
@ -109,7 +109,7 @@ class MergeItem extends Component {
item.pull_request_head &&
<Tag className="pr-branch-tag">
<Link
to={`/projects/${item.is_original ? item.fork_project_user : owner}/${ item.is_original ? item.fork_project_identifier : projectsId }/tree/${turnbar(item.pull_request_head)}`}
to={`/${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"
>
{item.is_original
@ -133,7 +133,7 @@ class MergeItem extends Component {
item.pull_request_base &&
<Tag className="pr-branch-tag">
<Link
to={`/projects/${owner}/${projectsId}/tree/${turnbar(item.pull_request_base)}`}
to={`/${owner}/${projectsId}/tree/${turnbar(item.pull_request_base)}`}
className="maxW200px hide-1 ver-middle"
>
{/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
@ -156,7 +156,7 @@ class MergeItem extends Component {
<li>
{item.assign_user_name ? (
<Link
to={`/users/${item.assign_user_login}`}
to={`/${item.assign_user_login}`}
className="show-user-link"
>
{item.assign_user_name}
@ -175,7 +175,7 @@ class MergeItem extends Component {
{item.journals_count ? (
<Link
className="mr5 color-grey-8"
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
>
<i className="iconfont icon-huifu1 font-15 mr5 ver-middle"></i>
{item.journals_count}
@ -183,7 +183,7 @@ class MergeItem extends Component {
) : (
""
)}
{user_admin_or_member && item.pull_request_status === 0 ? (
{user_admin_or_developer && item.pull_request_status === 0 ? (
<div
className="milepostleft"
style={{
@ -196,7 +196,7 @@ class MergeItem extends Component {
>
<div className="grid-item mr15 color-grey-9">
<Link
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/updatemerge`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/updatemerge`}
className="color-grey-9"
>
<i className="iconfont icon-bianji3 font-14 mr5"></i>

View File

@ -100,7 +100,7 @@ class MergeSubmit extends Component{
width:"10%",
render: (text,item) => (
<span className="f-wrap-alignCenter">
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
</Link>
@ -110,7 +110,7 @@ class MergeSubmit extends Component{
title:"SHA",
dataIndex: 'sha',
render: (text) => (
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${text}`)}`} className="commitKey">{text}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${text}`)}`} className="commitKey">{text}</Link>
)
},{
title:"备注",

View File

@ -361,7 +361,7 @@ class MessageCount extends Component {
<div className="mt15">
<Tag className="pr-branch-tag">
<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/${turnbar(data.pull_request && data.pull_request.head)}`}
to={`/${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"
>
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: {turnbar(data.pull_request && data.pull_request.head)}
@ -376,7 +376,7 @@ class MessageCount extends Component {
</span>
<Tag className="pr-branch-tag">
<Link
to={`/projects/${owner}/${projectsId}/tree/${data.pull_request.base}`}
to={`/${owner}/${projectsId}/tree/${data.pull_request.base}`}
className="ver-middle"
>
{data.issue.project_author_name}:{data.pull_request.base}
@ -386,14 +386,14 @@ class MessageCount extends Component {
}
<div className="mt15">
<Link to={`/users/${data.issue.author_login}`} className="show-user-link">
<Link to={`/${data.issue.author_login}`} className="show-user-link">
<img className="mr5" src={getImageUrl(`/${data.issue.author_picture}`)}
alt="" width="24" height="24" style={{borderRadius:"50%"}}
/>
</Link>
<span className="ver-middle">
<span className="color-grey-8 mr5"></span>
<Link to={`/users/${data.issue.author_login}`} className="show-user-link color-blue">
<Link to={`/${data.issue.author_login}`} className="show-user-link color-blue">
{data.issue.author_name}
</Link>
<span className="ml5 color-grey-8">
@ -408,7 +408,7 @@ class MessageCount extends Component {
<span className="color-grey-8">审查人员</span>
{data.issue.assign_user_name ? (
<Link
to={`/users/${data.issue.assign_user_login}`}
to={`/${data.issue.assign_user_login}`}
className="show-user-link color-blue"
>
{data.issue.assign_user_name}
@ -448,7 +448,7 @@ class MessageCount extends Component {
type="green"
ghost
className="ml20"
onClick={()=>{this.props.history.push(`/projects/${owner}/${projectsId}/pulls/${mergeId}/UpdateMerge`);}}
onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/UpdateMerge`);}}
>
编辑
</Button>

View File

@ -186,7 +186,7 @@ class NewMerge extends Component {
// this.ischeckmerge();
let { id ,merge , pull } = this.state;
if(type==="pull"){
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new/${pull}`)
this.props.history.push(`/${owner}/${projectsId}/pulls/new/${pull}`)
this.compareProject(id,value,merge);
}else{
this.compareProject(id,pull,value);
@ -208,7 +208,7 @@ class NewMerge extends Component {
merge_user_login: is_fork_id ? projects_names[0].project_user_login : undefined
}
})
this.props.history.push(`/projects/${login}/${identifier}/pulls/new`);
this.props.history.push(`/${login}/${identifier}/pulls/new`);
this.newMergelist(login,identifier);
};

View File

@ -4,7 +4,7 @@ import "./merge.css";
import "../Order/order.css";
import "../Order/index.scss";
import NoneData from "./no_data";
import OrderItem from "./MergeItem";
import MergeItem from "./MergeItem";
import './Index.scss';
import axios from "axios";
@ -212,7 +212,7 @@ class merge extends Component {
checkOperation() {
const { projectsId,owner } = this.props.match.params;
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new`);
this.props.history.push(`/${owner}/${projectsId}/pulls/new`);
}
render() {
const { projectsId , owner } = this.props.match.params;
@ -255,7 +255,7 @@ class merge extends Component {
/>
</div>
{
data && data.user_admin_or_member &&
data && data.user_admin_or_developer &&
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
+&nbsp;新建合并请求
</a>
@ -387,7 +387,7 @@ class merge extends Component {
<Spin spinning={isSpin}>
{data && data.search_count && data.search_count > 0 ? (
<div>
<OrderItem
<MergeItem
issues={issues}
search_count={search_count}
page={select_params.page}
@ -396,8 +396,8 @@ class merge extends Component {
project_author_name={data.project_author_name}
{...this.props}
{...this.state}
user_admin_or_member={data && data.user_admin_or_member}
></OrderItem>
user_admin_or_developer={data && data.user_admin_or_developer}
></MergeItem>
</div>
):""}
{search_count > select_params.limit ? (

View File

@ -165,7 +165,7 @@ class MergeForm extends Component {
this.setState({
isSpin: false,
});
this.props.history.push(`/projects/${owner}/${projectsId}/pulls`);
this.props.history.push(`/${owner}/${projectsId}/pulls`);
const { getDetail } = this.props;
getDetail && getDetail();
} else {
@ -195,7 +195,7 @@ class MergeForm extends Component {
isSpin: false,
});
this.props.history.push(
`/projects/${owner}/${projectsId}/pulls/${mergeId}/Messagecount`
`/${owner}/${projectsId}/pulls/${mergeId}/Messagecount`
);
} else {
this.setState({
@ -287,7 +287,7 @@ class MergeForm extends Component {
type="default"
className="ml30"
onClick={()=>{
this.props.history.push(merge_type === "new" ? `/projects/${owner}/${projectsId}/pulls` : `/projects/${owner}/${projectsId}/pulls/${mergeId}/detail`)
this.props.history.push(merge_type === "new" ? `/${owner}/${projectsId}/pulls` : `/${owner}/${projectsId}/pulls/${mergeId}/detail`)
}}
>
<span className="plr10">取消</span>

View File

@ -12,7 +12,7 @@ class Nodata extends Component{
<h3>欢迎使用合并请求</h3>
<div className="color-grey-8">
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/projects/${owner}/${projectsId}/pulls/new`}>合并请求</Link>
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/${owner}/${projectsId}/pulls/new`}>合并请求</Link>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete } from 'antd';
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd';
import { Base64 } from 'js-base64';
import '../css/index.scss';
@ -58,6 +58,8 @@ class Index extends Component {
this.getGitignore();
// 获取开源许可证
this.getLicenses();
//判断是否为删除新建项目失败后返回,并执行对应逻辑
this.isDeleteProjectBack();
}
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){
@ -69,6 +71,7 @@ class Index extends Component {
getOwner=()=>{
const { OIdentifier } = this.props.match.params;
const { user_id } = this.props && this.props.current_user;
const url = `/owners.json`;
axios.get(url).then(result=>{
if(result && result.data){
@ -77,16 +80,13 @@ class Index extends Component {
OwnerList: owner,
})
if(OIdentifier){
owner = owner.filter(item=>item.name === OIdentifier);
this.props.form.setFieldsValue({
user_id:OIdentifier
})
owner = owner.filter(item=>item.login === OIdentifier);
}else if(user_id){
owner = owner.filter(item=>item.id === user_id);
this.props.form.setFieldsValue({
user_id:owner && owner[0].name
})
}
this.props.form.setFieldsValue({
user_id:owner && owner[0].name
})
owner && this.setState({
owners_id:owner[0].id,
owners_name:owner[0].name
@ -144,6 +144,31 @@ class Index extends Component {
}).catch((error) => { })
}
isDeleteProjectBack = () => {
let mirror_status = this.props.history.location.mirror_status;
if (mirror_status === 2 && sessionStorage.newProjectValue) {
Modal.warning({
title: '警告',
content: '镜像项目创建失败!请按操作规范重新创建项目!',
});
let newProjectValue = JSON.parse(sessionStorage.newProjectValue);
if (newProjectValue) {
this.setState({
project_language_id: newProjectValue.project_language_id,
project_category_id: newProjectValue.project_category_id,
license_id: newProjectValue.license_id,
ignore_id: newProjectValue.ignore_id
});
delete newProjectValue.project_language_id;
delete newProjectValue.project_category_id;
delete newProjectValue.license_id;
delete newProjectValue.ignore_id;
this.props.form.setFieldsValue(newProjectValue);
}
}
}
// 设置option
setOptionsList = (data, _head, name) => {
if (data && data.length > 0) {
@ -172,6 +197,8 @@ class Index extends Component {
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
const decoderPass = Base64.encode(values.password);
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
// 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值
sessionStorage.newProjectValue=JSON.stringify({...values,project_language_id,project_category_id,license_id,ignore_id});
axios.post(url, {
...values,
auth_password:decoderPass,
@ -185,8 +212,8 @@ class Index extends Component {
this.setState({
isSpin: false
})
this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`);
this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`);
projectsType && projectsType !== "mirror" && this.props.showNotification(`托管项目创建成功!`);
this.props.history.push(`/${result.data.login}/${result.data.identifier}`);
}
}).catch((error) => {
this.setState({
@ -337,7 +364,9 @@ class Index extends Component {
{
projectsType && projectsType === "mirror" &&
<React.Fragment>
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i></p>
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>
需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i>
<span className="ml20 font-12 color-red">如果源项目为公有仓库禁止填写用户名密码如果源项目为私有仓库则必须填写正确的用户名和密码!</span></p>
{
mirrorCheck &&
<div className="df mb20" style={{alignItems:'center'}}>

View File

@ -86,7 +86,7 @@ class UserSubmitComponent extends Component {
const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname);
}
let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;
let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;
this.props.history.push(url);
}
})
@ -123,7 +123,7 @@ class UserSubmitComponent extends Component {
this.setState({ isSpin: false });
if (result.data && result.data.status === 1) {
let b = currentBranch || branch;
let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${turnbar(values.branchname)}` : (b ? `/tree/${turnbar(b)}`:""))}`;
let url = `/${owner}/${projectsId}${(values.branchname ? `/tree/${turnbar(values.branchname)}` : (b ? `/tree/${turnbar(b)}`:""))}`;
this.props.history.push(url);
this.props.showNotification("文件修改成功!");
}
@ -150,7 +150,7 @@ class UserSubmitComponent extends Component {
return (
<div>
<span className="df" style={{ alignItems: "center" }}>
<Link to={`/users/${current_user && current_user.login}`} className="show-user-link" >
<Link to={`/${current_user && current_user.login}`} className="show-user-link" >
<img
src={getImageUrl(`/${current_user && current_user.image_url}`)}
alt=""
@ -248,7 +248,7 @@ class UserSubmitComponent extends Component {
<Button
type="primary grey"
onClick={() => {
this.props.history.push(`/projects/${owner}/${projectsId}`);
this.props.history.push(`/${owner}/${projectsId}`);
}}
className="mr20"
>

View File

@ -63,11 +63,11 @@ function Apply(props) {
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<li key={k}>
<Link to={`/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex">
<p className="notifyInfos">
<Link to={`/users/${i.user && i.user.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<Link to={`/${i.user && i.user.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
<FlexAJ>

View File

@ -33,7 +33,7 @@ function Index(props){
useEffect(()=>{
if((username && current_user && (current_user.login !== username))){
props.history.push(`/users/${username}`);
props.history.push(`/${username}`);
}
},[current_user,username])
@ -47,14 +47,14 @@ function Index(props){
useEffect(()=>{
if(pathname && username){
if(pathname === `/users/${username}/notice`){
if(pathname === `/${username}/notice`){
setMenu("notify");
changeNum(user.undo_messages);
}
if(pathname === `/users/${username}/notice/undo`){
if(pathname === `/${username}/notice/undo`){
setMenu("undo");
}
if(pathname === `/users/${username}/notice/apply`){
if(pathname === `/${username}/notice/apply`){
setMenu("apply");
}
}
@ -70,9 +70,9 @@ function Index(props){
function deleteEvent(type,count) {
let c = count;
if(type==="apply"){
setTransferCount(transferCount-count);
}else if(type==="undo"){
setApplyCount(applyCount-count);
}else if(type==="undo"){
setTransferCount(transferCount-count);
}else{
setMessagesCount(0);
c = messagesCount;
@ -84,19 +84,19 @@ function Index(props){
<div>
<ul className="noticeMenu">
<li className={menu === "notify" ? "active":""}>
<Link to={`/users/${username}/notice`} onClick={changeNum}>
<Link to={`/${username}/notice`} onClick={changeNum}>
<span>通知</span>
{messagesCount ? <span className="unNum">{messagesCount}</span>:""}
</Link>
</li>
<li className={menu === "undo" ? "active":""}>
<Link to={`/users/${username}/notice/undo`}>
<Link to={`/${username}/notice/undo`}>
<span>接收仓库</span>
{transferCount ? <span className="unNum">{transferCount}</span>:""}
</Link>
</li>
<li className={menu === "apply" ? "active":""}>
<Link to={`/users/${username}/notice/apply`}>
<Link to={`/${username}/notice/apply`}>
<span>成员申请</span>
{applyCount ? <span className="unNum">{applyCount}</span>:""}
</Link>
@ -104,19 +104,19 @@ function Index(props){
</ul>
<Switch>
<Route
path="/users/:username/notice/apply"
path="/:username/notice/apply"
render={(p) => {
return <Apply {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/users/:username/notice/undo"
path="/:username/notice/undo"
render={(p) => {
return <UndoEvent {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/users/:username/notice"
path="/:username/notice"
render={(p) => {
return <Notify {...props} {...p} deleteEvent={deleteEvent}/>;
}}

View File

@ -44,13 +44,13 @@ function Notify(props){
if(status){
switch(status){
case 'canceled':
return <p>取消转移<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
return <p>取消转移<Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
case 'common':
return <p>正在将<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库转移给<Link to={`/users/${owner && owner.login}`}>{owner && owner.name}</Link></p>
return <p>正在将<Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库转移给<Link to={`/${owner && owner.login}`}>{owner && owner.name}</Link></p>
case 'successed':
return <p><Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库成功转移给<Link to={`/users/${owner && owner.login}`}>{owner && owner.name}</Link></p>
return <p><Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库成功转移给<Link to={`/${owner && owner.login}`}>{owner && owner.name}</Link></p>
default:
return <p>拒绝转移<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
return <p>拒绝转移<Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>仓库</p>
}
}else{
return ""
@ -62,9 +62,9 @@ function Notify(props){
if(status){
switch(status){
case 'successed':
return <p>已通过你加入<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>项目的申请</p>
return <p>已通过你加入<Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>项目的申请</p>
default:
return <p>已拒绝你加入<Link to={`/projects/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>项目的申请</p>
return <p>已拒绝你加入<Link to={`/${project && project.owner && project.owner.login}/${project && project.identifier}`}>{project && project.name}</Link>项目的申请</p>
}
}else{
return ""
@ -81,11 +81,11 @@ function Notify(props){
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link>
<li i={k}>
<Link to={`/${i.login}`}><img src={getImageUrl(`/${i.applied_user && i.applied_user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex">
<p className="notifyInfos">
<Link to={`/users/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link>
<Link to={`/${i.applied_user && i.applied_user.login}`} className="font-15 mr20">{i.applied_user && i.applied_user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
{ i.applied_type === "AppliedProject" ? renderApplyStatus(i.status,i.applied):renderStatus(i.status,i.applied)}

View File

@ -53,7 +53,7 @@ function UndoEvent(props){
Axios.post(url).then(result=>{
if(result && result.data){
getList();
props && props.deleteEvent("apply",1);
props && props.deleteEvent("undo",1);
}
}).catch(error=>{})
}
@ -68,16 +68,16 @@ function UndoEvent(props){
{
list.map((i,k)=>{
return(
<li>
<Link to={`/users/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<li key={k}>
<Link to={`/${i.user && i.user.login}`}><img src={getImageUrl(`/${i.user && i.user.image_url}`)} alt="" className="notifyImg"/></Link>
<div className="notifyFlex">
<p className="notifyInfos">
<Link to={`/users/${i.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<Link to={`/${i.login}`} className="font-15 mr20">{i.user && i.user.name}</Link>
<span className="color-grey-9">{i.time_ago}</span>
</p>
<FlexAJ>
<p className="color-grey-6">请求将仓库<Link to={`/projects/${i.project && i.project.owner && i.project.owner.login}/${i.project && i.project.identifier}`}>{i.project && i.project.name}</Link>
转移给<Link to={`/users/${i.owner && i.owner.login}`}>{i.owner && i.owner.name}</Link>是否接受</p>
<p className="color-grey-6">请求将仓库<Link to={`/${i.project && i.project.owner && i.project.owner.login}/${i.project && i.project.identifier}`}>{i.project && i.project.name}</Link>
转移给<Link to={`/${i.owner && i.owner.login}`}>{i.owner && i.owner.name}</Link>是否接受</p>
{
i.status === "common" &&
<span>

View File

@ -85,7 +85,7 @@ class Detail extends Component {
})
.then((result) => {
if (result) {
this.props.history.push(`/projects/${owner}/${projectsId}/issues`);
this.props.history.push(`/${owner}/${projectsId}/issues`);
}
})
.catch((error) => {
@ -132,7 +132,7 @@ class Detail extends Component {
.then((result) => {
if (result) {
this.props.history.push(
`/projects/${owner}/${projectsId}/issues/${result.data.issue_id}/copyetail`
`/${owner}/${projectsId}/issues/${result.data.issue_id}/copyetail`
);
}
})
@ -207,7 +207,7 @@ class Detail extends Component {
<div className="background-f boder-4">
<div className="grid-item border-1f pd20 ">
<Link
to={`/users/${data && data.author_login}`}
to={`/${data && data.author_login}`}
className="show-user-link"
>
<img
@ -240,7 +240,7 @@ class Detail extends Component {
<div className="mt10">
<span className="color-grey-9 mr5"></span>
<Link
to={`/users/${data && data.author_login}`}
to={`/${data && data.author_login}`}
className="show-user-link color-blue"
>
{data && data.author_name}
@ -269,7 +269,7 @@ class Detail extends Component {
</Popconfirm>
<Link
to={`/projects/${owner}/${projectsId}/issues/${orderId}/updatedetail`}
to={`/${owner}/${projectsId}/issues/${orderId}/updatedetail`}
className="color-blue fr"
>
编辑

View File

@ -187,7 +187,7 @@ class Milepost extends Component {
</ul>
{
data && data.user_admin_or_member ?
<Link to={`/projects/${owner}/${projectsId}/milestones/new`} className="topWrapper_btn">新的里程碑</Link>
<Link to={`/${owner}/${projectsId}/milestones/new`} className="topWrapper_btn">新的里程碑</Link>
: ''
}
</div>
@ -204,7 +204,7 @@ class Milepost extends Component {
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}`} className="font-16">{item.name}</Link>
<Link to={`/${owner}/${projectsId}/milestones/${item.id}`} className="font-16">{item.name}</Link>
</div>
</div>
</div>
@ -228,7 +228,7 @@ class Milepost extends Component {
<div className="milepostleft">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
<Link to={`/${owner}/${projectsId}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item ml15 color-grey-9">
<i className={item.status === "closed" ? "iconfont icon-gouxuan font-14 mr5":"iconfont icon-yiguanbi1 font-14 mr5"}></i>

View File

@ -238,8 +238,8 @@ class MilepostDetail extends Component {
<span className="font-weight-bold">{data && data.percent && data.percent.toFixed(2)}%完成 </span>
</span>
<div className="milepostdiv">
<Link to={`/projects/${owner}/${projectsId}/milestones/${meilid}/edit`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/projects/${owner}/${projectsId}/issues/${meilid}/new`} className="topWrapper_btn">创建易修</Link>
<Link to={`/${owner}/${projectsId}/milestones/${meilid}/edit`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/${owner}/${projectsId}/issues/${meilid}/new`} className="topWrapper_btn">创建易修</Link>
</div>
</FlexAJ>
</div>

View File

@ -7,8 +7,8 @@ class Nav extends Component{
const { projectsId , owner } = this.props.match.params;
return(
<p className="topWrapper_nav">
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${owner}/${projectsId}/issues/tags`}>标签</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${owner}/${projectsId}/milestones`}>里程碑</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/${owner}/${projectsId}/issues/tags`}>标签</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/${owner}/${projectsId}/milestones`}>里程碑</NavLink>
</p>
)
}

View File

@ -51,7 +51,7 @@ class OrderItem extends Component {
{current_user && current_user.login && checkbox}
<div className="flex-1">
<p className="mb10 df" style={{alignItems:"center"}}>
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/detail`} target="_blank" title={item.name} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"370px"}}>{item.name}</Link>
<Link to={`/${owner}/${projectsId}/issues/${item.id}/detail`} target="_blank" title={item.name} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"370px"}}>{item.name}</Link>
{TagInfo(item.priority,"mr10")}
</p>
<p className="color-grey-6 font-12">
@ -67,7 +67,7 @@ class OrderItem extends Component {
<li>
{
item.author_name ?
<Link to={`/users/${item.author_login}`} className="show-user-link">
<Link to={`/${item.author_login}`} className="show-user-link">
{item.author_name}
</Link>
: "--"
@ -76,7 +76,7 @@ class OrderItem extends Component {
<li>
{
item.assign_user_name ?
<Link to={`/users/${item.assign_user_login}`} className="show-user-link">
<Link to={`/${item.assign_user_login}`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"
@ -88,12 +88,12 @@ class OrderItem extends Component {
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
<li>
<div className="milepostleft">
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
<Link to={`/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
{
user_admin_or_member ?
<div id="hoverBox" style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
<div className="mr8 ml8 color-grey-9">
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
<Link to={`/${owner}/${projectsId}/issues/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="color-grey-9">
<Popconfirm placement="bottom" overlayClassName="overlayBox" getPopupContainer={()=>document.getElementById("hoverBox")} title={'您确定要删除当前易修吗?'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>

View File

@ -79,7 +79,7 @@ class UpdateMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${owner}/${projectsId}/milestones`);
this.props.history.push(`/${owner}/${projectsId}/milestones`);
}

View File

@ -63,7 +63,7 @@ class NewMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${owner}/${projectsId}/milestones`);
this.props.history.push(`/${owner}/${projectsId}/milestones`);
const { getDetail } = this.props;
getDetail && getDetail();
}

View File

@ -351,7 +351,7 @@ class order extends Component {
if(data && data.user_admin_or_member){
const { projectsId , owner } = this.props.match.params;
return(
<Link className="topWrapper_btn ml10" target="_blank" to={`/projects/${owner}/${projectsId}/issues/new`}>
<Link className="topWrapper_btn ml10" target="_blank" to={`/${owner}/${projectsId}/issues/new`}>
+&nbsp;创建易修
</Link>
)

View File

@ -165,7 +165,7 @@ class order_form extends Component {
}).then((result) => {
if (result && result.data.id) {
this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${owner}/${projectsId}/issues/${result.data.id}/detail`);
this.props.history.push(`/${owner}/${projectsId}/issues/${result.data.id}/detail`);
this.setState({
description: "",
isSpin: false,
@ -191,7 +191,7 @@ class order_form extends Component {
...values,
}).then((result) => {
if (result) {
this.props.history.push(`/projects/${owner}/${projectsId}/issues/${orderId}/detail`);
this.props.history.push(`/${owner}/${projectsId}/issues/${orderId}/detail`);
this.props.showNotification("任务更新成功!");
const { getDetail } = this.props;
getDetail && getDetail();
@ -371,7 +371,7 @@ class order_form extends Component {
type="default"
className="ml30"
onClick={()=>
this.props.history.push(form_type === "new" ? `/projects/${owner}/${projectsId || orderId}/issues` : `/projects/${owner}/${projectsId}/issues/${orderId}/detail`)}
this.props.history.push(form_type === "new" ? `/${owner}/${projectsId || orderId}/issues` : `/${owner}/${projectsId}/issues/${orderId}/detail`)}
>
<span className="plr10">取消</span>
</Button>

View File

@ -88,7 +88,7 @@ export default ((props)=>{
// 跳转
function settingRule(protectBranch){
props.history.push(`/projects/${owner}/${projectsId}/setting/branch/${protectBranch}`);
props.history.push(`/${owner}/${projectsId}/setting/branch/${protectBranch}`);
}
// 翻页

View File

@ -290,7 +290,7 @@ export default Form.create()(
<Cancel
className="ml30"
onClick={() => {
history.push(`/projects/${owner}/${projectsId}/setting/branch`);
history.push(`/${owner}/${projectsId}/setting/branch`);
}}
>
取消

View File

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState , useRef } from "react";
import {WhiteBack} from '../Component/layout';
import AddMember from '../Component/AddMember';
import AddGroup from '../Component/AddGroup';
@ -8,9 +8,11 @@ import Group from './CollaboratorGroup';
function Collaborator(props){
const [ nav , setNav] = useState("1");
const [ newId , setNewId] = useState(undefined);
const [ addOperation , setAddOperation] = useState(true);
const [ newGroupId , setNewGroupId] = useState(undefined);
const {projectsId ,owner} = props.match.params;
const author = props && props.projectDetail && props.projectDetail.author;
function getID(id){
@ -19,6 +21,7 @@ function Collaborator(props){
function getGroupID(id){
setNewGroupId(id);
}
return (
<WhiteBack>
@ -27,15 +30,17 @@ function Collaborator(props){
author && author.type === "Organization" ?
<span>
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined)}}>团队管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined);setNewGroupId(undefined)}}>团队管理</span>
</span>
:
<span className="font-18 text-black">协作者管理</span>
}
{
nav === "1" ?
nav === "1" &&
<AddMember getID={getID} login showNotification={props.showNotification}/>
:
}
{
(nav !== "1" && addOperation) &&
<AddGroup getGroupID={getGroupID} organizeId={owner}/>
}
</div>
@ -44,7 +49,7 @@ function Collaborator(props){
nav === "1" ?
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
:
<Group owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
<Group setAddOperation={setAddOperation} owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
}
</div>
</WhiteBack>

View File

@ -10,7 +10,7 @@ const roles = {
read: "报告者",
};
const limit = 15;
function CollaboratorGroup({ newGroupId, owner, projectsId }) {
function CollaboratorGroup({ newGroupId, owner, projectsId , setAddOperation }) {
const [list, setList] = useState(undefined);
const [isSpin, setIsSpin] = useState(true);
const [page, setPage] = useState(1);
@ -34,6 +34,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
setList(result.data.teams);
setTotal(result.data.total_count);
setIsSpin(false);
setAddOperation(result.data.can_add);
}
})
.catch((error) => {});
@ -47,16 +48,15 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
//
function addGroup(id) {
const url = `/${owner}/${projectsId}/teams.json`;
axios
.post(url, {
team_id: id,
})
.then((result) => {
if (result && result.data) {
getData();
}
})
.catch((error) => {});
axios.post(url, {
team_id: id,
})
.then((result) => {
if (result && result.data) {
getData();
}
})
.catch((error) => {});
}
//
@ -77,7 +77,11 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
title: "团队名",
dataIndex: "name",
render: (value, item) => {
return <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>;
if(item.is_admin || item.is_member){
return <Link to={`/${owner}/group/${item.id}`}>{value}</Link>;
}else{
return <span>{value}</span>;
}
},
},
{

View File

@ -186,7 +186,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
render: (text, item) => (
<span className="f-wrap-alignCenter">
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="show-user-link"
>
<img
@ -204,7 +204,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
title: "用户名",
dataIndex: "name",
render: (text, item) => (
<Link to={`/users/${item.login}`} className="show-user-link">
<Link to={`/${item.login}`} className="show-user-link">
{text}
</Link>
),

View File

@ -49,14 +49,14 @@ class Index extends Component {
const { projectsId , owner } = this.props.match.params;
const { pathname } = this.props.history.location;
const flag = pathname === `/projects/${owner}/${projectsId}/setting`;
const flag = pathname === `/${owner}/${projectsId}/setting`;
return (
<Box className="ProjectListIndex">
<Short>
<ul className="list-l-Menu">
<li className={flag ? "active" : ""}>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting`} className="w-100">
<Link to={`/${owner}/${projectsId}/setting`} className="w-100">
<i className="iconfont icon-huabanfuben font-18 mr10"></i>
</Link>
</p>
@ -67,7 +67,7 @@ class Index extends Component {
}
>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting/collaborator`} className="w-100">
<Link to={`/${owner}/${projectsId}/setting/collaborator`} className="w-100">
<i className="iconfont icon-chengyuan font-18 mr10"></i>
协作者管理
</Link>
@ -79,7 +79,7 @@ class Index extends Component {
}
>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting/webhooks`} className="w-100">
<Link to={`/${owner}/${projectsId}/setting/webhooks`} className="w-100">
<i className="iconfont icon-a-xuanzhongwebhookicon font-18 mr10 color-grey-9"></i>
Webhooks
</Link>
@ -91,7 +91,7 @@ class Index extends Component {
}
>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting/branch`} className="w-100">
<Link to={`/${owner}/${projectsId}/setting/branch`} className="w-100">
<i className="iconfont icon-fenzhi font-20 mr10"></i>
分支设置
</Link>
@ -101,7 +101,7 @@ class Index extends Component {
className={pathname.indexOf("setting/tags") > -1 ? "active" : ""}
>
<p>
<Link to={`/projects/${owner}/${projectsId}/setting/tags`} className="w-100">
<Link to={`/${owner}/${projectsId}/setting/tags`} className="w-100">
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
项目标签
</Link>
@ -127,64 +127,64 @@ class Index extends Component {
<Switch {...this.props}>
{/* webhooks */}
<Route
path="/projects/:owner/:projectsId/setting/webhooks/new"
path="/:owner/:projectsId/setting/webhooks/new"
render={(props) => (
<WebhookNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/webhooks/:id"
path="/:owner/:projectsId/setting/webhooks/:id"
render={(props) => (
<WebhookNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/webhooks"
path="/:owner/:projectsId/setting/webhooks"
render={(props) => (
<Webhook {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 协作者 */}
<Route
path="/projects/:owner/:projectsId/setting/collaborator"
path="/:owner/:projectsId/setting/collaborator"
render={(props) => (
<Collaborator {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 修改仓库信息 */}
<Route
path="/projects/:owner/:projectsId/setting/tags"
path="/:owner/:projectsId/setting/tags"
render={(props) => (
<Tags {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/branch/:branch"
path="/:owner/:projectsId/setting/branch/:branch"
render={(props) => (
<BranchNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/branch"
path="/:owner/:projectsId/setting/branch"
render={(props) => (
<Branch {...this.props} {...props } {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/manage/new"
path="/:owner/:projectsId/setting/manage/new"
render={(props) => (
<ManageNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:owner/:projectsId/setting/manage"
path="/:owner/:projectsId/setting/manage"
render={(props) => (
<Manage {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 修改仓库信息 */}
<Route
path="/projects/:owner/:projectsId/setting"
path="/:owner/:projectsId/setting"
render={(props) => (
<Setting {...this.props} {...props} {...this.state} />
)}

View File

@ -16,7 +16,7 @@ const menu = [
{name:"合并请求",index:"pulls"},
{name:"Wiki",index:"wiki"},
{name:"工作流(beta版)",index:"devops"},
{name:"资源库",index:"resources"},
// {name:"资源库",index:"resources"},
{name:"里程碑",index:"versions"},
{name:"动态",index:"activity"},
]
@ -351,7 +351,7 @@ class Setting extends Component {
{
is_transfering ?
<span>此仓库正在转移给
{transfer && <Link to={transfer.type="User"?`/users/${transfer.login}`:`/organize/${transfer.login}`}>{transfer.name}</Link>}
{transfer && <Link to={transfer.login}>{transfer.name}</Link>}
请联系对方接收此仓库</span>
:
`将此仓库转移给其他用户或组织`

View File

@ -62,7 +62,7 @@ function Index(props) {
if(total >= 20){
return props.showNotification("webhooks数量已到上限请删除暂不使用的webhooks以进行添加操作");
}
props.history.push(`/projects/${owner}/${projectsId}/setting/webhooks/new`)
props.history.push(`/${owner}/${projectsId}/setting/webhooks/new`)
}
return(
@ -90,9 +90,9 @@ function Index(props) {
return(
<List.Item key={k}>
<i className="iconfont icon-a-xuanzhongwebhookicon color-grey-d mr12 font-17"></i>
<Link to={`/projects/${owner}/${projectsId}/setting/webhooks/${i.id}`} className="webName">{i.url}</Link>
<Link to={`/${owner}/${projectsId}/setting/webhooks/${i.id}`} className="webName">{i.url}</Link>
<span>
<Button ghost type={"primary"} onClick={()=>{props.history.push(`/projects/${owner}/${projectsId}/setting/webhooks/${i.id}`)}}>编辑</Button>
<Button ghost type={"primary"} onClick={()=>{props.history.push(`/${owner}/${projectsId}/setting/webhooks/${i.id}`)}}>编辑</Button>
<Button ghost className="ml20" type="danger" onClick={()=>{deleteFunc(i.id,i.url)}}>删除</Button>
</span>
</List.Item>

View File

@ -111,7 +111,7 @@ function New({ form , match , showNotification , history }) {
}).then(result=>{
if(result){
showNotification("webhook更新成功");
history.push(`/projects/${owner}/${projectsId}/setting/webhooks`);
history.push(`/${owner}/${projectsId}/setting/webhooks`);
}
}).catch(error=>{})
}else{
@ -125,7 +125,7 @@ function New({ form , match , showNotification , history }) {
}).then(result=>{
if(result && result.data && result.data.id){
showNotification("webhook新建成功");
history.push(`/projects/${owner}/${projectsId}/setting/webhooks`);
history.push(`/${owner}/${projectsId}/setting/webhooks`);
}
}).catch(error=>{})
}
@ -157,7 +157,7 @@ function New({ form , match , showNotification , history }) {
axios.delete(url).then(result=>{
if(result){
showNotification("webhook删除成功");
history.push(`/projects/${owner}/${projectsId}/setting/webhooks`);
history.push(`/${owner}/${projectsId}/setting/webhooks`);
}
}).catch(error=>{})
}
@ -180,7 +180,7 @@ function New({ form , match , showNotification , history }) {
subTitle={`删除后未来事件将不会推送至此Webhook地址${data && data.url}`}
/>
<Banner>
<Link to={`/projects/${owner}/${projectsId}/setting/webhooks`} className="color-blue">Webhooks</Link>
<Link to={`/${owner}/${projectsId}/setting/webhooks`} className="color-blue">Webhooks</Link>
<i className="iconfont icon-youjiantou ml5 mr5 font-12"></i>
<span>{id ? "更新" : "添加"}Webhook</span>
</Banner>

View File

@ -217,7 +217,7 @@ function Index(props){
data.map((item,key)=>{
return(
<li>
<Link to= {`/users/${item.login}`} className="infoImg"><img src={getImageUrl(`/${item.imageUrl}`)} alt="" /></Link>
<Link to= {`/${item.login}`} className="infoImg"><img src={getImageUrl(`/${item.imageUrl}`)} alt="" /></Link>
<div style={{flex:'1',width:"0"}}>
<FlexAJ>
<AlignCenter>

View File

@ -31,7 +31,7 @@ export default (({projects}) => {
return (
<Div>
<Imgs src={item.project && getImageUrl(`/${item.project.owner_image_url}`)}/>
<Link to={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.name}</Link>
<Link to={`/${item.project.owner_login}/${item.project.identifier}`}>{item.project.name}</Link>
</Div>
)
})

View File

@ -26,18 +26,18 @@ export default (props)=>{
function returnActive (pathname){
let a = 0;
if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/member`){
if(pathname === `/${OIdentifier}/group/${groupId}/setting/member`){
a = 1;
}else if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/project`){
}else if(pathname === `/${OIdentifier}/group/${groupId}/setting/project`){
a = 2;
}
return a;
}
const active = returnActive(pathname);
const array = {list:[
{name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/group/${groupId}/setting`},
{name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/group/${groupId}/setting/member`},
{name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/group/${groupId}/setting/project`},
{name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/group/${groupId}/setting`},
{name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/group/${groupId}/setting/member`},
{name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/group/${groupId}/setting/project`},
],
active
}
@ -51,19 +51,19 @@ export default (props)=>{
<WhiteBack style={{border:'1px solid #eee'}}>
<Switch>
<Route
path="/organize/:OIdentifier/group/:groupId/setting/project"
path="/:OIdentifier/group/:groupId/setting/project"
render={() => (
<Project {...props} />
)}
></Route>
<Route
path="/organize/:OIdentifier/group/:groupId/setting/member"
path="/:OIdentifier/group/:groupId/setting/member"
render={() => (
<Member {...props} />
)}
></Route>
<Route
path="/organize/:OIdentifier/group/:groupId/setting"
path="/:OIdentifier/group/:groupId/setting"
render={() => (
<Common {...props} />
)}

View File

@ -89,7 +89,7 @@ export default ((props) => {
axios.delete(url).then((result) => {
if (result && result.data) {
props.showNotification(`已成功退出团队!`);
props.history.push(`/organize/${OIdentifier}`);
props.history.push(`/${OIdentifier}`);
}
}).catch((error) => { });
}
@ -119,7 +119,7 @@ export default ((props) => {
<div className="g-tip">
<p>管理员团队对 <span>所有仓库</span> 具有操作权限且对组织具有 <span>管理员权限</span> </p>
<p>此外该团队拥有了 <span>创建仓库</span> 的权限成员可以在组织中创建新的仓库 </p>
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/organize/${OIdentifier}/group/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/${OIdentifier}/group/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
</div>
</div>
:

View File

@ -24,21 +24,32 @@ export default Form.create()(
const [check_box, setCheckBox] = useState(false);
const [switch_box, setSwtichBox] = useState([]);
const [onwers, setOnwers] = useState(false);
const [auth, setAuth] = useState("");
const [ descNum , setDescNum ] = useState(0);
const [switch_box_code, setSwtichBoxCode] = useState(false);
const [switch_box_pull, setSwtichBoxPull] = useState(false);
const [switch_box_issue, setSwtichBoxIssue] = useState(false);
const [switch_box_release, setSwtichBoxRelease] = useState(false);
const [switch_box_wiki, setSwtichBoxWiki] = useState(false);
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const { OIdentifier, groupId } = match.params;
useEffect(()=>{
setFieldsValue({
authorize:"read",
includes_all_project:0
})
},[])
useEffect(() => {
if (GroupDetail) {
setOnwers(GroupDetail.authorize === "owner");
setAuth(GroupDetail.authorize);
setCheckBox(GroupDetail.can_create_org_project)
setSwtichBox(GroupDetail.units)
setFieldsValue({
...GroupDetail
...GroupDetail,
includes_all_project:GroupDetail.includes_all_project ? 1 :0
})
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
}
@ -50,6 +61,7 @@ export default Form.create()(
setSwtichBoxPull(switch_checked("pulls"))
setSwtichBoxIssue(switch_checked("issues"))
setSwtichBoxRelease(switch_checked("releases"))
setSwtichBoxWiki(switch_checked("wiki"))
}
}, [switch_box])
@ -68,25 +80,28 @@ export default Form.create()(
setIsSpin(true)
validateFields((error, values) => {
if (!error) {
values.unit_types = switch_box
// values.unit_types = switch_box
values.unit_types = ['code','pulls','issues','releases','wiki'];
if (groupId) { //
const url = `/organizations/${OIdentifier}/teams/${groupId}.json`;
axios.put(url, {
...values
...values,
includes_all_project:values.includes_all_project === 1?true:false
}).then(result => {
if (result && result.data) {
showNotification("基本设置更新成功!");
history.push(`/organize/${OIdentifier}/group/${groupId}`);
history.push(`/${OIdentifier}/group/${groupId}`);
}
}).catch(error => { })
} else {
const url = `/organizations/${OIdentifier}/teams.json`;
axios.post(url, {
...values
...values,
includes_all_project:values.includes_all_project === 1?true:false
}).then(result => {
if (result && result.data) {
showNotification("团队创建成功!");
history.push(`/organize/${OIdentifier}/group/${result.data.id}`);
history.push(`/${OIdentifier}/group/${result.data.id}`);
}
}).catch(error => { })
}
@ -132,14 +147,22 @@ export default Form.create()(
setSwtichBoxRelease(checked)
}
function switch_wiki_types(checked, event) {
switch_unit_types(checked, "wiki");
setSwtichBoxWiki(checked);
}
function cancelEdit(){
if(groupId){
history.push(`/organize/${OIdentifier}/group/${groupId}`);
history.push(`/${OIdentifier}/group/${groupId}`);
}else{
history.push(`/organize/${OIdentifier}`);
history.push(`/${OIdentifier}`);
}
}
function changeAuth(params) {
setAuth(params.target.value)
}
function checkname(rule, value, callback){
if(!value){
@ -192,8 +215,8 @@ export default Form.create()(
"includes_all_project",
[],
<Radio.Group>
<Radio value={false} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio>
<Radio value={true} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio>
<Radio value={0} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio>
<Radio value={1} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio>
</Radio.Group>, false, 0,onwers ? "hide":""
)}
{helper(
@ -202,37 +225,42 @@ export default Form.create()(
[],
<Checkbox checked={check_box} onChange={change_check_box_status} style={OptionStyle}>新建项目<span className="color-grey-8 ml10">(成员可以在组织中新建项目创建者将自动获得新建的项目的管理员权限)</span></Checkbox>, false, 20,onwers ? "hide":""
)}
{/* {helper(
{helper(
'版本库权限:',
"authorize",
[],
<Radio.Group>
<Radio.Group onChange={changeAuth}>
<Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio>
<Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio>
<Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio>
</Radio.Group>, false, 20,onwers ? "hide":""
)} */}
)}
</Form>
{/* <p className="required">访</p>
<AlignCenter className="mb10">
<Switch checked={switch_box_code} onClick={switch_code_types} />
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码文件提交和分支)</span></span>
</AlignCenter>
<AlignCenter className="mb10">
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告任务和里程碑)</span></span>
</AlignCenter>
<AlignCenter className="mb10">
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
</AlignCenter>
<AlignCenter className="mb20">
<Switch checked={switch_box_release} onClick={switch_releas_types} />
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
</AlignCenter>
*/}
{/* <div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
<p className="required">允许访问项目单元</p>
<AlignCenter className="mb10">
<Switch checked={switch_box_code} onClick={switch_code_types} />
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码文件提交和分支)</span></span>
</AlignCenter>
<AlignCenter className="mb10">
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告任务和里程碑)</span></span>
</AlignCenter>
<AlignCenter className="mb10">
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
</AlignCenter>
<AlignCenter className="mb10">
<Switch checked={switch_box_release} onClick={switch_releas_types} />
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
</AlignCenter>
<AlignCenter className="mb20">
<Switch checked={switch_box_wiki} onClick={switch_wiki_types} />
<span className="ml30 color-grey-3">wiki<span className="color-grey-8 ml15">(编辑此仓库的相关文档说明)</span></span>
</AlignCenter>
</div> */}
<Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button>
<Cancel className="ml30" onClick={() => cancelEdit()}><span className="pl30 pr30">取消</span></Cancel>
<Cancel className="ml30" onClick={() => cancelEdit()}><span>取消</span></Cancel>
</Div>
</WhiteBack>
</Spin>

View File

@ -87,7 +87,7 @@ export default ((props) => {
align: "center",
render: (value, item) => {
return (
<Link to={`/users/${item.user.login}`}>{item.user.name}</Link>
<Link to={`/${item.user.login}`}>{item.user.name}</Link>
)
}
},

View File

@ -180,7 +180,7 @@ function GroupProjectSetting(props) {
}
>
<List.Item.Meta
title={<a href={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.owner_name}/{item.project.name}</a>}
title={<a href={`/${item.project.owner_login}/${item.project.identifier}`}>{item.project.owner_name}/{item.project.name}</a>}
/>
</List.Item>
)}

View File

@ -33,28 +33,28 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
<Switch>
{/* 组织团队-设置 */}
<Route
path="/organize/:OIdentifier/group/:groupId/setting"
path="/:OIdentifier/group/:groupId/setting"
render={(p) => {
return <SubDetailIndex {...props} {...p}/>
}}
></Route>
{/* 组织团队-新建 */}
<Route
path="/organize/:OIdentifier/group/new"
path="/:OIdentifier/group/new"
render={(p) => {
return <GroupNew {...props} {...p}/>
}}
></Route>
{/* 组织团队-子级(包含组织团队列表) */}
<Route
path="/organize/:OIdentifier/group"
path="/:OIdentifier/group"
render={(p) => {
return <DetailIndex {...props} {...p}/>
}}
></Route>
{/* 组织成员 */}
<Route
path="/organize/:OIdentifier/member"
path="/:OIdentifier/member"
render={(p) => {
return <DetailIndex {...props} {...p}/>
}}
@ -68,7 +68,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
></Route>
{/* 组织详情(包含组织设置) */}
<Route
path="/organize/:OIdentifier"
path="/:OIdentifier"
render={(p) => (
<DetailIndex {...props} {...p}/>
)}

View File

@ -368,5 +368,5 @@
}
}
.hide{
display: hidden;
display: none;
}

View File

@ -61,8 +61,8 @@ function List(props){
)
const menu_new=(
<Menu>
<Menu.Item key="updated_on"><Link to={`/projects/deposit/new/${OIdentifier}`}>新建托管项目</Link></Menu.Item>
<Menu.Item key="created_on"><Link to={`/projects/mirror/new/${OIdentifier}`}>新建镜像项目</Link></Menu.Item>
<Menu.Item key="updated_on"><Link to={`/deposit/new/${OIdentifier}`}>新建托管项目</Link></Menu.Item>
<Menu.Item key="created_on"><Link to={`/mirror/new/${OIdentifier}`}>新建镜像项目</Link></Menu.Item>
</Menu>
)
@ -75,7 +75,7 @@ function List(props){
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
</div>
<p>
{ organizeDetail && organizeDetail.is_admin ?
{ organizeDetail && organizeDetail.can_create_project ?
<Sort menu={menu_new}>
<a className="addBtn mr30">+&nbsp;新建项目</a>
</Sort>

View File

@ -7,7 +7,7 @@ function ListItem({item,key,OIdentifier}) {
<div className="team_project" key={key}>
<p className="t_p_title">
<span className="flex1">
<Link to={`/projects/${OIdentifier}/${item.identifier}`} className="name">{item.name}</Link>
<Link to={`/${OIdentifier}/${item.identifier}`} className="name">{item.name}</Link>
{ item.forked_from_project_id && <i className="iconfont icon-fork font-18 color-orange ml8" /> }
{
item.type && item.type !== 0 ?

View File

@ -49,7 +49,7 @@ export default Form.create()(
}).then(result=>{
if(result && result.data){
showNotification("组织创建成功!");
history.push(`/organize/${result.data.name}`);
history.push(`/${result.data.name}`);
}
}).catch(error=>{})
}
@ -145,6 +145,7 @@ export default Form.create()(
<p className="mt20">
<Button type="primary" className="mr30" onClick={createOrganize}>创建组织</Button>
<Button className="grey" onClick={()=>{window.history.back(-1)}}>取消</Button>
<Button className="grey" onClick={()=>{test}}>test</Button>
</p>
</div>
)

View File

@ -67,14 +67,14 @@ function RightBox({ OIdentifier , history , admin }) {
<div className="list-r">
{
memberData && memberData.organization_users && memberData.organization_users.length>0 ?
<Box name="组织成员" count={memberData && memberData.total_count} url={`/organize/${OIdentifier}/member`}>
<Box name="组织成员" count={memberData && memberData.total_count} url={`/${OIdentifier}/member`}>
{
memberData.organization_users.map((item,key)=>{
return(
<div className="teammembers" key={key}>
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<Link to={`/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
<div>
<Link to={`/users/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
<Link to={`/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间{item.created_at}</Span></Align>
</div>
</div>
@ -87,8 +87,8 @@ function RightBox({ OIdentifier , history , admin }) {
<Box
name="组织团队"
count={groupData && groupData.total_count}
bottom={admin && <Button type={'primary'} onClick={()=>history.push(`/organize/${OIdentifier}/group/new`)}>新建团队</Button>}
url={`/organize/${OIdentifier}/group`}
bottom={admin && <Button type={'primary'} onClick={()=>history.push(`/${OIdentifier}/group/new`)}>新建团队</Button>}
url={`/${OIdentifier}/group`}
>
{
groupData && groupData.teams && groupData.teams.length>0?
@ -97,7 +97,12 @@ function RightBox({ OIdentifier , history , admin }) {
return(
<div className="teammembers" key={key}>
<div>
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
{
(item.is_admin || item.is_member) ?
<Link to={`/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
:
<ColorListName>{item.name}</ColorListName>
}
<Align>
<Span>{item.num_users}名成员</Span>
<Span>{item.num_projects}个仓库</Span>

View File

@ -62,7 +62,7 @@ export default Form.create()(
showNotification("组织信息更新成功!");
if(values.name !== organizeDetail.name){
console.log("false111");
history.push(`/organize/${values.name}/setting`);
history.push(`/${values.name}/setting`);
}
updateFunc && updateFunc(values.name,values.description);
}
@ -92,7 +92,7 @@ export default Form.create()(
}).then(result=>{
if(result && result.data){
//
history.push(`/users/${current_user && current_user.login}/organizes`);
history.push(`/${current_user && current_user.login}/organizes`);
}
})
setVisible(false);
@ -168,7 +168,7 @@ export default Form.create()(
'权限:',
"repo_admin_change_team_access",
[],
<Checkbox style={radioStyle}>仓库管理员可以添加或移除团队的访问权限</Checkbox>,false,true
<Checkbox style={radioStyle}>项目管理员可以添加或移除团队的访问权限</Checkbox>,false,true
)}
<Divider/>
{helper(

View File

@ -30,21 +30,21 @@ export default (( props )=>{
function returnActive (pathname){
let a = 0;
if(pathname === `/organize/${OIdentifier}/setting/member`){
if(pathname === `/${OIdentifier}/setting/member`){
a = 1;
}else if(pathname === `/organize/${OIdentifier}/setting/group`){
}else if(pathname === `/${OIdentifier}/setting/group`){
a = 2;
}else if(pathname === `/organize/${OIdentifier}/setting/hooks`){
}else if(pathname === `/${OIdentifier}/setting/hooks`){
a = 3;
}
return a;
}
const active = returnActive(pathname);
const array = {list:[
{name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/setting`},
{name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/setting/member`},
{name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/setting/group`},
// {name:'web',icon:"icon-zhongqingdianxinicon10",href:`/organize/${OIdentifier}/setting/hooks`}
{name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/setting`},
{name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/setting/member`},
{name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/setting/group`},
// {name:'web',icon:"icon-zhongqingdianxinicon10",href:`/${OIdentifier}/setting/hooks`}
],
active
}
@ -58,25 +58,25 @@ export default (( props )=>{
<div style={{border:"1px solid #eee"}}>
<Switch>
<Route
path="/organize/:OIdentifier/setting/hooks"
path="/:OIdentifier/setting/hooks"
render={() => (
<Hooks {...props} />
)}
></Route>
<Route
path="/organize/:OIdentifier/setting/group"
path="/:OIdentifier/setting/group"
render={() => (
<Group {...props} />
)}
></Route>
<Route
path="/organize/:OIdentifier/setting/member"
path="/:OIdentifier/setting/member"
render={() => (
<Member {...props} />
)}
></Route>
<Route
path="/organize/:OIdentifier/setting"
path="/:OIdentifier/setting"
render={() => (
<Common {...props} />
)}

View File

@ -64,7 +64,7 @@ export default (({organizeDetail})=>{
width:"5%",
render:(value)=>{
return(
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
value && <Link to={`/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
)
}
},
@ -73,7 +73,7 @@ export default (({organizeDetail})=>{
dataIndex: 'user',
width:"15%",
render:(value,item)=>{
return <Link to={`/users/${value && value.login}`}>{value && value.name}</Link>
return <Link to={`/${value && value.login}`}>{value && value.name}</Link>
}
},
{

View File

@ -38,12 +38,12 @@ function Detail(props){
//
useEffect(()=>{
if(pathname){
if(pathname.indexOf(`/organize/${OIdentifier}/setting`)>-1){
if(pathname.indexOf(`/${OIdentifier}/setting`)>-1){
setFlag(false);
}else{
setFlag(true);
}
if(pathname.indexOf(`/organize/${OIdentifier}/group`)>-1 || pathname.indexOf(`/organize/${OIdentifier}/member`)>-1){
if(pathname.indexOf(`/${OIdentifier}/group`)>-1 || pathname.indexOf(`/${OIdentifier}/member`)>-1){
setButtonflagFlag(true);
}else{
setButtonflagFlag(false);
@ -77,19 +77,19 @@ function Detail(props){
{
detail &&
<Cards
src={`/organize/${detail.name}`}
src={`/${detail.name}`}
title={detail.nickname}
desc={!buttonflag && detail.description}
img={detail.avatar_url}
rightBtn={
<React.Fragment>
{flag && !buttonflag && detail.is_admin ?
<Link to={`/organize/${OIdentifier}/setting`} className="color-blue ml10 font-14">设置<i className="iconfont icon-shezhi2 ml3 fr"></i></Link>
<Link to={`/${OIdentifier}/setting`} className="color-blue ml10 font-14">设置<i className="iconfont icon-shezhi2 ml3 fr"></i></Link>
:""}
{buttonflag &&
<span className="subNavs">
<Link to={`/organize/${OIdentifier}/member`} className={pathname ===`/organize/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={`/organize/${OIdentifier}/group`} className={pathname ===`/organize/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
<Link to={`/${OIdentifier}/member`} className={pathname ===`/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={`/${OIdentifier}/group`} className={pathname ===`/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
</span>
}
</React.Fragment>
@ -112,33 +112,33 @@ function Detail(props){
{/* 组织团队-详情 */}
<Route
path="/organize/:OIdentifier/group/:groupId"
path="/:OIdentifier/group/:groupId"
render={(p) => {
return <GroupDetails {...props} {...p} group={detail}/>
}}
></Route>
{/* 组织成员 */}
<Route
path="/organize/:OIdentifier/member"
path="/:OIdentifier/member"
render={(p) => {
return <Member {...props} {...p} organizeDetail={detail}/>
}}
></Route>
{/* 组织团队 */}
<Route
path="/organize/:OIdentifier/group"
path="/:OIdentifier/group"
render={(p) => {
return <Group {...props} {...p} organizeDetail={detail}/>
}}
></Route>
<Route
path="/organize/:OIdentifier/setting"
path="/:OIdentifier/setting"
render={(p) => {
return <Setting {...props} {...p} organizeDetail={detail} updateFunc={updateDetail}/>
}}
></Route>
<Route
path="/organize/:OIdentifier"
path="/:OIdentifier"
render={(p) => {
return <DetailIndex {...props} {...p} organizeDetail={detail}/>
}}

View File

@ -22,7 +22,7 @@ export default ((props)=>{
//
useEffect(()=>{
if(pathname){
if(pathname.indexOf(`/organize/${OIdentifier}/group/${groupId}/setting`)>-1){
if(pathname.indexOf(`/${OIdentifier}/group/${groupId}/setting`)>-1){
setFlag(false);
}else{
setFlag(true);
@ -48,19 +48,19 @@ export default ((props)=>{
<div className="teamDetail" style={{paddingTop:"0px"}}>
<div>
<i className="iconfont icon-zuobiao mr5"></i>
<Link to={`/organize/${OIdentifier}`}>{OIdentifier}</Link>
<Link to={`/${OIdentifier}`}>{OIdentifier}</Link>
<i className="iconfont icon-youjiantou ml3 mr3 font-12 color-grey-9"></i>
<span className="color-grey-9">{detail ? detail.name : "新建团队"}</span>
</div>
{
detail &&
<Cards
src={`/organize/${OIdentifier}/group/${groupId}`}
src={`/${OIdentifier}/group/${groupId}`}
title={detail.nickname||detail.name}
rightBtn={
flag && <span className="subNavs">
<Link to={`/organize/${OIdentifier}/member`} className={pathname ===`/organize/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={`/organize/${OIdentifier}/group`} className={pathname ===`/organize/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
<Link to={`/${OIdentifier}/member`} className={pathname ===`/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={`/${OIdentifier}/group`} className={pathname ===`/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
</span>
}
desc={!flag && detail.description}
@ -69,7 +69,7 @@ export default ((props)=>{
<Switch {...props}>
{/* 组织团队-设置 */}
<Route
path="/organize/:OIdentifier/group/:groupId/setting"
path="/:OIdentifier/group/:groupId/setting"
render={(p) => {
return <GroupSetting {...props} {...p}/>
}}

View File

@ -53,7 +53,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
}
//
function toGroupSetting(id){
history.push(`/organize/${organizeDetail && organizeDetail.name}/group/${id}/setting`);
history.push(`/${organizeDetail && organizeDetail.name}/group/${id}/setting`);
}
//
function disMissGroup(id){
@ -75,7 +75,12 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
return(
<div key={key}>
<p className="g-head">
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
{
(item.is_admin || item.is_member) ?
<Link to={`/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
:
<span className="color-grey-3 font-16">{item.nickname}</span>
}
<span>
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
@ -86,10 +91,10 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
{
item.users && item.users.map((i,k)=>{
return(
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
k < count ? <Link to={`/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
:
k === count ?
<Link to={`/organize/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
<Link to={`/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
:""
)
})

View File

@ -83,7 +83,7 @@ class ForkUsers extends Component {
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="show-user-link"
>
<img
@ -96,7 +96,7 @@ class ForkUsers extends Component {
<div className="ml12">
<div>
<Link
to={`/projects/${item.login}/${item.identifier}`}
to={`/${item.login}/${item.identifier}`}
className="font-16 text-primary task-hide max-w-200"
style={{display:"block"}}
title={item.name}

View File

@ -14,7 +14,7 @@ class UserList extends Component {
<div className="pbt25 grid-item mlr10 border-b-line">
<div>
<a
href={`/users/${item.login}`}
href={`/${item.login}`}
className="show-user-link"
>
<img
@ -27,7 +27,7 @@ class UserList extends Component {
<div className="ml12">
<div>
<Link
to={`/users/${item.login}`}
to={`/${item.login}`}
className="font-16 text-primary task-hide max-w-200"
style={{display:"block"}}
title={item.name}

View File

@ -103,7 +103,7 @@ export default Form.create()(
.then(result => {
if (result) {
showNotification("版本修改成功!");
history.push(`/projects/${owner}/${projectsId}/releases`);
history.push(`/${owner}/${projectsId}/releases`);
}
});
} else {
@ -116,7 +116,7 @@ export default Form.create()(
.then(result => {
if (result) {
showNotification("版本发布成功!");
history.push(`/projects/${owner}/${projectsId}/releases`);
history.push(`/${owner}/${projectsId}/releases`);
}
});
}
@ -233,7 +233,7 @@ export default Form.create()(
</Button>
<Button
onClick={() =>
history.push(`/projects/${owner}/${projectsId}/releases`)
history.push(`/${owner}/${projectsId}/releases`)
}
style={{
backgroundColor: "rgba(187,187,187,1)",

View File

@ -79,7 +79,7 @@ class version extends Component {
<span className="task-hide">{item.name}</span>
{
(isManager || isDeveloper) && type !==2 &&
<Link to={`/projects/${owner}/${projectsId}/releases/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
<Link to={`/${owner}/${projectsId}/releases/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
}
</span>
<span className="color-grey-3">
@ -114,7 +114,7 @@ class version extends Component {
<span className="font-18 color-grey-3">版本发布</span>
{
data && data.user_permission && type !== 2 ?
<Link to={`/projects/${owner}/${projectsId}/releases/new`} className="topWrapper_btn_new">+ 发布新版</Link>
<Link to={`/${owner}/${projectsId}/releases/new`} className="topWrapper_btn_new">+ 发布新版</Link>
: ''
}
</div>

View File

@ -126,7 +126,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
}
function goBack() {
history.push(`/projects/${owner}/${projectsId}/wiki`);
history.push(`/${owner}/${projectsId}/wiki`);
}
function changeModal(e) {

View File

@ -2,7 +2,7 @@ import React, { useEffect, useCallback, useState } from 'react';
import { Button, Dropdown, Icon, Input, Menu, Tooltip, Select, Upload, message, Spin } from 'antd';
import { getImageUrl, timeAgo } from 'educoder';
import cookie from 'react-cookies';
// import Loading from "../../Loading";
import CopyTool from '../Component/CopyTool';
import DelModal from './components/ModalFun';
import Welcome from './Welcome';
import { wikiPages, getWiki, deleteWiki } from './api';
@ -14,15 +14,12 @@ const InputGroup = Input.Group;
const { Option } = Select;
export default (props) => {
const { match, current_user, history, showNotification, project, projectDetail } = props;
// const permission = projectDetail && projectDetail.permission !== "Reporter";
const { match, history, showNotification, project, projectDetail } = props;
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
let projectsId = match.params.projectsId;
let owner = match.params.owner;
console.log(project);
const [fileArrInit, setFileArrInit] = useState(null);
const [checkItem, setCheckItem] = useState({});
const [itemDetail, setItemDetail] = useState({});
@ -85,7 +82,7 @@ export default (props) => {
DelModal({
title: '删除页面',
contentTitle: `您确定要删除“${item.name}”此页面吗?`,
content: '此操作将删除该页面,请进行确认以防文件的丢失',
content: '此操作将删除该页面,请进行确认以防文件的丢失',
onOk: () => {
deleteWiki({
owner: owner,
@ -106,30 +103,19 @@ export default (props) => {
function goUser(login) {
window.location.href = `/users/${login}`;
window.location.href = `/${login}`;
}
//
const copyUrl = useCallback(() => {
let wikiUrl = document.getElementById("wikiUrl");
wikiUrl.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
}
message.success('复制成功');
wikiUrl.blur();
}, [])
function addFile() {
history.push(`/projects/${owner}/${projectsId}/wiki/add`);
history.push(`/${owner}/${projectsId}/wiki/add`);
}
function goEdit() {
history.push(`/projects/${owner}/${projectsId}/wiki/edit/${encodeURI(checkItem.name)}`);
history.push(`/${owner}/${projectsId}/wiki/edit/${encodeURI(checkItem.name)}`);
}
function preview() {
window.open(`/projects/${owner}/${projectsId}/wiki/preview/${encodeURI(project.name)}/${project.id}`);
window.open(`/${owner}/${projectsId}/wiki/preview/${encodeURI(project.name)}/${project.id}`);
}
// MarkdownHtmlPdf
@ -231,6 +217,7 @@ export default (props) => {
<Button type="default" className="ml10">导出<Icon type="caret-down" /></Button>
</Dropdown>
<Button type="default" className="ml10" onClick={preview}>预览</Button>
</div>
</div>
@ -246,8 +233,8 @@ export default (props) => {
{
fileArr.map(item => {
return <div className="wiki-nav-title-parent">
<div className={`wiki-nav-title ${item.name === checkItem.name ? 'active' : ''}`} key={item.name} onClick={() => { setCheckItem(item) }}>
return <div className="wiki-nav-title-parent" key={item.name}>
<div className={`wiki-nav-title ${item.name === checkItem.name ? 'active' : ''}`} onClick={() => { setCheckItem(item) }}>
<div className="nav-title-left">
<i className="iconfont icon-wenjianjia2 mr3"></i>
<span className="nav-title-left-text">{item.name}</span>
@ -266,9 +253,7 @@ export default (props) => {
<Option value="SSH">SSH</Option>
</Select>
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
<Tooltip placement="bottom" title={'复制'}>
<i className="iconfont icon-fuzhiicon copy-svg" onClick={copyUrl}></i>
</Tooltip>
<CopyTool className="copy-wiki" inputId="wikiUrl" />
</InputGroup>}
</div>
@ -277,11 +262,11 @@ export default (props) => {
<div className="wiki-content-head">
<div className="wiki-content-head-left">
<h3 className="wiki-detail-title">{checkItem.name}</h3>
<span className="user-box mr10" onClick={() => { goUser(current_user.login) }}>
<span className="user-box mr10" onClick={() => { checkItem.commit && goUser(checkItem.commit.author.name) }}>
{itemDetail.image_url && <img alt="头像" className="head-log-small" src={getImageUrl(`/${itemDetail.image_url}`)} />}
<span >{checkItem.commit ? checkItem.commit.author.name : ''}</span>
<span >{itemDetail.userName}</span>
</span>
<span className="time-ago">上次修改于{checkItem.commit && timeAgo(checkItem.commit.author.when)}</span>
<span className="time-ago">上次修改于{checkItem.commit ? timeAgo(checkItem.commit.author.when):'刚刚'}</span>
</div>
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
</div>

View File

@ -199,7 +199,7 @@ body {
word-break: break-all;
}
.copy-svg {
.copy-wiki {
display: inline-flex;
align-items: center;
justify-content: center;

Some files were not shown because too many files have changed in this diff Show More