diff --git a/src/AppConfig.js b/src/AppConfig.js index 8434a70c..9bf5e095 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'p86402359' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 's' } function clearAllCookie() { cookie.remove('_educoder_session', { path: '/' }); diff --git a/src/forge/DevOps/Index.jsx b/src/forge/DevOps/Index.jsx index 1855da42..193276cf 100644 --- a/src/forge/DevOps/Index.jsx +++ b/src/forge/DevOps/Index.jsx @@ -10,40 +10,55 @@ const About = Loadable({ loader: () => import('./About'), loading: Loading, }) -const Infos = Loadable({ - loader: () => import('./Infos'), +const New = Loadable({ + loader: () => import('./disposePipeline'), + loading: Loading, +}) +const Dispose = Loadable({ + loader: () => import('./Dispose'), + loading: Loading, +}) +const Stucture = Loadable({ + loader: () => import('./Structure'), + loading: Loading, +}) +const Mould = Loadable({ + loader: () => import('./Mould'), loading: Loading, }) export default ((props)=>{ - const { projectsId , owner } = props.match.params; - const open_devops = props.projectDetail && props.projectDetail.open_devops; - // 工作流:两种状态进入的链接不同 - useEffect(()=>{ - if(open_devops !== undefined){ - if(open_devops){ - props.history.replace(`/projects/${owner}/${projectsId}/devops/list`); - }else{ - props.history.replace(`/projects/${owner}/${projectsId}/devops`); - } - } - },[open_devops]) return( - () + (p) => () } > - () + (p) => () + } + > + () + } + > + () + } + > + () } > () + (p) => () } > diff --git a/src/forge/Index.js b/src/forge/Index.js index f1e57cbc..58f61064 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -6,6 +6,7 @@ import { withRouter } from "react-router"; import { SnackbarHOC } from "educoder"; import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; +import Handbook from './Component/Handbook'; import "./css/index.scss"; import Loadable from "react-loadable"; @@ -13,7 +14,7 @@ import Loading from "../Loading"; import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC"; const ProjectNew = Loadable({ - loader: () => import("./New/Index"), + loader: () => import("./New/Index"), loading: Loading, }); const ProjectIndex = Loadable({ @@ -30,13 +31,18 @@ const Infos = Loadable({ loader: () => import("./users/Infos"), loading: Loading, }); - class Index extends Component { - render() { return (
+ + ( + + )} + > ( diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index 9fc39cae..c9665c77 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -145,7 +145,7 @@ class CoderRootCommit extends Component{ ) }) } - {commitDatas && commitDatas.length > 0 && } + {commitDatas && commitDatas.length === 0 && }
{ diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 759165de..e36c9a1e 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -251,7 +251,7 @@ class CoderRootDirectory extends Component { // readme文件内容 renderReadMeContent = (readMeContent, permission) => { const { fileDetail, readMeFile } = this.state; - if (fileDetail) { + if (fileDetail && fileDetail.length !== 0) { return; } if (readMeContent && readMeContent.length > 0) { diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index d86d694c..9886b7e2 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -115,22 +115,23 @@ const DevIndex = Loadable({ /** * permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外) */ -function checkPathname(pathname){ +function checkPathname(projectsId,owner,pathname){ let name = ""; - if(pathname){ - if(pathname.indexOf("/about")>-1){ + if(pathname && pathname !== `/projects/${owner}/${projectsId}`){ + let url = pathname.split(`/projects/${owner}/${projectsId}`)[1]; + if(url.indexOf("/about")>-1){ name="about" - }else if(pathname.indexOf("/issues")>-1 ||pathname.indexOf("Milepost") > 0){ + }else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){ name = "issues"; - }else if(pathname.indexOf("/pulls")>-1){ + }else if(url.indexOf("/pulls")>-1){ name="pulls" - }else if(pathname.indexOf("/milestones")>-1){ + }else if(url.indexOf("/milestones")>-1){ name="milestones" - }else if(pathname.indexOf("/activity")>-1){ + }else if(url.indexOf("/activity")>-1){ name="activity" - }else if(pathname.indexOf("/setting")>-1){ + }else if(url.indexOf("/setting")>-1){ name="setting" - }else if(pathname.indexOf("/devops")>-1){ + }else if(url.indexOf(`/devops`)>-1){ name="devops" } } @@ -369,6 +370,7 @@ class Detail extends Component { const url = `/${owner}/${projectsId}/sync_mirror.json`; axios.post(url).then(result => { if (result && result.data && result.data.status === 0) { + this.props.showNotification("镜像同步成功!"); this.getProject(2); } else { this.props.showNotification("镜像同步失败!"); @@ -399,9 +401,9 @@ class Detail extends Component { const url = this.props.history.location.pathname; const urlArr = url.split("/"); const urlFlag = (urlArr.length === 3); - let pathname = checkPathname(url); const { projectsId , owner } = this.props.match.params; + let pathname = checkPathname(projectsId,owner,url); const { state } = this.props.history.location; @@ -729,7 +731,7 @@ class Detail extends Component { (props) => () } > - () } diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 628e2358..3e721ebc 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -122,12 +122,12 @@ class MessageCount extends Component { SpinMerge: true, }); const { projectsId , owner } = this.props.match.params; - const { title, body, mergekey, pull_request } = this.state; - const url = `/${owner}/${projectsId}/pulls/${pull_request.id}/pr_merge.json`; + const { data, title, body, mergekey, pr_status } = this.state; + const url = `/${owner}/${projectsId}/pulls/${data.pull_request.id}/pr_merge.json`; axios .post(url, { project_id: projectsId, - id: pull_request.id, + id: data.pull_request.id, do: mergekey, body: body, title: title, @@ -255,11 +255,6 @@ class MessageCount extends Component { pull_request } = this.state; const { current_user, projectDetail } = this.props; - - const permission = projectDetail && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner" || projectDetail.permission === "Manager"); - const userLogin = current_user && current_user.login; - const operate = userLogin && projectDetail && pr_status === 0 && permission; - const menu = ( this.getOption(e)}> @@ -276,9 +271,11 @@ class MessageCount extends Component { ); - + const permission = projectDetail && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner" || projectDetail.permission === "Manager"); + const userLogin = current_user && current_user.login; + const operate = userLogin && projectDetail && pr_status === 0 && permission; return ( -
+
{data ? (
@@ -288,13 +285,13 @@ class MessageCount extends Component {
- { data.issue && data.issue.subject} + {data.issue.subject} - {pull_request && ( + {data.pull_request && ( {pr_status === 1 ? "已合并" @@ -308,10 +305,10 @@ class MessageCount extends Component {
- {pull_request.is_original ? pull_request.fork_project_user : data.issue.project_author_name}:{pull_request.head} + {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head} @@ -323,11 +320,11 @@ class MessageCount extends Component { {/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */} - {data.issue.project_author_name}:{pull_request.base} + {data.issue.project_author_name}:{data.pull_request.base}
diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js index cda25a5c..fdffad36 100644 --- a/src/forge/Settings/Collaborator.js +++ b/src/forge/Settings/Collaborator.js @@ -1,528 +1,53 @@ -import React, { Component } from "react"; -import { Link } from "react-router-dom"; -import { - Input, - AutoComplete, - Dropdown, - Menu, - Icon, - Spin, - Pagination, - Button, - Table, - Tooltip -} from "antd"; -import NoneData from "../Nodata"; -import axios from "axios"; -import { getImageUrl } from "educoder"; +import React, { useState } from "react"; import {WhiteBack} from '../Component/layout'; +import AddMember from '../Component/AddMember'; +import AddGroup from '../Component/AddGroup'; +import Member from './CollaboratorMember'; +import Group from './CollaboratorGroup'; -const { Search } = Input; +function Collaborator(props){ + const [ nav , setNav] = useState("1"); + const [ newId , setNewId] = useState(undefined); + const [ newGroupId , setNewGroupId] = useState(undefined); + const {projectsId ,owner} = props.match.params; -const { Option } = AutoComplete; -const MENU_LIST = [ - { - id: "Manager", - name: "管理员", - }, - { - id: "Developer", - name: "开发者", - }, - { - id: "Reporter", - name: "报告者", - }, -]; -const LIMIT = 15; -class Collaborator extends Component { - constructor(props) { - super(props); - this.state = { - listData: undefined, - user: undefined, - user_id: undefined, - userDataSource: undefined, - page: 1, - total_count: undefined, - isSpin: true, - searchKey: undefined, - search: undefined, - role: undefined, - otherSpin: false, - searchSpin: false, - roleName: undefined, - }; + const author = props.projectDetail && props.projectDetail.author; + + function getID(id){ + setNewId(id); } - componentDidUpdate=(prevPros)=>{ - if(prevPros && this.props && !this.props.checkIfLogin()){ - this.props.history.push("/403") - return - } + function getGroupID(id){ + setNewGroupId(id); } - componentDidMount = () => { - // this.check_is_login() - if (this.props.project_id) { - this.getMember(); - } - }; - - // check_is_login =() =>{ - // if(!this.props.checkIfLogin()){ - // this.props.history.push("/403") - // return - // } - // }; - - componentDidUpdate = (prevState) => { - if ( - this.props.project_id && - this.props.project_id !== prevState.project_id - ) { - this.getMember(); - } - }; - - // 获取项目协作者 - getMember = () => { - const { page, search, role } = this.state; - const {projectsId ,owner} = this.props.match.params; - const url = `/${owner}/${projectsId}/collaborators.json`; - axios - .get(url, { - params: { - page, - search: search, - role: role, - limit: LIMIT, - }, - }) - .then((result) => { - if (result) { - this.setState({ - listData: result.data.members, - isSpin: false, - otherSpin: false, - searchSpin: false, - total_count: result.data.total_count, - }); - } - }) - .catch((error) => { - this.setState({ - isSpin: false, - otherSpin: false, - searchSpin: false, - }); - console.log(error); - }); - }; - // 输入用户 - changeInputUser = (e) => { - this.setState({ - searchKey: e, - }); - this.getUserList(e); - }; - searchMember = (e) => { - this.state.search = e; - this.setState({ - searchSpin: true, - }); - this.getMember(); - }; - orderMember = (id, name) => { - this.setState({ - isSpin: true - }) - this.state.role = id; - this.state.roleName = name; - this.getMember(); - }; - // 选择用户 - selectInputUser = (e, option) => { - this.setState({ - user_id: e, - searchKey: option.props.searchValue, - }); - this.getUserList(option.props.searchValue); - }; - getUserList = (e) => { - const url = `/users/list.json`; - axios - .get(url, { - params: { - search: e, - }, - }) - .then((result) => { - if (result) { - this.setState({ - userDataSource: result.data.users, - }); - } - }) - .catch((error) => { - console.log(error); - }); - }; - - // 增加协作者 - addCollaborator = () => { - // const { project_id } = this.props; - const { user_id } = this.state; - if(user_id){ - this.setState({ - otherSpin: true, - }); - const {projectsId ,owner} = this.props.match.params; - const url = `/${owner}/${projectsId}/collaborators.json`; - axios.post(url, { - user_id, - }) - .then((result) => { - if (result) { - this.setState({ - isSpin: true, - otherSpin: false, - }); - this.getMember(); - } - }) - .catch((error) => { - this.setState({ - isSpin: false, - otherSpin: false, - }); - console.log(error); - }); - } - }; - - // 修改权限 - changeOperaiton = (e, id) => { - // const { project_id, page } = this.state; - this.setState({ - isSpin: true, - }); - const {projectsId ,owner} = this.props.match.params; - - const url = `/${owner}/${projectsId}/collaborators/change_role.json`; - axios - .put(url, { - user_id: id, - role: e.key, - }) - .then((result) => { - if (result) { - this.setState({ - isSpin: true, - }); - this.props.showNotification("权限修改成功!"); - this.getMember(); - } - }) - .catch((error) => { - this.setState({ - isSpin: false, - }); - console.log(error); - }); - }; - - // 删除协作者 - deleteUser = (id) => { - const { page } = this.state; - const {projectsId ,owner} = this.props.match.params; - this.props.confirm({ - content: "确认将此成员从项目中移除?", - onOk: () => { - const { project_id } = this.props; - const url = `/${owner}/${projectsId}/collaborators/remove.json`; - axios - .delete(url, { - data: { - user_id: id, - }, - }) - .then((result) => { - if (result) { - this.setState({ - isSpin: true, - }); - this.props.showNotification("成员删除成功!"); - this.getMember(); - } - }) - .catch((error) => { - this.setState({ - isSpin: false, - }); - console.log(error); - }); - }, - }); - }; - changePage = (page) => { - this.state.page = page; - this.setState({ - isSpin: true, - }); - this.getMember(); - }; - - render() { - const { - userDataSource, - listData, - isSpin, - page, - total_count, - searchKey, - otherSpin, - searchSpin, - roleName, - } = this.state; - // 获取当前项目的拥有者 - const { author } = this.props; - const get_color = (role) => { - if (role === "Manager") { - return "text-green"; - } else if (role === "Developer") { - return "text-primary"; - } else if(role === "Reporter"){ - return "text-yellow"; - }else{ - return "text-gray"; - } - }; - const member_roles = (item) => { - const operation = MENU_LIST.filter((i) => i.id === item.role); - return ( - - {author && author.login === item.login ? ( - - ) : - item.is_apply_signature ? - + + return ( + +
+ { + author && author.type === "Organization" ? + + setNav("1")}>协作者管理 + setNav("2")}>团队管理 + : - ( - - - {operation && operation[0].name} - - - - )} - - ); - }; - const roleTitle = ( -
角色 - -
管理员:拥有仓库设置功能、代码库读、写操作
-
开发人员:只拥有代码库读、写操作
-
报告者:只拥有代码库读操作
-
- }> - - -
- ); - const columns = [ - { - title: "头像", - dataIndex: "image_url", - render: (text, item) => ( - - - - - - ), - }, - { - title: "用户名", - dataIndex: "name", - render: (text, item) => ( - - {text} - - ), - }, - { - title: "邮箱", - dataIndex: "email", - render: (text) => {text}, - }, - { - title: "Token值", - dataIndex: "token", - render: (text) => {text}, - }, - { - title: roleTitle, - dataIndex: "role_name", - render: (text, item) => member_roles(item), - }, - { - title: "操作", - dataIndex: "action", - render: (text, item) => ( - - {author && author.login !== item.login && ( - this.deleteUser(item.id)} - > - 删除 - - )} - - ), - }, - ]; - const roles = (id) => ( - - this.orderMember(undefined, "角色筛选")} - > - 全部 - - {MENU_LIST.map((item, key) => { - return ( - this.orderMember(item.id, item.name)} - > - {item.name} - - ); - })} - - ); - const setRoles = (id) => ( - - {MENU_LIST.map((item, key) => { - return ( - this.changeOperaiton(e,id)} - > - {item.name} - - ); - })} - - ); - - const source = - userDataSource && - userDataSource.map((item, key) => { - return ( - - ); - }); - return ( - -
协作者管理 -
- - -
-
-
- this.searchMember(value)} - /> - - - {roleName ? roleName : "角色筛选"} - - - -
- - -
- {listData && listData.length>0 ? ( - record.id} - >
- ) : ( - - )} -
-
- {total_count && total_count > LIMIT ? ( -
- -
- ) : ( - "" - )} -
- ); - } + } + { + nav === "1" ? + + : + + } +
+
+ { + nav === "1" ? + + : + + } +
+ + ); } export default Collaborator; diff --git a/src/forge/Settings/CollaboratorMember.jsx b/src/forge/Settings/CollaboratorMember.jsx index fa307a97..d556b6ab 100644 --- a/src/forge/Settings/CollaboratorMember.jsx +++ b/src/forge/Settings/CollaboratorMember.jsx @@ -166,7 +166,11 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification - ) : ( + ) + : + item.is_apply_signature ? + + :( {operation && operation[0].name} @@ -262,13 +266,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification {total > LIMIT ?
- setPage(page)} - > + setPage(page)}/>
:""} diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index f33a3f10..0965d27a 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -137,7 +137,7 @@ class Infos extends Component { render() { - const { current_user, mygetHelmetapi } = this.props; + const { current_user, main_web_site_url } = this.props; const { username } = this.props.match.params; const { user, isSpin, project_type, route_type } = this.state; @@ -167,7 +167,7 @@ class Infos extends Component {
); } } diff --git a/src/modules/login/LoginDialog.js b/src/modules/login/LoginDialog.js index 47fad4b1..bd57e094 100644 --- a/src/modules/login/LoginDialog.js +++ b/src/modules/login/LoginDialog.js @@ -580,9 +580,9 @@ class LoginDialog extends Component { - this.getloginurl("http://39.105.176.215/account/lost_password")} + this.getloginurl("https://osredm.com/account/lost_password")} className="mr3 color-grey-9">找回密码 - this.getloginurl("http://39.105.176.215/user_join")} className="color-grey-9">注册 + this.getloginurl("https://osredm.com/user_join")} className="color-grey-9">注册

diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 5c2ac829..f133e911 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -13,9 +13,12 @@ import 'antd/lib/radio/style/index.css'; import 'antd/lib/input/style/index.css'; import './TPMIndex.css'; import logo from './images/logo.png'; -import { result } from 'lodash'; const $ = window.$ +// TODO 这部分脚本从公共脚本中直接调用 +const { Search } = Input; +let old_url; + window._header_componentHandler = null; // 非trustie链接则新开页跳转 const str = ['www.trustie.net','forgeplus.trustie.net','forum.trustie.net','testforgeplus.trustie.net'] @@ -46,7 +49,7 @@ class NewHeader extends Component { headtypess: "/", mygetHelmetapi2: null, goshowqqgtounp: false, - visiblemyss: false + visiblemyss: false, } } componentDidMount() { @@ -93,6 +96,10 @@ class NewHeader extends Component { this.setState({ user: newProps.user }) + if (newProps.Headertop !== undefined) { + old_url = newProps.Headertop.old_url + } + } getCookie = (key) => { var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)'); @@ -388,7 +395,6 @@ class NewHeader extends Component { } inputjoinclassvalue = (e) => { - console.log(e.target.value.length); if (e.target.value.length >= 7) { this.openNotification("请输入6位项目邀请码!"); return @@ -546,6 +552,8 @@ class NewHeader extends Component { axios.get(url).then((response) => { if (response && response.data) { this.setState({ mygetHelmetapi2: response.data.setting }); + // localStorage.setItem('chromesetting', JSON.stringify(response.data.setting)); + // localStorage.setItem('chromesettingresponse', JSON.stringify(response)); try { if (response.data.setting.tab_logo_url) { this.gettablogourldata(response); @@ -602,7 +610,7 @@ class NewHeader extends Component { headtypesonClickbool, headtypess, mygetHelmetapi2, - goshowqqgtounp + goshowqqgtounp, } = this.state; /*用户名称 用户头像url*/ let activeIndex = false; @@ -705,7 +713,7 @@ class NewHeader extends Component { mygetHelmetapi2 && mygetHelmetapi2.nav_logo_url ? 可控开源社区 : - 可控开源社区 + "" }
@@ -753,10 +761,11 @@ class NewHeader extends Component {
{ coursestypes === true && this.props.user && this.props.user.main_site === false ? "" : -
    -
  • 新建镜像项目
  • -
  • 新建托管项目
  • -
+
    +
  • 新建镜像项目
  • +
  • 新建托管项目
  • +
  • 新建组织
  • +
}
@@ -825,33 +834,17 @@ class NewHeader extends Component {