Merge branch 'feature_repo_upgrade' of https://git.trustie.net/caishi/forgeplus-react into feature_repo_upgrade

This commit is contained in:
caishi 2021-09-09 16:59:12 +08:00
commit 93736781c5
7 changed files with 215 additions and 147 deletions

View File

@ -256,11 +256,11 @@ class Index extends Component {
newItem = ()=>{
return(
<Menu>
<Menu.Item key="created_mirror">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>新建镜像项目</CheckProfile>
</Menu.Item>
<Menu.Item key="created_deposit">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}}>新建托管项目</CheckProfile>
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}}>新建项目</CheckProfile>
</Menu.Item>
<Menu.Item key="created_mirror">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
</Menu.Item>
</Menu>
)

View File

@ -41,22 +41,22 @@ class IndexItem extends Component {
{ !item.is_public && <span className="privateTag">私有</span> }
{
item.forked_from_project_id ?
<span className="ml5">
<Tooltip title="该项目是一个fork仓库" className="ml5">
<i className="iconfont icon-fork font-18 color-orange" />
</span>
</Tooltip>
: ""
}
{
item.type && item.type === 2 ?
<Tooltip title="该项目是一个镜像" className="ml5">
<Tooltip title="该项目是一个同步镜像仓库" className="ml5">
<i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>:""
}
{
item.type && item.type === 1 ?
<span className="ml5">
<Tooltip title="该项目是一个导入于其他网站的仓库" className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" />
</span>:""
</Tooltip>:""
}
</AlignCenter>
<span className="p-r-tags">

View File

@ -2,9 +2,10 @@ import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd';
import { Base64 } from 'js-base64';
import { AlignCenter } from '../Component/layout';
import '../css/index.scss';
import './new.css'
import './new.scss'
import axios from 'axios';
const Option = Select.Option;
@ -44,7 +45,12 @@ class Index extends Component {
project_category_name: undefined,
license_name: undefined,
ignore_name: undefined,
descNum:0
descNum:0,
categoreFlag:false,
languageFlag:false,
ignoreFlag:false,
licenseFlag:false,
}
}
componentDidMount = () => {
@ -189,6 +195,7 @@ class Index extends Component {
subMitFrom = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
console.log(err);
if (!err) {
this.setState({
isSpin: true
@ -313,41 +320,28 @@ class Index extends Component {
mirrorCheck,
descNum
descNum,
ignoreFlag,
licenseFlag,
languageFlag,
categoreFlag
} = this.state;
return (
<div className="main back-white" style={{padding:"0px",border:"none"}}>
<div className="newPanel">
<div className="newPanel_title">创建{projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目</div>
<div className="newPanel_title">{projectsType && projectsType === "mirror" ? "导入" : "新建"}项目</div>
<Spin spinning={isSpin}>
<Form>
<div className="newPanel_content">
<Form.Item
label="拥有者"
>
{getFieldDecorator('user_id', {
rules: [{
required: true, message: '请选择拥有者'
},{
validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者')
}],
})(
<AutoComplete
placeholder="请选择拥有者"
onChange={(value, e) => this.ChangePlatform(value, e, 'owners', OwnerList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, OwnerList, "owners")}
>
{owners_list}
</AutoComplete>
)}
</Form.Item>
{
{
projectsType && projectsType === "mirror" &&
<React.Fragment>
<Form.Item
label="镜像版本库地址"
style={{ marginBottom: "0px" }}
colon={false}
>
{getFieldDecorator('clone_addr', {
rules: [{
@ -362,13 +356,13 @@ class Index extends Component {
}
{
projectsType && projectsType === "mirror" &&
<React.Fragment>
<div className="pb10">
<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>
<span className="ml20 font-12 color-red">如果导入项目为私有仓库则必须填写相应平台正确的用户名和密码</span></p>
{
mirrorCheck &&
<div className="df mb20" style={{alignItems:'center'}}>
<div className="df mb10" style={{alignItems:'center'}}>
<span className="mr10">用户名</span>
<Form.Item
style={{ marginBottom: "0px" }}
@ -383,7 +377,6 @@ class Index extends Component {
<span className="mr10">密码</span>
<Form.Item
style={{ marginBottom: "0px" }}
label=""
>
{getFieldDecorator('password', {
rules: [],
@ -393,143 +386,144 @@ class Index extends Component {
</Form.Item>
</div>
}
</React.Fragment>
</div>
}
<AlignCenter>
<Form.Item
label="拥有者"
style={{width:"260px"}}
colon={false}
className="explainPos"
>
{getFieldDecorator('user_id', {
rules: [{
required: true, message: '请选择拥有者'
},{
validator:(rule, value, callback) => this.checkId(rule, value, callback, OwnerList, '拥有者')
}],
})(
<AutoComplete
style={{width:"260px",height:"35px"}}
placeholder="请选择拥有者"
onChange={(value, e) => this.ChangePlatform(value, e, 'owners', OwnerList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, OwnerList, "owners")}
>
{owners_list}
</AutoComplete>
)}
</Form.Item>
<span className="ml10 mr10 mt10 font-18">/</span>
<Form.Item
label="项目名称"
className="flex1 explainPos"
colon={false}
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请填写项目名称'
}],
})(
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/>
)}
</Form.Item>
</AlignCenter>
<Form.Item
label="项目名称"
label={<span>项目标识 <span className="color-grey-9">(项目url标识部分)</span></span>}
colon={false}
>
{getFieldDecorator('name', {
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写项目名称'
required: true, message: '请填写项目标识'
}],
})(
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/>
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength={100} />
)}
</Form.Item>
<div className="pr">
<span className="toprightNum">{descNum}/200</span>
<Form.Item
label="项目简介"
colon={false}
style={{marginBottom:"0px"}}
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
rules: [],
})(
<Input.TextArea maxLength={200} placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} onChange={this.changeDesc}/>
)}
</Form.Item>
</div>
<Form.Item
label="仓库名称"
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="仓库名称请使用与项目相关的英文关键字" maxLength={100} />
)}
</Form.Item>
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category', {
rules: [{
required: true, message: '请选择大类别',
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
}],
})(
<AutoComplete
placeholder="请选择项目类别"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_category', CategoryList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")}
>
{project_category_list}
</AutoComplete>
)}
</Form.Item>
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language', {
rules: [{
required: true, message: '请选择项目语言'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_language', LanguageList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")}
>
{project_language_list}
</AutoComplete>
)}
</Form.Item>
{
(projectsType === "deposit" || !projectsType) &&
<React.Fragment>
<Form.Item
label=".gitignore"
className="privatePart"
>
{getFieldDecorator('ignore', {
rules: [{
required: true, message: '请选择gitignore'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore')
}],
})(
<AutoComplete
placeholder="请选择gitignore用来定义哪些文件不需要添加到版本管理中"
onChange={(value, e) => this.ChangePlatform(value, e, 'ignore', GitignoreList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")}
>
{ignore_list}
</AutoComplete>
{getFieldDecorator('ignoreFlag')(
<Checkbox checked={ignoreFlag} onChange={(e)=>this.setState({ignoreFlag:e.target.checked})}>.gitignore</Checkbox>
)}
</Form.Item>
{ ignoreFlag &&
<Form.Item>
{getFieldDecorator('ignore', {
rules: [{
required: ignoreFlag, message: '请选择gitignore'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore')
}],
})(
<AutoComplete
placeholder="请选择gitignore用来定义哪些文件不需要添加到版本管理中"
onChange={(value, e) => this.ChangePlatform(value, e, 'ignore', GitignoreList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")}
>
{ignore_list}
</AutoComplete>
)}
</Form.Item>
}
<Form.Item
label="开源许可证"
className="privatePart"
>
{getFieldDecorator('license', {
rules: [{
required: true, message: '请选择开源许可证'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证')
}],
})(
<AutoComplete
placeholder="请选择开源许可证"
onChange={(value, e) => this.ChangePlatform(value, e, 'license', LicensesList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LicensesList, "license")}
>
{license_list}
</AutoComplete>
{getFieldDecorator('licenseFlag')(
<Checkbox checked={licenseFlag} onChange={(e)=>this.setState({licenseFlag:e.target.checked})}>开源许可证</Checkbox>
)}
</Form.Item>
{ licenseFlag &&
<Form.Item>
{getFieldDecorator('license', {
rules: [{
required: licenseFlag, message: '请选择开源许可证'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证')
}],
})(
<AutoComplete
placeholder="请选择开源许可证"
onChange={(value, e) => this.ChangePlatform(value, e, 'license', LicensesList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LicensesList, "license")}
>
{license_list}
</AutoComplete>
)}
</Form.Item>
}
</React.Fragment>
}
<Form.Item
label="可见性"
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('private')(
<Checkbox value="limit">将项目设为私有<span className="ml15 font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
<Checkbox value="limit">将项目设为私有<span className="font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
)}
</Form.Item >
{
projectsType && projectsType === "mirror" &&
<Form.Item
label="迁移类型:"
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('is_mirror')(
@ -537,7 +531,64 @@ class Index extends Component {
)}
</Form.Item >
}
<div>
<Form.Item
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('categoreFlag')(
<Checkbox checked={categoreFlag} onChange={(e)=>this.setState({categoreFlag:e.target.checked})}>项目类别</Checkbox>
)}
</Form.Item>
{categoreFlag &&
<Form.Item
className="privatePart"
>
{getFieldDecorator('project_category', {
rules: [{
required: categoreFlag, message: '请选择大类别',
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
}],
})(
<AutoComplete
placeholder="请选择项目类别"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_category', CategoryList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")}
>
{project_category_list}
</AutoComplete>
)}
</Form.Item>
}
<Form.Item
className="privatePart"
>
{getFieldDecorator('languageFlag')(
<Checkbox checked={languageFlag} onChange={(e)=>this.setState({languageFlag:e.target.checked})}>项目语言</Checkbox>
)}
</Form.Item>
{languageFlag &&
<Form.Item>
{getFieldDecorator('project_language', {
rules: [{
required: languageFlag, message: '请选择项目语言'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_language', LanguageList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")}
>
{project_language_list}
</AutoComplete>
)}
</Form.Item>
}
<div className="mt20">
<span className="ant-form-item-required"></span>
</div>
<Form.Item className="formTip mt20">

View File

@ -12,7 +12,13 @@
border-bottom: 1px solid #f0f0f0
}
.newPanel_content{
padding:1rem 2rem;
padding:2rem;
}
.newPanel_content form .ant-row.ant-form-item{
margin-bottom: 25px;
}
.newPanel_content .ant-form-item-label label{
font-size: 16px;
}
.newPanel_content .ant-form-item-control-wrapper{
flex: 1;
@ -25,24 +31,35 @@
height: 35px;
line-height: 35px;
}
.newContent_inline{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items:flex-end
}
.explainPos{
.ant-form-explain{
position: absolute;
}
}
.newContent_inline > .ant-form-item:nth-child(2){
margin-left: 20px;
}
.newPanel_content .privatePart .ant-form-item-label{
margin-left: 0px;
.privatePart{
margin-bottom: 0px!important;
.ant-form-item-label{
margin-left: 0px;
}
}
.newPanel_content .ant-form-item-label{
line-height: 25px;
height: 25px;
margin-left: -0.8rem;
}
.plateAutoComplete{
.ant-input{
height: 34px!important;
}
}
@media screen and (max-width: 750px){
.newPanel_content{

View File

@ -63,10 +63,10 @@ function List(props){
const menu_new=(
<Menu>
<Menu.Item key="updated_on">
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建托管项目</CheckProfile>
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建项目</CheckProfile>
</Menu.Item>
<Menu.Item key="created_on">
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>新建镜像项目</CheckProfile>
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>导入项目</CheckProfile>
</Menu.Item>
</Menu>
)

View File

@ -108,7 +108,7 @@ function RightBox({ OIdentifier , history , admin , showCompeleteDialog ,complet
<div>
{
(item.is_admin || item.is_member) ?
<Link to={`/${OIdentifier}/teams/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
<Link to={`/${OIdentifier}/teams/${item.id}`}><ColorListName>{item.nickname}</ColorListName></Link>
:
<ColorListName>{item.name}</ColorListName>
}

View File

@ -115,11 +115,11 @@ class InfosUser extends Component {
newItem =()=> (
<Menu>
<Menu.Item key="created_mirror">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>新建镜像项目</CheckProfile>
</Menu.Item>
<Menu.Item key="created_deposit">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}} >新建托管项目</CheckProfile>
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}} >新建项目</CheckProfile>
</Menu.Item>
<Menu.Item key="created_mirror">
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
</Menu.Item>
</Menu>
);