Merge pull request 'issue列表筛选保存、项目名含http报错等问题' (#336) from caishi/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
3d9b43a784
|
@ -140,7 +140,7 @@ class App extends Component {
|
||||||
pathname && this.getPathnameType(pathname);
|
pathname && this.getPathnameType(pathname);
|
||||||
|
|
||||||
// 添加路由监听,决定组织还是个人
|
// 添加路由监听,决定组织还是个人
|
||||||
this.unlisten = this.props.history.listen((location) => {
|
this.unlisten = this.props.history.listen((location,history) => {
|
||||||
let newPathname = location.pathname.split('/')[1];
|
let newPathname = location.pathname.split('/')[1];
|
||||||
if (this.state.pathName !== newPathname) {
|
if (this.state.pathName !== newPathname) {
|
||||||
// this.setState({ pathType: '' });
|
// this.setState({ pathType: '' });
|
||||||
|
|
|
@ -36,7 +36,7 @@ export function initAxiosInterceptors(props) {
|
||||||
//响应前的设置
|
//响应前的设置
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
if(config.url.indexOf("http") !== -1) {
|
if(config.url.substr(0, 4) === "http") {
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
requestProxy(config);
|
requestProxy(config);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Menu, Popconfirm } from "antd";
|
||||||
import { TagsLine } from "../Component/OpsStatus";
|
import { TagsLine } from "../Component/OpsStatus";
|
||||||
import { Time } from "../Utils/Time";
|
import { Time } from "../Utils/Time";
|
||||||
import { truncateCommitId } from "../common/util";
|
import { truncateCommitId } from "../common/util";
|
||||||
import { getUrl } from 'educoder';
|
import { getImageUrl } from 'educoder';
|
||||||
|
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
const Img = styled.img`
|
const Img = styled.img`
|
||||||
|
@ -70,7 +70,7 @@ export default ({ data, repeatSet , chooseSteps }) => {
|
||||||
<div>
|
<div>
|
||||||
<FlexAJ className="leftheader">
|
<FlexAJ className="leftheader">
|
||||||
<AlignCenter>
|
<AlignCenter>
|
||||||
<Img src={getUrl(`/images/${data && data.author && data.author.image_url}`)} />
|
<Img src={getImageUrl(`/${data && data.author && data.author.image_url}`)} />
|
||||||
{data && data.started &&
|
{data && data.started &&
|
||||||
<span className="nest">
|
<span className="nest">
|
||||||
开始时间:<span> {data.started}</span>
|
开始时间:<span> {data.started}</span>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Spin, Tooltip } from 'antd';
|
||||||
import { Link, Route, Switch } from 'react-router-dom';
|
import { Link, Route, Switch } from 'react-router-dom';
|
||||||
import { Content, AlignTop } from '../Component/layout';
|
import { Content, AlignTop } from '../Component/layout';
|
||||||
import DetailBanner from './sub/DetailBanner';
|
import DetailBanner from './sub/DetailBanner';
|
||||||
import { numFormat } from 'educoder';
|
import cookie from 'react-cookies';
|
||||||
import '../css/index.scss'
|
import '../css/index.scss'
|
||||||
import './list.scss';
|
import './list.scss';
|
||||||
|
|
||||||
|
@ -204,6 +204,8 @@ class Detail extends Component {
|
||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
this.getProject();
|
this.getProject();
|
||||||
|
let history = this.props.location;
|
||||||
|
this.clearIssueCookies(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = (prevState) => {
|
componentDidUpdate = (prevState) => {
|
||||||
|
@ -212,6 +214,20 @@ class Detail extends Component {
|
||||||
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
|
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
|
||||||
this.getProject();
|
this.getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.props.history.listen((history) => {
|
||||||
|
// 非issue链接地址清除cookie states,具体保存和操作在order.js页面
|
||||||
|
this.clearIssueCookies(history);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
clearIssueCookies=(history)=>{
|
||||||
|
const { pathname } = history;
|
||||||
|
const { projectsId , owner } = this.props.match.params;
|
||||||
|
let currentIssue = pathname.indexOf(`/${owner}/${projectsId}/issues`) === -1;
|
||||||
|
if (currentIssue) {
|
||||||
|
cookie.save('states', undefined,{ expires: 0,path:`/` });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
|
@ -75,19 +75,26 @@ class order extends Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
// const selectParams = cookie.load('selectParams');
|
const datas = cookie.load('states');
|
||||||
// let states = selectParams.select_params;
|
let states = datas === "undefined" ? undefined : datas;
|
||||||
// this.setState({
|
if(states){
|
||||||
// ...states
|
this.setState({
|
||||||
// },()=>{
|
...states
|
||||||
// this.getSelectList();
|
},()=>{
|
||||||
// this.getIssueList('1');
|
this.getSelectList();
|
||||||
// })
|
this.getIssueList(states.status_type);
|
||||||
this.getSelectList();
|
})
|
||||||
this.getIssueList('1');
|
}else{
|
||||||
|
this.getSelectList();
|
||||||
|
this.getIssueList('1');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
getSelectList = () => {
|
getSelectList = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true
|
isSpin: true
|
||||||
|
@ -110,7 +117,6 @@ class order extends Component {
|
||||||
|
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
getIssueList = (status_type, begin, end) => {
|
getIssueList = (status_type, begin, end) => {
|
||||||
cookie.remove('selectParams');
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true
|
isSpin: true
|
||||||
})
|
})
|
||||||
|
@ -129,8 +135,7 @@ class order extends Component {
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
const issues = result.data.issues;
|
const issues = result.data.issues;
|
||||||
// let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);
|
this.saveCookies(status_type);
|
||||||
// cookie.save('selectParams', {states:this.state},{ expires: inFifteenMinutes,path:`/${owner}/${projectsId}/issues` });
|
|
||||||
this.setState({
|
this.setState({
|
||||||
data: result.data,
|
data: result.data,
|
||||||
issues: issues,
|
issues: issues,
|
||||||
|
@ -138,7 +143,8 @@ class order extends Component {
|
||||||
isSpin: false,
|
isSpin: false,
|
||||||
allValue: issues && issues.length > 0 && issues.map((item) => {
|
allValue: issues && issues.length > 0 && issues.map((item) => {
|
||||||
return (item.id)
|
return (item.id)
|
||||||
})
|
}),
|
||||||
|
status_type
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -147,6 +153,36 @@ class order extends Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
saveCookies=(status_type)=>{
|
||||||
|
const { projectsId, owner } = this.props.match.params;
|
||||||
|
const {
|
||||||
|
select_params,
|
||||||
|
issue_tag_ids,//标记
|
||||||
|
tracker_ids,//类型
|
||||||
|
author_ids,//发布人
|
||||||
|
assigned_to_ids,//负责人
|
||||||
|
author_id,//发布人(用来区分选中的是搜索结果、指派给我、我的发布)
|
||||||
|
assigned_to_id,//负责人(用来区分选中的是搜索结果、指派给我、我的发布)
|
||||||
|
fixed_version_ids,//里程碑
|
||||||
|
status_ids,//状态
|
||||||
|
done_ratios,//完成度
|
||||||
|
paix,//排序
|
||||||
|
update_author_ids,//更换负责人
|
||||||
|
update_fixed_version_idsx,//更换里程碑
|
||||||
|
update_status_ids,//修改状态
|
||||||
|
begin,
|
||||||
|
end,
|
||||||
|
search
|
||||||
|
} = this.state;
|
||||||
|
const d = {select_params,assigned_to_ids,status_type,issue_tag_ids,tracker_ids,author_id,assigned_to_id,
|
||||||
|
author_ids,fixed_version_ids,status_ids,done_ratios,paix,update_author_ids,update_fixed_version_idsx,update_status_ids,
|
||||||
|
begin,end,search
|
||||||
|
};
|
||||||
|
|
||||||
|
let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);
|
||||||
|
cookie.save('states', {...d},{ expires: inFifteenMinutes,path:`/` });
|
||||||
|
}
|
||||||
|
|
||||||
getMenu = (e, id, name) => {
|
getMenu = (e, id, name) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true,
|
isSpin: true,
|
||||||
|
@ -162,7 +198,7 @@ class order extends Component {
|
||||||
paix: "最早创建",
|
paix: "最早创建",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.state.select_params.order_name = e.key;
|
// this.state.select_params.order_name = e.key;
|
||||||
} else if (key_name[0] === "updated_on") {
|
} else if (key_name[0] === "updated_on") {
|
||||||
if (e.item.props.value === "desc") {
|
if (e.item.props.value === "desc") {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -174,11 +210,19 @@ class order extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.state.select_params.order_name = key_name[0];
|
this.setState({
|
||||||
this.state.select_params.order_type = e.item.props.value;
|
select_params:{
|
||||||
this.state.select_params.page = 1;
|
order_name:key_name[0],
|
||||||
const { status_type } = this.state;
|
order_type:e.item.props.value,
|
||||||
this.getIssueList(status_type);
|
page:1
|
||||||
|
}
|
||||||
|
},()=>{
|
||||||
|
const { status_type } = this.state;
|
||||||
|
this.getIssueList(status_type);
|
||||||
|
})
|
||||||
|
// this.state.select_params.order_name = key_name[0];
|
||||||
|
// this.state.select_params.order_type = e.item.props.value;
|
||||||
|
// this.state.select_params.page = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
getOption = (e, id, name, toGet) => {
|
getOption = (e, id, name, toGet) => {
|
||||||
|
@ -548,9 +592,8 @@ class order extends Component {
|
||||||
isSpin,
|
isSpin,
|
||||||
status_type,
|
status_type,
|
||||||
select_params,
|
select_params,
|
||||||
begin, end, checkedValue, all
|
begin, end, checkedValue, all,search
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="main" style={{padding:"0px"}}>
|
<div className="main" style={{padding:"0px"}}>
|
||||||
<div style={{padding:"10px 20px 0px 20px"}}>
|
<div style={{padding:"10px 20px 0px 20px"}}>
|
||||||
|
@ -585,6 +628,9 @@ class order extends Component {
|
||||||
enterButton
|
enterButton
|
||||||
onSearch={this.searchFunc}
|
onSearch={this.searchFunc}
|
||||||
style={{ width: 300 }}
|
style={{ width: 300 }}
|
||||||
|
value={search}
|
||||||
|
allowClear
|
||||||
|
onChange={(e)=>{this.setState({search:e.target.value})}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -633,7 +679,7 @@ class order extends Component {
|
||||||
display:
|
display:
|
||||||
current_user && current_user.login === "" ? "none" : "flex",
|
current_user && current_user.login === "" ? "none" : "flex",
|
||||||
}}
|
}}
|
||||||
className={author_id ? "active" : ""}
|
className={ author_id ? "active" : ""}
|
||||||
onClick={() => this.ChangeAssign(2)}
|
onClick={() => this.ChangeAssign(2)}
|
||||||
>
|
>
|
||||||
<label>我的发布</label>
|
<label>我的发布</label>
|
||||||
|
|
|
@ -26,7 +26,6 @@ class claims extends React.Component {
|
||||||
axios.get(`/issues/${issue_id}/claims.json`)
|
axios.get(`/issues/${issue_id}/claims.json`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if(result){
|
if(result){
|
||||||
console.log(result.data),
|
|
||||||
this.setState({
|
this.setState({
|
||||||
claimerdata: result.data.claimers,
|
claimerdata: result.data.claimers,
|
||||||
currentUserClaimed: result.data.currentUserclaimed,
|
currentUserClaimed: result.data.currentUserclaimed,
|
||||||
|
|
Loading…
Reference in New Issue