需求优化

This commit is contained in:
谢思 2022-08-11 11:38:12 +08:00
parent d793440b37
commit 3e3a055b7d
4 changed files with 27 additions and 11 deletions

View File

@ -21,8 +21,13 @@ function EditStore(props){
}
const keysArr = Object.keys(values);
if(keysArr.indexOf('github_address') === -1 && keysArr.indexOf('gitee_address') === -1){
// githubgitee
form.setFields({github_address: {value:values.github_address,errors:[new Error('请至少输入一个地址')]}});
form.setFields({gitee_address: {value:values.gitee_address,errors:[new Error('请至少输入一个地址')]}});
}else if(keysArr.indexOf('github_address') !== -1 && keysArr.indexOf('github_token') === -1){
form.setFields({github_token: {value:values.github_token,errors:[new Error('请输入Github的授权token')]}});
}else if(keysArr.indexOf('gitee_address') !== -1 && keysArr.indexOf('gitee_token') === -1){
form.setFields({gitee_token: {value:values.gitee_token,errors:[new Error('请输入Gitee的授权token')]}});
}else{
axios.post(`/${owner}/${projectsId}/synchronizes.json`,values).then(res=>{
if(res && res.data.message === "success"){
@ -73,7 +78,7 @@ function EditStore(props){
<div className="tipStoreBox">
1在开启仓库同步前您需要绑定并授权目标同步仓库<br/>
2完成仓库绑定后需对仓库内的分支进行二次绑定当已绑定的分支有代码提交代码推送变更将实时同步更新至其他仓库<br/>
3目前仅提供Github与Gitee平台的仓库同步功能其中Github仓库为必填项每个平台支持同时同步一个仓库
3目前仅提供Github与Gitee平台的仓库同步功能每个平台支持同时同步一个仓库
</div>
<Form.Item>
<Button type="primary" style={{width: '112px', height: '36px'}} onClick={submit}>确认绑定</Button>

View File

@ -76,9 +76,8 @@ function RecordList(props){
const expandRow = (record) => {
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>})}
{item.create_time + ' [' + item.log_type + '] ' + item.log}
</div>
})}
</div> : <Nodata _html="暂无数据"/>}
@ -126,10 +125,11 @@ function RecordList(props){
<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>
{storeDetail && <a className="ml15 blueSpan" href={type === 'github' ? storeDetail.github_address : storeDetail.gitee_address} target="_blank">{type === 'github' ? storeDetail.github_address : storeDetail.gitee_address}</a>}
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but createJobBut" onClick={()=>{setVisibleNew(true);}}>新建同步分支</Button>
</div>
<Table
className="storeListTable"
loading={loading}
columns={columns}
dataSource={data}

View File

@ -50,18 +50,24 @@ function StoreList(props){
{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>
{storeDetail && storeDetail.github_address && <div className="showStoreInfo dashedBor">
<div className="infoBox">
<div className="storeInfoBox">
<div className="font-15 sTil"><img src={gitHub1} alt="" className="mr10"/><span>Github仓库地址</span></div>
<Link className="linkSpan" to={`/${owner}/${projectsId}/server/reposyncer/record/${`github`}`}>{storeDetail && storeDetail.github_address}</Link>
<span>{storeDetail && storeDetail.github_address}</span>
</div>
<div>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but mr20"><Link to={`/${owner}/${projectsId}/server/reposyncer/record/github`}>查看同步分支</Link></Button>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Github')}}>新建同步分支</Button>
</div>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Github')}}>新建同步分支</Button>
</div>}
{storeDetail && storeDetail.gitee_address && <div className="showStoreInfo">
<div className="infoBox">
<div className="storeInfoBox">
<div className="font-15 sTil"><img src={gitee1} alt="" className="mr10"/><span>Gitee仓库地址</span></div>
<Link className="linkSpan" to={`/${owner}/${projectsId}/server/reposyncer/record/gitee`}>{storeDetail.gitee_address}</Link>
<span>{storeDetail.gitee_address}</span>
</div>
<div>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but mr20"><Link to={`/${owner}/${projectsId}/server/reposyncer/record/gitee`}>查看同步分支</Link></Button>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Gitee')}}>新建同步分支</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 mt40" onClick={()=>{setVisible(true)}}>清空仓库绑定</Button>

View File

@ -101,6 +101,9 @@
}
}
.storeListBox{
.storeListTable{
width: 100%;
}
.blueSpan{
color: $primary-color;
}
@ -122,7 +125,7 @@
.storeFormItem{
width: 70%;
}
.has-error .ant-input, .has-error .ant-input:hover{
.has-error .ant-input, .has-error .ant-input:hover, .has-error .storeInput .ant-input{
border-color:#f60011;
}
#gitHubToken, #giteeToken, .storeInput{
@ -153,6 +156,7 @@
color:$primary-color;
&:hover{color: $primary-color-hover;}
}
.storeInfoBox{color: #666;}
.sTil{
color:#202d40;
display: flex;
@ -165,6 +169,7 @@
margin: -16px;
padding-bottom: 16px;
.expandCont{
word-break: break-all;
padding: 16px 16px 0;
}
}