dev_forge
Jasder 5 years ago
commit bfb58c72b9

@ -36,7 +36,7 @@ class CoderRootBranch extends Component {
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="operationBtn">
<a className="ant-dropdown-link">
<Tooltip title={`下载分支${branch}`}><Icon type="cloud-download" className="font-18"/></Tooltip>
<Tooltip title={`下载分支${item.name}`}><Icon type="cloud-download" className="font-18"/></Tooltip>
</a>
</Dropdown>
</span>

@ -11,6 +11,12 @@ import RootTable from './RootTable';
import CoderRootFileDetail from './CoderRootFileDetail';
import axios from 'axios';
/**
* address:http和SSHhttp_url(对应git地址)
* branch:当前分支
* filePath:点击目录时当前目录的路径
* subfileType:保存当前点击目录的文件类型显示目录列表时才显示新建文件如果点击的是文件就不显示新建文件按钮
*/
class CoderRootDirectory extends Component{
constructor(props){
super(props);
@ -19,6 +25,7 @@ class CoderRootDirectory extends Component{
branch:"master",
filePath:[],
http_url:undefined,
subFileType:"",
branchList:undefined,
fileDetail:undefined,
@ -56,34 +63,38 @@ class CoderRootDirectory extends Component{
}).catch((error)=>{})
}
ChangeFile=(arr)=>{
this.renderUrl(arr);
ChangeFile=(arr,index)=>{
this.renderUrl(arr.name,arr.path,arr.type);
this.getFileDetail(arr);
this.setState({
subFileType:arr.type
})
}
renderUrl=(array)=>{
if(array && array.path){
let { path } = array;
let list = [];
let urlList=Object.assign({},array);
renderUrl=(name,path,type)=>{
let list =[];
const { filePath } = this.state;
if(path.indexOf("/")){
const array = path.split("/");
let str = "";
if(path.indexOf("/")>0){
const wraps = path.split("/");
wraps.map((item,key)=>{
str += '/'+item;
urlList.path = str.substr(1);
urlList.name = item;
list.push({...urlList});
array.map((i,k)=>{
str += '/'+i;
return list.push({
index:k,
name:i,
path:str.substr(1),
type:(filePath && filePath.length>0) ? (filePath[k] ? filePath[k].type : type) : type
})
}else{
urlList.path = '';
urlList.name = path;
list.push({...urlList});
}
this.setState({
filePath:list
})
}else{
list.push({
index:0,
name,path,type
})
}
this.setState({
filePath:list
})
}
// 获取子目录
@ -91,6 +102,8 @@ class CoderRootDirectory extends Component{
const { current_user } = this.props;
const { projectsId } = this.props.match.params;
const { branch } = this.state;
const url =`/${current_user.login}/${projectsId}/sub_entries.json`;
axios.get(url,{
@ -142,9 +155,9 @@ class CoderRootDirectory extends Component{
})
}
render(){
const { rootList , branch ,filePath , fileDetail } = this.state;
const { rootList , branch ,filePath , fileDetail , subFileType } = this.state;
const { branchLastCommit , http_url } = this.props;
const { branchLastCommit , http_url , current_user } = this.props;
const { projectsId } = this.props.match.params;
const columns = [
@ -207,7 +220,7 @@ class CoderRootDirectory extends Component{
key === filePath.length-1 ?
<span className="color-grey-6 subFileName">{item.name}</span>
:
<a onClick={()=>this.ChangeFile(item)} className="color-blue subFileName">{item.name}</a>
<a onClick={()=>this.ChangeFile(item,key)} className="color-blue subFileName">{item.name}</a>
}
</React.Fragment>
)
@ -218,9 +231,22 @@ class CoderRootDirectory extends Component{
}
</div>
{
filePath && filePath.length === 0 && <CloneAddress http_url={http_url} downloadUrl={downloadUrl}></CloneAddress>
}
<div className="f-wrap-alignCenter">
{/* 暂时先放出来,新建和上传文件需要操作权限--current_uesr.admin */}
{/* {
current_user && current_user.admin && <span>新建文件</span>
} */}
{
subFileType !== "file" &&
<p className="addFile">
<Link to={`/projects/${projectsId}/coder/file/new`} >新建文件</Link>
<Link to={``}>上传文件</Link>
</p>
}
{
filePath && filePath.length === 0 && <CloneAddress http_url={http_url} downloadUrl={downloadUrl}></CloneAddress>
}
</div>
</div>
{/* 文件夹-子目录列表 */}
{

@ -1,5 +1,5 @@
import React , { Component } from "react";
import Editor from "@monaco-editor/react";
import Editor from "react-monaco-editor";
import { Popconfirm } from 'antd';
@ -46,7 +46,7 @@ class CoderRootFileDetail extends Component{
</p>
<Editor
height="300px"
theme={"dark"}
theme={"vs-dark"}
value={detail && detail.content}
readOnly={readOnly}
/>

@ -8,6 +8,10 @@ import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
const FileNew = Loadable({
loader: () => import('../Newfile/Index'),
loading: Loading,
})
const OrderIndex = Loadable({
loader: () => import('../Order/order'),
loading: Loading,
@ -70,6 +74,11 @@ class Detail extends Component{
</div>
<Switch {...this.props}>
<Route path="/projects/:projectsId/coder/file/new"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
}
></Route>
<Route path="/projects/:projectsId/orders"
render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state}/>)

@ -226,6 +226,7 @@ body,#root{
border-radius: 4px;
border:1px solid #eee;
background: #fff;
margin-left: 20px;
}
.gitAddressClone > span{
display: flex;
@ -329,6 +330,28 @@ body,#root{
height: 22px;
line-height: 22px;
}
.addFile{
display: flex;
}
.addFile a{
display: block;
background-color: rgb(76, 172, 255,0.8);
color: #fff;
cursor: pointer;
height: 32px;
line-height: 32px;
padding: 0px 10px;
}
.addFile a:first-child{
border-radius: 4px 0px 0px 4px;
}
.addFile a:last-child{
border-radius: 0px 4px 4px 0px;
border-left: 1px solid rgba(247, 247, 247, 0.3);
}
.addFile a:active{
background-color: rgb(76, 172, 255,1);
}
@ -355,6 +378,7 @@ body,#root{
}
.gitAddressClone{
width:100%;
margin-left: 0px;
}
.gitAddressClone > span{
padding:0px;

@ -0,0 +1,52 @@
import React , { Component } from "react";
import Editor from "react-monaco-editor";
import { Input } from 'antd';
import './index.css';
class Index extends Component{
constructor(props){
super(props);
this.state={
editorValue:""
}
}
// 取消,弹框询问
CancelAddFile=()=>{
}
changeEditor=(editorValue)=>{
this.setState({
editorValue
})
}
render(){
const { editorValue } = this.state;
const { projectDetail } = this.props;
return(
<div className="main">
<div className="f-wrap-alignCenter">
<div className="setInputAddon">
<Input addonBefore={`/${projectDetail && projectDetail.identifier}/`} placeholder="命名文件..."/>
</div>
<a onClick={this.CancelAddFile} className="color-blue">取消</a>
</div>
<div className="branchTable">
<p className="branchTitle">新建文件</p>
<Editor
height="320px"
theme={"vs-dark"}
value={editorValue}
onChange={this.changeEditor}
/>
</div>
<div>
</div>
</div>
)
}
}
export default Index;

@ -0,0 +1,17 @@
.setInputAddon{
width: 350px;
margin-right: 20px;
}
.setInputAddon .ant-input-group-addon{
height: 30px;
line-height: 30px;
border-left: 1px solid #d9d9d9!important;
border-right: none!important;
}
@media screen and (max-width: 400px){
.setInputAddon{
width: 100%;
margin-right: 0px;
}
}

@ -59,6 +59,9 @@
flex-wrap: wrap;
align-items: center;
}
.topWrapper .ant-btn.ant-input-search-button{
height: 30px;
}
.topWrapper_select li{
text-align: center;
cursor: pointer;

@ -7,12 +7,18 @@ import axios from 'axios';
const Search = Input.Search;
const tagList= ['所有标签','release','test'];
const typeList= ['所有类型','普通','悬赏'];
const categoryList=['所有分类','缺陷','支持','任务','功能','周报'];
const levelList=['优先度','低','正常','高','紧急','立刻'];
const percentList=['完成度','0%','10%','20%','30%','40%','50%','60%','70%','80%','90%','100%'];
const tagList= ['release','test'];
const typeList= ['普通','悬赏'];
const categoryList=['缺陷','支持','任务','功能','周报'];
const levelList=['低','正常','高','紧急','立刻'];
const percentList=['0%','10%','20%','30%','40%','50%','60%','70%','80%','90%','100%'];
class order extends Component{
constructor(props){
super(props);
this.state={
issue_chosen:undefined
}
}
componentDidMount=()=>{
this.getSelectList();
@ -25,7 +31,9 @@ class order extends Component{
const url = `/projects/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result)=>{
if(result){
this.setState({
issue_chosen:result.data.issue_chosen
})
}
}).catch((error)=>{
console.log(error);
@ -46,20 +54,28 @@ class order extends Component{
console.log(error);
})
}
renderMenu =(array)=>{
getOption=(e)=>{
console.log(e);
}
renderMenu =(array,name)=>{
return(
<Menu>
{
array.length > 0 && array.map((item,key)=>{
return(
<Menu.Item value={item} key={key}>{item}</Menu.Item>
)
})
}
<Menu.Item key="0" onClick={this.getOption}>{name}</Menu.Item>
{
array && array.length > 0 && array.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={this.getOption}>{item.name}</Menu.Item>
)
})
}
</Menu>
)
}
render(){
const { issue_chosen } = this.state;
return(
<div className="main">
<div className="topWrapper">
@ -67,7 +83,7 @@ class order extends Component{
<Link to={``} >标签</Link>
<Link to={``}>里程</Link>
</p>
<a className="topWrapper_btn">创建工单</a>
<Link to={``} className="topWrapper_btn">创建工单</Link>
</div>
<div className="topWrapper" style={{borderBottom:"none"}}>
<p className="topWrapper_nav">
@ -92,37 +108,37 @@ class order extends Component{
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(tagList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签')} trigger={['click']} placement="bottomCenter">
<span>标签<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(typeList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_type,'所有类型')} trigger={['click']} placement="bottomCenter">
<span>类型<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(categoryList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker,'所有分类')} trigger={['click']} placement="bottomCenter">
<span>分类<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(typeList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'发布人')} trigger={['click']} placement="bottomCenter">
<span>发布人<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(categoryList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'指派人')} trigger={['click']} placement="bottomCenter">
<span>指派人<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(levelList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.priority,'优先度')} trigger={['click']} placement="bottomCenter">
<span>优先度<Icon type="caret-down" className="ml5"/></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(percentList)} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio,'完成度')} trigger={['click']} placement="bottomCenter">
<span>完成度<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>

@ -1189,7 +1189,7 @@ samp {
box-shadow: none!important;
}
/* 这个加了干嘛的影响到了带addonAfter的input */
.searchViewAfter,.searchViewAfter:focus,.searchViewAfter .ant-input:hover,.ant-input-group .ant-input:focus{
.searchViewAfter,.searchViewAfter:focus,.searchViewAfter .ant-input:hover,.searchViewAfter .ant-input-group .ant-input:focus{
border-right: none!important;
}
.AboutInputForm .ant-form-item-label{

Loading…
Cancel
Save