新建项目相关bug
This commit is contained in:
parent
98ca09e64b
commit
007feded68
|
@ -2,9 +2,9 @@ import React from 'react';
|
|||
import {Popover} from 'antd';
|
||||
import './Component.scss';
|
||||
|
||||
export default (({menu , children})=>{
|
||||
export default (({menu , children, overlayClassName})=>{
|
||||
return(
|
||||
<Popover content={menu} trigger={['click']} placement='bottom'>
|
||||
<Popover content={menu} trigger={['click']} placement='bottom' overlayClassName={overlayClassName}>
|
||||
{children}
|
||||
</Popover>
|
||||
)
|
||||
|
|
|
@ -494,7 +494,7 @@ class Detail extends Component {
|
|||
}
|
||||
{
|
||||
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>
|
||||
<span className="color-grey-9">导入于 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
|
||||
: ""
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -255,14 +255,14 @@ class Index extends Component {
|
|||
|
||||
newItem = ()=>{
|
||||
return(
|
||||
<Menu>
|
||||
<Menu.Item key="created_deposit">
|
||||
<ul>
|
||||
<li>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}}>新建项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="created_mirror">
|
||||
</li>
|
||||
<li>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</li>
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,13 @@ class Index extends Component {
|
|||
<div>
|
||||
{
|
||||
current_user && current_user.login &&
|
||||
<Popover content={this.newItem()} trigger={["click"]} placement='bottom' className="mr50">
|
||||
<Popover
|
||||
overlayClassName="newPopUl"
|
||||
content={this.newItem()}
|
||||
trigger={["click"]}
|
||||
placement='bottom'
|
||||
className="mr50"
|
||||
>
|
||||
<a className="ant-dropdown-link">
|
||||
<span className="color-blue font-16"><img src={img_new} alt="" width="13px" /> 新建</span>
|
||||
</a>
|
||||
|
|
|
@ -155,7 +155,7 @@ class Index extends Component {
|
|||
if (mirror_status === 2 && sessionStorage.newProjectValue) {
|
||||
Modal.warning({
|
||||
title: '警告',
|
||||
content: '镜像项目创建失败!请按操作规范重新创建项目!',
|
||||
content: '项目导入失败!请按操作规范重新创建项目!',
|
||||
});
|
||||
let newProjectValue = JSON.parse(sessionStorage.newProjectValue);
|
||||
if (newProjectValue) {
|
||||
|
@ -195,13 +195,16 @@ class Index extends Component {
|
|||
|
||||
subMitFrom = () => {
|
||||
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||
console.log(err);
|
||||
console.log(values);
|
||||
if (!err) {
|
||||
this.setState({
|
||||
isSpin: true
|
||||
})
|
||||
const { projectsType } = this.props.match.params;
|
||||
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
|
||||
const {
|
||||
project_language_id, project_category_id, license_id, ignore_id , owners_id ,
|
||||
ignoreFlag,licenseFlag,categoreFlag,languageFlag
|
||||
} = this.state;
|
||||
const decoderPass = Base64.encode(values.password);
|
||||
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
|
||||
// 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值
|
||||
|
@ -209,10 +212,10 @@ class Index extends Component {
|
|||
axios.post(url, {
|
||||
...values,
|
||||
auth_password:decoderPass,
|
||||
project_language_id,
|
||||
project_category_id,
|
||||
license_id,
|
||||
ignore_id,
|
||||
project_language_id:languageFlag ? project_language_id : undefined,
|
||||
project_category_id:categoreFlag ? project_category_id : undefined,
|
||||
license_id:licenseFlag ? license_id : undefined,
|
||||
ignore_id:ignoreFlag ? ignore_id : undefined,
|
||||
user_id:owners_id
|
||||
}).then((result) => {
|
||||
if (result && result.data.id) {
|
||||
|
@ -339,7 +342,7 @@ class Index extends Component {
|
|||
projectsType && projectsType === "mirror" &&
|
||||
<React.Fragment>
|
||||
<Form.Item
|
||||
label="镜像版本库地址"
|
||||
label="导入仓库URL"
|
||||
style={{ marginBottom: "0px" }}
|
||||
colon={false}
|
||||
>
|
||||
|
@ -358,12 +361,14 @@ class Index extends Component {
|
|||
projectsType && projectsType === "mirror" &&
|
||||
<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>
|
||||
需要授权验证<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 mb10" style={{alignItems:'center'}}>
|
||||
<span className="mr10">用户名</span>
|
||||
<input type="password" style={{display:"none"}} />
|
||||
<Form.Item
|
||||
style={{ marginBottom: "0px" }}
|
||||
label=""
|
||||
|
@ -381,7 +386,7 @@ class Index extends Component {
|
|||
{getFieldDecorator('password', {
|
||||
rules: [],
|
||||
})(
|
||||
<Input placeholder="请输入对应平台的登录密码" type="password" style={{width:"240px"}}/>
|
||||
<Input placeholder="请输入对应平台的登录密码" type={"password"} style={{width:"240px"}}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
@ -545,7 +550,7 @@ class Index extends Component {
|
|||
>
|
||||
{getFieldDecorator('project_category', {
|
||||
rules: [{
|
||||
required: categoreFlag, message: '请选择大类别',
|
||||
required: categoreFlag, message: '请选择项目类别',
|
||||
}, {
|
||||
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
|
||||
}],
|
||||
|
@ -592,7 +597,7 @@ class Index extends Component {
|
|||
注:<span className="ant-form-item-required"></span> 为必填项,否则为选填
|
||||
</div>
|
||||
<Form.Item className="formTip mt20">
|
||||
<Button type="primary" onClick={this.subMitFrom} className="mr20">创建项目</Button>
|
||||
<Button type="primary" onClick={this.subMitFrom} className="mr20">{projectsType && projectsType === "mirror" ? "导入" : "创建"}项目</Button>
|
||||
<Link to={'/explore'} className="btn_32">取消</Link>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
|
|
@ -61,14 +61,14 @@ function List(props){
|
|||
</Menu>
|
||||
)
|
||||
const menu_new=(
|
||||
<Menu>
|
||||
<Menu.Item key="updated_on">
|
||||
<ul>
|
||||
<li>
|
||||
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="created_on">
|
||||
</li>
|
||||
<li>
|
||||
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>导入项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</li>
|
||||
</ul>
|
||||
)
|
||||
|
||||
return(
|
||||
|
@ -81,7 +81,7 @@ function List(props){
|
|||
</div>
|
||||
<p>
|
||||
{ organizeDetail && organizeDetail.can_create_project ?
|
||||
<Sort menu={menu_new}>
|
||||
<Sort menu={menu_new} overlayClassName={"newPopUl"}>
|
||||
<a className="addBtn mr30">+ 新建项目</a>
|
||||
</Sort>
|
||||
:""}
|
||||
|
|
|
@ -271,3 +271,15 @@ form{
|
|||
border-color: #DF0002;
|
||||
color: #fff;
|
||||
}
|
||||
.newPopUl{
|
||||
li{
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
border-bottom: 1px solid #eee;
|
||||
min-width: 78px;
|
||||
text-align: center;
|
||||
&:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -114,14 +114,14 @@ class InfosUser extends Component {
|
|||
);
|
||||
|
||||
newItem =()=> (
|
||||
<Menu>
|
||||
<Menu.Item key="created_deposit">
|
||||
<ul>
|
||||
<li>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/deposit/new')}} >新建项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="created_mirror">
|
||||
</li>
|
||||
<li>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</li>
|
||||
</ul>
|
||||
);
|
||||
|
||||
|
||||
|
@ -192,6 +192,7 @@ class InfosUser extends Component {
|
|||
trigger={["hover"]}
|
||||
placement="bottom"
|
||||
className="mr50"
|
||||
overlayClassName="newPopUl"
|
||||
>
|
||||
<a className="ant-dropdown-link">
|
||||
<span className="color-blue font-16">
|
||||
|
|
Loading…
Reference in New Issue