forked from Gitlink/forgeplus-react
工作流流程更改
This commit is contained in:
parent
c3ed52bc32
commit
45273782c5
|
|
@ -65,7 +65,7 @@ export function initAxiosInterceptors(props) {
|
|||
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
|
||||
var
|
||||
// proxy = "http://localhost:3000"
|
||||
proxy = "https://forgeplus.trustie.net"
|
||||
proxy = "https://testforgeplus.trustie.net"
|
||||
|
||||
const requestMap = {};
|
||||
window.setfalseInRequestMap = function (keyName) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ function About(props, ref) {
|
|||
// 开始激活
|
||||
function startActive(){
|
||||
setIsSpining(true);
|
||||
const url = `/${owner}/${projectsId}/cloud_accounts/${cloudAccount && cloudAccount.id}/activate.json`;
|
||||
const url = `/${owner}/${projectsId}/activate.json`;
|
||||
axios.post(url).then(result=>{
|
||||
setIsSpining(false);
|
||||
if(result && result.data.status === 0){
|
||||
|
|
@ -157,15 +157,15 @@ function About(props, ref) {
|
|||
<Blueback onClick={goStep}>下一步</Blueback>
|
||||
</React.Fragment>
|
||||
:""}
|
||||
{step >= 1 &&(
|
||||
{step >= 1 &&
|
||||
<div style={{textAlign:'center',marginTop:"20px"}}>
|
||||
{
|
||||
{/* {
|
||||
step === 1 && current_user && !current_user.ci_certification &&
|
||||
<p style={{ maxWidth: "300px",textAlign:"left",color:"#999" }}>初始化配置已完成,请前往:<br/><a target="_blank" href={redirectUrl} className="color-blue">{redirectUrl}</a> 进入认证</p>
|
||||
}
|
||||
} */}
|
||||
<Blueback onClick={startActive} className="mt20">开始激活</Blueback>
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
</React.Fragment>
|
||||
:""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ function Dispose(props){
|
|||
<p className="editorHead">{info}</p>
|
||||
<Editor
|
||||
height="300px"
|
||||
language={"java"}
|
||||
language={"yml"}
|
||||
theme={"vs-grey"}
|
||||
defaultValue="请输入内容"
|
||||
value={ymlValue}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React , { useEffect , useState } from 'react';
|
||||
import React , { useEffect , useState , useRef } from 'react';
|
||||
import { Banner } from '../Component/layout';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ const Div = styled.div`{
|
|||
}`;
|
||||
export default ((props)=>{
|
||||
const [ menu , setMenu ] = useState(false);
|
||||
const childRef = useRef();
|
||||
|
||||
const path = props.location.pathname;
|
||||
const owner = props.match.params.owner;
|
||||
|
|
@ -23,14 +24,23 @@ export default ((props)=>{
|
|||
setMenu(false);
|
||||
}
|
||||
},[path])
|
||||
|
||||
const updateChildState = () => {
|
||||
// changeVal就是子组件暴露给父组件的方法
|
||||
if (childRef.current) {
|
||||
childRef.current.changeVal();
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="disposePanel">
|
||||
<Banner>
|
||||
<Link to={`/projects/${owner}/${props.match.params.projectsId}/devops/dispose`} className={menu===false && "color-blue"}>工作流配置</Link>
|
||||
<Link to={`/projects/${owner}/${props.match.params.projectsId}/devops/list`}className={menu===true && "color-blue"} style={{ marginLeft:"66px"}}>构建列表</Link>
|
||||
{ menu===true && <a onClick={updateChildState} style={{float:"right",fontSize:"14px",color:"#FF6E21",marginTop:"5px"}}>刷新</a>}
|
||||
</Banner>
|
||||
<Div>
|
||||
{ menu === true && <Structure {...props}/> }
|
||||
{ menu === true && <Structure {...props} wrappedComponentRef={(form) => childRef.current = form} ref={childRef}/> }
|
||||
{ menu === false && <Dispost {...props}/> }
|
||||
</Div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
import { FlexAJ, AlignCenter, Blueback } from "../Component/layout";
|
||||
import React, { useState, useEffect , useImperativeHandle ,forwardRef } from "react";
|
||||
import { FlexAJ, AlignCenter } from "../Component/layout";
|
||||
import { Table, Pagination, Popconfirm } from "antd";
|
||||
import { truncateCommitId } from "../common/util";
|
||||
import {getUrl} from 'educoder';
|
||||
import styled from "styled-components";
|
||||
import axios from "axios";
|
||||
|
||||
const STATUS = [
|
||||
|
|
@ -14,7 +13,7 @@ const STATUS = [
|
|||
{ name: "已完成", value: "success" },
|
||||
];
|
||||
const LIMIT = 15;
|
||||
export default (props) => {
|
||||
function Structure(props,ref){
|
||||
const [status, setStatus] = useState(undefined);
|
||||
const [page, setPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
|
|
@ -24,6 +23,12 @@ export default (props) => {
|
|||
let projectsId = props.match.params.projectsId;
|
||||
let owner = props.match.params.owner;
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
changeVal: () => {
|
||||
setTableLoading(true);
|
||||
Init();
|
||||
}
|
||||
}))
|
||||
useEffect(() => {
|
||||
if (projectsId) {
|
||||
Init();
|
||||
|
|
@ -290,7 +295,7 @@ export default (props) => {
|
|||
pagination={false}
|
||||
loading={tableLoading}
|
||||
></Table>
|
||||
{total > LIMIT ? (
|
||||
{total > LIMIT ?
|
||||
<div style={{ textAlign: "center", margin: "30px 50px" }}>
|
||||
<Pagination
|
||||
showQuickJumper
|
||||
|
|
@ -299,10 +304,10 @@ export default (props) => {
|
|||
pageSize={LIMIT}
|
||||
onChange={ChangePage}
|
||||
></Pagination>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
:
|
||||
"" }
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default forwardRef(Structure);
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ class Detail extends Component {
|
|||
</li>
|
||||
}
|
||||
<li className={pathname==="devops" ? "active" : ""}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/devops${open_devops ? `/list`:""}`, state }}>
|
||||
<i className="iconfont icon-gongzuoliu font-13 mr8"></i>工作流
|
||||
{projectDetail && projectDetail.ops_count ? <span>{projectDetail.ops_count}</span> : ""}
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React , { useEffect , useState } from 'react';
|
||||
import { Button ,Spin , Pagination } from 'antd';
|
||||
import { Button ,Spin , Pagination , Popconfirm } from 'antd';
|
||||
import { Link } from 'react-router-dom';
|
||||
import Nodata from '../Nodata';
|
||||
import axios from 'axios';
|
||||
|
|
@ -15,26 +15,43 @@ function CIList(props){
|
|||
useEffect(()=>{
|
||||
setIsSpining(true);
|
||||
if(user && user.login){
|
||||
const url = `/users/${user.login}/projects.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
limit , page , category:"manage"
|
||||
}
|
||||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
setList(result.data.projects);
|
||||
setTotal(result.data.count);
|
||||
setIsSpining(false);
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
})
|
||||
getInfo();
|
||||
}
|
||||
},[user,page])
|
||||
|
||||
function getInfo(){
|
||||
const url = `/users/${user.login}/projects.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
limit , page , category:"manage"
|
||||
}
|
||||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
setList(result.data.projects);
|
||||
setTotal(result.data.count);
|
||||
setIsSpining(false);
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
function changePage(page){
|
||||
setPage(page);
|
||||
}
|
||||
|
||||
// 取消激活
|
||||
function cancelActivate(author,identifier){
|
||||
setIsSpining(true);
|
||||
const url =`/${author && author.login}/${identifier}/deactivate.json`;
|
||||
axios.delete(url).then(result=>{
|
||||
if(result){
|
||||
getInfo();
|
||||
}else{
|
||||
setIsSpining(false);
|
||||
}
|
||||
}).catch(error=>{setIsSpining(false);})
|
||||
}
|
||||
return(
|
||||
<div style={{minHeight:"400px"}}>
|
||||
<Spin spinning={isSpining}>
|
||||
|
|
@ -45,14 +62,25 @@ function CIList(props){
|
|||
return(
|
||||
<li key={key}>
|
||||
<span>
|
||||
<Link to={`/projects/${item.author && item.author.login}/${item.identifier}`}>{item.name}</Link>
|
||||
<Link to={`/projects/${item.author && item.author.login}/${item.identifier}${ item.open_devops ? "/devops/list":""}`}>{item.name}</Link>
|
||||
{ item.open_devops ?
|
||||
<span className="authTag green ml20">已激活</span>
|
||||
:
|
||||
<span className="authTag red ml20">未激活</span>
|
||||
}
|
||||
</span>
|
||||
{ !item.open_devops && <Button type={"primary"} onClick={()=>{props.history.push(`/projects/${item.author && item.author.login}/${item.identifier}/devops`)}}>马上激活</Button> }
|
||||
{ item.open_devops ?
|
||||
<Popconfirm
|
||||
title="确定取消激活?"
|
||||
onConfirm={()=>cancelActivate(item.author,item.identifier)}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button>取消激活</Button>
|
||||
</Popconfirm>
|
||||
:
|
||||
<Button type={"primary"} onClick={()=>{props.history.push(`/projects/${item.author && item.author.login}/${item.identifier}/devops`)}}>马上激活</Button>
|
||||
}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ function CIdispose(props){
|
|||
getInit();
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
setBindVisible(false);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -141,12 +141,12 @@ function CIdispose(props){
|
|||
<span>CI服务器地址</span>
|
||||
{CIData && step >= 1 && <span className="ml10">{CIData.ip}</span>}
|
||||
{ step === 0 && <span className="ml10 authTag red">未绑定</span> }
|
||||
{ !ci_certification && <span className="ml10 authTag red">未认证</span> }
|
||||
{ step > 0 && !ci_certification && <span className="ml10 authTag red">未认证</span> }
|
||||
{ ci_certification && <span className="ml10 authTag green">已认证</span> }
|
||||
</AlignCenter>
|
||||
<AlignCenter>
|
||||
{ step === 0 && <Button type={'primary'} onClick={()=>setBindVisible(true)} >马上绑定</Button> }
|
||||
{ !ci_certification && <Button type={'primary'} style={{color:"#fff"}} href={CIData && CIData.redirect_url} target="_blank">马上认证</Button> }
|
||||
{ step > 0 && !ci_certification && <Button type={'primary'} style={{color:"#fff"}} href={CIData && CIData.redirect_url} target="_blank">马上认证</Button> }
|
||||
{ step >= 1 && <Button type={'danger'} className="ml20" onClick={()=>setVisible(true)}>解除绑定</Button> }
|
||||
</AlignCenter>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue