forked from Gitlink/forgeplus-react
页面调整
This commit is contained in:
parent
e34485c7dc
commit
7c83425dba
|
@ -7209,8 +7209,7 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -7231,14 +7230,12 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -7253,20 +7250,17 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"optional": true
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"optional": true
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
||||
"optional": true
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -7383,8 +7377,7 @@
|
|||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"optional": true
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -7396,7 +7389,6 @@
|
|||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -7411,7 +7403,6 @@
|
|||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -7419,14 +7410,12 @@
|
|||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"optional": true
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
|
||||
"integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -7445,7 +7434,6 @@
|
|||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
|
||||
"integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
|
@ -7507,8 +7495,7 @@
|
|||
"npm-normalize-package-bin": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz",
|
||||
"integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==",
|
||||
"optional": true
|
||||
"integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA=="
|
||||
},
|
||||
"npm-packlist": {
|
||||
"version": "1.4.8",
|
||||
|
@ -7536,8 +7523,7 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
||||
"optional": true
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -7549,7 +7535,6 @@
|
|||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -7627,8 +7612,7 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"optional": true
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -7664,7 +7648,6 @@
|
|||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -7684,7 +7667,6 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -7728,14 +7710,12 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"optional": true
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
||||
"optional": true
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -72,8 +72,6 @@ function Data(props) {
|
|||
|
||||
|
||||
function iframeHeight(e){
|
||||
console.log('iframeHeight');
|
||||
console.log(e.data);
|
||||
if (e && e.data && viewBase && e.origin && viewBase.indexOf(e.origin)>-1) {
|
||||
let myHeight = JSON.parse(e.data);
|
||||
if (document.querySelector("#htmlIframe")) {
|
||||
|
@ -134,9 +132,7 @@ function Data(props) {
|
|||
function iframeLoad() {
|
||||
try {
|
||||
let myIframe = document.getElementById("htmlIframe");
|
||||
console.log('myIframe', myIframe, myIframe.contentDocument);
|
||||
if (myIframe.contentDocument) {
|
||||
console.log(myIframe.contentDocument.querySelector('.el-main'));
|
||||
myIframe.height = myIframe.contentDocument.querySelector('.el-main').clientHeight + 260;
|
||||
// myIframe.contentDocument.querySelector('.admin-body-container').style.overflow = 'hidden';
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 276 B |
Binary file not shown.
After Width: | Height: | Size: 262 B |
|
@ -0,0 +1,75 @@
|
|||
import React, {useState} from 'react';
|
||||
import { Button, Modal, Input, Select, message } from 'antd';
|
||||
import axios from 'axios';
|
||||
const {Option} = Select;
|
||||
|
||||
function DeleteBox({owner, projectsId, visible, setVisible, createJobBy, branchOptions, reload}) {
|
||||
const [error, setError] = useState(undefined);
|
||||
const [errorByOther, setErrorByOther] = useState(undefined);
|
||||
const [branch, setBranch] = useState(undefined);
|
||||
const [branchByOther, setBranchByOther] = useState(undefined);
|
||||
|
||||
// 新建同步分支点击函数
|
||||
function createNew(){
|
||||
if(branch && branchByOther){
|
||||
// 新建同步分支
|
||||
const param = {
|
||||
gitlink_branch: branch,
|
||||
job_type: 'TwoWay',
|
||||
github_branch: undefined,
|
||||
gitee_branch: undefined
|
||||
}
|
||||
createJobBy === 'Github' ? (param.github_branch = branchByOther) : (param.gitee_branch = branchByOther)
|
||||
axios.post(`/${owner}/${projectsId}/synchronizes/create_jobs.json`,param).then(res=>{
|
||||
if(res && res.data.message === "success"){
|
||||
setBranch(undefined);
|
||||
setBranchByOther(undefined);
|
||||
reload && reload(Math.random());
|
||||
message.success('新建成功');
|
||||
setVisible(false);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
!branch && setError('请选择仓库分支')
|
||||
!branchByOther && setErrorByOther('请输入仓库分支')
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
<Modal
|
||||
title="新建同步分支"
|
||||
visible={visible}
|
||||
onCancel={()=>{setVisible(false)}}
|
||||
footer={<div><Button style={{width: '104px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button type="primary" style={{width: '104px', height:'36px', marginLeft: '40px'}} onClick={createNew}>确认</Button></div>}
|
||||
width={550}
|
||||
className="cancelBound createJobBox"
|
||||
>
|
||||
<div className="itemBox mt10">
|
||||
<label className="labelBox font-16"><i className="iconfont icon-a-bitian2x font-12"></i> {createJobBy}分支:</label>
|
||||
<Input placeholder="请输入分支名称" className="inputBox" value={branchByOther} onChange={(e)=>setBranchByOther(e.target.value)}/>
|
||||
<div className="errorBox">{errorByOther}</div>
|
||||
</div>
|
||||
<div className="itemBox mt30 mb20">
|
||||
<label className="labelBox font-16"><i className="iconfont icon-a-bitian2x font-12"></i> GitLink分支:</label>
|
||||
<Select
|
||||
value={branch}
|
||||
onSelect={(e) => {setBranch(e)}}
|
||||
showSearch
|
||||
className="inputBox"
|
||||
dropdownMatchSelectWidth={false}
|
||||
dropdownClassName="overlihide"
|
||||
placeholder="请选择仓库分支"
|
||||
>
|
||||
{branchOptions && branchOptions.map((item, key) => {
|
||||
return (
|
||||
<Option key={key + 1} value={item.name}>
|
||||
{item.name}
|
||||
</Option>
|
||||
)})}
|
||||
</Select>
|
||||
<div className="errorBox">{error}</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export default DeleteBox;
|
|
@ -1,4 +1,4 @@
|
|||
import React, {forwardRef, useState} from "react";
|
||||
import React, {forwardRef} from "react";
|
||||
import { Button, Form, Input, message } from "antd";
|
||||
import gitHub from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
|
@ -13,35 +13,25 @@ function EditStore(props){
|
|||
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('绑定成功');
|
||||
}
|
||||
})
|
||||
}
|
||||
axios.post(`/${owner}/${projectsId}/synchronizes.json`,values).then(res=>{
|
||||
if(res && res.data.message === "success"){
|
||||
message.success('绑定成功');
|
||||
window.location.href = `/${owner}/${projectsId}/server/reposyncer`;
|
||||
}else{
|
||||
message.error('绑定失败');
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return <div className="storeListBox">
|
||||
return <div className="storeListBox mt20">
|
||||
<div className="registerBox">
|
||||
<Form>
|
||||
<div className="storeTitle pb10 mb15"><img src={gitHub} alt="" className="storeLogo"/></div>
|
||||
<Form.Item label="Github同步仓库地址" className="storeFormItem">
|
||||
{getFieldDecorator("github_address",{
|
||||
rules:[]
|
||||
rules:[{required: true, message: '请输入Github同步仓库地址'}]
|
||||
})(
|
||||
<Input placeholder="请输入Github目标版本库地址" className="storeInput"/>
|
||||
)}
|
||||
|
@ -69,9 +59,9 @@ function EditStore(props){
|
|||
)}
|
||||
</Form.Item>
|
||||
<div className="tipStoreBox">
|
||||
1、在开启仓库同步前,您需要绑定并授权目标同步仓库<br/>
|
||||
2、完成仓库绑定后,任意已绑定仓库有代码提交、代码推送及合并请求更新,将实时同步更新至其他仓库<br/>
|
||||
3、目前仅提供Github与Gitee平台的仓库同步功能,每个平台支持同时同步一个仓库
|
||||
1、在开启仓库同步前,您需要绑定并授权目标同步仓库;<br/>
|
||||
2、完成仓库绑定后,需对仓库内的分支进行二次绑定。当已绑定的分支有代码提交、代码推送变更,将实时同步更新至其他仓库;<br/>
|
||||
3、目前仅提供Github与Gitee平台的仓库同步功能,其中Github仓库为必填项;每个平台支持同时同步一个仓库;
|
||||
</div>
|
||||
<Form.Item>
|
||||
<Button type="primary" style={{width: '112px', height: '36px'}} onClick={submit}>确认绑定</Button>
|
||||
|
|
|
@ -1,55 +1,87 @@
|
|||
import React, {useState} from "react";
|
||||
import { Table } from 'antd';
|
||||
import gitHub from '../../img/github.png';
|
||||
import gitee from '../../img/gitee.png';
|
||||
import { Table, Modal, Button, message } from 'antd';
|
||||
import { Link } from "react-router-dom";
|
||||
import gitHub1 from '../../img/github2.svg';
|
||||
import gitee1 from '../../img/gitee1.svg';
|
||||
import anniu from '../../img/anniu.png';
|
||||
import anniu2 from '../../img/anniu2.png';
|
||||
import '../index.scss';
|
||||
import { useEffect } from "react";
|
||||
import axios from "axios";
|
||||
import CreateJobModal from './createJobModal';
|
||||
import Nodata from "../../../Nodata";
|
||||
|
||||
function RecordList(props){
|
||||
const { owner , projectsId } = props.match.params;
|
||||
const { owner , projectsId, type } = props.match.params;
|
||||
const { storeDetail} = props;
|
||||
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'}]);
|
||||
const [data, setData] = useState([]);
|
||||
// table
|
||||
const [current, setCurrent] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
|
||||
const [deleteRecordId, setDeleteRecordId] = useState(undefined);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [reload, setReload] = useState(undefined);
|
||||
const [visibleNew, setVisibleNew] = useState(false);
|
||||
const [branchOptions, setBranchOptions] = useState([]);
|
||||
const [logInfo, setLogInfo]= useState([]);
|
||||
|
||||
useEffect(()=>{
|
||||
axios.get(`/${owner}/${projectsId}/pulls/get_branches.json`, {}).then(res=>{
|
||||
res && setBranchOptions(res.data);
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(()=>{
|
||||
// 获取仓库同步记录
|
||||
axios.get(`/${owner}/${projectsId}/synchronizes/jobs.json`).then(res=>{
|
||||
console.log('111', res);
|
||||
axios.get(`/${owner}/${projectsId}/synchronizes/jobs.json`, {params: {type: type}}).then(res=>{
|
||||
if(res && res.data && res.data.message === "success"){
|
||||
res.data.data.map(item=>{
|
||||
item.create_time = item.create_time.replace('T', ' ')
|
||||
})
|
||||
setData(res.data.data);
|
||||
}
|
||||
})
|
||||
},[])
|
||||
},[reload])
|
||||
|
||||
const columns = [
|
||||
// 同步状态errorBox
|
||||
let 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} /> },
|
||||
{ title: '同步内容', dataIndex: 'content', className:"recordColumns"},
|
||||
{ title: '同步时间', dataIndex: 'time', className:"recordColumns"},
|
||||
{ title: '同步状态', dataIndex: 'status', className:"recordColumns", render: (text) => text === '0' ? <span className="errorBox statusBox">错误</span> : <span className="accomplish statusBox">完成</span> },
|
||||
{ title: '最后一次哈希值', dataIndex: 'last', className:"primaryColor recordColumns"},
|
||||
{ title: '同步日志', dataIndex: 'action', align: 'center', className:"primaryColor recordColumns"},
|
||||
{ title: type === 'github' ? 'Github分支' : 'Gitee分支', dataIndex: type === 'github' ? 'github_branch': 'gitee_branch', className:"recordColumns taskName"},
|
||||
{ title: 'GitLink分支', dataIndex: 'gitlink_branch', className:"recordColumns"},
|
||||
{ title: '创建时间', dataIndex: 'create_time', className:"primaryColor recordColumns"},
|
||||
{ title: '同步状态', dataIndex: 'status', className:"recordColumns", render: ()=><span className="accomplish statusBox">开启中</span>},
|
||||
{ title: '操作', dataIndex: 'action', align: 'center', className:"primaryColor recordColumns", render: (text, item)=><span className="deleteRecord" onClick={()=>{setVisible(true);setDeleteRecordId(item.id);}}>删除</span>},
|
||||
]
|
||||
|
||||
const customExpandIcon = (props) => {
|
||||
if (props.expanded) {
|
||||
return <a className='primaryColor' onClick={e => {
|
||||
props.onExpand(props.record, e);
|
||||
}}>查看<i className="iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-12 ml5 down mr10"></i></a>
|
||||
}}>查看日志<img alt="" src={anniu2} style={{width: '18px'}} className="ml5"/></a>
|
||||
} else {
|
||||
return <a className='primaryColor' onClick={e => {
|
||||
props.onExpand(props.record, e);
|
||||
}}>查看<i className="iconfont icon-jiantou9 font-12 ml5 down mr10"></i></a>
|
||||
axios.get(`/${owner}/${projectsId}/synchronizes/job_logs.json`, {params:{job_id: props.record.id}}).then(res=>{
|
||||
if(res && res.data){
|
||||
setLogInfo(res.data.data);
|
||||
props.onExpand(props.record, e);
|
||||
}
|
||||
})
|
||||
}}>查看日志<img alt="" src={anniu} style={{width: '18px'}} className="ml5"/></a>
|
||||
}
|
||||
}
|
||||
|
||||
const expandRow = (record) => {
|
||||
return <div>
|
||||
{record.info}
|
||||
</div>
|
||||
}
|
||||
return logInfo && logInfo.length > 0 ? <div className="expandBox">
|
||||
{logInfo.map(item=>{
|
||||
const keys = Object.keys(item);
|
||||
return <div className="expandCont" key={item.id}>
|
||||
{keys.map((i, index)=>{return <p key={index}>{i}: <span>{item[i]}</span></p>})}
|
||||
</div>
|
||||
})}
|
||||
</div> : <Nodata _html="暂无数据"/>}
|
||||
|
||||
// 展开收起行回调
|
||||
function onExpand(expanded, record){
|
||||
|
@ -75,13 +107,34 @@ function RecordList(props){
|
|||
setCurrent(page);
|
||||
}
|
||||
|
||||
// 删除同步分支
|
||||
function deleteRecord(){
|
||||
deleteRecordId && axios.delete(`/${owner}/${projectsId}/synchronizes/delete_job.json`, {data: {job_id: deleteRecordId}}).then(res=>{
|
||||
if(res && res.data.message === "success"){
|
||||
setReload(Math.random());
|
||||
message.success('删除成功');
|
||||
setVisible(false);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return <div className="storeListBox">
|
||||
<div className="font-16">
|
||||
<Link to={`/${owner}/${projectsId}/server/reposyncer`} className="blueSpan">仓库绑定</Link>
|
||||
<span> > 同步分支</span>
|
||||
</div>
|
||||
<div className="headBox font-16 pl15 mt20 mb10">
|
||||
<img src={type === 'github' ? gitHub1 : gitee1} alt="" className="mr10 mb5"/>
|
||||
<span>{type === 'github' ? 'Github' : 'Gitee'}仓库地址</span>
|
||||
<span className="ml15 blueSpan">{storeDetail && (type === 'github' ? storeDetail.github_address : storeDetail.gitee_address)}</span>
|
||||
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but createJobBut" onClick={()=>{setVisibleNew(true);}}>新建同步分支</Button>
|
||||
</div>
|
||||
<Table
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
expandedRowRender={expandRow}
|
||||
expandIconColumnIndex={6}
|
||||
expandIconColumnIndex={5}
|
||||
expandIconAsCell={false}
|
||||
expandIcon={customExpandIcon}
|
||||
rowKey={'id'}
|
||||
|
@ -89,6 +142,18 @@ function RecordList(props){
|
|||
onExpand={onExpand}
|
||||
pagination={{current: current, pageSize: pageSize, total: total, showSizeChanger: true, onShowSizeChange:onShowSizeChange, showQuickJumper: true, onChange: changePage}}
|
||||
/>
|
||||
<Modal
|
||||
title="删除同步分支"
|
||||
visible={visible}
|
||||
onCancel={()=>{setVisible(false)}}
|
||||
footer={<div><Button style={{width: '90px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button className="okBut" style={{width: '90px', height:'36px'}} onClick={deleteRecord}>确认删除</Button></div>}
|
||||
width={535}
|
||||
className="cancelBound"
|
||||
>
|
||||
<div className="bTilModal font-16"><span className="errorRedSpan font-18 mr20 mt20 ml15">!</span>确认删除此同步分支?</div>
|
||||
<div className="sTilModal"> 删除同步分支后,系统将清除此条同步数据及日志,对应分支也将停止自动同步</div>
|
||||
</Modal>
|
||||
<CreateJobModal owner={owner} projectsId={projectsId} visible={visibleNew} setVisible={setVisibleNew} createJobBy={type === 'github' ? 'Github' : 'Gitee'} branchOptions={branchOptions} reload={setReload}/>
|
||||
</div>
|
||||
}
|
||||
export default RecordList;
|
|
@ -1,50 +1,83 @@
|
|||
import React, { useState} from "react";
|
||||
import { Button, Modal } from "antd";
|
||||
import React, { useEffect, useState} from "react";
|
||||
import { Button, Modal, Icon, message, Select, Input, Tooltip } from "antd";
|
||||
import { Link } from "react-router-dom";
|
||||
import gitHub1 from '../../img/github2.svg';
|
||||
import gitee1 from '../../img/gitee1.svg';
|
||||
import logo from '../../img/logo2.png';
|
||||
import '../index.scss';
|
||||
import axios from "axios";
|
||||
import CreateJobModal from './createJobModal';
|
||||
|
||||
function StoreList(props){
|
||||
const { storeDetail} = props;
|
||||
const { owner , projectsId } = props.match.params;
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [visibleNew, setVisibleNew] = useState(false);
|
||||
const [createJobBy, setCreateJobBy] = useState("Github");
|
||||
const [branchOptions, setBranchOptions] = useState([]);
|
||||
|
||||
useEffect(()=>{
|
||||
axios.get(`/${owner}/${projectsId}/pulls/get_branches.json`, {}).then(res=>{
|
||||
res && setBranchOptions(res.data);
|
||||
})
|
||||
}, [])
|
||||
|
||||
// 取消仓库绑定点击函数
|
||||
function updateStore(){
|
||||
|
||||
axios.delete(`/${owner}/${projectsId}/synchronizes/delete.json`).then(res=>{
|
||||
if(res && res.data.message === "success"){
|
||||
message.success('取消绑定成功');
|
||||
setVisible(false);
|
||||
props.history.push(`/${owner}/${projectsId}/server`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return <div className="storeListBox">
|
||||
<div className="listStore">
|
||||
<div className="storeTitle pb5 mb5 font-18">已绑定仓库地址</div>
|
||||
<div className="headBox font-16 pl15">Reposyncer仓库同步系统
|
||||
{storeDetail !== null && <Tooltip title="Reposyncer仓库同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷" overlayStyle={{width: 400}}><span className="helpBox1 font-12 ml10">?</span></Tooltip>}
|
||||
</div>
|
||||
{/* 空数据 */}
|
||||
{!storeDetail && <div className="nullStoreBox mt25">
|
||||
<img src={logo} alt="" className="loBox mt50"/>
|
||||
<p className="font-22 mt10">欢迎使用跨平台代码同步系统</p>
|
||||
<div className="introBox font-15">跨平台代码同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷</div>
|
||||
<div className="borBox"></div>
|
||||
<Button type="primary" style={{width: '112px', height: '36px'}}><Link to={`/${owner}/${projectsId}/server/reposyncer/store/edit`}>开始体验</Link></Button>
|
||||
</div>}
|
||||
{/* 已绑定仓库信息 */}
|
||||
{storeDetail && <div className="listStore mt20">
|
||||
<div className="storeTitle pb5 mb5 font-18">已绑定仓库地址<Icon type="exclamation-circle" style={{color: '#466aff'}} className="ml10 font-14"/><span className="ml5 font-14" style={{fontWeight: 'normal'}}>对已绑定的仓库,请添加同步分支实现分支的跨平台双向同步</span></div>
|
||||
<div className="showStoreInfo dashedBor">
|
||||
<div className="infoBox">
|
||||
<div className="font-15 sTil"><img src={gitHub1} alt="" className="mr10"/><span>Github仓库地址</span></div>
|
||||
<div>{storeDetail && storeDetail.github_address}</div>
|
||||
<Link className="linkSpan" to={`/${owner}/${projectsId}/server/reposyncer/record/${`github`}`}>{storeDetail && storeDetail.github_address}</Link>
|
||||
</div>
|
||||
{/* <Button style={{width: '88px', height:'36px'}} className="red_border_but" onClick={()=>{setVisible(true)}}>取消绑定</Button> */}
|
||||
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Github')}}>新建同步分支</Button>
|
||||
</div>
|
||||
<div className="showStoreInfo">
|
||||
{storeDetail && storeDetail.gitee_address && <div className="showStoreInfo">
|
||||
<div className="infoBox">
|
||||
<div className="font-15 sTil"><img src={gitee1} alt="" className="mr10"/><span>Gitee仓库地址</span></div>
|
||||
<div>{storeDetail && storeDetail.gitee_address}</div>
|
||||
<Link className="linkSpan" to={`/${owner}/${projectsId}/server/reposyncer/record/gitee`}>{storeDetail.gitee_address}</Link>
|
||||
</div>
|
||||
{/* <Button style={{width: '88px', height:'36px'}} className="red_border_but">取消绑定</Button> */}
|
||||
</div>
|
||||
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Gitee')}}>新建同步分支</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 style={{width: '134px', height:'36px'}} className="red_border_but" onClick={()=>{setVisible(true)}}>取消绑定</Button>
|
||||
</div>
|
||||
<Button style={{width: '134px', height:'36px'}} className="red_border_but mt40" onClick={()=>{setVisible(true)}}>清空仓库绑定</Button>
|
||||
</div>}
|
||||
<Modal
|
||||
title="取消绑定"
|
||||
visible={visible}
|
||||
onOk={updateStore}
|
||||
onCancel={()=>{setVisible(false)}}
|
||||
footer={<div><Button style={{width: '104px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button className="okBut" style={{width: '104px', height:'36px'}}>确认取消</Button></div>}
|
||||
width={486}
|
||||
footer={<div><Button style={{width: '90px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button className="okBut" style={{width: '90px', height:'36px'}} onClick={updateStore}>确认取消</Button></div>}
|
||||
width={535}
|
||||
className="cancelBound"
|
||||
>
|
||||
<div className="bTilModal font-16"><span className="errorRedSpan font-18 mr20 mt20 ml15">!</span>您确定要取消此仓库地址的绑定吗?</div>
|
||||
<div className="sTilModal">缺文案</div>
|
||||
<div className="bTilModal font-16"><span className="errorRedSpan font-18 mr20 mt20 ml15">!</span>您确定要清空已绑定仓库?</div>
|
||||
<div className="sTilModal">此操作将清空所有绑定仓库/绑定分支及同步日志,请谨慎操作</div>
|
||||
</Modal>
|
||||
<CreateJobModal owner={owner} projectsId={projectsId} visible={visibleNew} setVisible={setVisibleNew} createJobBy={createJobBy} branchOptions={branchOptions}/>
|
||||
</div>
|
||||
}
|
||||
export default StoreList;
|
|
@ -18,14 +18,13 @@ const StoreList = Loadable({
|
|||
loader: () => import("./component/storeList"),
|
||||
loading: Loading,
|
||||
});
|
||||
// 同步记录页面
|
||||
// 跨平台代码同步服务-同步记录页面
|
||||
const RecordList = Loadable({
|
||||
loader: () => import("./component/recordList"),
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
function Reposyncer(propsF){
|
||||
const {pathname} = propsF.location;
|
||||
const { owner , projectsId } = propsF.match.params;
|
||||
|
||||
const [storeDetail, setStoreDetail] = useState(null);
|
||||
|
@ -40,47 +39,26 @@ function Reposyncer(propsF){
|
|||
},[])
|
||||
|
||||
return <div className="reposyncerBox">
|
||||
<div className="headBox font-16 pl15">Reposyncer仓库同步系统
|
||||
{storeDetail !== null && <Tooltip title="Reposyncer仓库同步系统提供跨托管平台的项目协同开发同步功能。支持用户在任何一个托管平台上的代码提交、代码推送、合并请求等操作自动同步至其他托管平台。不仅增加每个开源项目与开发者的流量,也使不同平台的开源项目维护与更新变得方便与快捷" overlayStyle={{width: 400}}><span className="helpBox1 font-12 ml10">?</span></Tooltip>}
|
||||
</div>
|
||||
{(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>
|
||||
<div className="borBox"></div>
|
||||
<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${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}>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/store/edit"
|
||||
render={(props) => (
|
||||
<EditStore {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/store"
|
||||
render={(props) => (
|
||||
<StoreList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/record"
|
||||
render={(props) => (
|
||||
<RecordList {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer"
|
||||
render={(props) => (
|
||||
<StoreList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
</div>}
|
||||
<Switch {...propsF}>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/record/:type"
|
||||
render={(props) => (
|
||||
<RecordList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer/store/edit"
|
||||
render={(props) => (
|
||||
<EditStore {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:owner/:projectsId/server/reposyncer"
|
||||
render={(props) => (
|
||||
<StoreList {...propsF} {...props} storeDetail={storeDetail}/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
export default Reposyncer;
|
|
@ -14,16 +14,33 @@
|
|||
border-color:#f60011;
|
||||
}
|
||||
}
|
||||
.blue_border_but, .blue_border_but:focus{
|
||||
color:$primary-color;
|
||||
background-color:rgba(70, 106, 255, 0.09);
|
||||
border:1px solid #1a47ff;
|
||||
border-radius:5px;
|
||||
&:hover{
|
||||
color:#6684fe;
|
||||
background-color:rgba(70, 106, 255, 0.09);;
|
||||
border-color:#6684fe;
|
||||
}
|
||||
&:active{
|
||||
color:#1a47ff;
|
||||
background-color:rgba(70, 106, 255, 0.09);
|
||||
border-color:#1a47ff;
|
||||
}
|
||||
}
|
||||
.reposyncerBox .headBox, .storeListBox .headBox{
|
||||
height:60px;
|
||||
line-height: 60px;
|
||||
background-color:#fafcff;
|
||||
border:1px solid rgba(42, 97, 255, 0.23);
|
||||
border-radius:3px 3px 0px 0px;
|
||||
color:#333333;
|
||||
position: relative;
|
||||
}
|
||||
.reposyncerBox{
|
||||
padding-bottom: 60px;
|
||||
.headBox{
|
||||
height:60px;
|
||||
line-height: 60px;
|
||||
background-color:#fafcff;
|
||||
border:1px solid rgba(42, 97, 255, 0.23);
|
||||
border-radius:3px 3px 0px 0px;
|
||||
color:#333333;
|
||||
}
|
||||
.helpBox1{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
|
@ -84,25 +101,36 @@
|
|||
}
|
||||
}
|
||||
.storeListBox{
|
||||
flex: 1;
|
||||
.blueSpan{
|
||||
color: $primary-color;
|
||||
}
|
||||
.createJobBut{
|
||||
position: absolute;
|
||||
top: 11px;
|
||||
right: 40px;
|
||||
}
|
||||
.storeTitle{
|
||||
font-weight:700;
|
||||
color:#151d40;
|
||||
border-bottom: 1px solid #e0e6f5;;
|
||||
}
|
||||
.registerBox{
|
||||
width: 85%;
|
||||
.storeLogo{
|
||||
width: 75px;
|
||||
}
|
||||
.storeFormItem{
|
||||
width: 70%;
|
||||
}
|
||||
.has-error .ant-input, .has-error .ant-input:hover{
|
||||
border-color:#f60011;
|
||||
}
|
||||
#gitHubToken, #giteeToken, .storeInput{
|
||||
border-color: #9eaacb;
|
||||
height: 36px;
|
||||
&:hover{border-color: $primary-color;}
|
||||
}
|
||||
.storeInput .ant-input-group-addon{
|
||||
.storeInput .ant-input-group-addon, .storeInput .ant-input{
|
||||
border-color: #9eaacb;
|
||||
}
|
||||
.tipStoreBox{
|
||||
|
@ -121,8 +149,9 @@
|
|||
border-bottom: 1px dashed #e0e6f5;
|
||||
}
|
||||
}
|
||||
.infoBox{
|
||||
color:#99a2af;
|
||||
.linkSpan{
|
||||
color:$primary-color;
|
||||
&:hover{color: $primary-color-hover;}
|
||||
}
|
||||
.sTil{
|
||||
color:#202d40;
|
||||
|
@ -130,6 +159,15 @@
|
|||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
.expandBox{
|
||||
background-color: #171b23;
|
||||
color: white;
|
||||
margin: -16px;
|
||||
padding-bottom: 16px;
|
||||
.expandCont{
|
||||
padding: 16px 16px 0;
|
||||
}
|
||||
}
|
||||
th.recordColumns{
|
||||
background-color: rgba(90, 117, 193, 0);
|
||||
.ant-table-column-title{
|
||||
|
@ -165,6 +203,21 @@
|
|||
border:1px solid #00b843;;
|
||||
}
|
||||
}
|
||||
.deleteRecord{
|
||||
color:#f60011;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
&::before{
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
left: 5px;
|
||||
width: 1px;
|
||||
height: 9px;
|
||||
background-color: #dfdfdf;;
|
||||
}
|
||||
}
|
||||
.primaryColor{color: $primary-color;}
|
||||
}
|
||||
.cancelBound{
|
||||
|
@ -179,7 +232,7 @@
|
|||
}
|
||||
.ant-modal-close{
|
||||
top: 0 !important;
|
||||
.ant-modal-close-x{font-size: 26px;}
|
||||
.ant-modal-close-x{font-size: 22px;}
|
||||
}
|
||||
.bTilModal{
|
||||
color:#333333;
|
||||
|
@ -214,4 +267,24 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.createJobBox{
|
||||
.itemBox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
.errorBox{
|
||||
position: absolute;
|
||||
top: 35px;
|
||||
left: 130px;
|
||||
color:#f60011;
|
||||
}
|
||||
}
|
||||
.labelBox{
|
||||
width: 125px;
|
||||
.icon-a-bitian2x{color: #fe1010;}
|
||||
}
|
||||
.inputBox{
|
||||
width: 80%;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue