This commit is contained in:
caishi 2021-01-20 10:12:35 +08:00
parent 0b007b35d9
commit a235879dd0
7 changed files with 59 additions and 34 deletions

View File

@ -67,7 +67,7 @@ function Dispose(props){
const url = `/ci/pipelines.json`;
axios.post(url,{
pipeline_name,
file_name:".trustie.pipeline.yml",
file_name:".trustie-pipeline.yml",
identifier:projectsId
}).then(result=>{
setVisible(false);

View File

@ -3,7 +3,17 @@ import { Button , Popconfirm } from 'antd';
import { Cancel } from '../../Component/layout';
import Item from './StageItem';
function Stage({ templates , datas , saveDatas , saveFunc , stepName , showNotification , deleteStep , deleteFunc }){
function Stage({
templates ,
datas ,
saveDatas ,
saveFunc ,
stepName ,
showNotification ,
deleteStep ,
deleteFunc ,
deleteFlag
}){
const [ stepList , setStepList ] = useState(undefined);
const [ temp , setTemp ] = useState(undefined);
const [ saveFlag , setSaveFlag ] = useState(true);
@ -87,9 +97,11 @@ function Stage({ templates , datas , saveDatas , saveFunc , stepName , showNotif
<div className="mt20">
<Button type="primary" onClick={()=>nextStep("last")}>上一步</Button>
<Button className="ml20" type="primary" onClick={()=>nextStep("next")}>下一步</Button>
<Popconfirm title={'确定要删除当前阶段吗'} okText="是" cancelText="否" onConfirm={deleteFunc}>
<Cancel className="ml20">删除</Cancel>
</Popconfirm>
{!deleteFlag &&
<Popconfirm title={'确定要删除当前阶段吗'} okText="是" cancelText="否" onConfirm={deleteFunc}>
<Cancel className="ml20">删除</Cancel>
</Popconfirm>
}
</div>
</div>
)

View File

@ -1,14 +1,12 @@
import React from 'react';
import { AlignCenterBetween } from '../../Component/layout';
import { Link } from 'react-router-dom';
function head(){
return(
<AlignCenterBetween>
<span className="font-20">工作流配置</span>
<Link to={`https://forum.trustie.net/forums/3111/detail`} target="_blank" className="color-grey-6"><i className="iconfont icontishi1 font-14 mr3"></i>模板使用说明</Link>
<a href={`https://forum.trustie.net/forums/3111/detail`} target="_blank" className="color-grey-6"><i className="iconfont icontishi1 font-14 mr3"></i>模板使用说明</a>
</AlignCenterBetween>
)
}

View File

@ -30,7 +30,7 @@ function menusAdd ({ getName , checkDatas , k }){
function showInput(){
let c = checkDatas();
if(c){
if(c || c === "" ){
setShow(true);
setPut(true);
}

View File

@ -4,6 +4,7 @@ import { Table, Pagination, Popconfirm } from "antd";
import { truncateCommitId } from "../common/util";
import {getUrl} from 'educoder';
import axios from "axios";
import { Link } from 'react-router-dom';
import styled from 'styled-components';
@ -284,19 +285,16 @@ function Structure(props,ref){
];
return (
<div className="disposePanel">
<Banner>构建列表</Banner>
<Banner>
<FlexAJ>
<span>构建列表</span>
<Link to={`/projects/${owner}/${projectsId}/devops/dispose`} className="font-15 color-grey-9">返回</Link>
</FlexAJ>
</Banner>
<Div>
<div className="listPart">
<FlexAJ>
{renderStatus()}
{/* <Blueback>手动创建</Blueback> */}
{/* <span className="mr30">
<i className="iconfont icon-fenzhi1 font-16 mr5 color-blue"></i>分支
</span>
<span>
<i className="iconfont icon-biaoqian3 font-16 mr5 color-blue"></i>
标签
</span> */}
</FlexAJ>
<Table
onRow={(record,index)=>{

View File

@ -157,7 +157,6 @@ function disposePipeline(props){
steps:datas
}).then(result=>{
if(result && result.data){
props.showNotification("阶段更新成功!");
setDatasUpdataFlag(false);
if(!btn){
setStage(show_index);
@ -167,6 +166,8 @@ function disposePipeline(props){
}else{
enters(btn);
}
}else{
props.showNotification("阶段更新失败,请稍微重试!");
}
}).catch(error=>{})
}
@ -232,14 +233,19 @@ function disposePipeline(props){
stage_name:name
}).then(result=>{
if(result && result.data){
props.showNotification("阶段新增成功!");
getData(index-1);
setStageType("customize");
}else{
props.showNotification("阶段新增失败!");
}
})
}
//
function deleteStageFunc(){
debugger;
let next = menuList && menuList.filter(item=>item.show_index === (stage+1));
let nextStageType = next && next.length>0 && next[0].stage_type;
const url = `/ci/pipelines/${disposeId}/${stageId}/delete_stage.json`;
axios.delete(url,{
show_index:stage
@ -247,6 +253,7 @@ function disposePipeline(props){
if(result && result.data){
props.showNotification("阶段删除成功!");
getData(stage-1);
setStageType(nextStageType);
}
}).catch(error=>{})
}
@ -272,7 +279,7 @@ function disposePipeline(props){
...params
}).then(result=>{
if(result){
props.history.push(`/projects/${owner}/${disposeId}/devops/dispose`);
props.history.push(`/projects/${owner}/${projectsId}/devops/dispose`);
}
}).catch(error=>{
console.log(error);
@ -281,7 +288,7 @@ function disposePipeline(props){
url = `/ci/pipelines/${disposeId}/create_trustie_pipeline.json`;
axios.post(url,params).then(result=>{
if(result){
props.history.push(`/projects/${owner}/${disposeId}/devops/dispose`);
props.history.push(`/projects/${owner}/${projectsId}/devops/dispose`);
}
}).catch(error=>{
console.log(error);
@ -297,11 +304,21 @@ function disposePipeline(props){
<div style={{minHeight:"450px"}}>
<Menus step={stage} checkDatas={checkDatas} changeStep={changestage} menuList={menuList} renameFunc={renameFunc} addFunc={addMenuFunc}/>
{
stage === 1 ? <Init stage_type={stageType} templates={templates} datas={datas} saveDatas={saveDatas} saveFunc={saveFunc}/>
stageType === "init" ? <Init stage_type={stageType} templates={templates} datas={datas} saveDatas={saveDatas} saveFunc={saveFunc}/>
:
menuList && (stage === menuList.length) ? <Sure sureSubmit={sureSubmit} name={pipeLineName} datas={datas} saveFunc={saveFunc}/>
stageType === "confirm" ? <Sure sureSubmit={sureSubmit} name={pipeLineName} datas={datas} saveFunc={saveFunc}/>
:
<Stage {...props} stepName={stepName} deleteStep={deleteStep} stage_type={stageType} templates={templates} datas={datas} deleteFunc={deleteStageFunc} saveDatas={saveDatas} saveFunc={saveFunc}/>
<Stage {...props}
stepName={stepName}
deleteStep={deleteStep}
stage_type={stageType}
templates={templates}
datas={datas}
deleteFunc={deleteStageFunc}
saveDatas={saveDatas}
saveFunc={saveFunc}
deleteFlag={menuList && menuList.length === 3}
/>
}
</div>
</Spin>

View File

@ -337,20 +337,19 @@
display: flex;
flex-flow: column;
align-items:center;
justify-content: center;
justify-content: flex-start;
text-align: center;
color: #787878;
font-size: 16px;
position: relative;
cursor: pointer;
width: 110px;
max-width: 122px;
flex:2;
&>i{
font-size: 30px!important;
height: 30px;
width: 30px;
line-height: 30px;
margin-bottom: 10px;
}
&:hover,&.active{
& > i{
@ -369,17 +368,18 @@
}
.aboutEdit{
width: 100%;
padding:0px 15px;
.operateName{
position: relative;
line-height: 22px;
height: 40px;
display: block;
display: flex;
align-items: center;
justify-content: center;
padding: 0px 15px;
min-height: 40px;
& > i{
position: absolute;
right:-15px;
top:50%;
margin-top: -11px;
right:0px;
top:10px;
display: none;
}
}