新建项目相关bug

This commit is contained in:
caishi 2021-09-10 15:02:19 +08:00
parent 98ca09e64b
commit 007feded68
7 changed files with 60 additions and 36 deletions

View File

@ -2,9 +2,9 @@ import React from 'react';
import {Popover} from 'antd'; import {Popover} from 'antd';
import './Component.scss'; import './Component.scss';
export default (({menu , children})=>{ export default (({menu , children, overlayClassName})=>{
return( return(
<Popover content={menu} trigger={['click']} placement='bottom'> <Popover content={menu} trigger={['click']} placement='bottom' overlayClassName={overlayClassName}>
{children} {children}
</Popover> </Popover>
) )

View File

@ -494,7 +494,7 @@ class Detail extends Component {
} }
{ {
projectDetail && projectDetail.type && projectDetail.type !== 0 ? 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> </div>

View File

@ -255,14 +255,14 @@ class Index extends Component {
newItem = ()=>{ newItem = ()=>{
return( return(
<Menu> <ul>
<Menu.Item key="created_deposit"> <li>
<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> </li>
<Menu.Item key="created_mirror"> <li>
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile> <CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
</Menu.Item> </li>
</Menu> </ul>
) )
} }
@ -392,7 +392,13 @@ class Index extends Component {
<div> <div>
{ {
current_user && current_user.login && 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"> <a className="ant-dropdown-link">
<span className="color-blue font-16"><img src={img_new} alt="" width="13px" /> 新建</span> <span className="color-blue font-16"><img src={img_new} alt="" width="13px" /> 新建</span>
</a> </a>

View File

@ -155,7 +155,7 @@ class Index extends Component {
if (mirror_status === 2 && sessionStorage.newProjectValue) { if (mirror_status === 2 && sessionStorage.newProjectValue) {
Modal.warning({ Modal.warning({
title: '警告', title: '警告',
content: '镜像项目创建失败!请按操作规范重新创建项目!', content: '项目导入失败!请按操作规范重新创建项目!',
}); });
let newProjectValue = JSON.parse(sessionStorage.newProjectValue); let newProjectValue = JSON.parse(sessionStorage.newProjectValue);
if (newProjectValue) { if (newProjectValue) {
@ -195,13 +195,16 @@ class Index extends Component {
subMitFrom = () => { subMitFrom = () => {
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
console.log(err); console.log(values);
if (!err) { if (!err) {
this.setState({ this.setState({
isSpin: true isSpin: true
}) })
const { projectsType } = this.props.match.params; 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 decoderPass = Base64.encode(values.password);
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json"; const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
// 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值 // 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值
@ -209,10 +212,10 @@ class Index extends Component {
axios.post(url, { axios.post(url, {
...values, ...values,
auth_password:decoderPass, auth_password:decoderPass,
project_language_id, project_language_id:languageFlag ? project_language_id : undefined,
project_category_id, project_category_id:categoreFlag ? project_category_id : undefined,
license_id, license_id:licenseFlag ? license_id : undefined,
ignore_id, ignore_id:ignoreFlag ? ignore_id : undefined,
user_id:owners_id user_id:owners_id
}).then((result) => { }).then((result) => {
if (result && result.data.id) { if (result && result.data.id) {
@ -339,7 +342,7 @@ class Index extends Component {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<React.Fragment> <React.Fragment>
<Form.Item <Form.Item
label="镜像版本库地址" label="导入仓库URL"
style={{ marginBottom: "0px" }} style={{ marginBottom: "0px" }}
colon={false} colon={false}
> >
@ -358,12 +361,14 @@ class Index extends Component {
projectsType && projectsType === "mirror" && projectsType && projectsType === "mirror" &&
<div className="pb10"> <div className="pb10">
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}> <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> 需要授权验证<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 && mirrorCheck &&
<div className="df mb10" style={{alignItems:'center'}}> <div className="df mb10" style={{alignItems:'center'}}>
<span className="mr10">用户名</span> <span className="mr10">用户名</span>
<input type="password" style={{display:"none"}} />
<Form.Item <Form.Item
style={{ marginBottom: "0px" }} style={{ marginBottom: "0px" }}
label="" label=""
@ -381,7 +386,7 @@ class Index extends Component {
{getFieldDecorator('password', { {getFieldDecorator('password', {
rules: [], rules: [],
})( })(
<Input placeholder="请输入对应平台的登录密码" type="password" style={{width:"240px"}}/> <Input placeholder="请输入对应平台的登录密码" type={"password"} style={{width:"240px"}}/>
)} )}
</Form.Item> </Form.Item>
</div> </div>
@ -545,7 +550,7 @@ class Index extends Component {
> >
{getFieldDecorator('project_category', { {getFieldDecorator('project_category', {
rules: [{ rules: [{
required: categoreFlag, message: '请选择类别', required: categoreFlag, message: '请选择项目类别',
}, { }, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别') 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> <span className="ant-form-item-required"></span>
</div> </div>
<Form.Item className="formTip mt20"> <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> <Link to={'/explore'} className="btn_32">取消</Link>
</Form.Item> </Form.Item>
</div> </div>

View File

@ -61,14 +61,14 @@ function List(props){
</Menu> </Menu>
) )
const menu_new=( const menu_new=(
<Menu> <ul>
<Menu.Item key="updated_on"> <li>
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建项目</CheckProfile> <CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/deposit/new/${OIdentifier}`)}}>新建项目</CheckProfile>
</Menu.Item> </li>
<Menu.Item key="created_on"> <li>
<CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>导入项目</CheckProfile> <CheckProfile {...props} sureFunc={()=>{props.history.push(`/projects/mirror/new/${OIdentifier}`)}}>导入项目</CheckProfile>
</Menu.Item> </li>
</Menu> </ul>
) )
return( return(
@ -81,7 +81,7 @@ function List(props){
</div> </div>
<p> <p>
{ organizeDetail && organizeDetail.can_create_project ? { organizeDetail && organizeDetail.can_create_project ?
<Sort menu={menu_new}> <Sort menu={menu_new} overlayClassName={"newPopUl"}>
<a className="addBtn mr30">+&nbsp;新建项目</a> <a className="addBtn mr30">+&nbsp;新建项目</a>
</Sort> </Sort>
:""} :""}

View File

@ -270,4 +270,16 @@ form{
background-color: #DF0002!important; background-color: #DF0002!important;
border-color: #DF0002; border-color: #DF0002;
color: #fff; 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;
}
}
} }

View File

@ -114,14 +114,14 @@ class InfosUser extends Component {
); );
newItem =()=> ( newItem =()=> (
<Menu> <ul>
<Menu.Item key="created_deposit"> <li>
<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> </li>
<Menu.Item key="created_mirror"> <li>
<CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile> <CheckProfile {...this.props} sureFunc={()=>{this.props.history.push('/projects/mirror/new')}}>导入项目</CheckProfile>
</Menu.Item> </li>
</Menu> </ul>
); );
@ -192,6 +192,7 @@ class InfosUser extends Component {
trigger={["hover"]} trigger={["hover"]}
placement="bottom" placement="bottom"
className="mr50" className="mr50"
overlayClassName="newPopUl"
> >
<a className="ant-dropdown-link"> <a className="ant-dropdown-link">
<span className="color-blue font-16"> <span className="color-blue font-16">