forked from Gitlink/forgeplus-react
正在导入的仓库增加删除按钮
This commit is contained in:
parent
64c759f8e2
commit
ea3f591eb6
|
|
@ -1,5 +1,5 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Spin, Tooltip } from 'antd';
|
||||
import { Spin, Tooltip , Button } from 'antd';
|
||||
import { Link, Route, Switch } from 'react-router-dom';
|
||||
import { withRouter } from "react-router";
|
||||
import { connect } from 'react-redux';
|
||||
|
|
@ -17,6 +17,7 @@ import '../css/index.scss'
|
|||
import './list.scss';
|
||||
import '../../modules/courses/css/Courses.css'
|
||||
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
||||
import { unInstallMarketBot } from "../../softbot/api";
|
||||
|
||||
|
||||
import Loadable from 'react-loadable';
|
||||
|
|
@ -590,6 +591,25 @@ class Detail extends Component {
|
|||
</div> : ""
|
||||
}
|
||||
|
||||
// 删除仓库
|
||||
deleteProject = () => {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { projectName } = this.state;
|
||||
this.props.confirm({
|
||||
content: <span style={{display:"block",textAlign:"left"}}>该操作无法撤销!且将会一并删除相关的疑修、合并请求、工作流、里程碑、动态等数据。<br/>是否确认删除 <span style={{fontWeight:"bold"}}>{owner}/{projectName}({projectsId})</span>?</span>,
|
||||
onOk: () => {
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios.delete(url).then((result) => {
|
||||
window.scrollTo(0,0);
|
||||
this.props.showNotification("仓库删除成功!");
|
||||
this.props.history.push(`/${owner}`);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { projectDetail, watchers_count, praises_count,
|
||||
|
|
@ -732,6 +752,9 @@ class Detail extends Component {
|
|||
firstSync &&
|
||||
<Content className="spincontent">
|
||||
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
|
||||
<Button className="red_deleteBtn mt30" onClick={this.deleteProject}>
|
||||
删除本仓库
|
||||
</Button>
|
||||
</Content>
|
||||
}
|
||||
<Spin spinning={secondSync && !firstSync} className="spinstyle" tip="正在同步镜像" size="large">
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@
|
|||
}
|
||||
.spincontent{
|
||||
height:400px;
|
||||
flex-direction: column;
|
||||
}
|
||||
.spinstyle .ant-spin-text{
|
||||
margin-top:30px;
|
||||
|
|
|
|||
|
|
@ -438,4 +438,17 @@ button.btngrey{
|
|||
background-color:#708cff;
|
||||
border-color:#708cff;
|
||||
}
|
||||
}
|
||||
.red_deleteBtn{
|
||||
display: block;
|
||||
height: 38px;
|
||||
line-height: 36px;
|
||||
border:1px solid #db2828;
|
||||
border-radius: 4px;
|
||||
color: #db2828!important;
|
||||
padding:0px 15px;
|
||||
font-size: 16px;
|
||||
&:hover{
|
||||
border-color:#db2828!important;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue