From 2997ff85178bdb8e2062955c37c3840b71b89874 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 13 Mar 2025 09:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=BA=90=E8=AE=B8=E5=8F=AF=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/FileName/index.jsx | 3 +- .../licenseModal/dorpChooseMenus.jsx | 54 ++++++++ .../Component/licenseModal/img/license.png | Bin 0 -> 16544 bytes .../Component/licenseModal/img/search.png | Bin 0 -> 1070 bytes src/forge/Component/licenseModal/index.jsx | 57 ++++++++ src/forge/Component/licenseModal/index.scss | 126 ++++++++++++++++++ src/forge/Component/licenseModal/list.jsx | 52 ++++++++ src/forge/Issues/Component/drop.jsx | 4 +- src/forge/Main/CoderDepot.jsx | 28 +++- src/forge/New/Index.js | 110 +++++---------- src/forge/New/new.scss | 1 + src/forge/Newfile/Index.js | 86 +++++++++++- src/forge/Newfile/UserSubmitComponent.js | 22 ++- src/forge/Newfile/m_editor.js | 5 +- src/forge/Settings/Setting.js | 108 +++++++++------ 15 files changed, 520 insertions(+), 136 deletions(-) create mode 100644 src/forge/Component/licenseModal/dorpChooseMenus.jsx create mode 100644 src/forge/Component/licenseModal/img/license.png create mode 100644 src/forge/Component/licenseModal/img/search.png create mode 100644 src/forge/Component/licenseModal/index.jsx create mode 100644 src/forge/Component/licenseModal/index.scss create mode 100644 src/forge/Component/licenseModal/list.jsx diff --git a/src/forge/Component/FileName/index.jsx b/src/forge/Component/FileName/index.jsx index 1933cf91d..b22caec5b 100644 --- a/src/forge/Component/FileName/index.jsx +++ b/src/forge/Component/FileName/index.jsx @@ -3,7 +3,7 @@ import { Input } from 'antd'; import './index.scss'; function FileName({ -onChangeFile,addonBefore , name , empty , onEmpty +onChangeFile,addonBefore , name , empty , onEmpty , readOnly }){ const [ defaultUrl , setDefaultUrl ] = useState(undefined); const [ newUrl , setNewUrl ] = useState([]); @@ -115,6 +115,7 @@ onChangeFile,addonBefore , name , empty , onEmpty onKeyUp={keyUpFun} onChange={changeValue} style={{width:"220px",borderColor:empty===true ? "red":"grey"}} + disabled={readOnly} /> {empty &&

请输入文件名称

} diff --git a/src/forge/Component/licenseModal/dorpChooseMenus.jsx b/src/forge/Component/licenseModal/dorpChooseMenus.jsx new file mode 100644 index 000000000..5217d0540 --- /dev/null +++ b/src/forge/Component/licenseModal/dorpChooseMenus.jsx @@ -0,0 +1,54 @@ +import React,{useEffect,useState,useRef} from 'react'; +import { Input } from 'antd'; +import Drop from '../../Issues/Component/drop'; +import "./index.scss"; +import ListItem from './list'; + +/*** + * list:下拉内容列表 + * name:所用内容名字,新建页面:.gitignore、许可证、类别、语言,项目基本设置:类别、语言 + * value:选中id + * getValue:点击确定 + * idname:下拉内容定位的父元素 + */ +function DorpChooseMenus({list,name,value,getValue,idname}){ + const dropRef = useRef(null); + const [ choose , setChoose ] = useState(undefined); + const [ defaultValue , setDefaultValue ] = useState(undefined); + + useEffect(()=>{ + if(value){ + setChoose({name:value}); + setDefaultValue(value) + } + },value) + + const panel=()=>{ + return( +
+ + 确定 +
+ ) + } + function chooseFunc(value){ + setChoose(value); + } + + function sureFunc(){ + getValue(choose); + dropRef.current && dropRef.current.clearVisible(false); + } + return( + + + + ) +} +export default DorpChooseMenus; \ No newline at end of file diff --git a/src/forge/Component/licenseModal/img/license.png b/src/forge/Component/licenseModal/img/license.png new file mode 100644 index 0000000000000000000000000000000000000000..d66dc80adea0042612fb7f7de277c68622fae9ff GIT binary patch literal 16544 zcmY+sbzECd&^L-hOL2!5C|=y%ot7eP@nXeGaS873Qrx9L(Nf$J+?@hNQ=H%uB!PsR z-}AoD{oMOclHGH5cFvyJk?+hVR!2*X;5qGcG&D2<4Rz%YXlUqxsNYaL9MmVE@%9Gw zh3@e|O%bhr`XvMnjS)>lS>cn9*=Zndz{|xJB)}H1Xfx41h_mkWEv^fK#s8X*k1z5n z1UDk&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gF(kS=;YsKPI!5 zq2G7sT!n{*yOQ#a9t;lcq@8D8<3K{j)AYM@o<|_&=N)^B{Aj6wD`d~mGq)`9o@wfP9uEkBJF`-MicNC^4_E6gn_XF9_!JJr>d2bd^`VG2a=%gNCP}_Yj zHz0mzNX$(w-m2|n((EyGmiKJ6Zd2l}1T*)7={dQ;*zwTz&kW zy%C1Y+pVQm8rjJInC=M2KX#6LipXJmjHrp}b4~D;|4PVU(JR`Fhc)ns{y~}w|)>dwj2oB+Z*yO uVM>3|t7H*zxg7cKw_cFmo<26d literal 0 HcmV?d00001 diff --git a/src/forge/Component/licenseModal/img/search.png b/src/forge/Component/licenseModal/img/search.png new file mode 100644 index 0000000000000000000000000000000000000000..9687212e6b687e617b60426190f11cc292a5330e GIT binary patch literal 1070 zcmV+}1kwA6P)Px&=t)FDR9HvNSWQwIK@|QTRv^2W6R0N$o*-ByRCa+AsJp;MZlIh%+<-gf1d?3} zQYD^1IDvYCkY$EsUgkC3V^1>!!;h)-hGM$=_1E9~`n}gpSh5vsoF~Q+19_QBgo6As zFa~3&%n`Z(?)xp8{$H|Dn(>7?Z)ZK61`F2-*iJJ?jbS_mKj*zRbyCk!dz#Zyfnkh< zB?Xr7A=ccI;1WT7`og<^GPot}Cbe*a6~ zH_sjy3+nI-7ibE|c2&d6qPfVRZCn8QgmVy%!tabHCRFC>Z3dJ8%4Be785w05%RH?@2ftJrSy(2G&g4u|u%$#DCMfe|8r~yv;ExIv%im76ae+WwwhbB4fT5dZg;95^y zn<0A>&ME)eYmvk?)kx(s;6ZCCBJN_1p8`-j(zlL|k{GqU&}&hsZvoXL;MAotm{1Pf zcB{TK?)z<0iFcFDUK@-`uT7H3LAGzbEZ$qLiv_z$P>u^jEk{7v6dqQ&o*`VgI@=^D zm4-5S)Ly#mx2Ud|D%F^^o<;$Eszx$RcJlizhU*;vMVm0|+Y$*uy_RlP0#&T?SfXoO z5L;w$6aBGF*+RE9wTT56*|5VA123AgLD}hLk-<&$+hHfr_si)sr_7C0n^<&_jZ&3w zOaW*I=V(L+BH@0K(RKSvRel6vSL{S0x_q$H$-i=8#C1;XW)gCkc;O6KmyM+PHcM_^ z4U?eF76bdMUL@0OBBJA%ylR88%arjXi@n!~U~P{ + visible && getLicenses(); + },[visible]) + + + const getLicenses = () => { + const url = `/licenses.json`; + axios.get(url).then((result) => { + if (result) { + setList(result.data.licenses); + } + }).catch((error) => { }) + } + + function chooseFunc(value){ + setChoose(value); + } + + + return( + +

+
+

了解开源许可证

+
+ +
+

开源许可证是您软件源代码使用、修改及分发的法律约定,明确了他人使用项目的权利与限制,常见的有MIT、Apache 2.0、GPL等。

+

请从推荐列表中选择适合的协议,或根据高级项目需求自定义创建您的许可证。

+
createDefaultLicense(-1)}>创建自定义许可证 +
+ +
+ + createDefaultLicense(choose && choose.id)}>使用该许可证 +
+
+ + ) +} +export default Index \ No newline at end of file diff --git a/src/forge/Component/licenseModal/index.scss b/src/forge/Component/licenseModal/index.scss new file mode 100644 index 000000000..ee2180f94 --- /dev/null +++ b/src/forge/Component/licenseModal/index.scss @@ -0,0 +1,126 @@ +.licenseBox{ + display: flex; + .licenseDesc{ + background: #FBFCFF; + border-radius: 11px 11px 11px 11px; + border: 1px solid rgba(70,106,255,0.33); + width: 38%; + padding:20px; + margin-right: 20px; + .licImg{ + background: #F7F9FF; + border-radius: 0px 0px 0px 0px; + border: 1px dashed rgba(70,106,255,0.3); + padding:24px 30px; + text-align: center; + margin-top: 20px; + img{ + height: 122px; + } + } + .licWord{ + color: #4C4D5A; + line-height: 26px; + } + .licCreate{ + display: block; + height: 36px; + line-height: 36px; + background: #F7F9FF; + border-radius: 7px 7px 7px 7px; + border: 1px solid #466AFF; + color: #466AFF; + text-align: center; + margin-top: 25px; + } + } +} + +.licenseData{ + flex: 1; +} +.licList{ + margin-top: 20px; + height: 394px; + overflow-y: auto; + clear: both; + width: 100%; + li{ + height: 36px; + line-height: 36px; + background: rgba(126,135,172,0.08); + border-radius: 4px 4px 4px 4px; + width: 48.5%; + margin-right: 3%; + text-align: center; + margin-bottom: 15px!important; + float: left; + cursor: pointer; + &:nth-child(2n){ + margin-right: 0px; + } + &.active{ + color: #fff; + background-color: #466AFF; + } + } + &.small{ + height: 200px; + li{ + width: 22.5%; + &:nth-child(2n){ + margin-right: 3%; + } + &:nth-child(4n){ + margin-right: 0px; + } + } + .none_panels{ + padding:0px; + min-height: 200px; + } + } +} +.licUse{ + display: block; + height: 36px; + line-height: 36px; + border-radius: 4px 4px 4px 4px; + font-size: 15px; + color: #fff!important; + text-align: center; + margin-top: 38px; + background-color: #c0c0c0; + cursor: default; + &.active{ + background: #466AFF; + cursor: pointer; + } +} +.dropspan{ + display: block; +} + +.alllists{ + background-color: #fff; + box-shadow: 2px 4px 15px rgba(0, 0, 0, 0.1); + padding:20px!important; + width: 80%; +} +.sureDrop{ + width: 200px; + height: 36px; + background: #c0c0c0; + border-radius: 4px; + line-height: 36px; + color: #fff!important; + display: block; + text-align: center; + font-size: 15px; + margin:20px auto 0px; + cursor: default; + &.active{ + background: #466AFF; + cursor: pointer; + } +} \ No newline at end of file diff --git a/src/forge/Component/licenseModal/list.jsx b/src/forge/Component/licenseModal/list.jsx new file mode 100644 index 000000000..e2469c5b8 --- /dev/null +++ b/src/forge/Component/licenseModal/list.jsx @@ -0,0 +1,52 @@ + +import React, { useEffect, useState } from "react"; +import Search from './img/search.png'; +import Nodata from "../../Nodata"; +import { Input } from 'antd'; +import "./index.scss"; + +/** + * + * @param {list} param1 列表 + * @param {onChooseFunc} param2 选中后调用父级方法 + * @param {size} param3 一行显示4个,默认显示2个 + * @param {defaultValue} param4 默认选中的---name + * @returns + */ +function List({list,onChooseFunc,size,defaultValue}){ + const [ value , setValue ] = useState(undefined); + const [ active , setActive ] = useState(undefined); + const [ copylist , setCopyList ] = useState(undefined); + + + useEffect(()=>{ + if(list && list.length>0){ + setCopyList(list); + if(defaultValue){ + let getMIT = list.filter(i=>i.name === defaultValue); + getMIT && getMIT.length > 0 && setActive(getMIT[0].id); + } + } + },[list && list.length,defaultValue]) + + + function searchFunc(search){ + let filters = list && list.filter(i=>i.name.toLowerCase().indexOf(search.toLowerCase()) > -1); + setCopyList(filters); + } + return( + + } value={value} onChange={(e)=>{setValue(e.target.value);searchFunc(e.target.value)}}/> +
    + { copylist && copylist.length>0 && copylist.map((i,k)=>{ + return
  • {setActive(i.id);onChooseFunc(i)}}>{i.name}
  • + }) + } + { + copylist && copylist.length === 0 && + } +
+
+ ) +} +export default List; \ No newline at end of file diff --git a/src/forge/Issues/Component/drop.jsx b/src/forge/Issues/Component/drop.jsx index f90a19d69..8bfc7e85e 100644 --- a/src/forge/Issues/Component/drop.jsx +++ b/src/forge/Issues/Component/drop.jsx @@ -1,8 +1,9 @@ import React,{useState, useEffect, useRef, useImperativeHandle,forwardRef} from 'react'; import { Dropdown } from 'antd'; import { findDOMNode } from 'react-dom'; +import "../index.scss"; -function Drop({overlay , children , placement, overlayClassName},ref){ +function Drop({overlay , children , placement, overlayClassName,idname},ref){ const [ visible , setVisible ] = useState(false); const refFa = useRef(null); const refBox = useRef(null); @@ -35,6 +36,7 @@ function Drop({overlay , children , placement, overlayClassName},ref){ placement={placement} visible={visible} overlay={
{overlay}
} + getPopupContainer={(trigger) => idname ? document.getElementById(idname) :trigger.parentNode} trigger={['click']} overlayClassName={overlayClassName} > diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index a394fead7..76c693f6d 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import { truncateCommitId } from "../common/util"; import CloneAddress from '../Branch/CloneAddress'; - +import CheckProfile from '../Component/ProfileModal/Profile'; import SelectBranch from '../Branch/Select'; import User from '../Component/User'; import axios from 'axios'; @@ -21,12 +21,12 @@ import DrawerPanel from '../Component/DrawerPanel'; import UpdateDescModal from './sub/UpdateDescModal'; import Nodata from '../Nodata'; import Invite from './sub/Invite'; -import CheckProfile from '../Component/ProfileModal/Profile'; import RenderHtml from '../../components/render-html'; import Loadable from 'react-loadable'; import Loading from '../../Loading'; import ProjectPortrait from '../Component/projectPortrait'; import imNoneImg from './img/importNone.png'; +import LicenseModal from '../Component/licenseModal/index'; import moment from 'moment'; const ProjectCompass = Loadable({ @@ -77,6 +77,7 @@ function CoderDepot(props){ const [ pullsFlag , setPullsFlag ] = useState(true); const [ issuesFlag , setIssuesFlag ] = useState(true); const [ releaseVersions , setReleaseVersions] = useState(undefined); + const [ licenseVisible ,setLicenseVisible] = useState(false); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; @@ -308,6 +309,7 @@ function CoderDepot(props){ ) } + function getPathUrl(array,index){ if(array && array.length>0 && index){ let str = ""; @@ -404,6 +406,16 @@ function CoderDepot(props){ props.showLoginDialog(`/${owner}/${projectsId}/issues/new`); } } + // 创建自定义许可证 + function createDefaultLicense(id){ + if(props.checkIfLogin()===false){ + props.showLoginDialog() + return false; + } + let b = branchName || defaultBranch; + let checkvalue = turnbar(b); + props.history.push({pathname:`/${owner}/${projectsId}/${checkvalue}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`,state:`${id}`}) + } // 如果项目是fork的项目,pr自动指向源仓库,否则指向本仓库默认分支 function compare() { @@ -423,6 +435,7 @@ function CoderDepot(props){ return(
{mirror_status ===0 && setOpenModal(false)} onOk={okUpdate}/> } + {setLicenseVisible(false)}} createDefaultLicense={createDefaultLicense}/> { ((dirInfo || fileInfo) && mirror_status===0 ) && @@ -663,10 +676,15 @@ function CoderDepot(props){ {projectDetail && projectDetail.size}
{ - projectDetail && projectDetail.license_name && -
+ projectDetail && projectDetail.license_id !== 0 && +
- {projectDetail.license_name} + { + projectDetail.license_name ? + {projectDetail.license_name} + : + 暂无数据,点击{setLicenseVisible(true)}}>选择并创建许可证 + }
}
diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 392eb4c7c..b1898ffc1 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -3,6 +3,7 @@ import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal import { Base64 } from 'js-base64'; import { AlignCenter } from '../Component/layout'; import { withTranslation } from 'react-i18next'; +import DorpChooseMenus from '../Component/licenseModal/dorpChooseMenus'; import '../css/index.scss'; import './new.scss' @@ -76,6 +77,8 @@ class Index extends Component { this.getOwner(); //判断是否为删除新建项目失败后返回,并执行对应逻辑 this.isDeleteProjectBack(); + // 获取开源许可证 + this.getLicenses(); } componentDidUpdate=(prevPros)=>{ this.updateDocumentTitle(); @@ -123,7 +126,7 @@ class Index extends Component { const url = `/project_categories.json` axios.get(url).then((result) => { if (result) { - this.setOptionsList(result.data.project_categories, 'project_category'); + // this.setOptionsList(result.data.project_categories, 'project_category'); this.setState({ CategoryList: result.data.project_categories }) @@ -135,7 +138,7 @@ class Index extends Component { const url = `/project_languages.json` axios.get(url).then((result) => { if (result) { - this.setOptionsList(result.data.project_languages, 'project_language') + // this.setOptionsList(result.data.project_languages, 'project_language') this.setState({ LanguageList: result.data.project_languages }) @@ -147,7 +150,7 @@ class Index extends Component { const url = `/ignores.json` axios.get(url).then((result) => { if (result) { - this.setOptionsList(result.data.ignores, 'ignore'); + // this.setOptionsList(result.data.ignores, 'ignore'); this.setState({ GitignoreList: result.data.ignores }) @@ -159,14 +162,13 @@ class Index extends Component { const url = `/licenses.json` axios.get(url).then((result) => { if (result) { - this.setOptionsList(result.data.licenses, 'license'); + let data = result.data.licenses; this.setState({ - LicensesList: result.data.licenses + LicensesList: data }) } }).catch((error) => { }) } - isDeleteProjectBack = () => { let mirror_status = this.props.history.location.mirror_status; if (mirror_status === 2 && sessionStorage.newProjectValue) { @@ -264,28 +266,6 @@ class Index extends Component { }) } - ChangePlatform = (value, e, name, list) => { - this.setOptionsList(list, name, value) - this.setState({ - [name + "_id"]: e.key, - [name + "_name"]: value, - }) - } - - blurCategory = (value, list, name) => { - let filter = list && list.filter(item => item.name === value); - if (!filter || filter.length === 0) { - this.props.form.setFieldsValue({ - [name]: undefined - }) - this.setState({ - [name + "_name"]: undefined, - [name + "_id"]: undefined - }) - this.setOptionsList(list, name); - } - } - checkId = (rule, value, callback, list, title) => { let filter = list.filter(item => item.name === value); if(!value){ @@ -358,14 +338,6 @@ class Index extends Component { this.getGitignore(); } } - showLicenseFunc =(e)=>{ - const { LicensesList } = this.state; - this.setState({licenseFlag:e.target.checked}) - if(e.target.checked && (!LicensesList || (LicensesList && LicensesList.length===0))){ - // 获取开源许可证 - this.getLicenses(); - } - } blurFunc=(rule, value, callback)=>{ @@ -430,6 +402,24 @@ class Index extends Component { } } + showLicenseFunc =(e)=>{ + const { LicensesList } = this.state; + this.setState({ + licenseFlag:e.target.checked + }) + } + + getValue=(values,typeName)=>{ + const {id,name} = values + if(id){ + this.setState({ + [typeName + "_id"]: id + }) + this.props.form.setFieldsValue({ + [`${typeName}`]:name + }) + } + } render() { const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 @@ -465,7 +455,7 @@ class Index extends Component { } = this.state; return (
-
+
{projectsType && projectsType === "mirror" ? "导入" : "新建"}项目
@@ -655,14 +645,7 @@ class Index extends Component { validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore') }], })( - this.ChangePlatform(value, e, 'ignore', GitignoreList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")} - > - {ignore_list} - + this.getValue(value,"ignore")}/> )} } @@ -674,7 +657,7 @@ class Index extends Component { )} { licenseFlag && - + {getFieldDecorator('license', { rules: [{ required: licenseFlag, message: '请选择开源许可证' @@ -682,14 +665,7 @@ class Index extends Component { validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证') }], })( - this.ChangePlatform(value, e, 'license', LicensesList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, LicensesList, "license")} - > - {license_list} - + this.getValue(value,"license")}/> )} } @@ -721,9 +697,7 @@ class Index extends Component { )} {categoreFlag && - + {getFieldDecorator('project_category', { rules: [{ required: categoreFlag, message: '请选择项目类别', @@ -731,20 +705,11 @@ class Index extends Component { validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别') }], })( - this.ChangePlatform(value, e, 'project_category', CategoryList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")} - > - {project_category_list} - + this.getValue(value,"project_category")}/> )} } - + {getFieldDecorator('languageFlag')( this.showLanguageFunc(e)}>项目语言 )} @@ -758,14 +723,7 @@ class Index extends Component { validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言') }], })( - this.ChangePlatform(value, e, 'project_language', LanguageList)} - className="plateAutoComplete" - onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")} - > - {project_language_list} - + this.getValue(value,"project_language")}/> )} } diff --git a/src/forge/New/new.scss b/src/forge/New/new.scss index 8432cecdf..161c1f18f 100644 --- a/src/forge/New/new.scss +++ b/src/forge/New/new.scss @@ -1,6 +1,7 @@ .newPanel{ border:1px solid #eaeaea; border-radius: 4px; + position: relative; } .newPanel_title{ height: 3rem; diff --git a/src/forge/Newfile/Index.js b/src/forge/Newfile/Index.js index 7239e75e5..1ba60d42c 100644 --- a/src/forge/Newfile/Index.js +++ b/src/forge/Newfile/Index.js @@ -2,18 +2,25 @@ import React, { useEffect , useState } from "react"; import Meditor from "./m_editor"; import "./index.css"; import { returnbar } from 'educoder'; +import { Select } from "antd"; import FileLanguage from '../Component/FileLanguage'; import FP from '../Component/FileName/index'; +import axios from 'axios'; +const { Option } = Select; function Index(props){ const [ filename , setFileName ] = useState(""); const [ language , setLanguage ] = useState(""); const [ checkName , setCheckName ] = useState(false); + const [ licenseList ,setLicenseList ] = useState([]) + const [ licenseId ,setLicenseId ] = useState([]) + const [ content ,setContent ] = useState(""); + const [ chooseName ,setChooseName ] = useState(""); const [ empty , setEmpty ] = useState(false); const {projectDetail} = props; - const { pathname } = props && props.location; + const { pathname , state } = props && props.location; const urlroot = pathname.split("newfile/")[1]; const file_path = urlroot ? `/${urlroot}/` :"/"; @@ -21,6 +28,55 @@ function Index(props){ updateDocumentTitle(); },[projectDetail]) + + useEffect(()=>{ + if(state){ + getLicenseList(); + setLicenseId(parseInt(state)) + if(parseInt(state) !== -1){ + getLinceseById(state); + } + } + },[state]) + + useEffect(()=>{ + if(licenseList && licenseList.length>0 && licenseId){ + let filters = licenseList.filter(i=>i.id === licenseId); + let name = filters && filters.length === 1 ? filters[0].name : -1 + setChooseName(name); + } + },[licenseId,licenseList.splice()]) + + // 根据license id查询详情 + const getLinceseById=(id)=>{ + let url =`/licenses/${id}.json`; + axios.get(url).then(res=>{ + if(res && res.data){ + setContent(res.data.content) + } + }).catch(error=>{}) + } + // 获取license列表 + const getLicenseList=()=>{ + let url =`/licenses.json`; + axios.get(url).then(res=>{ + if(res && res.data){ + setLicenseList(res.data.licenses) + } + }).catch(error=>{}) + } + // 选择许可证 + const selectFunc=(e,item)=>{ + const { key } = item; + setLicenseId(parseInt(key)); + props.history.push({state:key}) + if(key && parseInt(key) !== -1){ + getLinceseById(key); + }else{ + setContent(undefined) + } + } + // 更新网页标题 function updateDocumentTitle(){ @@ -57,11 +113,34 @@ function Index(props){ addonBefore={`${ projectDetail && projectDetail.identifier }${returnbar(file_path)}`} onChangeFile={onChangeFile} empty={empty} + name={(Boolean(state) ? "LICENSE" :"")} onEmpty={(e)=>setEmpty(e)} + readOnly={Boolean(state)} />
- + { + (licenseList && licenseList.length>0 && state) ? + + : + + }
@@ -69,13 +148,14 @@ function Index(props){ {...props} filepath={`${file_path}`} language = {language} - content={""} + content={content} readOnly={false} editor_type="new" descName={filename ? `Add ${filename}`:""} checkName={checkName} onEmpty={(e)=>setEmpty(e)} empty={empty} + state={state} filename={filename} >
diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index 808679ac1..c10e5de5b 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -69,7 +69,7 @@ class UserSubmitComponent extends Component { // 提交变更 subMitFrom = () => { - const { filepath, content, editor_type , checkName , onEmpty , checkContent} = this.props; + const { filepath, content, editor_type , checkName , onEmpty , checkContent , state , projectDetail} = this.props; const { branch, projectsId , owner } = this.props.match.params; const { submitType, filename , empty } = this.state; if(editor_type==="upload" && checkContent && !content){ @@ -99,13 +99,25 @@ class UserSubmitComponent extends Component { this.setState({ isSpin: false }); if (result.data && result.data.name) { this.props.showNotification("文件新建成功!"); + const { getDetail } = this.props; if(submitType === "1"){ - const { getDetail } = this.props; getDetail && getDetail(); } - window.scrollTo(0,0); - let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`; - this.props.history.push(url); + // 存在state是代表创建自定义许可证 + if(state){ + const url = `/${owner}/${projectsId}.json`; + const { name , identifier } = projectDetail; + axios.put(url,{name,identifier,license_id:parseInt(state)===-1?0:state }).then(res=>{ + getDetail && getDetail(); + window.scrollTo(0,0); + let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`; + this.props.history.push(url); + }).catch(error=>{}) + }else{ + window.scrollTo(0,0); + let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`; + this.props.history.push(url); + } } }) .catch((error) => { diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index f0450b63c..e9e7b154b 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -6,7 +6,6 @@ import 'codemirror/mode/clike/clike'; import 'codemirror/mode/css/css'; import UserSubmitComponent from "./UserSubmitComponent"; import CloudIDE from "./cloudIDE"; -import { Base64 } from "js-base64"; import "./index.css"; import "./editor.css"; @@ -35,7 +34,7 @@ class m_editor extends Component { render() { const { editorValue, changeValue } = this.state; - const { readOnly, editorType,onEmpty,filename,empty, currentBranch, descName, checkName, detail, match: { params },filepath, ideTheme , md } = this.props; + const { readOnly, editorType,onEmpty,filename,empty, currentBranch, descName, checkName, detail, match: { params },filepath, state , projectDetail} = this.props; const editor_options = { lineNumbers: "on", lineWrapping: true, //强制换行 @@ -87,6 +86,8 @@ class m_editor extends Component { empty={empty} filename={filename} changeValueFlag={this.props.content !== changeValue} + state={state} + projectDetail={projectDetail} >
)} diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index be7eebe8f..59c05d0f5 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -7,6 +7,8 @@ import { Link } from 'react-router-dom'; import axios from "axios"; import "./setting.scss"; import { unInstallMarketBot } from "../../softbot/api"; +import DorpChooseMenus from '../Component/licenseModal/dorpChooseMenus'; + const { TextArea } = Input; const { Option } = Select; @@ -46,6 +48,7 @@ class Setting extends Component { return; } } + componentDidMount = () => { this.updateDocumentTitle(); this.getCategory(); @@ -63,18 +66,39 @@ class Setting extends Component { } getLanguage = () => { + this.getInfo(); + }; + getLanguage = (id) => { const url = `/project_languages.json`; - axios - .get(url) - .then((result) => { - if (result) { - let LanguageList = this.setOptionsList(result.data.project_languages); - this.setState({ - LanguageList, - }); + axios.get(url).then((result) => { + if (result) { + let data = result.data.project_languages; + this.setState({LanguageList:data}); + if(id){ + let filters = data.filter(i=>i.id === id); + if(filters && filters.length > 0){ + this.props.form.setFieldsValue({project_language_id:filters[0].name}) + } } - }) - .catch((error) => {}); + } + }) + .catch((error) => {}); + }; + + getCategory = (id) => { + const url = `/project_categories.json`; + axios.get(url).then((result) => { + if (result) { + let data = result.data.project_categories; + this.setState({CategoryList:data}); + if(id){ + let filters = data.filter(i=>i.id === id); + if(filters && filters.length > 0){ + this.props.form.setFieldsValue({project_category_id:filters[0].name}) + } + } + } + }).catch((error) => {}); }; getInfo = () => { @@ -85,13 +109,15 @@ class Setting extends Component { .then((result) => { if (result) { const { project_units } = this.state; + const { project_name ,project_description , project_identifier } = result.data; let units = result.data.project_units; units.push(...project_units); - this.props.form.setFieldsValue({ - ...result.data, + project_name ,project_description , private:result.data.private , project_identifier , project_units:units }); + this.getCategory(result.data.project_category_id); + this.getLanguage(result.data.project_language_id); this.setState({ projectName:result.data.project_name, private_check: result.data.private, @@ -108,23 +134,6 @@ class Setting extends Component { }); }; - getCategory = () => { - const url = `/project_categories.json`; - axios - .get(url) - .then((result) => { - if (result) { - let CategoryList = this.setOptionsList( - result.data.project_categories - ); - this.setState({ - CategoryList, - }); - } - }) - .catch((error) => {}); - }; - setOptionsList = (data) => { let list = undefined; if (data && data.length > 0) { @@ -163,17 +172,17 @@ class Setting extends Component { update=(values)=>{ const { projectsId , owner } = this.props.match.params; - const { private_check , project_units } = this.state; - const {project_language_id, project_category_id, pr_view_admin} = values; + const { private_check , project_units , project_language_id , project_category_id} = this.state; + const {pr_view_admin} = values; const url = `/${owner}/${projectsId}.json`; axios.patch(url, { name: values.project_name, description: values.project_description, private: private_check, identifier:values.project_identifier, - project_language_id, - project_category_id, - pr_view_admin + pr_view_admin, + ...values, + project_language_id , project_category_id }).then((result) => { if (result) { this.props.showNotification(`仓库信息修改成功!`); @@ -272,6 +281,17 @@ class Setting extends Component { }) } + + getValue=(values,typeName)=>{ + const {id,name} = values; + this.setState({ + [`${typeName}`]:id + }) + this.props.form.setFieldsValue({ + [`${typeName}`]:name + }) + } + render() { const { getFieldDecorator } = this.props.form; const { projectsId , owner } = this.props.match.params; @@ -295,7 +315,7 @@ class Setting extends Component { 基本设置 - + {getFieldDecorator("project_name", { rules: [ @@ -358,20 +378,22 @@ class Setting extends Component { {getFieldDecorator("project_category_id", { rules: [], })( - + // + this.getValue(value,"project_category_id")}/> )} {getFieldDecorator("project_language_id", { rules: [], })( - + // + this.getValue(value,"project_language_id")}/> )} 访问权限: