diff --git a/src/AppConfig.js b/src/AppConfig.js index cf7fe8b6a..9c5fbfd40 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 || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index d7c00fbb4..476a4ed31 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -47,7 +47,7 @@ function NewsDetail(props){

{detail.name}

diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 91bc4ef21..9915ade4e 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -63,7 +63,7 @@ function CoderDepot(props){ branchName = returnbar(branchName); const details = props.projectDetail; let pathname = props.history.location.pathname; - const { platform } = props ; + const { platform , mirror_status } = props ; //distribution:判断此用户是否可以创建发行版 const distribution = details && details.type !== 2 && ( details.permission && details.permission !== "Reporter"); const { bannerList } = props; @@ -93,7 +93,7 @@ function CoderDepot(props){ useEffect(()=>{ - if(details){ + if(details && mirror_status!==2){ setProjectDetail(details); setTopics(details.topics); setDesc(details.description); @@ -102,7 +102,7 @@ function CoderDepot(props){ setDefaultBranch(details.default_branch); setInviteCode(details.invite_code); } - },[details]) + },[details,mirror_status]) useEffect(()=>{ // 设置网页标题 @@ -126,7 +126,7 @@ function CoderDepot(props){ },[treeValue]) useEffect(()=>{ - if (projectsId && owner && defaultBranch){ + if (projectsId && owner && defaultBranch && mirror_status!==2){ let b = turnbar(branchName) ; if(pathname.indexOf(`/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) { let url = pathname.split(`/tree/${b}/`)[1]; @@ -139,10 +139,10 @@ function CoderDepot(props){ setType("dir"); } } - },[projectsId,owner,pathname,defaultBranch]) + },[projectsId,owner,pathname,defaultBranch,mirror_status]) useEffect(()=>{ - if(platform){ + if(platform && mirror_status!==2){ setReadOnly(props.history.location.search.indexOf('edit') !== -1); axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{ if(result && result.data){ @@ -154,7 +154,7 @@ function CoderDepot(props){ } }) } - },[platform]) + },[platform,mirror_status]) // 获取readme信息 function getReadmeInfo(path, ref) { @@ -390,10 +390,10 @@ function CoderDepot(props){ const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin)); return( - setOpenModal(false)} onOk={okUpdate}/> + {mirror_status !== 2 && setOpenModal(false)} onOk={okUpdate} showNotification={props.showNotification}/> } { - (dirInfo || fileInfo) && + ((dirInfo || fileInfo) && mirror_status!==2 ) &&
{ - props && props.platform ? + props && (props.platform && mirror_status !== 2) ? } {/* 贡献者 */} - + {mirror_status !==2 && } {/* 语言 */} - + { mirror_status !== 2 && } } diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 8f4e41887..4ce2d4181 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -192,12 +192,14 @@ class Detail extends Component { // 非本平台项目 platform: false, - mirror_status:1 + mirror_status:2 } } componentDidMount = () => { + const { mirror_status } = this.state + this.props.showNotification("getProject getProject getProject",mirror_status); this.getProject(); let history = this.props.location; this.clearIssueCookies(history); @@ -262,14 +264,16 @@ class Detail extends Component { } else if (result.data.mirror_status === 2) { this.deleteProjectBack(); this.setState({ - mirror_status:2 + mirror_status:2, + firstSync: false }) } else { this.getBanner(); this.getDetail(); this.setState({ firstSync: false, - secondSync: false + secondSync: false, + mirror_status:0 }) } } @@ -860,7 +864,7 @@ class Detail extends Component { > (mirror_status!==2 ? :) + (props) => } > diff --git a/src/forge/Main/sub/UpdateDescModal.jsx b/src/forge/Main/sub/UpdateDescModal.jsx index 0043b865a..a2f9ade4a 100644 --- a/src/forge/Main/sub/UpdateDescModal.jsx +++ b/src/forge/Main/sub/UpdateDescModal.jsx @@ -4,7 +4,7 @@ import "./sub.scss"; import axios from 'axios'; import { useState } from 'react'; const { TextArea } = Input; -function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url, topicsInfo}){ +function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url, topicsInfo,showNotification}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; const [topics, setTopics] = useState(undefined); diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 8ade2df05..6502016a0 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -53,7 +53,10 @@ class Index extends Component { licenseFlag:false, // 区块链确权 - tokenConTri: false + tokenConTri: false, + + gitHubUrl:false, + checkToken:undefined } } componentDidMount = () => { @@ -203,7 +206,9 @@ class Index extends Component { isSpin: true }) const { projectsType } = this.props.match.params; - const { project_language_id, project_category_id, license_id, ignore_id, owners_id, ignoreFlag, licenseFlag, categoreFlag, languageFlag, tokenConTri} = this.state; + const { project_language_id, project_category_id, license_id + , ignore_id, owners_id, ignoreFlag, licenseFlag, + categoreFlag, languageFlag, tokenConTri,gitHubUrl} = this.state; const decoderPass = Base64.encode(values.password); const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json"; // 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值 @@ -220,7 +225,8 @@ class Index extends Component { user_id:owners_id, blockchain: tokenConTri, blockchain_token_all: 10000, - blockchain_init_token: parseInt(blockchain_init) + blockchain_init_token: parseInt(blockchain_init), + auth_token:gitHubUrl ? values.auth_token : undefined }).then((result) => { if (result && result.data.id) { projectsType && projectsType !== "mirror" && this.props.showNotification(`项目创建成功!`); @@ -235,6 +241,7 @@ class Index extends Component { }) }) } else { + window.scrollTo(0,0); this.setState({ isSpin: false }) @@ -301,6 +308,9 @@ class Index extends Component { repository_name:first }) } + this.setState({gitHubUrl:value.indexOf("https://github.com")>-1 ? true : false}) + }else{ + this.setState({gitHubUrl:false,checkToken:undefined}) } } @@ -344,6 +354,29 @@ class Index extends Component { } } + + blurFunc=(e)=>{ + let value = e.target.value; + if(value){ + const { clone_addr } = this.props.form.getFieldsValue(); + if(clone_addr){ + const u = `/projects/verify_auth_token.json`; + axios.post(u,{ + auth_token:value, + clone_addr + }).then(response=>{ + if(response && response.data){ + this.setState({ + checkToken:response.data.data + }) + } + }).catch(error=>{}) + } + }else{ + this.setState({checkToken:undefined}) + } + } + render() { const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 @@ -372,7 +405,9 @@ class Index extends Component { licenseFlag, languageFlag, categoreFlag, - tokenConTri + tokenConTri, + gitHubUrl, + checkToken } = this.state; return (
@@ -381,7 +416,6 @@ class Index extends Component {
- { projectsType && projectsType === "mirror" && @@ -398,7 +432,7 @@ class Index extends Component { )} -

示例:https://github.com/Stability-AI/StableStudio.git

+

示例:https://github.com/Stability-AI/StableStudio.git

} { @@ -406,10 +440,32 @@ class Index extends Component {

需要授权验证 - 如果导入项目为私有仓库,则必须填写相应平台正确的用户名和密码 + + 如果导入项目为私有仓库,{gitHubUrl ? `则需输入目标平台用户token进行授权,`:"则必须填写相应平台正确的用户名和密码"} + {gitHubUrl && 如何获取token?} +

{ - mirrorCheck && + mirrorCheck && gitHubUrl && +
+ Token + + + {getFieldDecorator('auth_token')( + + )} + + + { checkToken === false && } + { checkToken === true && } + +
+ } + { + mirrorCheck && !gitHubUrl &&
用户名 @@ -447,19 +503,26 @@ class Index extends Component { {getFieldDecorator('user_id', { rules: [{ required: true, message: '请选择拥有者' - },{ - validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者') }], })( - this.ChangePlatform(value, e, 'owners', OwnerList)} className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, OwnerList, "owners")} + optionFilterProp="children" + filterOption={(input, option) => + option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } > - {owners_list} - + {OwnerList && OwnerList.length > 0 && + OwnerList.map((i,k)=>{ + return( + + ) + }) + } + )} / @@ -681,4 +744,6 @@ class Index extends Component { } } const WrappedIndexForm = Form.create({ name: 'NewWorkForm' })(Index); -export default WrappedIndexForm; \ No newline at end of file +export default WrappedIndexForm; + + diff --git a/src/forge/New/new.scss b/src/forge/New/new.scss index 15aca70b2..8432cecdf 100644 --- a/src/forge/New/new.scss +++ b/src/forge/New/new.scss @@ -11,6 +11,12 @@ font-size: 1.6em; border-bottom: 1px solid #f0f0f0 } +.token_box{ + align-items: center; +} +.token_box .ant-form-explain{ + position: absolute; +} .newPanel_content{ padding:2rem; } @@ -25,7 +31,7 @@ min-width: 280px; } .newPanel_content .ant-select-selection{ - height: 37px; + height: 35px; } .newPanel_content .ant-select-selection__rendered,.newPanel_content input{ height: 35px; diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index 125d7c362..ae2ad19be 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -34,7 +34,6 @@ class m_editor extends Component { render() { const { editorValue, changeValue } = this.state; - console.log("editorValue:",editorValue) const { readOnly, editorType,onEmpty,filename,empty, currentBranch, descName, checkName, detail, match: { params },filepath,ideTheme } = this.props; const editor_options = { lineNumbers: "on", diff --git a/src/forge/SecuritySetting/cla/DeleteBox.jsx b/src/forge/SecuritySetting/cla/DeleteBox.jsx index 45514fdce..d6ae99032 100644 --- a/src/forge/SecuritySetting/cla/DeleteBox.jsx +++ b/src/forge/SecuritySetting/cla/DeleteBox.jsx @@ -1,4 +1,4 @@ -import React , { useState , useEffect } from 'react'; +import React from 'react'; import { AlignCenter } from '../../Component/layout'; import Modals from '../../Component/PublicModal/Index'; import { Button } from 'antd'; @@ -12,14 +12,14 @@ function DeleteBox({visible , onCancel,onSuccess,pr_need}){ btn={
- +
} >
确定解除协议吗? - { pr_need &&

您解除协议后,后续提交的合并请求对项目成员将不再可见(已存在的不会受影响)

} + { pr_need &&

您解除协议后,提交的合并请求对项目成员将不再可见(已存在的开启的合并请求也将被隐藏)

}
) diff --git a/src/forge/SecuritySetting/cla/Index.jsx b/src/forge/SecuritySetting/cla/Index.jsx index a93c9afa9..7a98fa6c1 100644 --- a/src/forge/SecuritySetting/cla/Index.jsx +++ b/src/forge/SecuritySetting/cla/Index.jsx @@ -1,6 +1,6 @@ import React,{useEffect,useState} from 'react'; import './index.scss'; -import logo from '../img/cla-logo.png'; +import logo from '../img/icon.svg'; import { Link } from 'react-router-dom'; import { Button , Spin } from 'antd'; import Nodata from '../../Nodata'; @@ -14,6 +14,9 @@ function Index(props){ const [ visible , setVisible ] = useState(false); const [ cancelKey , setCancelKey ] = useState(undefined); const [ pr_need , setPr_need ] = useState(true); + useEffect(()=>{ + document.title = "我的CLA"; + },[]) useEffect(()=>{ if(current_user && current_user.user_id){ diff --git a/src/forge/SecuritySetting/img/cla-logo.png b/src/forge/SecuritySetting/img/cla-logo.png index d5b3ebb59..d9a35de0b 100644 Binary files a/src/forge/SecuritySetting/img/cla-logo.png and b/src/forge/SecuritySetting/img/cla-logo.png differ diff --git a/src/forge/SecuritySetting/img/icon.svg b/src/forge/SecuritySetting/img/icon.svg new file mode 100644 index 000000000..121d52f4d --- /dev/null +++ b/src/forge/SecuritySetting/img/icon.svg @@ -0,0 +1,13 @@ + + + + + + + + CLA + + + + + diff --git a/src/forge/Team/New.jsx b/src/forge/Team/New.jsx index 16247e7b4..db4bf1451 100644 --- a/src/forge/Team/New.jsx +++ b/src/forge/Team/New.jsx @@ -45,7 +45,7 @@ export default Form.create()( } const url = `/organizations.json`; axios.post(url,{ - ...values,image + ...values,image,visibility:"common" }).then(result=>{ if(result && result.data){ showNotification("组织创建成功!"); @@ -121,7 +121,7 @@ export default Form.create()( [], ,false )} - {helper( + {/* {helper( '可见性', "visibility", [{ required: true, message: "请选择可见性" }], @@ -130,7 +130,7 @@ export default Form.create()( 受限(仅对登录用户可见) 私有(仅对组织成员可见) - )} + )} */}

选择头像

diff --git a/src/forge/Team/RightBox.jsx b/src/forge/Team/RightBox.jsx index 4e75fe666..6a05d6214 100644 --- a/src/forge/Team/RightBox.jsx +++ b/src/forge/Team/RightBox.jsx @@ -27,6 +27,10 @@ const ListName = styled.div`{ margin-bottom:8px; height:18px; line-height:18px; + width:210px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; }`; const ColorListName = styled.div`{ color:rgba(31, 35, 41, 1); @@ -34,6 +38,10 @@ const ColorListName = styled.div`{ margin-bottom:8px; height:18px; line-height:18px; + width:230px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; }` const Img = styled.img`{ border-radius:50%; diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index d16f15037..d1ff67c0f 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -58,7 +58,7 @@ export default Form.create()( if(!error){ const url = `/organizations/${organizeDetail.id}.json`; axios.patch(url,{ - ...values,image:imageFlag ? image : undefined + ...values,image:imageFlag ? image : undefined,visibility:"common" }).then(result=>{ if(result && result.data){ showNotification("组织信息更新成功!"); @@ -172,7 +172,7 @@ export default Form.create()( [], )} - {helper( + {/* {helper( '可见性:', "visibility", [], @@ -181,7 +181,7 @@ export default Form.create()( 受限(仅对登录用户可见) 私有(仅对组织成员可见) - )} + )} */} {helper( '权限:', "repo_admin_change_team_access", diff --git a/src/forge/Team/Setting/TeamSettingIndex.jsx b/src/forge/Team/Setting/TeamSettingIndex.jsx index 00b1f1f79..91db1156b 100644 --- a/src/forge/Team/Setting/TeamSettingIndex.jsx +++ b/src/forge/Team/Setting/TeamSettingIndex.jsx @@ -42,7 +42,6 @@ export default (( props )=>{ const pathname = props.location.pathname; const OIdentifier = props.match.params.OIdentifier; const {organizeDetail} = props; - console.log(organizeDetail); useEffect(()=>{ if(organizeDetail){ const {nickname} = organizeDetail; diff --git a/src/forge/Team/Setting/cla/CLAinfos.jsx b/src/forge/Team/Setting/cla/CLAinfos.jsx index 5a69cb9fd..3896f0cf2 100644 --- a/src/forge/Team/Setting/cla/CLAinfos.jsx +++ b/src/forge/Team/Setting/cla/CLAinfos.jsx @@ -1,13 +1,13 @@ import React,{ forwardRef, useState , useEffect } from 'react'; import '../teamSetting.scss'; import RenderHtml from '../../../../components/render-html'; -import { Button , Form , Input} from 'antd'; -import Cla from '../../images/cla.png'; +import { Button , Form , Input , Spin } from 'antd'; +import { getImageUrl } from 'educoder'; import axios from 'axios'; function CLAinfos(props){ - const { form , current_user } = props; + const { form , current_user , showLoginDialog } = props; const { getFieldDecorator , validateFields , setFieldsValue , getFieldsValue} = form; const OIdentifier = props.match.params.OIdentifier; @@ -15,9 +15,17 @@ function CLAinfos(props){ const [ details, setDetails ] = useState(undefined); + useEffect(()=>{ + if(current_user && current_user.email){ + setFieldsValue({ + email:current_user.email + }) + } + },[current_user,details]) + useEffect(()=>{ if(current_user &&!current_user.login){ - props.history.push(`/login`); + props.history.push(`/login?go_page=/${OIdentifier}/cla/${claid}`); } },[current_user]) @@ -32,6 +40,7 @@ function CLAinfos(props){ axios.get(url).then(response=>{ if(response && response.data){ setDetails(response.data); + document.title = `${response.data.name}`; } }).catch(error=>{}) } @@ -42,10 +51,12 @@ function CLAinfos(props){ const url = `/users/${current_user && current_user.user_id}/clas.json`; axios.post(url,{ ...values, - cla_id:details && details.id + cla_id:details && details.id, + email:(current_user && current_user.email) || values.email }).then(response=>{ if(response && response.data){ props.showNotification('协议签署成功!'); + window.scrollTo(0,0); getDetails(); } }).catch(error=>{}) @@ -54,11 +65,11 @@ function CLAinfos(props){ } return( - details && + details ?
- +

{details.name}

{details.organization && details.organization.nickname}

@@ -87,7 +98,7 @@ function CLAinfos(props){ {getFieldDecorator("email",{ rules:[{ required: true, message: "请输入签署邮箱" }] })( - + )}
@@ -96,6 +107,8 @@ function CLAinfos(props){ }
+ : +
) } export default Form.create()(forwardRef(CLAinfos)) \ No newline at end of file diff --git a/src/forge/Team/Setting/cla/TeamSettingCLA.jsx b/src/forge/Team/Setting/cla/TeamSettingCLA.jsx index aaab6c953..a207f0c81 100644 --- a/src/forge/Team/Setting/cla/TeamSettingCLA.jsx +++ b/src/forge/Team/Setting/cla/TeamSettingCLA.jsx @@ -1,7 +1,7 @@ import React,{ useState , useEffect } from 'react'; import Title from '../../../Component/Title'; import defaultimg from '../../images/cla-icon-big.png'; -import Logo from '../../images/cla-logo.png'; +import Logo from '../../images/icon.svg'; import { Button, Spin } from 'antd'; import axios from 'axios'; @@ -40,7 +40,7 @@ function TeamSettingCLA(props){

{list.name}

签署人数{list.count || 0}
- +
diff --git a/src/forge/Team/Setting/cla/TeamSettingCLAEdit.jsx b/src/forge/Team/Setting/cla/TeamSettingCLAEdit.jsx index 170fbaa34..a7d956593 100644 --- a/src/forge/Team/Setting/cla/TeamSettingCLAEdit.jsx +++ b/src/forge/Team/Setting/cla/TeamSettingCLAEdit.jsx @@ -75,7 +75,7 @@ forwardRef((props)=>{ function checkKeyReg(rule, value, callback){ let reg = /^[a-zA-Z0-9][a-zA-Z0-9_]*[a-zA-Z0-9]+$/g if(value && !reg.test(value)){ - callback("协议标识只能以数字、字母开头结尾,可包含下划线"); + callback("协议标识长度2-30,只能以数字、字母开头结尾,可包含下划线"); } callback(); } @@ -103,7 +103,7 @@ forwardRef((props)=>{ { validator: checkKeyReg } ] })( - + )} diff --git a/src/forge/Team/Setting/teamSetting.scss b/src/forge/Team/Setting/teamSetting.scss index bdcdae7c0..6f5a21bc6 100644 --- a/src/forge/Team/Setting/teamSetting.scss +++ b/src/forge/Team/Setting/teamSetting.scss @@ -65,7 +65,7 @@ margin:0px auto; width: 1200px; &>img{ - width: 116px; + height: 94px; margin-right: 32px; border-radius: 4px; } diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index ab4c049ff..eedce64b2 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -6,7 +6,6 @@ import { setSeoMeta } from "educoder"; import Cards from '../../Component/Cards'; import axios from 'axios'; import '../Index.scss'; - const GroupDetails = Loadable({ loader: () => import("../Group/GroupDetails"), loading: Loading, @@ -40,6 +39,9 @@ function Detail(props){ if(pathname){ if(pathname.indexOf(`/${OIdentifier}/setting`)>-1){ setFlag(false); + if(detail && !detail.is_admin ){ + props.history.push("/nopage"); + } }else{ setFlag(true); } @@ -49,7 +51,7 @@ function Detail(props){ setButtonflagFlag(false); } } - },[pathname]) + },[pathname,detail]) useEffect(()=>{ if(OIdentifier){ @@ -134,12 +136,14 @@ function Detail(props){ return }} > - { - return - }} - > + + { + return + }} + > + { diff --git a/src/forge/Team/images/cla-logo.png b/src/forge/Team/images/cla-logo.png index d5b3ebb59..d9a35de0b 100644 Binary files a/src/forge/Team/images/cla-logo.png and b/src/forge/Team/images/cla-logo.png differ diff --git a/src/forge/Team/images/icon.svg b/src/forge/Team/images/icon.svg new file mode 100644 index 000000000..121d52f4d --- /dev/null +++ b/src/forge/Team/images/icon.svg @@ -0,0 +1,13 @@ + + + + + + + + CLA + + + + +