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"> <Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="operationBtn">
<a className="ant-dropdown-link"> <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> </a>
</Dropdown> </Dropdown>
</span> </span>

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

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

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

@ -226,6 +226,7 @@ body,#root{
border-radius: 4px; border-radius: 4px;
border:1px solid #eee; border:1px solid #eee;
background: #fff; background: #fff;
margin-left: 20px;
} }
.gitAddressClone > span{ .gitAddressClone > span{
display: flex; display: flex;
@ -329,6 +330,28 @@ body,#root{
height: 22px; height: 22px;
line-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{ .gitAddressClone{
width:100%; width:100%;
margin-left: 0px;
} }
.gitAddressClone > span{ .gitAddressClone > span{
padding:0px; 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; flex-wrap: wrap;
align-items: center; align-items: center;
} }
.topWrapper .ant-btn.ant-input-search-button{
height: 30px;
}
.topWrapper_select li{ .topWrapper_select li{
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;

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

@ -1189,7 +1189,7 @@ samp {
box-shadow: none!important; box-shadow: none!important;
} }
/* 这个加了干嘛的影响到了带addonAfter的input */ /* 这个加了干嘛的影响到了带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; border-right: none!important;
} }
.AboutInputForm .ant-form-item-label{ .AboutInputForm .ant-form-item-label{

Loading…
Cancel
Save