联调0.5
This commit is contained in:
parent
5678fa0232
commit
e29d55986b
|
|
@ -32,15 +32,15 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
|
|||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
console.log("detail:",open_devops);
|
||||
|
||||
return(
|
||||
<div className="f-wrap-between mt25">
|
||||
<QuitBox visible={visible} onCancel={()=>setVisible(false)} name={projectDetail && projectDetail.name} onSuccess={onSuccess}/>
|
||||
{
|
||||
menuName && projectDetail ?
|
||||
menuName && projectDetail ?
|
||||
<ul className="headerMenu-wrapper">
|
||||
{
|
||||
Array.isArray(menuName)&& menuName.map((item,key)=>{
|
||||
Array.isArray(menuName)&& menuName.map((item,key)=>{
|
||||
return(
|
||||
<React.Fragment key={item.menu_name}>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,26 +1,53 @@
|
|||
import React, {forwardRef, useState} from "react";
|
||||
import { Button, Form, Input } from "antd";
|
||||
import { Button, Form, Input, message } from "antd";
|
||||
import gitHub from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
import '../index.scss';
|
||||
import axios from "axios";
|
||||
|
||||
function EditStore(props){
|
||||
const { form, history} = props;
|
||||
const { owner , projectsId } = props.match.params;
|
||||
const { getFieldDecorator, validateFields , setFieldsValue } = form;
|
||||
|
||||
function submit() {
|
||||
validateFields((error,values)=>{
|
||||
if(!error){
|
||||
// 处理空值
|
||||
// for(let i in values){
|
||||
// if(!values[i]){
|
||||
// delete values[i];
|
||||
// }
|
||||
// }
|
||||
const keysArr = Object.keys(values);
|
||||
if(keysArr.indexOf('github_address') === -1 && keysArr.indexOf('gitee_address') === -1){
|
||||
form.setFields({github_address: {value:values.github_address,errors:[new Error('输入')]}});
|
||||
form.setFields({gitee_address: {value:values.gitee_address,errors:[new Error('输入')]}});
|
||||
}else{
|
||||
axios.post(`/${owner}/${projectsId}/synchronizes.json`,{...values}).then(res=>{
|
||||
console.log('res', res);
|
||||
if(res && res.data.message === "success"){
|
||||
message.success('绑定成功');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return <div className="storeListBox">
|
||||
<div className="registerBox">
|
||||
<Form>
|
||||
<div className="storeTitle pb10 mb15"><img src={gitHub} alt="" className="storeLogo"/></div>
|
||||
<Form.Item label="Github同步仓库地址" className="storeFormItem">
|
||||
{getFieldDecorator("gitHubUrl",{
|
||||
{getFieldDecorator("github_address",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入Github目标版本库地址" className="storeInput"/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="Github同步仓库授权验证" className="storeFormItem">
|
||||
{getFieldDecorator("gitHubToken",{
|
||||
{getFieldDecorator("github_token",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input addonBefore="token" placeholder="请输入Github的授权token" className="storeInput"/>
|
||||
|
|
@ -28,14 +55,14 @@ function EditStore(props){
|
|||
</Form.Item>
|
||||
<div className="storeTitle pb10 mb15 pt20"><img src={gitee} alt="" className="storeLogo"/></div>
|
||||
<Form.Item label="Gitee同步仓库地址" className="storeFormItem">
|
||||
{getFieldDecorator("giteeUrl",{
|
||||
{getFieldDecorator("gitee_address",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入Gitee目标版本库地址" className="storeInput"/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item label="Github同步仓库授权验证" className="storeFormItem">
|
||||
{getFieldDecorator("giteeToken",{
|
||||
<Form.Item label="Gitee同步仓库授权验证" className="storeFormItem">
|
||||
{getFieldDecorator("gitee_token",{
|
||||
rules:[]
|
||||
})(
|
||||
<Input addonBefore="token" placeholder="请输入Gitee的授权token" className="storeInput"/>
|
||||
|
|
@ -47,7 +74,7 @@ function EditStore(props){
|
|||
3、目前仅提供Github与Gitee平台的仓库同步功能,每个平台支持同时同步一个仓库
|
||||
</div>
|
||||
<Form.Item>
|
||||
<Button type="primary" style={{width: '112px', height: '36px'}}>确认绑定</Button>
|
||||
<Button type="primary" style={{width: '112px', height: '36px'}} onClick={submit}>确认绑定</Button>
|
||||
<Button style={{width: '112px', height: '36px'}} className="ml40" onClick={()=>{history.goBack(-1)}}>取消</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import { Table } from 'antd';
|
|||
import gitHub from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
import '../index.scss';
|
||||
import { useEffect } from "react";
|
||||
import axios from "axios";
|
||||
|
||||
function RecordList(props){
|
||||
const { owner , projectsId } = props.match.params;
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [data, setData] = useState([{id: 1, name: 'gitHub', content: 'commit', time: '2022.5.12', status: '0', last: 'aaaaaa', info: 'hajahjah'}]);
|
||||
// table
|
||||
|
|
@ -13,6 +16,13 @@ function RecordList(props){
|
|||
const [pageSize, setPageSize] = useState(20);
|
||||
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
|
||||
|
||||
useEffect(()=>{
|
||||
// 获取仓库同步记录
|
||||
axios.get(`/${owner}/${projectsId}/synchronizes/jobs.json`).then(res=>{
|
||||
console.log('111', res);
|
||||
})
|
||||
},[])
|
||||
|
||||
const columns = [
|
||||
{ title: '序号', dataIndex: 'index', className:"recordColumns", render: (text, item, index) => <span>{(current-1)*pageSize+index + 1}</span> },
|
||||
{ title: '同步平台', dataIndex: 'name', className:"recordColumns taskName", render: (text, item) => text === 'gitHub' ? <img src={gitHub} alt="" width={76}/> : <img src={gitee} alt="" width={76} /> },
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import gitee1 from '../../img/gitee1.svg';
|
|||
import '../index.scss';
|
||||
|
||||
function StoreList(props){
|
||||
const { storeDetail} = props;
|
||||
const { owner , projectsId } = props.match.params;
|
||||
const [info, setInfo] = useState({gitHub: 'aaaaaaaa', gitee: 'bbbbbbbbb'});
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
function updateStore(){
|
||||
|
|
@ -19,18 +19,19 @@ function StoreList(props){
|
|||
<div className="showStoreInfo dashedBor">
|
||||
<div className="infoBox">
|
||||
<div className="font-15 sTil"><img src={gitHub1} alt="" className="mr10"/><span>Github仓库地址</span></div>
|
||||
<div>{info.gitHub}</div>
|
||||
<div>{storeDetail && storeDetail.github_address}</div>
|
||||
</div>
|
||||
<Button style={{width: '88px', height:'36px'}} className="red_border_but" onClick={()=>{setVisible(true)}}>取消绑定</Button>
|
||||
{/* <Button style={{width: '88px', height:'36px'}} className="red_border_but" onClick={()=>{setVisible(true)}}>取消绑定</Button> */}
|
||||
</div>
|
||||
<div className="showStoreInfo">
|
||||
<div className="infoBox">
|
||||
<div className="font-15 sTil"><img src={gitee1} alt="" className="mr10"/><span>Gitee仓库地址</span></div>
|
||||
<div>{info.gitee}</div>
|
||||
<div>{storeDetail && storeDetail.gitee_address}</div>
|
||||
</div>
|
||||
<Button style={{width: '88px', height:'36px'}} className="red_border_but">取消绑定</Button>
|
||||
{/* <Button style={{width: '88px', height:'36px'}} className="red_border_but">取消绑定</Button> */}
|
||||
</div>
|
||||
<Button type="primary" style={{width: '134px', height:'36px', padding: 0}} className="mt30"><Link to={`/${owner}/${projectsId}/server/reposyncer/store/edit`}>更改绑定仓库信息</Link></Button>
|
||||
{/* <Button type="primary" style={{width: '134px', height:'36px', padding: 0}} className="mt30"><Link to={`/${owner}/${projectsId}/server/reposyncer/store/edit`}>更改绑定仓库信息</Link></Button> */}
|
||||
<Button style={{width: '134px', height:'36px'}} className="red_border_but" onClick={()=>{setVisible(true)}}>取消绑定</Button>
|
||||
</div>
|
||||
<Modal
|
||||
title="取消绑定"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useState} from "react";
|
||||
import React, {useState, useEffect} from "react";
|
||||
import { Button, Tooltip } from "antd";
|
||||
import './index.scss';
|
||||
import logo from '../img/logo2.png';
|
||||
|
|
@ -6,6 +6,7 @@ import Loadable from "react-loadable";
|
|||
import { Route, Switch } from "react-router";
|
||||
import Loading from "../../../Loading";
|
||||
import { Link } from "react-router-dom";
|
||||
import axios from 'axios';
|
||||
|
||||
// 编辑同步仓库页面
|
||||
const EditStore = Loadable({
|
||||
|
|
@ -27,13 +28,22 @@ function Reposyncer(propsF){
|
|||
const {pathname} = propsF.location;
|
||||
const { owner , projectsId } = propsF.match.params;
|
||||
|
||||
const [storeList, setStoreList] = useState([]);
|
||||
const [storeDetail, setStoreDetail] = useState(null);
|
||||
|
||||
useEffect(()=>{
|
||||
// 获取仓库同步详情
|
||||
axios.get(`/${owner}/${projectsId}/synchronizes.json`).then(res=>{
|
||||
if(res && res.data.message === "success"){
|
||||
setStoreDetail(res.data.data);
|
||||
}
|
||||
})
|
||||
},[])
|
||||
|
||||
return <div className="reposyncerBox">
|
||||
<div className="headBox font-16 pl15">Reposyncer仓库同步系统
|
||||
{(storeList.length !== 0) && <Tooltip title="Reposyncer仓库同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷" overlayStyle={{width: 400}}><span className="helpBox1 font-12 ml10">?</span></Tooltip>}
|
||||
{storeDetail !== null && <Tooltip title="Reposyncer仓库同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷" overlayStyle={{width: 400}}><span className="helpBox1 font-12 ml10">?</span></Tooltip>}
|
||||
</div>
|
||||
{(storeList.length === 0 && pathname.endsWith('/reposyncer')) ? <div className="nullStoreBox mt25">
|
||||
{(storeDetail === null && pathname.endsWith('/reposyncer')) ? <div className="nullStoreBox mt25">
|
||||
<img src={logo} alt="" className="loBox mt50"/>
|
||||
<p className="font-22 mt10">欢迎使用跨平台代码同步系统</p>
|
||||
<div className="introBox font-15">跨平台代码同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷</div>
|
||||
|
|
@ -41,7 +51,7 @@ function Reposyncer(propsF){
|
|||
<Button type="primary" style={{width: '112px', height: '36px'}}><Link to={`/${owner}/${projectsId}/server/reposyncer/store/edit`}>开始体验</Link></Button>
|
||||
</div> : <div className="rightContentBox mt20">
|
||||
<div className="leftNav font-15">
|
||||
<Link to={`/${owner}/${projectsId}/server/reposyncer/store${storeList.length === 0 ? '/edit' : ''}`} className={`oneBox ${pathname.endsWith('/record') ? '' : 'active'}`}>仓库绑定</Link>
|
||||
<Link to={`/${owner}/${projectsId}/server/reposyncer/store${storeDetail === null ? '/edit' : ''}`} className={`oneBox ${pathname.endsWith('/record') ? '' : 'active'}`}>仓库绑定</Link>
|
||||
<Link to={`/${owner}/${projectsId}/server/reposyncer/record`} className={`oneBox ${pathname.endsWith('/record') ? 'active' : ''}`}>同步记录</Link>
|
||||
</div>
|
||||
<Switch {...propsF}>
|
||||
|
|
@ -54,7 +64,7 @@ function Reposyncer(propsF){
|
|||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/store"
|
||||
render={(props) => (
|
||||
<StoreList {...propsF} {...props}/>
|
||||
<StoreList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
|
|
@ -66,7 +76,7 @@ function Reposyncer(propsF){
|
|||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer"
|
||||
render={(props) => (
|
||||
<StoreList {...propsF} {...props} edit={false}/>
|
||||
<StoreList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
|||
Loading…
Reference in New Issue