Merge pull request 'logo 从接口获取 nav_logo_url' (#226) from caishi/forgeplus-react:feature_homepage into feature_homepage

This commit is contained in:
jasder 2021-10-28 17:30:39 +08:00
commit 7ec53a246c
143 changed files with 7361 additions and 2110 deletions

1179
.idea/workspace.xml Normal file

File diff suppressed because it is too large Load Diff

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

124
LICENSE Normal file
View File

@ -0,0 +1,124 @@
木兰宽松许可证, 第2版
2020年1月 http://license.coscl.org.cn/MulanPSL2
您对“软件”的复制、使用、修改及分发受木兰宽松许可证第2版“本许可证”的如下条款的约束
0. 定义
“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
“法人实体” 是指提交贡献的机构及其“关联实体”。
“关联实体” 是指对“本许可证”下的行为方而言控制、受控制或与其共同受控制的机构此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
1. 授予版权许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
2. 授予专利许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
3. 无商标许可
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可但您为满足第4条规定的声明义务而必须使用除外。
4. 分发限制
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
5. 免责声明与责任限制
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
6. 语言
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
条款结束
如何将木兰宽松许可证第2版应用到您的软件
如果您希望将木兰宽松许可证第2版应用到您的新软件为了方便接收者查阅建议您完成如下三步
1 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
2 请您在软件包的一级目录下创建以“LICENSE”为名的文件将整个许可证文本放入该文件中
3 请将如下声明文本放入每个源文件的头部注释中。
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
Mulan Permissive Software LicenseVersion 2
Mulan Permissive Software LicenseVersion 2 (Mulan PSL v2)
January 2020 http://license.coscl.org.cn/MulanPSL2
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
0. Definition
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
Contribution means the copyrightable work licensed by a particular Contributor under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, control means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
1. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
2. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
3. No Trademark License
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4.
4. Distribution Restriction
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
5. Disclaimer of Warranty and Limitation of Liability
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW ITS CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. Language
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
END OF THE TERMS AND CONDITIONS
How to Apply the Mulan Permissive Software LicenseVersion 2 (Mulan PSL v2) to Your Software
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
Create a file named "LICENSE" which contains the whole context of this License in the first directory of your software package;
Attach the statement to the appropriate annotated syntax at the beginning of each source file.
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.

57
package-lock.json generated
View File

@ -3425,9 +3425,9 @@
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw=="
},
"clipboard": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
"integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz",
"integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==",
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
@ -3875,6 +3875,52 @@
"warning": "^4.0.3"
}
},
"cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"requires": {
"cross-spawn": "^7.0.1"
},
"dependencies": {
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"requires": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
}
},
"path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
},
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"requires": {
"shebang-regex": "^3.0.0"
}
},
"shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"requires": {
"isexe": "^2.0.0"
}
}
}
},
"cross-fetch": {
"version": "3.1.4",
"resolved": "https://registry.nlark.com/cross-fetch/download/cross-fetch-3.1.4.tgz",
@ -16586,6 +16632,11 @@
}
}
},
"save-dev": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/save-dev/-/save-dev-0.0.1-security.tgz",
"integrity": "sha512-k6knZTDNK8PKKbIqnvxiOveJinuw2LcQjqDoaorZWP9M5AR2EPsnpDeSbeoZZ0pHr5ze1uoaKdK8NBGQrJ34Uw=="
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",

View File

@ -22,10 +22,11 @@
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"classnames": "^2.2.5",
"clipboard": "^2.0.6",
"clipboard": "^2.0.8",
"code-prettify": "^0.1.0",
"codemirror": "^5.53.0",
"connected-react-router": "4.4.1",
"cross-env": "^7.0.3",
"css-loader": "^3.5.2",
"dompurify": "^2.0.15",
"dotenv": "4.0.0",
@ -103,6 +104,7 @@
"redux-thunk": "2.3.0",
"rsuite": "^4.3.4",
"sass-loader": "7.3.1",
"save-dev": "0.0.1-security",
"scroll-into-view": "^1.14.2",
"showdown": "^1.9.1",
"showdown-katex": "^0.8.0",
@ -122,8 +124,8 @@
},
"scripts": {
"start": "node --max_old_space_size=15360 scripts/start.js",
"build": "NODE_ENV=production node --max_old_space_size=15360 scripts/build.js",
"test-build": "NODE_ENV=testBuild node --max_old_space_size=15360 scripts/build.js",
"build": "cross-env NODE_ENV=production node --max_old_space_size=15360 scripts/build.js",
"test-build": "cross-env NODE_ENV=testBuild node --max_old_space_size=15360 scripts/build.js",
"pre-build": "NODE_ENV=preBuild node --max_old_space_size=15360 scripts/build.js",
"gen_stats": "NODE_ENV=production webpack --profile --config=./config/webpack.config.prod.js --json > stats.json",
"ana": "webpack-bundle-analyzer ./stats.json",

View File

@ -1268,11 +1268,17 @@ a.shixun-task-btn {
/*-----------实训配置、评测脚本-------------*/
@font-face {
font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1631773579834') format('woff2'),
url('iconfont.woff?t=1631773579834') format('woff'),
url('iconfont.ttf?t=1631773579834') format('truetype');
}
html body {
font-size: 14px;
line-height: 2.0;
background: #fafafa;
font-family: "Microsoft YaHei", "SimSun";
font-family: "iconfont";
color: #05101a;
height: 100%;
position: relative;
@ -1520,7 +1526,15 @@ a.edu-txt-w80,
.font-16 {
font-size: 16px !important;
}
.weight400{
font-weight: 400;
}
.weight500{
font-weight: 500;
}
.weight{
font-weight: bold;
}
.font-17 {
font-size: 17px !important;
}
@ -1540,6 +1554,9 @@ a.edu-txt-w80,
.font-25 {
font-size: 25px !important;
}
.font-26 {
font-size: 26px !important;
}
.font-24 {
font-size: 24px !important;
@ -1561,6 +1578,9 @@ a.edu-txt-w80,
font-size: 36px !important;
}
.font-40 {
font-size: 40px !important;
}
.font-50 {
font-size: 50px !important;
}
@ -1746,6 +1766,14 @@ a.decoration {
margin-bottom: 10px;
}
.mb12 {
margin-bottom: 12px;
}
.mb13 {
margin-bottom: 13px;
}
.mb14 {
margin-bottom: 14px;
}
@ -2434,7 +2462,7 @@ a.hoverLine:hover{
.color-grey-9 {
color: #333333 !important;
color: #999 !important;
}
a:hover{
@ -2460,7 +2488,7 @@ a:hover{
.color-grey-B3 {
color: #B3B3B3 !important;
}
`
.color-grey-B4 {
color: #B4B4B4 !important;
}
@ -6683,10 +6711,13 @@ p{
right: 0px;
top:4px;
color: #999;
<<<<<<< HEAD
=======
}
.ant-input, .ant-input .ant-input-suffix{
background-color: #fff!important;
}
.has-error .ant-input{
background-color: #FEF1F0!important;
>>>>>>> pre_develop
}

View File

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1632738478946') format('woff2'),
url('iconfont.woff?t=1632738478946') format('woff'),
url('iconfont.ttf?t=1632738478946') format('truetype');
src: url('iconfont.woff2?t=1634881729644') format('woff2'),
url('iconfont.woff?t=1634881729644') format('woff'),
url('iconfont.ttf?t=1634881729644') format('truetype');
}
.iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-wenjian7:before {
content: "\e8e0";
}
.icon-xiangyoujiantou:before {
content: "\e8de";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "24656750",
"name": "文件",
"font_class": "wenjian7",
"unicode": "e8e0",
"unicode_decimal": 59616
},
{
"icon_id": "630094",
"name": "向右箭头",

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/favicon-.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -10,7 +10,7 @@ import {
import axios from 'axios';
import LoginDialog from './modules/login/LoginDialog';
import 'babel-polyfill';
import Loading from './Loading'
import Loading from './Loading';
import Loadable from 'react-loadable';
import marked from './common/marked';
@ -101,6 +101,10 @@ const Home = Loadable({
loader: () => import('./home/Index'),
loading: Loading,
})
// const CreateMerge = Loadable({
// loader: () => import('./forge/Merge/NewMerge'),
// loading: Loading,
// })
// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"];
@ -279,7 +283,7 @@ class App extends Component {
} />
{/* 项目PR */}
<Route path="/:owner/:projectsId/pulls/new"
<Route path="/:owner/:projectsId/compare"
render={
(props) => (<ProjectDetail {...this.props} {...props} {...this.state} />)
}

View File

@ -69,7 +69,7 @@ export function appendFileSizeToUploadFile(item) {
}
export function appendFileSizeToUploadFileAll(fileList) {
return fileList.map(item => {
if (item.name.indexOf(uploadNameSizeSeperator) == -1) {
if (item.name.indexOf(uploadNameSizeSeperator) === -1) {
return Object.assign({}, item, { name: `${item.name}${uploadNameSizeSeperator}${bytesToSize(item.size)}` })
}
return item

View File

@ -10,6 +10,10 @@ import ActivityItem from './ActivityItem';
import axios from 'axios';
const LIMIT = 15;
const ARRAY = [
{
id:"",
name:'全部'
},
{
id:1,
name:'1天'
@ -32,10 +36,15 @@ class Activity extends Component{
constructor(props){
super(props);
this.state={
time:'30',
time:undefined,
type:undefined,
state:undefined,
page:1,
pr_count:undefined,
new_pr_count:undefined,
close_issues_count:undefined,
open_issues_count:undefined,
pr_all_count:undefined,issues_count:undefined,
data:undefined,
project_trends:undefined,
@ -63,8 +72,15 @@ class Activity extends Component{
this.setState({
data:result.data,
project_trends:result.data.project_trends,
isSpin:false
isSpin:false,
pr_count:result.data.pr_count,
new_pr_count:result.data.new_pr_count,
close_issues_count:result.data.close_issues_count,
open_issues_count:result.data.open_issues_count,
pr_all_count:result.data.pr_all_count,
issues_count:result.data.issues_count,
})
window.scrollTo(0,0);
}
}).catch(error=>{
console.log(error);
@ -74,19 +90,19 @@ class Activity extends Component{
// 切换周期
changeTime=(e)=>{
this.setState({
time:e.key,
time:e.key ==="item_0"?undefined:e.key,
isSpin:true
})
const { type,status,page } = this.state;
this.getInfo(e.key,type,status,page);
this.getInfo(e.key ==="item_0"?undefined:e.key,type,status,page);
}
//筛选
changeTrends=(type,status)=>{
this.setState({
type,status
type,status,page:1
})
const {time,page}=this.state;
this.getInfo(time,type,status,page);
const {time}=this.state;
this.getInfo(time,type,status,1);
}
// 分页
ChangePage=(page)=>{
@ -108,12 +124,14 @@ class Activity extends Component{
</Menu>
)
render(){
const { time , data , page , project_trends , isSpin } = this.state;
const { time , data , page , project_trends , isSpin , pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count } = this.state;
let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}];
let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ;
const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%';
const first_per = pr_all_count > 0 ? `${parseFloat(pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
const second_per =pr_all_count > 0 ? `${parseFloat(new_pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
const third_per =issues_count > 0 ?`${parseFloat(close_issues_count/issues_count).toFixed(2)*100}%` :"50%";
const fourth_per =issues_count > 0 ?`${parseFloat(open_issues_count/issues_count).toFixed(2)*100}%` :"50%";
return(
<div className="main">
@ -122,7 +140,7 @@ class Activity extends Component{
<div className="orderInfo">
<div>
<div className="percentLine prPercent">
<p className="percent_purple" style={{width:'100%'}}></p>
<p className="percent_purple" style={{width:first_per}}></p>
<p className="percent_green resetStyle" style={{width:`${second_per}`}}></p>
</div>
<span>{data && data.pr_all_count}合并请求</span>
@ -132,25 +150,25 @@ class Activity extends Component{
<p className="percent_red" style={{width:`${third_per}`}}></p>
<p className="percent_green" style={{width:`${fourth_per}`}}></p>
</div>
<span>{data && data.issues_count}任务</span>
<span>{data && data.issues_count}易修</span>
</div>
</div>
<ul className="percentBox">
<li>
<span className="purple">{data && data.pr_count}</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","close")}>已处理的合并请求</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","delay")}>已处理的合并请求</span>
</li>
<li>
<span className="green">{data && data.new_pr_count}</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","create")}>未处理的合并请求</span>
<span className="change" onClick={()=>this.changeTrends("PullRequest","not_delay")}>未处理的合并请求</span>
</li>
<li>
<span className="red">{data && data.close_issues_count}</span>
<span className="change" onClick={()=>this.changeTrends("Issue","close")}>已关闭的任务</span>
<span className="change" onClick={()=>this.changeTrends("Issue","delay")}>已关闭的易修</span>
</li>
<li>
<span className="green">{data && data.open_issues_count}</span>
<span className="change" onClick={()=>this.changeTrends("Issue","create")}>未处理的任务</span>
<span className="change" onClick={()=>this.changeTrends("Issue","not_delay")}>未处理的易修</span>
</li>
</ul>
</div>

View File

@ -27,7 +27,7 @@ class ActivityItem extends Component {
:
// 如果是合并请求
<p className="itemLine">
<Link to={`/${owner}/${projectsId}/pulls/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<Link to={`/${owner}/${projectsId}/pulls/${item.trend_id}`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
}

View File

@ -1,32 +1,61 @@
import React , { useState , useEffect } from 'react';
import { Popover , Dropdown , Input , Spin } from 'antd';
import React , { useState , useEffect , useRef } from 'react';
import { Dropdown} from 'antd';
import './branch.scss';
import { getBranch , getTag } from '../GetData/getData';
import SelectOverlay from './SelectOverlay';
import { findDOMNode } from 'react-dom';
export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{
const [ showValue , setShowValue ] = useState(branch);
const [ visible , setVisible ] = useState(false);
const refFa = useRef(null);
const refBox = useRef(null);
useEffect(() => {
document.addEventListener('click', clickMe , false);
}, [])
const clickMe = ({ target }) => {
//
const faComponent = findDOMNode(refFa.current);
const boxComponent = findDOMNode(refBox.current);
if (faComponent && boxComponent) {
const isChild = faComponent.contains(target);
const isBox = boxComponent.contains(target);
if(!isChild && !isBox){
setVisible(false);
}
}
}
useEffect(()=>{
setShowValue(branch);
},[branch])
function ChangeB(params) {
setVisible(false);
changeBranch(params);
}
const menu = (
<SelectOverlay
changeBranch={changeBranch}
tagflag={tagflag}
projectsId={projectsId}
owner={owner}
branchList={branchList}
<div ref={refFa}>
<SelectOverlay
visible={visible}
changeBranch={ChangeB}
tagflag={tagflag}
projectsId={projectsId}
owner={owner}
branchList={branchList}
/>
</div>
);
return(
<Dropdown placement='bottomLeft' overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
<div className="branch-tagBox">
<Dropdown placement='bottomLeft' visible={visible} overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
<div className="branch-tagBox" ref={refBox} onClick={()=>setVisible(visible ? false : true)}>
{/* {nav === 0 ?"分支":"标签"} */}
<span className="color-grey-9 mr3 ml8"><i className="iconfont icon-fenzhi2 font-18"></i></span>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500"}}>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"270px"}}>
{showValue}
</span>
<i className="showtag iconfont icon-sanjiaoxing-down font-15 color-grey-9 mr5 ml5 mt1" />

View File

@ -2,7 +2,7 @@ import React , { useState , useEffect } from 'react';
import { Input , Spin , Menu } from 'antd';
import { getBranch , getTag } from '../GetData/getData';
function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owner }) {
function SelectOverlay({ changeBranch , tagflag , projectsId , owner , visible }) {
const [ inputValue , setInputValue] = useState(undefined);
const [ nav , setNav ] = useState(0);
const [ isSpin , setIsSpin ] = useState(true);
@ -12,12 +12,12 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne
const [ keys ,setKeys] = useState("branch");
useEffect(()=>{
if(branchList){
setData(branchList);
setDatas(branchList);
setIsSpin(false);
if(visible){
setKeys("branch");
getBranchs(projectsId,owner);
setIsSpin(true);
}
},[branchList])
},[visible])
async function getBranchs(id,owner){
let result = await getBranch(id,owner);
@ -45,8 +45,10 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne
setIsSpin(true);
if(e.key === "branch"){
getBranchs(projectsId,owner);
setNav(0);
}else{
getTags(projectsId,owner);
setNav(1);
}
}
@ -55,7 +57,7 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne
<div className="padding15" style={{paddingBottom:"0px"}}>
<Input
prefix={<i className="iconfont icon-sousuo_icon1 font-14"></i>}
placeholder="请输入分支或标签名称搜索"
placeholder={`请输入分支${tagflag ? "或标签" :""}名称搜索`}
autocomplete="off" className="OptionsInput"
value={inputValue}
onChange={changeInputValue}
@ -68,12 +70,16 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne
<Spin spinning={isSpin}>
<ul className="OptionsUl" id="ul-btn">
{
datas && datas.length>0 ?
datas && datas.length>0 &&
datas.map((item,key)=>{
return(
<li key={key} onClick={()=>chooseitem(item.name)}><a className="task-hide ulALink">{item.name}</a></li>
)
}):
})
}
{
datas && datas.length === 0 &&
<p className="listTips">暂无{inputValue}{nav === 0 ?"分支":"标签"}~</p>
}
</ul>

View File

@ -23,6 +23,7 @@
max-height: 300px;
}
.OptionsUl{
min-height: 50px;
max-height: 220px;
overflow-y: auto;
}
@ -87,6 +88,13 @@
line-height: 30px;
padding:0px 5px;
margin-left: 20px!important;
&.ant-menu-item-selected{
border-color:#466aff!important;
color:#466aff!important;
}
&.ant-menu-item-active{
border-color:transparent ;
}
}
}
}
@ -109,7 +117,7 @@
color: #333;
}
&.ant-menu-item-selected{
border-color:#1890ff!important;
border-color:#466aff!important;
}
&.ant-menu-item-active{
border-color:transparent ;

View File

@ -0,0 +1,125 @@
/* eslint-disable react/jsx-no-duplicate-props */
import React, { useState } from 'react';
import * as ReactDOM from 'react-dom';
import { Modal, Button } from 'antd';
import './index.scss';
//
InitModal.defaultProps = {
okText: '确认', //
cancelText: '取消', //
className: '', //
inputId: 'copyText', //ID
onCancel:()=>{}, //
onOk:()=>{}, //
title:'提示', //
contentTitle:'', //
content:'', //
afterClose:()=>{}, //
};
// 使
export default function DelModal(props) {
renderModal({ ...props, type: 'delete' })
}
// 使
export function Confirm(props) {
renderModal({ ...props, type: 'confirm' })
}
function renderModal(props) {
const { type, afterClose } = props;
const div = document.createElement('div');
document.body.appendChild(div);
function destroy() {
afterClose && afterClose();
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
}
}
function modalType(type) {
if (type === 'delete') {
return <InitModal
title="删除"
contentTitle="确定要删除吗?"
okText="确认删除"
{...props}
afterClose={destroy}
contentTitle={<React.Fragment>
<i className="red-circle iconfont icon-shanchu_tc_icon mr3"></i>
{props.contentTitle}
</React.Fragment>}
/>
} else if (type === 'confirm') {
return <InitModal title="选择" afterClose={destroy} {...props} />
} else {
return <InitModal title="选择" afterClose={destroy} {...props} />
}
}
function render() {
setTimeout(() => {
ReactDOM.render(
modalType(type),
div,
);
});
}
render();
}
//
function InitModal({
onCancel,
onOk,
title,
contentTitle,
content,
okText,
cancelText,
afterClose,
className,
}) {
const [visible, setVisible] = useState(true);
function onCancelModal() {
setVisible(false);
onCancel && onCancel()
}
function onSuccess() {
setVisible(false);
onOk && onOk();
}
return (
<Modal
visible={visible}
onCancel={onCancelModal}
afterClose={afterClose}
title={title}
className={`myself-modal ${className}`}
centered
footer={[
<Button type="default" key="back" onClick={onCancelModal}>
{cancelText}
</Button>,
<Button className="foot-submit" key="submit" onClick={onSuccess}>
{okText}
</Button>,
]}
>
<div>
{contentTitle && <p className="content-title">{contentTitle}</p>}
<p className="content-descibe">{content}</p>
</div>
</Modal>
)
}

View File

@ -0,0 +1,63 @@
.myself-modal {
.ant-modal-header {
padding: 9px 24px;
background: #f8f8f8;
border-bottom: 1px solid #eee;
}
.ant-modal-title {
text-align: left;
}
.ant-modal-close {
top: 0px !important;
}
.ant-modal-close-x {
font-size: 24px;
}
.ant-modal-body {
text-align: center;
}
.content-title {
display: flex;
justify-content: center;
align-items: center;
margin: 2rem 0 1rem !important;
font-size: 16px;
color: #333;
letter-spacing: 0;
line-height: 29px;
font-weight: 400;
}
.red-circle {
align-self: flex-start;
color: #ca0002;
font-size: 1.5rem !important;
}
.content-descibe {
font-size: 14px;
color: #666;
line-height: 33px;
font-weight: 400;
}
.ant-modal-footer {
padding: 2rem 0;
text-align: center;
border: 0;
.ant-btn {
width: 6rem;
}
}
.foot-submit {
margin-left: 3rem;
color: #df0002;
&:hover {
border-color: #df0002;
}
}
.ant-btn-default:hover,
.ant-btn-default:active,
.ant-btn-default:focus {
background: #f3f4f6;
color: #333;
border-color: #d0d0d0;
}
}

View File

@ -0,0 +1,90 @@
.systemBox{
.ant-modal-body{
padding:1px 0px 0px 0px;
.sysBox{
background-image: url('./bg.png');
background-repeat: no-repeat;
background-size: 100% 334px;
margin-top: -55px;
}
.sysnoticeBox{
width: 100%;
padding:80px 0px 34px;
display: flex;
flex-direction: column;
width: 780px;
margin: 0px auto;
p.ntitle{
height: 33px;
font-size: 24px;
font-weight: 500;
color: #31FFF7;
line-height: 33px;
text-align: center;
}
p.nSubtitle{
height: 25px;
line-height: 25px;
font-size: 18px;
font-weight: 500;
color: #FFFFFF;
margin-top: 60px;
padding-left: 20px;
}
.markdown-body{
box-shadow: 0px 0px 17px rgba(0,0,0,0.2);
border-radius: 4px;
margin-top: 17px!important;
}
.nContent{
padding:20px 34px;
background-color: #fff;
line-height: 30px;
font-size: 15px;
font-weight: 400;
color: #333;
.realmName{
margin-top: 20px;
display: flex;
ul{
width: 50%;
padding-left: 0px!important;
li{
font-size: 15px;
font-weight: 500;
line-height: 32px;
text-align: left;
color: #000;
list-style-type: none!important;
&:first-child{
color: #E65714;
}
}
}
}
.nSubdesc{
font-size: 15px;
font-weight: 400;
color: #000000;
line-height: 31px;
margin-top: 20px;
}
.nInfo{
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
margin-top: 25px;
p{
height: 20px;
line-height: 20px;
}
}
}
.nBtn{
text-align: center;
margin-top: 33px;
}
}
}
}

View File

@ -0,0 +1,76 @@
import React , { useEffect , useState } from 'react';
import { Modal , Button } from 'antd';
import './Index.scss';
import '../../css/index.scss';
import RenderHtml from '../../../components/render-html';
import cookie from 'react-cookies';
function SystemNotice({system_notification,history}){
const [ visible , setVisible ] = useState(false);
useEffect(()=>{
if(system_notification && !cookie.load('notice_stage')){
setVisible(true);
}
},[system_notification,history.location])
function sureContinue() {
cookie.remove('notice_stage');
let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//
// let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//
cookie.save('notice_stage', true,{ expires: inFifteenMinutes,path:"/" });
setVisible(false);
}
return (
<Modal
visible = {visible}
width="1000px"
footer={false}
title={false}
centered={true}
closable={false}
wrapClassName={'systemBox'}
>
<div className="sysBox">
<div className="sysnoticeBox">
<p className="ntitle">{system_notification && system_notification.subject}</p>
<p className="nSubtitle">{system_notification && system_notification.sub_subject}</p>
{/* <div className="nContent">
<div className="nMaindesc">
为了给用户提供更加稳定优质的服务我们即将对平台门户首页平台名称平台域名进行一次全面升级与变更原平台名称Trustie中文名确实将于2021年10月xx日统一更改为Gitlink中文名确实开源届时平台域名将统一进行更换更换规则如下
</div>
<div className="realmName">
<ul>
<li>原域名</li>
<li>官网顶级域名https://www.trustie.net</li>
<li>版本库子域名https://forgeplus.trustie.net</li>
<li>论坛子域名https://forum.trustie.net/forums</li>
</ul>
<ul>
<li>更换后域名</li>
<li>官网顶级域名https://www.gitlink.org.cn</li>
<li>版本库子域名https://www.git.gitlink.org.cn</li>
<li>论坛子域名https://forum.gitlink.org.cn</li>
</ul>
</div>
<div className="nSubdesc">
自2021年10月xx日起旧域名将停止访问因平台名称与域名变更给您带来的不便我们深表歉意!非常感谢您一直以来对本平台的信任与支持我们将一如既往地为您提供优质的服务 特此通知!
</div>
<div className="nInfo">
<p>Gitlink运营团队</p>
<p>2021年10月xx日</p>
</div>
</div> */}
<RenderHtml className="break_word_comments imageLayerParent" value={system_notification && system_notification.content} url={history.location}/>
<div className="nBtn">
<Button type="primary" className="btnblue" onClick={sureContinue}>确认并继续</Button>
</div>
</div>
</div>
</Modal>
)
}
export default SystemNotice;

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

View File

@ -2,8 +2,7 @@ import React from 'react';
import { AlignTop } from '../Component/layout';
import { Link } from 'react-router-dom';
function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}){
function Releases({ owner, projectsId, releaseVersions, distribution }) {
return(
<div>
<Link to={`/${owner}/${projectsId}/releases`} className="font-16 color-ooo hoverA">
@ -16,8 +15,9 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
return(
key === 0 &&<AlignTop className="mt10">
<div>
<p className="font-16 color-grey-6">
<Link to={`/${owner}/${projectsId}/releases`}>{item.name}</Link>
<p className="font-16 color-grey-6" style={{display:'flex',alignItems:'center'}}>
{/* 如果是点击最新则发行版列表页只展示最新的一个 */}
<Link to={{pathname:`/${owner}/${projectsId}/releases`,query:{turnFromNew:true}}} style={{maxWidth:'200px',overflow: 'hidden',whiteSpace: 'nowrap',textOverflow:'ellipsis'}}>{item.name}</Link>
<span className="font-12 laterest ml5">最新</span>
</p>
<p className="color-grey-3 font-12">{item.created_at}</p>
@ -27,7 +27,8 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
})
:
<div className="mt8">
您暂未发布任何版本{baseOperate && projectType !==2 && <Link className="color-blue ml20" to={`/${owner}/${projectsId}/releases/new`}>创建新版本</Link>}
您暂未发布任何版本
{distribution && <Link className="color-blue ml20" to={{pathname:`/${owner}/${projectsId}/releases/new`,state:{stable:true}}}>创建新版本</Link>}
</div>
}

View File

@ -5,6 +5,7 @@ import { Link } from 'react-router-dom';
export default ({ url , name , column , id , login })=>{
const Img = styled.span`
display:flex;
font-weight: bold;
${column && "flex-direction: column;text-align:center;"}
align-items: center;
& img{

View File

@ -51,7 +51,7 @@ function PipelineName({visible,onCancel,onOk,value ,branchList}){
})
}
</Select>
<Select mode="multiple" allowClear value={eventValue} dropdownClassName="chooseCon" style={{width:"180px",marginLeft:"10px"}} onChange={(e)=>{console.log(e);setEventValue(e)}}>
<Select mode="multiple" allowClear value={eventValue} dropdownClassName="chooseCon" style={{width:"180px",marginLeft:"10px"}} onChange={(e)=>{setEventValue(e)}}>
{
EVENT.map((item,key)=>{
return(

View File

@ -24,7 +24,6 @@ function onLayout(term, el) {
entry.target.offsetHeight,
term,
);
console.log('cols, rows', cols, rows);
term.resize(cols, rows);
mediator.publish('ssh-xterm-resize', {
columns: cols,
@ -139,12 +138,10 @@ export default ({ sshConfigData, sid }) => {
}, 1000);
}
isFirstConnected.current = true;
console.log('event:', event);
const data = Base64.decode(event.data.toString());
let w = term._core._renderService.dimensions.actualCellWidth || 9.5;
console.log('data:', data, w, term);
term.write(data);
};

View File

@ -0,0 +1,108 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Icon } from 'antd';
import _ from 'lodash';
import Nodata from '../Nodata';
class PullRefresh extends Component {
constructor(props) {
super(props);
this.state = {
}
this.pullRef = {};
//
this.onScrollList = _.throttle(this.handleScroll, 200, {
leading: false,
trailing: true,
});
}
componentDidMount() {
let dom = document.querySelector('.pull-refresh-wrap');
dom && dom.addEventListener('scroll', this.onScrollList);
}
componentWillUnmount() {
let dom = document.querySelector('.pull-refresh-wrap');
dom && dom.removeEventListener('scroll', this.onScrollList)
}
handleScroll = () => {
if (this.props.count < this.props.pageSize) return;
if (this.props.type === 1 || this.props.type === 2) return;
const wrap = this.pullRef;
const currentScroll = wrap.scrollTop + wrap.clientHeight
//
if (currentScroll >= (wrap.scrollHeight - 200)) {
this.loadData()
}
}
handleLoadClick = () => {
this.loadData();
}
loadData = () => {
this.props.onPullRefresh()
}
renderLoading() {
switch (this.props.type) {
case 0: //
return <div className='text-center' onClick={this.handleLoadClick}>显示更多</div>
case 1: //
return (
<div className='text-center'>
<Icon type="loading" />
<span className='text-center'>加载中...</span>
</div>
)
case 2: //
return <div className='text-center'>没有更多了</div>
default:
return <div className='text-center'>没有更多了</div>
}
}
render() {
const { className, count, children } = this.props;
return (
<div
className={`pull-refresh-wrap ${className}`}
ref={dom => { this.pullRef = dom }}
>
{children}
{
count < 1 && <Nodata _html="暂无未读消息"/>
}
{/* 大于分页数据才显示loading */}
{/* {this.props.count >= this.props.pageSize ? this.renderLoading() : null} */}
</div>
)
}
}
PullRefresh.propTypes = {
className: PropTypes.string,
children: PropTypes.any,
onPullRefresh: PropTypes.func.isRequired,
type: PropTypes.oneOf([0, 1, 2]),
count: PropTypes.number.isRequired,
pageSize: PropTypes.number.isRequired,
}
export default PullRefresh

View File

@ -19,9 +19,10 @@ function Footer(){
return(
<div>
<div style={{height:"443px"}}></div>
{/* {value && showhtml(value)} */}
<div style={{height:"483px"}}></div>
<div className="newFooter edu-txt-center">
{value && showhtml(value)}
{value && showhtml(value)}
{/* <div className="footEdition">
<div className="footContent">
<ul className="center">
@ -50,14 +51,14 @@ function Footer(){
<img src={"Img"} alt="公众号"/>
</div>
<div>
<li>qq</li>
<img src={"qqImg"} alt="qq群"/>
<li>QQ</li>
<img src={"qqImg"} alt="QQ群"/>
</div>
</li>
</ul>
</div>
<p className="copyrightDesc">©Copyright 20072021 国防科技大学Gitlink团队 & IntelliDE <br/>湘ICP备 17009477</p>
</div> */}
</div> */}
</div>
</div>
)

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import AccountProfile from "../../modules/user/AccountProfile";
import { getImageUrl } from 'educoder'
import axios from 'axios';
import { Input , notification , Dropdown , Menu } from 'antd';
import { Input , notification , Dropdown ,Popover, Menu,Badge, Button } from 'antd';
import { Link } from 'react-router-dom';
import LoginDialog from '../../modules/login/LoginDialog';
@ -13,6 +13,7 @@ import '../../modules/tpm/TPMIndex.css';
import CheckProfile from '../Component/ProfileModal/Profile';
import './header.scss';
import NoticeContent from './NoticeContent';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const { Search } = Input;
@ -47,6 +48,7 @@ class NewHeader extends Component {
settings: null,
visiblemyss: false,
openSearch:false,
visible:false, //浮动消息框展示控制
}
}
componentDidMount() {
@ -92,9 +94,6 @@ class NewHeader extends Component {
this.setState({
user: newProps.user
})
if (newProps.Headertop !== undefined) {
old_url = newProps.Headertop.old_url
}
}
educoderlogin = () => {
@ -121,7 +120,6 @@ class NewHeader extends Component {
})
};
HideAddcoursestypess = (i) => {
console.log("调用了");
this.setState({
Addcoursestypes: false,
mydisplay: true,
@ -255,6 +253,7 @@ class NewHeader extends Component {
</div>
)
}
renderMenu=(personal)=>{
const { current_user } = this.props;
return(
@ -269,14 +268,18 @@ class NewHeader extends Component {
)
})
}
<li><Link to={`/settings/profile`}>设置</Link></li>
{/* <li><Link to={`/settings/profile`}>设置</Link></li> */}
<Menu.Item><a onClick={() => this.educoderloginysl()}>退出</a></Menu.Item>
</Menu>
)
}
handleVisibleChange = visible => {
this.setState({ visible });
};
render() {
const { match} = this.props;
const { match ,resetUserInfo ,showNotification} = this.props;
let current_user = this.props.user;
let {
AccountProfiletype,
@ -285,6 +288,7 @@ class NewHeader extends Component {
headtypesonClickbool,
headtypess,
settings,
visible,
} = this.state;
/*用户名称 用户头像url*/
let activeIndex = false;
@ -363,7 +367,6 @@ class NewHeader extends Component {
}
let search_url = settings && settings.common && settings.common.search;
let notice_url = settings && settings.common && settings.common.notice;
return (
<div className="newHeaders" id="nHeader">
<div className="headerContent">
@ -395,7 +398,7 @@ class NewHeader extends Component {
{
settings.navbar && settings.navbar.map((item, key) => {
var new_link = item.link;
var user_login = this.props.user && this.props.user.login;
var user_login = current_user && current_user.login;
var is_hidden = item.hidden
if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) {
if (user_login) {
@ -426,25 +429,30 @@ class NewHeader extends Component {
}
</div>
<div className="head-right">
{/* {search_url ? this.SearchInput(openSearch,search_url):""} */}
{ search_url && <HeadSearch {...this.props}/>}
{
current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)?
<Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight">
<i className="iconfont icon-tianjiafangda color-grey-6 ml30"></i>
<i className="iconfont icon-tianjiafangda color-grey-6 ml30 mr15"></i>
</Dropdown>:""
}
{this.props.user && this.props.user.login && notice_url ?
<div className="ml30 edu-menu-panel">
{user && user.login &&
<a href={`${notice_url}`} style={{ position: 'relative' }}>
<i className="iconfont icon-xiaoxilingdang color-grey-6"></i>
<span className="newslight" style={{ display: this.props.Headertop === undefined ? "none" : this.props.Headertop.new_message === true ? "block" : "none" }}>
</span>
</a>
}
</div>:""
{ (settings && settings.common && settings.common.notice) && (current_user && current_user.login)?
<Popover
overlayClassName="notice-popover"
placement={`bottomRight`}
content={<NoticeContent visible={visible} current_user={current_user} showNotification={showNotification} resetUserInfo={resetUserInfo}/>}
visible={visible}
onVisibleChange={this.handleVisibleChange}
destroyTooltipOnHide
>
<Link to={"/settings/notice"} className="message-icon">
{current_user && <Badge count={current_user.message_unread_total}>
<i className="iconfont icon-xiaoxilingdang color-grey-6 ml15 mr15"></i>
</Badge>}
</Link>
</Popover>
: ""
}
</div>
{!user || (user && !user.login) ?

View File

@ -0,0 +1,262 @@
import React, { useEffect, useState } from 'react';
import { Badge, Menu } from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import AppPullRefresh from './AppPullRefresh';
import { noticeSourceType } from '../common/static';
import './header.scss';
import '../SecuritySetting/notice/manager/Index.scss';
import '../SecuritySetting/Index.scss';
import '../SecuritySetting/notice/myNotice/Index.scss';
function NoticeContent({ visible, showNotification, resetUserInfo, current_user: { login } }) {
const [initialize, setInitialize] = useState(true);
const [noticeType, setNoticeType] = useState("notification");
const [letterUnreadCount, setLetterUnreadCount] = useState(0);//
const [noticeUnreadCount, setNoticeUnreadCount] = useState(0);//
const [noticePage, setNoticePage] = useState(0);
const [noticeUnreadList, setNoticeUnreadList] = useState([]);//
const [atUnreadCount, setAtUnreadCount] = useState();//@
const [atPage, setAtPage] = useState(0);
const [atUnreadList, setAtUnreadList] = useState([]);//@
useEffect(() => {
resetUserInfo();
}, [noticeUnreadCount,atUnreadCount]);
useEffect(()=>{
setNoticePage(0);
setAtPage(0);
},[visible])
useEffect(() => {
const params = {
type: noticeType,
limit: 10,
page: noticeType === "notification" ? noticePage : noticeType === "atme" ? atPage : "",
status: 1,
}
getMessageList(params);
}, [noticePage, atPage]);
useEffect(() => {
const params = {
type: noticeType,
limit: 10,
page: 0,
status: 1,
};
if (initialize) {
params.type = "atme"
}
visible && getMessageList(params);
}, [visible]);
function getMessageList(params) {
axios.get(`/users/${login}/messages.json`, {
params: params,
}).then((response) => {
if (response && response.data) {
setNoticeUnreadCount(response.data.unread_notification);
setAtUnreadCount(response.data.unread_atme);
if (params.type === "notification") {
let list = response.data.messages;
if (params.page !== 0) {
list = [...noticeUnreadList, ...list];
}
setNoticeUnreadList(list);
if (initialize) {
// tab
setInitialize(false);
if (response.data.unread_notification === 0 && response.data.unread_atme !== 0) {
setNoticeType("atme");
}
}
} else if (params.type === "atme") {
let list = response.data.messages;
if (params.page !== 0) {
list = [...atUnreadList, ...list];
}
setAtUnreadList(list);
}
}
})
}
function readAll() {
axios.post(`/users/${login}/messages/read.json`, {
type: noticeType,
ids: [-1]
}).then((response) => {
let data = response.data;
if (!data) return;
if (data.status === 0) {
changeReadMarkAll(noticeType);
} else {
showNotification(data.message);
}
});
}
function changeReadMarkAll(noticeType) {
if (noticeType === "notification") {
let list = noticeUnreadList.slice();
list.forEach(item => {
item.status = 2;
})
setNoticeUnreadList(list);
setNoticeUnreadCount(0);
} else if (noticeType === "atme") {
let list = atUnreadList.slice();
list.forEach(item => {
item.status = 2;
})
setAtUnreadList(list);
setAtUnreadCount(0);
}
}
// const [letter_unread_list, setLetter_unread_list] = useState([
// {
// id: 122,
// read: 0, //01
// send_name: "", //
// send_login: "jiangYuHang", //login
// content: "", //
// create_time: "2019-03-04 18:08", //
// },
// ]);
function readItem(item) {
axios.post(`/users/${login}/messages/read.json`, {
type: noticeType,
ids: [item.id]
}).then((response) => {
let data = response.data;
if (!data) return;
if (data.status === 0) {
changeReadMark(item);
item.notification_url && window.open(item.notification_url);
} else {
showNotification(data.message);
}
});
}
function changeReadMark(item) {
if (item.type === "notification") {
let list = noticeUnreadList.slice();
let index = noticeUnreadList.indexOf(item);
list[index].status = 2;
setNoticeUnreadList(list);
if (noticeUnreadCount > 0) {
setNoticeUnreadCount(noticeUnreadCount - 1);
}
} else if (item.type === "atme") {
let list = atUnreadList.slice();
let index = atUnreadList.indexOf(item);
list[index].status = 2;
setAtUnreadList(list);
if (atUnreadCount > 0) {
setAtUnreadCount(atUnreadCount - 1);
}
}
}
return (
<div className="messageHoverDiv notice01">
<div className="sshHead hoverNotice-head">
<Menu mode="horizontal" selectedKeys={noticeType} onClick={(e) => setNoticeType(e.key)}>
<Menu.Item key="notification"><Badge count={noticeUnreadCount}>系统通知</Badge></Menu.Item>
{/* <Menu.Item key="1" id="item-private"><Badge count={letterUnreadCount}>私信</Badge></Menu.Item> */}
<Menu.Item key="atme"><Badge count={atUnreadCount}>@</Badge></Menu.Item>
</Menu>
</div>
{/* 系统通知 */}
{noticeType === "notification" && <AppPullRefresh
className='hoverNotice-body' // className
onPullRefresh={() => { setNoticePage(noticePage + 1); }} //ajaxfunction
// type={2} //
count={noticeUnreadList.length} //
pageSize={10} //
>
{
noticeUnreadList.map(item => {
return (
<div key={item.id + Math.random()} className="noticeCont-back" onClick={() => { readItem(item) }}>
<div className={`noticeCont ${item.notification_url?'pointer':''}`}>
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>
<i className={"iconfont " + noticeSourceType[item.source]}></i>
<div className="noticeCont-text">
<span className="content-span notice-cont-span" dangerouslySetInnerHTML={{ __html: item.content }}></span>
<span className="timeSpan">{item.time_ago}</span>
</div>
</div>
</div>
)
})
}
</AppPullRefresh>
}
{/* @我 */}
{noticeType === "atme" && <AppPullRefresh
className='hoverNotice-body' // className
onPullRefresh={() => { setAtPage(atPage + 1); }} //ajaxfunction
// type={1} //
count={atUnreadList.length} //
pageSize={10} //
>
{atUnreadList.map(item => {
return (
<div key={item.id + Math.random()} className="noticeCont-back" onClick={() => { readItem(item) }}>
<div className="noticeCont">
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>
<div className="noticeCont-text">
<span className="content-span atme-cont-span" dangerouslySetInnerHTML={{ __html: "<b>" + (item.sender ? item.sender.name : '') + "</b>&nbsp;&nbsp;&nbsp;" + item.content + " 中@我" }}></span>
<span className="timeSpan">{item.time_ago}</span>
</div>
</div>
</div>
)
})
}
</AppPullRefresh>
}
{/* 私信 */}
{/* {noticeType === "1" ? letter_unread_list.length > 0 ? letter_unread_list.map(item => {
return (
<div className="noticeCont-back">
<div className="noticeCont" style={{ height: item.content.length >= 30 && item.content.length <= 34 ? '65px' : "" }}>
<Badge color="#FA2020" />
<div className="noticeCont-text">
<span>{item.send_name}</span>
<span className="boldSpan" dangerouslySetInnerHTML={{ __html: item.content.length >= 50 ? item.content.substr(0, 50) + "..." : item.content }}></span>
<span className="timeSpan">{item.create_time ? timeAgo(item.create_time) : "刚刚"}</span>
</div>
</div>
</div>
)
}) : "暂无数据" : ""} */}
<div className="hoverNotice-buttom">
<Link to={{pathname:"/settings/notice",query:{noticeType:noticeType}}}>全部消息</Link>
{noticeUnreadCount > 0 && noticeType === "notification" && <a onClick={readAll}>所有系统消息一键已读</a>}
{atUnreadCount > 0 && noticeType === "atme" && <a onClick={readAll}>所有@我一键已读</a>}
</div>
</div>
)
}
export default NoticeContent;

View File

@ -24,8 +24,9 @@
width: 34px;
height: 34px;
border-radius: 50%;
margin-left: 30px;
margin-left: 15px;
}
.currentMenu{
width: 120px;
text-align: center;
@ -128,6 +129,141 @@
}
}
// 右上角小铃铛单独样式
.notice-popover{
//popover小尖尖
.ant-popover-arrow{
display: none;
}
//popover框
.ant-popover-inner-content {
width: 386px;
height: 446px;
box-shadow: 0px 4px 8px 2px rgba(212, 212, 212, 0.5);
border-radius: 4px;
margin-top: -10px;
padding: 12px 1px 12px 0;
}
}
.messageHoverDiv .ant-menu-item{
margin-right: 24px !important;
}
.hoverNotice-head{
margin-left: 18px;
& .ant-badge{
font-size: 14px !important;
}
&>.ant-menu-horizontal {
border-bottom: 1px solid #e8e8e8 !important;
}
}
.hoverNotice-body{
height: 342px;
overflow-y: scroll;
& b{
font-weight: 400;
text-shadow: 0.5px 0 0 #333;
}
.none_panels{
height: 100%;
}
}
.message-icon{
position: relative;
.ant-scroll-number{
right:12px;
padding: 0 0px;
}
}
.hoverNotice-buttom{
display: flex;
justify-content: space-between;
padding: 12px 18px;
a{
color: #466AFF;
&:hover{
opacity:0.85;
}
}
}
.noticeCont-back{
.pointer{
cursor: pointer;
}
&:hover{
background: #F3F4F6;
}
}
.noticeCont{
display: flex;
margin: 0 16px 0 18px;
padding: 12px 0 10px 0;
line-height: 24px;
border-bottom: 1px solid #EEEEEE;
cursor: default;
i{
font-size: 14px !important;
margin-right: 6px;
color: #333333;
}
.boldSpan{
font-weight: 400;
text-shadow: 0.5px 0 0 #333;
}
.noticeCont-text{
display: flex;
color:#333333;
flex:auto;
justify-content: space-between;
& .content-span{
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
& .atme-cont-span{
width: 272px;
}
& .notice-cont-span{
width: 255px;
}
.timeSpan{
font-size: 12px;
color: #666666;
}
.at-name{
margin-right: 12px;
}
}
}
.text-center{
text-align: center;
}
.footEdition{
background-color: #171B23;
.footContent{

View File

@ -60,12 +60,6 @@ class Index extends Component {
<ProjectNew {...this.props} {...props} />
)}
></Route>
{/* <Route
path="/:owner/:projectsId"
render={(props) => (
<ProjectDetail {...this.props} {...props} />
)}
></Route> */}
<Route
path="/explore"
render={(props) => (
@ -73,12 +67,12 @@ class Index extends Component {
)}
></Route>
<Route
{/* <Route
path="/"
render={(props) => (
<ProjectIndex {...this.props} {...props} />
)}
></Route>
></Route> */}
</Switch>
</div>
);
@ -90,10 +84,3 @@ export default withRouter(
parentSelector: ".newMain",
})(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
);
// export default withRouter(
// ImageLayerOfCommentHOC({
// imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
// parentSelector: ".newMain",
// })(Index)
// );

View File

@ -22,6 +22,7 @@ import UpdateDescModal from './sub/UpdateDescModal';
import Nodata from '../Nodata';
import Invite from './sub/Invite';
import CheckProfile from '../Component/ProfileModal/Profile';
import RenderHtml from '../../components/render-html';
/**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/
@ -67,6 +68,7 @@ function CoderDepot(props){
const [ editReadme , setEditReadme ] = useState(false);
const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true);
const [ releaseVersions , setReleaseVersions] = useState(undefined);
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -74,7 +76,8 @@ function CoderDepot(props){
branchName = returnbar(branchName);
const details = props.projectDetail;
let pathname = props.history.location.pathname;
//distribution
const distribution = details && details.type != 2 && (details.permission === "Admin" || details.permission === "Owner" || details.permission === "Manager");
const { bannerList } = props;
useEffect(()=>{
@ -119,14 +122,47 @@ function CoderDepot(props){
setTreeValue(url);
getFileInfo(url,branchName);
setType("file");
// getReadmeInfo(url,branchName);
// setReadme(undefined);
}else{
setTreeValue(undefined);
getDirInfo(branchName || defaultBranch);
setType("dir");
// getReadmeInfo('', branchName || defaultBranch);
}
}
},[projectsId,owner,pathname,defaultBranch])
useEffect(()=>{
axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{
if(result && result.data){
const release = {
"list":result.data.releases,
"total_count":result.data.releases.length
}
setReleaseVersions(release);
}
})
},[])
// readme
function getReadmeInfo(path, ref) {
axios.get(`/${owner}/${projectsId}/readme.json`, {
params:{
owner: owner,
repo: projectsId,
filepath:path,
ref:ref || branchName
}
}).then((result) => {
if (result) {
setReadme(result.data);
} else {
setReadme(undefined);
}
})
}
//
function getDirInfo(branch){
setIsSpin(true);
@ -146,9 +182,10 @@ function CoderDepot(props){
setLastCommitAuthor(c && c.committer);
setMainFlag(true);
setReadOnly(true);
setReadme(result.data.readme);
// setReadme(result.data.readme);
setEditReadme(false);
setHide(true);
getReadmeInfo('', branchName || defaultBranch);
}
setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);})
@ -160,7 +197,7 @@ function CoderDepot(props){
let ele = document.getElementById("ptxt");
if(ele){
let h = ele.offsetHeight;
if( h > 18 ) setHideBtn(true);
if( h > 35 ) setHideBtn(true);
}
}
},[projectDetail,lastCommit])
@ -181,15 +218,18 @@ function CoderDepot(props){
setDirInfo(undefined);
setFileInfo(en);
setType(en.type);
setReadme(undefined);
}else{
setFileInfo(undefined);
setDirInfo(en);
setType("dir");
getReadmeInfo(path, branchName || defaultBranch);
}
let c = result.data.last_commit
setLastCommit(c && c.commit);
setLastCommitAuthor(c && c.committer);
setMainFlag(false);
setReadOnly(true);
setReadOnly(!editReadme);
setHide(true);
}
@ -301,7 +341,8 @@ function CoderDepot(props){
const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
const { current_user } = props;
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter";
const baseOper = current_user && current_user.login && issuesFlag;
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter" && projectDetail.type !== 2 && pullsFlag;
const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
return(
@ -348,34 +389,47 @@ function CoderDepot(props){
branchList={projectDetail && projectDetail.branches && projectDetail.branches.list}
></SelectBranch>
:
<span>分支<span className="color-grey-6">{branchName || defaultBranch}</span></span>
<span>分支<span className="color-grey-6">{branchName || defaultBranch}</span></span>
}
</div>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/branches`} className="iconBtn">
<i className="iconfont icon-master_icon font-16"></i>
<span>分支</span>
<span>{projectDetail && projectDetail.branches && projectDetail.branches.total_count}</span>
</Link>
</AlignCenter>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/tags`} className="iconBtn">
<i className="iconfont icon-biaoqianicon font-16"></i>
<span>标签</span>
<span>{projectDetail && projectDetail.tags && projectDetail.tags.total_count}</span>
</Link>
</AlignCenter>
{
treeValuePath && treeValuePath.length > 0 ?
<Path
identifier={projectDetail && projectDetail.identifier}
treeValuePath={treeValuePath}
returnUlr={returnUlr}
returnMain={returnMain}
getPathUrl={getPathUrl}
/>
:
<React.Fragment>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/branches`} className="iconBtn">
<i className="iconfont icon-master_icon font-16"></i>
<span>分支</span>
<span>{projectDetail && projectDetail.branches_count}</span>
</Link>
</AlignCenter>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/tags`} className="iconBtn">
<i className="iconfont icon-biaoqianicon font-16"></i>
<span>标签</span>
<span>{projectDetail && projectDetail.tags_count}</span>
</Link>
</AlignCenter>
</React.Fragment>
}
</AlignCenter>
<AlignCenter className="depotBtn">
{
baseOperate && ((projectDetail.type !== 2 && pullsFlag) || issuesFlag )&&
(baseOperate || baseOper) &&
<div className="addOptionBtn">
{
projectDetail.type !== 2 && pullsFlag &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</CheckProfile>
baseOperate &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile>
}
{
issuesFlag &&
baseOper &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/issues/new`)} >+ 易修</CheckProfile>
}
</div>
@ -403,8 +457,8 @@ function CoderDepot(props){
lastCommit &&
<div className="listtablehead">
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
<div onClick={()=>props.history.push(`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`)} className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
<pre id="ptxt">{lastCommit.message}</pre>
<div className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
<pre id="ptxt"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`}><RenderHtml value={lastCommit.message}/></Link></pre>
</div>
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
@ -418,16 +472,6 @@ function CoderDepot(props){
</div>
}
<ul className="listtablebody">
{
treeValuePath && treeValuePath.length > 0 &&
<Path
identifier={projectDetail && projectDetail.identifier}
treeValuePath={treeValuePath}
returnUlr={returnUlr}
returnMain={returnMain}
getPathUrl={getPathUrl}
/>
}
{
dirInfo && dirInfo.length > 0 &&
dirInfo.map((item,key)=>{
@ -461,11 +505,11 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && !fileInfo ? <Nodata _html="暂未发现文件"/> :""
}
{/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
{ (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
</div>
</LongWidth>
{
!fileInfo &&
(!(treeValuePath && treeValuePath.length > 0) && !fileInfo) &&
<ShortWidth>
<Gap style={{paddingLeft:"30px"}}>
<div className="panelmenu">
@ -516,16 +560,15 @@ function CoderDepot(props){
}
{/* 发布 */}
{
projectDetail && projectDetail.release_versions &&
releaseVersions &&
<React.Fragment>
<Divider />
<Releases
owner={owner}
projectsId={projectsId}
releaseVersions={projectDetail.release_versions}
releaseVersions={releaseVersions}
history={props.history}
baseOperate={baseOperate}
projectType={projectDetail.type}
distribution={distribution}
/>
</React.Fragment>
}
@ -535,7 +578,7 @@ function CoderDepot(props){
<Contributors contributors={projectDetail.contributors} owner={owner} projectsId={projectsId} />
}
{/* 语言 */}
{ projectDetail && projectDetail.languages &&
{ projectDetail && projectDetail.languages &&
<React.Fragment>
<Divider />
<LanguagePower languages={projectDetail.languages}/>

View File

@ -1,3 +1,4 @@
import { result } from 'lodash';
import React from 'react';

View File

@ -73,7 +73,6 @@ export default ((props)=>{
<Menu.Item key={'1'}><a href={tar_url}>TAR.GZ</a></Menu.Item>
</Menu>
)
return(
<React.Fragment>
<div className="main">

View File

@ -1,13 +1,19 @@
import React , { Component } from 'react';
import { Spin , Pagination } from 'antd';
import { Spin , Pagination, Timeline } from 'antd';
import { getImageUrl } from 'educoder';
import { truncateCommitId } from '../common/util';
import { truncateCommitId ,timeFormat } from '../common/util';
import { AlignTop } from '../Component/layout';
import SelectBranch from '../Branch/Select';
import Nodata from '../Nodata';
import User from '../Component/User';
import RenderHtml from '../../components/render-html.jsx';
import Tree from './img/tree.png';
import axios from 'axios';
import {Link} from "react-router-dom";
import CopyTool from '../Component/CopyTool';
import './tree/Index.scss'
function returnbar(str){
if(str && str.length>0 && str.indexOf("%2F")>-1){
@ -15,14 +21,16 @@ function returnbar(str){
}
return str;
}
//代码库--提交页面
class CoderRootCommit extends Component{
constructor(props){
super(props)
super(props);
this.state={
commitDatas:undefined,
dataCount:undefined,
limit:20,
page:1,
limit:10,
page: 1,
isSpining:false,
branchList:undefined
}
@ -50,20 +58,34 @@ class CoderRootCommit extends Component{
this.Init();
}
}
UrlParamHash(url){
const params = {};
let h;
let hash = url.slice(url.indexOf('?')+1).split('&');
for(let i = 0; i<hash.length;i++){
h = hash[i].split('=');
params[h[0]] = h[1];
}
return params;
}
Init =()=>{
const { branchName } = this.props.match.params;
const { page , limit } = this.state;
const { limit } = this.state;
const {search} = this.props.location;
const realPage = (search && this.UrlParamHash(search).page) ? parseInt(this.UrlParamHash(search).page) : 1;
this.setState({
isSpining:true
isSpining:true,
page:realPage
})
this.getCommitList( branchName , page , limit );
this.getCommitList( branchName , realPage , limit );
}
getCommitList=(branch , page , limit)=>{
this.setState({
isSpining:true
})
console.log(returnbar(branch));
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/commits.json`;
axios.get(url,{
@ -86,7 +108,8 @@ class CoderRootCommit extends Component{
image_url:item.author && item.author.image_url,
sha:item.sha,
time_from_now:item.time_from_now,
message:item.message
message:item.message,
timestamp:item.timestamp
})
})
this.setState({
@ -105,10 +128,9 @@ class CoderRootCommit extends Component{
}
ChangePage=(page)=>{
const { branchName } = this.props.match.params;
const { limit } = this.state;
this.getCommitList(branchName , page , limit);
this.props.history.push({pathname: this.props.history.location.pathname,search: `page=${page}`})
}
render(){
const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state;
const { projectDetail, commit_class , defaultBranch } = this.props;
@ -129,46 +151,50 @@ class CoderRootCommit extends Component{
></SelectBranch>
</div>
<Spin spinning={isSpining}>
<div className="commonBox">
<div className="commonBox-title">
<div className="f-wrap-between" style={{alignItems:"center"}}>
<span className="font-16">{dataCount}次提交代码({branch})</span>
</div>
</div>
<div className="commitList">
{
commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{
return(
<div key={k}>
<AlignTop>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0,marginTop:"3px"}}>{truncateCommitId(`${item.sha}`)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitDesc">{item.message}</Link>
</AlignTop>
<p className="f-wrap-alignCenter mt15">
{
item.id ?
<Link to={`/${item.login}`} className="show-user-link">
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</Link>:
<span className="show-user-link">
{item.image_url?<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
</span>
}
</p>
<Timeline className="commitList">
{
commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{
return(
<Timeline.Item key={k} dot={page ===1 && k===0 ?<span className="new-conmmit">最新</span>:<i className="iconfont icon-a-yuanquan2x"></i>}>
<div className="commitList-item f-wrap-between">
<div>
<AlignTop>
<div className="commitDesc"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd"><RenderHtml value={item.message}/></Link></div>
</AlignTop>
<p className="f-wrap-alignCenter mt15 pb5">
<User
id={item.id}
url={(item.image_url && getImageUrl(`/${item.image_url}`)) || "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
name={item.name}
login={item.login}
/>
{item.timestamp && <label className="font-14 color-grey-3 ml3">提交于 {timeFormat(item.timestamp)}</label>}
</p>
</div>
<div>
<div className="treecopy">
<div>
<span className="treecopy-cont shadow">
<img src={Tree} alt="sha" width={"16px"}/>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(`${item.sha}`)}</Link>
<input type="text" id={`value${k}`} value={`${truncateCommitId(`${item.sha}`)}`}/>
</span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${k}`}/>
</div>
<button className="btn-83" onClick={()=>{window.location.href=`/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}`}}>浏览文件</button>
</div>
</div>
</div>
)
})
}
{commitDatas && commitDatas.length === 0 && <Nodata _html="暂无数据"/>}
</div>
</div>
</Timeline.Item>
)
})
}
{commitDatas && commitDatas.length === 0 && <Nodata _html="暂无数据"/>}
</Timeline>
{
dataCount > limit ?
<div className="edu-txt-center pt30 mb30">
<Pagination simple defaultCurrent={page} total={dataCount} pageSize={limit} onChange={this.ChangePage}></Pagination>
<Pagination simple current={page} total={dataCount} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>
:""
}

View File

@ -1,10 +1,12 @@
import React, { Component } from "react";
import { Popconfirm , Select } from "antd";
import { Popconfirm , Select , Dropdown , Spin , Anchor } from "antd";
import "./list.scss";
import axios from "axios";
import Meditor from "../Newfile/m_editor";
import RenderHtml from "../../components/render-html";
import ReadmeCatelogue from "./sub/ReadmeCatelogue";
const $ = window.$;
function bytesToSize(bytes) {
if (bytes === 0) return "0 B";
let k = 1024,
@ -19,11 +21,13 @@ class CoderRootFileDetail extends Component {
value: undefined,
language: undefined,
languages: undefined,
description: props.detail.content
description: props.detail.content,
menuList:undefined
};
}
componentDidMount = () => {
window.scrollTo(0, 0);
const { detail , mdFlag } = this.props;
this.setState({
value: detail.content,
@ -169,6 +173,31 @@ class CoderRootFileDetail extends Component {
});
};
renderMenulist=()=>{
const { description } = this.state;
if(description){
const items = $.map($("#files-md").find("h1,h2,h3,h4,h5,h6"), function (el, _) {
const anchor = el.id;
const level = el.tagName.replace("H", "");
const href = `#${anchor}`;
return { href:`${href}`,text:el.textContent , level:level }
});
return items;
}
return [];
}
menu=()=>{
const menuList = this.renderMenulist();
if(menuList && menuList.length > 0){
return(
<ReadmeCatelogue menuList={menuList} hash={this.props.history.location.hash}/>
)
}else{
return <Spin />
}
}
render() {
const {
readOnly,
@ -186,79 +215,88 @@ class CoderRootFileDetail extends Component {
const Option = Select.Option;
return (
<React.Fragment>
<div className="grid-item branchTitle">
<div className="grid-item">
<span className="ml20 color-grey-6 font-16">
<Anchor className="griditemAnchor" offsetTop={70}>
<div className="griditemCate">
{
md && readOnly &&
<Dropdown overlay={this.menu()} trigger={['hover']} overlayClassName="menuslist">
<span className="catelogue mr20">
<i className="iconfont icon-muluicon font-12 mr5"></i>
<span>目录</span>
</span>
</Dropdown>
}
<span className="color-grey-6 font-16">
{bytesToSize(detail && detail.size)}
</span>
</div>
<p className="text-right">
{flag && platform && (
<div>
{readOnly ? (
<span>
{
!detail.direct_download?
<span>
<a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20">
<i className="iconfont icon-xiazai1 font-15 color-grey-6"></i>
</a>
{
type !==2 &&
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
{flag && platform && (
<div>
{readOnly ? (
<span>
{
!detail.direct_download?
<span>
<a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20">
<i className="iconfont icon-xiazai1 font-15 color-grey-6"></i>
</a>
}
</span>:""
}
</span>
) : (
<React.Fragment>
<Select
showSearch={true}
placeholder={"请选择文本语言"}
style={{ width: 200 }}
value={language}
onChange={this.select_language}
>
<Option value={undefined}>请选择文本语言</Option>
{languages &&
languages.map((item, key) => {
return (
<Option value={item} key={key}>
{item}
</Option>
);
})}
</Select>
<button
type="button"
className="ant-btn ant-btn-sm ml20"
onClick={() => this.EditFile(true)}
>
<span> </span>
</button>
</React.Fragment>
)}
{
type !==2 &&
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
}
</div>
)}
</p>
</div>
{
type !==2 &&
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
}
</span>:""
}
</span>
) : (
<React.Fragment>
<Select
showSearch={true}
placeholder={"请选择文本语言"}
style={{ width: 200 }}
value={language}
onChange={this.select_language}
>
<Option value={undefined}>请选择文本语言</Option>
{languages &&
languages.map((item, key) => {
return (
<Option value={item} key={key}>
{item}
</Option>
);
})}
</Select>
<button
type="button"
className="ant-btn ant-btn-sm ml20"
onClick={() => this.EditFile(true)}
>
<span> </span>
</button>
</React.Fragment>
)}
{
type !==2 &&
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
}
</div>
)}
</p>
</Anchor>
<div>
{detail.image_type ? (
<div className="edu-txt-center pt20 pb20">
@ -272,7 +310,7 @@ class CoderRootFileDetail extends Component {
</div>
) : (
md && readOnly ?
<div className="files-md">
<div className="files-md" id="files-md">
<RenderHtml className="file-md imageLayerParent" value={description} url={this.props.history.location}/>
</div>
:

View File

@ -1,9 +1,9 @@
import React , { Component } from 'react';
import { Route , Switch } from 'react-router-dom';
import Top from './DetailTop';
// import Top from './DetailTop';
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
import './Index.scss';
const FileNew = Loadable({
loader: () => import('../Newfile/Index'),
@ -18,25 +18,25 @@ const CoderRootCommit = Loadable({
loading: Loading,
})
const CoderRootBranch = Loadable({
loader: () => import('./CoderRootBranch'),
loader: () => import('./tree/Index'),
loading: Loading,
})
const CoderRootTag = Loadable({
loader: () => import('./CoderRootTag'),
loader: () => import('./tag/Index'),
loading: Loading,
})
const CoderRootVersion = Loadable({
loader: () => import('../Version/version'),
loading: Loading,
})
const CoderRootVersionNew = Loadable({
loader: () => import('../Version/New'),
loading: Loading,
})
const CoderRootVersionUpdate = Loadable({
loader: () => import('../Version/New'),
loader: () => import('./version/Index'),
loading: Loading,
})
// const CoderRootVersionNew = Loadable({
// loader: () => import('./version/New'),
// loading: Loading,
// })
// const CoderRootVersionUpdate = Loadable({
// loader: () => import('./version/New'),
// loading: Loading,
// })
const Diff = Loadable({
loader: () => import('./Diff'),
loading: Loading,
@ -50,41 +50,41 @@ class CoderRootIndex extends Component{
}
}
componentDidMount=()=>{
this.Init();
}
componentDidUpdate=(prevProps)=>{
const { location } = this.props;
const prevlocation = prevProps && prevProps.location;
if (location !== prevlocation) {
this.Init();
}
}
// componentDidMount=()=>{
// this.Init();
// }
// componentDidUpdate=(prevProps)=>{
// const { location } = this.props;
// const prevlocation = prevProps && prevProps.location;
// if (location !== prevlocation) {
// this.Init();
// }
// }
Init=()=>{
const { branchName } = this.props.match.params;
const { defaultBranch } = this.props;
this.getTopCount(branchName || defaultBranch);
}
// Init=()=>{
// const { branchName } = this.props.match.params;
// const { defaultBranch } = this.props;
// this.getTopCount(branchName || defaultBranch);
// }
// 获取<Top />组件里要显示的数据
getTopCount=(branch)=>{
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/top_counts.json`;
axios.get(url,{params:{
ref:branch
}}).then(result=>{
if(result){
this.setState({
coderCount:result.data
})
}
}).catch(error=>{console.log(error);})
}
// getTopCount=(branch)=>{
// const { projectsId , owner } = this.props.match.params;
// const url = `/${owner}/${projectsId}/top_counts.json`;
// axios.get(url,{params:{
// ref:branch
// }}).then(result=>{
// if(result){
// this.setState({
// coderCount:result.data
// })
// }
// }).catch(error=>{console.log(error);})
// }
render(){
return(
<div>
<Top {...this.props} {...this.state}/>
<div className="coderSubPage">
{/* <Top {...this.props} {...this.state}/> */}
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/:owner/:projectsId/:branch/newfile/:path"
@ -99,12 +99,12 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/:owner/:projectsId/commits/branch/:branchName"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
<Route path="/:owner/:projectsId/commits/:sha"
@ -114,10 +114,10 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/commits"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
<Route path="/:owner/:projectsId/releases/:versionId/update"
{/* <Route path="/:owner/:projectsId/releases/:versionId/update"
render={
(props) => (<CoderRootVersionUpdate {...this.props} {...this.state} {...props} />)
}
@ -126,7 +126,7 @@ class CoderRootIndex extends Component{
render={
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
}
></Route>
></Route> */}
<Route path="/:owner/:projectsId/releases"
render={
() => (<CoderRootVersion {...this.props} {...this.state} />)

View File

@ -3,6 +3,7 @@ import { Spin, Tooltip } from 'antd';
import { Link, Route, Switch } from 'react-router-dom';
import { Content, AlignTop } from '../Component/layout';
import DetailBanner from './sub/DetailBanner';
import { numFormat } from 'educoder';
import '../css/index.scss'
import './list.scss';
@ -70,7 +71,7 @@ const MergeIndexDetail = Loadable({
})
const CreateMerge = Loadable({
loader: () => import('../Merge/NewMerge'),
loader: () => import('../Merge/CreateMerge'),
loading: Loading,
})
@ -150,7 +151,9 @@ function checkPathname(projectsId, owner, pathname) {
name = "about"
} else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) {
name = "issues";
} else if (url.indexOf("/pulls") > -1) {
} else if (url.indexOf("/pulls") > -1 || url.indexOf("/compare") > -1) {
// /pulls合并请求除新建合并请求外
// /compare新建合并请求
name = "pulls"
} else if (url.indexOf("/milestones") > -1) {
name = "milestones"
@ -318,6 +321,9 @@ class Detail extends Component {
const url = `/${owner}/${projectsId}/detail.json`;
axios.get(url).then((result) => {
if (result && result.data) {
if (result.data.status === 404) {
this.props.history.push('/nopage');
}
this.setState({
projectDetail: result.data,
project_id: result.data.project_id,
@ -503,11 +509,6 @@ class Detail extends Component {
this.textFunc(projectDetail.forked_from_project_id, projectDetail.fork_info)
: ""
}
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">导入于 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
: ""
}
</div>
</div>
<div>
@ -552,7 +553,7 @@ class Detail extends Component {
<span className="detail_tag_btn" loading={forkSpin}>
<Tooltip title="复刻是fork的中文名即复制代码仓库" placement="bottom">
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}>
<i className="iconfont icon-fork color-grey-9 mr3 font-16"></i><span></span>
<i className="iconfont icon-fork color-grey-9 mr3 font-16"></i><span>(Fork)</span>
</a>
</Tooltip>
{
@ -570,6 +571,18 @@ class Detail extends Component {
}
</div>
</AlignTop>
{/* <div className="mt6" style={{minHeight:"20px"}}>
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
this.textFunc(projectDetail.forked_from_project_id,projectDetail.fork_info)
:""
}
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">镜像自 <a className="color-blue hoverLine" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
:""
}
</div> */}
{
firstSync ? "" :
<DetailBanner
@ -681,18 +694,19 @@ class Detail extends Component {
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 修改详情 */}
<Route path="/:owner/:projectsId/issues/:orderId/updatedetail"
{/* 修改详情 updatedetail*/}
<Route path="/:owner/:projectsId/issues/:orderId/:operateName"
render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 复制详情 */}
{/* 复制详情 copyetail*/}
<Route path="/:owner/:projectsId/issues/:orderId/copyetail"
render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 任务详情 */}
<Route path="/:owner/:projectsId/issues/:orderId"
render={
@ -712,22 +726,32 @@ class Detail extends Component {
}
></Route>
{/* 新建合并请求 */}
<Route path="/:owner/:projectsId/pulls/new/:branch"
{/* <Route path="/:owner/:projectsId/compare/:branch"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route> */}
<Route path="/:owner/:projectsId/compare"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
<Route path="/:owner/:projectsId/pulls/:mergeId/edit"
render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/Messagecount"
<Route path="/:owner/:projectsId/pulls/:mergeId"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/commits"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/:owner/:projectsId/pulls/:mergeId/files"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}

View File

@ -1,35 +1,65 @@
import React, { useEffect, useState } from "react";
import styled from "styled-components";
import { Button ,Spin } from "antd";
import { truncateCommitId } from '../common/util';
import { timeFormat, truncateCommitId } from '../common/util';
import { getImageUrl } from 'educoder';
import Files from '../Merge/Files';
import Tree from "./img/tree.png";
import User from "../Component/User";
import Keys from "../Component/Keys";
import RenderHtml from "../../components/render-html";
import axios from "axios";
import { Link } from "react-router-dom";
const Infos = styled.div`
border: 1px solid #dddddd;
border: 1px solid #FAFCFF;
margin-bottom:15px;
& .commitinfos {
background-color: #f1f8ff;
border-bottom: 1px solid #ddd;
padding: 20px;
border: 1px solid rgba(42, 97, 255, 0.23);
border-radius: 3px 3px 0px 0px;
padding: 10px 20px 10px 16px;
& .markdown-body table{
background: #f1f8ff;
}
& .btnblue{
margin-top: 12px;
}
& .task-hide{
width: 65rem;
overflow:hidden;
white-space:normal;
word-break:break-all;
font-weight: bold;
color: #333333;
font-size: 16px;
}
}
& > .f-wrap-between {
padding: 10px 20px;
padding: 14px 20px 14px 16px;
border-radius: 3px 3px 0px 0px;
border: 1px solid #D0D0D0;
.df{
align-items: center;
& .underline:hover{
text-decoration: underline;
}
}
}
`;
export default ({ match , history }) => {
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
//
export default (props) => {
const {match , history } = props;
const [data, setData] = useState({undefined});
const [commit, setCommit] = useState(undefined);
const [parents, setParents] = useState(undefined);
const [committer, setCommitter] = useState(undefined);
const [isSpin, setIsSpin] = useState(true);
const { sha , projectsId, owner } = match.params;
useEffect(() => {
if (projectsId && owner && sha) {
@ -43,6 +73,7 @@ export default ({ match , history }) => {
setParents(result.data.parents);
setCommitter(result.data.committer || (result.data.commit && result.data.commit.committer));
setIsSpin(false);
}
})
.catch(error => {
@ -56,29 +87,42 @@ export default ({ match , history }) => {
<Infos>
<div className="commitinfos">
<div className="f-wrap-between">
{commit && commit.message &&
<pre className="task-hide" style={{marginBottom:"0px",height:"28px",whiteSpace:"pre-wrap"}}>{commit.message}</pre>
}
<Button type="primary" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="ml30">浏览代码</Button>
<div>
{commit && commit.message &&
<RenderHtml className="task-hide" value={commit.message}/>
}
<Link to={`/${owner}/${projectsId}/tree/${data.branch}`}><i className="iconfont icon-fenzhi2 font-18"></i>{data.branch}</Link>
</div>
<Button type="primary" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="btnblue" style={{height:"36px"}}>浏览文件</Button>
</div>
</div>
<div className="f-wrap-between" style={{ alignItems: "center" }}>
<ul className="df">
<User
url={(committer && getImageUrl(`/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
id = {committer && committer.id}
url={(committer && getImageUrl(`/${committer.image_url}`))}
name={committer && committer.name}
login={committer && committer.login}
/>
{committer && committer.time_from_now && <li className="ml20 mt2">{committer.time_from_now}</li>}
{commit && commit.timestamp && <li className="ml4">提交于{timeFormat(commit.timestamp)}</li>}
</ul>
<li className="df">
{
parents && parents.length > 0 && parents.map((item,key)=>{
return(
<Keys title="父节点" value={truncateCommitId(item.sha)} key={key} className="mr20"></Keys>
<div className="ml40 f-wrap-alignCenter">
<label className="mr8">父节点</label>
<img src={Tree} alt="sha" width={"16px"} className="mr4"/>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${data.branch}`} className="underline">{truncateCommitId(item.sha)}</Link>
</div>
)
})
}
<Keys title="当前节点" value={truncateCommitId(sha)}></Keys>
<div className="ml40 f-wrap-alignCenter">
<label className="mr8">当前节点</label>
<img src={Tree} alt="sha" width={"16px"} className="mr4"/>
<span>{truncateCommitId(sha)}</span>
</div>
</li>
</div>
</Infos>
@ -87,6 +131,7 @@ export default ({ match , history }) => {
data={data}
owner={owner}
projectsId={projectsId}
parentsSha={parents && parents.length > 0 && parents[0].sha}
/>
</Spin>
</div>

View File

@ -189,13 +189,13 @@
flex-wrap: wrap;
padding-bottom: 2px;
a{
margin: 0px 17px 0px 0px;
margin: 0px 17px 10px 0px;
img{
border-radius: 50%;
width: 40px;
height: 40px;
}
&:nth-child(6){
&:nth-child(5n){
margin-right: 0px;
}
}
@ -224,7 +224,7 @@
height: 8px;
width: 8px;
left: 0px;
top:10px
top:8px;
}
&>span{
padding-left: 15px;
@ -252,8 +252,14 @@
border: 1px solid rgba(42, 97, 255, 0.23);
background-color: #FAFCFF;
.ellipsistxt{
margin-top: 6px;
cursor: pointer;
&:hover .markdown-body{
color: #466AFF;
& a{
color: #466AFF;
}
}
margin-top: 2px;
// cursor: pointer;
#ptxt{
margin-bottom: 0px;
word-break: break-all;
@ -263,6 +269,27 @@
white-space:-pre-wrap; /* Opera 4-6 */
white-space:-o-pre-wrap; /* Opera 7 */
word-wrap:break-word;
.markdown-body{
line-height: 10px;
font-size: 14px;
& p {
margin: 1px 0px 0px !important;
font-size: 14px !important;
}
& ol,ul{
padding-bottom: 3px;
& li{
min-height: 18px;
}
}
& table{
line-height: 1;
background: #FAFCFF;
}
&:first-child {
margin-top: -1px !important;
}
}
}
margin-left: 13px;
line-height:18px;
@ -270,7 +297,7 @@
width: 0;
color: #666;
&.hidetxt{
height: 18px;
height: 24px;
overflow: hidden;
position: relative;
padding-right:8px;
@ -402,6 +429,16 @@
cursor: pointer;
background: #FAFBFC;
border-radius: 4px;
.ant-dropdown-menu-item{
border-radius: 8px;
text-align: left!important;
a{
width: 350px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
border: 1px solid #D0D0D0;
font-size: 15px;
font-weight: normal;
@ -443,8 +480,32 @@
}
}
.ant-anchor-wrapper{
padding-left: 2px;
padding-left: 2px!important;
.ant-anchor-ink::before{
background-color: #fff;
}
}
.coderSubPage{
width: 1200px;
margin:0px auto;
}
.griditemAnchor{
margin-left: 0px!important;
padding: 0px!important;
border-bottom: 1px solid #ddd;
.ant-anchor{
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 20px;
}
.griditemCate{
color: #333;
font-size: 16px;
display: flex;
align-items: center;
.catelogue{
margin-left: 0px;
}
}
}

View File

@ -52,12 +52,6 @@ class IndexItem extends Component {
<i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>:""
}
{
item.type && item.type === 1 ?
<Tooltip title="该项目是一个导入于其他网站的仓库" className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" />
</Tooltip>:""
}
</AlignCenter>
<span className="p-r-tags">
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

BIN
src/forge/Main/img/tree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

View File

@ -426,14 +426,15 @@
border-right: none;
}
.gitAddressClone > input{
border:none;
outline: none;
padding:0px 8px;
height: 40px;
line-height: 40px;
border-radius: 0px;
border: 1px solid #eee;
flex:1;
padding: 0px 8px;
height: 38px;
line-height: 38px;
border: none!important;
border-right: 1px solid #eee!important;
border-radius: 4px 0px 0px 4px;
flex: 1;
max-width: 249px;
}
.wrap-commit-table .ant-table-small > .ant-table-content > .ant-table-body{
margin:0px;
@ -574,6 +575,9 @@
border:1px solid #ddd;
margin-top: 18px;
border-radius: 4px;
.ant-anchor-wrapper{
overflow: unset!important;
}
}
.commonBox .commonBox-title{
padding:0px 20px;
@ -718,12 +722,84 @@ a.color-grey-ccc:hover{
padding:0px 30px;
min-height: 400px;
}
.commitList > div{
border-bottom: 1px solid #EEEEEE;
padding:16px 0px;
}
.commitList > div:last-child{
border-bottom: none;
.main{
margin: 30px auto;
.ant-timeline{
margin-top: 28px;
.commitList-item{
position: relative;
padding: 20px 20px;
background: #FAFCFF;
border: 1px solid rgba(42, 97, 255, 0.23);
border-radius: 4px;
margin-left: 16px;
& .treecopy{
margin-top: 20px;
}
& .markdown-body table{
background: #FAFCFF;
}
&:after,&:before{
content: "";
position: absolute;
left: -10px;
top: 10px;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right: 10px solid rgba(42, 97, 255, 0.23);
}
&:after{
left: -8px;
border-right: 10px solid #FAFCFF;
&:hover{
border-right: 10px solid #EEF6FF;
}
}
&:hover{
background: #EEF6FF;
border: 1px solid rgba(42, 97, 255, 0.58);
&:after{
border-right: 10px solid #EEF6FF;
}
&:before{
border-right: 10px solid rgba(42, 97, 255, 0.58);
}
& .markdown-body table{
background: #EEF6FF;
}
}
.treecopy-cont{
padding: 4px 15px;
}
.btn-83{
margin-left: 20px;
}
}
.ant-timeline-item{
padding: 8px 0 20px;
}
.ant-timeline-item-tail{
height: calc(100% - 20px);
border-left: 2px solid #EEEEEE;
top: 12px;
&:after{
content: ' ';
height: 0;
position: absolute;
width: 0;
border: 7px solid transparent;
border-top-color: #EEEEEE;
top: 100%;
left: 50%;
margin-left: -8px;
}
}
.ant-timeline-item-head-custom{
top:20px;
padding: 0 1px;
}
}
}

View File

@ -50,7 +50,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
<Link to={{ pathname: `/${owner}/${projectsId}/issues`, state }}>
<Tooltip title="易修是Issue的中文名即问题列表" placement="bottom">
<i className={"iconfont icon-yixiuicon1 color-grey-3 mr5 font-14"}></i>
<span>易修</span>
<span>易修(Issue)</span>
</Tooltip>
{projectDetail && projectDetail.issues_count ? <span className="num">{numFormat(projectDetail.issues_count)}</span> : ""}
</Link>
@ -86,7 +86,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</li>
:""
}
{
{/* {
item.menu_name === "resources" &&
<li className={pathname==="source" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/source`, state }}>
@ -95,7 +95,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
{projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
</Link>
</li>
}
} */}
{
item.menu_name === "versions" &&
<li className={pathname==="milestones" ? "active" : ""}>

View File

@ -1,7 +1,7 @@
import React , { useState , useEffect } from 'react';
import React , { useState } from 'react';
import { Anchor , Input } from 'antd';
import './sub.scss';
import { Base64 } from 'js-base64';
import { useEffect } from 'react';
const { Link } = Anchor;
@ -18,7 +18,7 @@ function ReadmeCatelogue({ menuList , hash }) {
function changeValue(e) {
setValue(e.target.value);
if(e.target.value){
let m = menuList.filter(i=>i.text.indexOf(e.target.value)>-1);
let m = menuList.filter(i=>i.text.toLowerCase().indexOf(e.target.value.toLowerCase())>-1);
setMenu(m);
}else{
setMenu(menuList);

View File

@ -0,0 +1,13 @@
import React from 'react';
import { Link } from 'react-router-dom';
import'./sub.scss'
function SubMenu({tab,owner,projectsId}) {
return(
<ul className="subMenu">
<Link to={`/${owner}/${projectsId}/tags`} className={tab==="tags"?"active":""}>标签</Link>
<Link to={`/${owner}/${projectsId}/releases`} className={tab==="releases"?"active":""}>发行版</Link>
</ul>
)
}
export default SubMenu;

View File

@ -64,4 +64,28 @@
background-color: #fff;
}
}
}
.subMenu{
display: flex;
padding-top: 30px;
a{
width: 83px;
font-weight: 500;
line-height: 30px;
height: 32px;
color: #333333!important;
text-align: center;
border: 1px solid #D0D0D0;
border-radius: 0px 4px 4px 0px;
background: rgba(250, 251, 252, 0);
&:first-child{
border-right: none;
border-radius: 4px 0px 0px 4px;
}
&.active{
background-color: #466AFF;
color: #fff!important;
border-color: #466AFF;
}
}
}

View File

@ -0,0 +1,138 @@
import React,{ useEffect , useState } from 'react';
import SubMenu from '../sub/SubMenu';
import { Table , Tooltip , Spin } from 'antd';
import axios from 'axios';
import { Link } from 'react-router-dom';
import { truncateCommitId } from '../../common/util';
import { getImageUrl } from 'educoder';
import Nonedata from '../../Nodata';
import './Index.scss';
import Tree from '../img/tree.png'
import moment from 'moment';
function Tags(props) {
const [ source , setSource ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId , owner } = props.match.params;
useEffect(() => {
if (projectsId) {
const url = `/${owner}/${projectsId}/tags.json`;
axios.get(url).then((result) => {
if (result) {
setSource(result.data);
setIsSpin(false);
}
}).catch(error => {})
}
}, [owner, projectsId]);
const columns=[
{
title:"标签名",
dataIndex:"name",
key:1,
ellipsis:true,
width:"200px",
render:(txt,item)=>{
return(
<div className="tagBranch">
<Link className="hover tagClass" to={`/${owner}/${projectsId}/tree/${item.name}`}>{item.name}</Link>
</div>
)
}
},
{
title:"创建时间",
dataIndex:"time_ago",
key:2,
ellipsis:true,
render:(txt,item)=>{
return (
<span className="color-grey-3 tagModel">
{
item.tagger &&
<Tooltip placement="top" title={item.tagger.name}>
{
item.tagger.id ?
<Link className="mr3 tagModelImg" to={`/${item.tagger.login}`} >
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt=""/>
</Link>
:
<span className="mr3 tagModelImg" style={{cursor:"default"}}>
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt=""/>
</span>
}
</Tooltip>
}
<span>创建于{txt}</span>
</span>
)
}
},
{
title:"提交ID",
dataIndex:"id",
key:3,
ellipsis:true,
render:(txt,item)=>{
return (
<Tooltip placement="top" title={`最后提交日期:${item.created_at_unix ? moment(item.created_at_unix*1000).format('YYYY-MM-DD'):''}`}>
<img src={Tree} alt="提交ID" width="22px" className="mr4"/>
<Link className="hover color-blue" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`}>{truncateCommitId(item.id)}</Link>
</Tooltip>
)
}
},
{
title:"描述信息",
dataIndex:"message",
key:4,
ellipsis:true,
render:(txt,item)=>{
return item.message || "--"
}
},
{
title:"下载",
dataIndex:"stage_type",
key:5,
ellipsis:true,
align:"center",
width:"204px",
render:(txt,item)=>{
return (
<React.Fragment>
<a href={`${item.tarball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>TAR
</a>
<a href={`${item.zipball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>ZIP
</a>
</React.Fragment>
)
}
}
]
return(
<div>
<SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/>
<Spin spinning={isSpin}>
<div className="tagSpin">
{
source && source.length > 0 &&
<Table
className="tagTable"
dataSource={source} columns={columns} pagination={false}></Table>
}
{
source && source.length === 0 && <Nonedata _html={'暂无数据~'}/>
}
</div>
</Spin>
</div>
)
}
export default Tags;

View File

@ -0,0 +1,58 @@
.tagTable{
margin-top: 30px;
thead{
tr th{
background-color: #fff;
padding:5px 0px;
width: 172px;
.ant-table-column-title{
font-size: 16px;
font-weight: 500;
color: #333333;
}
}
}
tbody{
.btn-83{
margin:0px 8px;
}
tr{
&:hover td{
background-color: #fff!important;
}
td{
padding:0px;
height: 69px;
line-height: 69px;
color:#333333;
div{
font-weight: 500;
}
}
&:last-child{
td{
border-bottom: none!important;
}
}
}
}
}
.tagSpin{
min-height: 300px;
}
.tagBranch{
padding-right: 15px;
text-overflow: ellipsis;
overflow: hidden;
.tagClass{
color:#333333;
}
}
.tagModel{
font-weight: 400;
.tagModelImg img{
width: 25px;
height: 25px;
border-radius: 50%;
}
}

View File

@ -0,0 +1,114 @@
import React , { useEffect , useState } from 'react';
import CopyTool from '../../Component/CopyTool';
import { truncateCommitId } from '../../common/util';
import { Link } from 'react-router-dom';
import { getImageUrl } from 'educoder';
import { Dropdown , Menu , Spin } from 'antd';
import './Index.scss';
import Tree from '../img/tree.png';
import Axios from 'axios';
function turnbar(str){
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
return str;
}
function Index(props) {
const [ list , setList ] = useState([]);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId , owner } = props.match.params;
const { isManager , isDeveloper , projectDetail } = props;
useEffect(()=>{
getList();
},[])
const menu =(zip_url,tar_url)=> (
<Menu>
<Menu.Item key={'0'}><a href={zip_url}>ZIP</a></Menu.Item>
<Menu.Item key={'1'}><a href={tar_url}>TAR.GZ</a></Menu.Item>
</Menu>
)
function getList() {
const url = `/${owner}/${projectsId}/branches_slice.json`;
Axios.get(url).then(result=>{
if(result){
setList(result.data);
}
setIsSpin(false);
}).catch(error=>{setIsSpin(false);})
}
return(
<Spin spinning={isSpin}>
<div style={{paddingTop:"10px",minHeight:"400px"}}>
{
list && list.length>0 && list.map((item,key)=>{
return(
<React.Fragment>
<p className="branchSort">{item.branch_type === "default" ? "默认分支" : item.branch_type==="protected"?"保护分支":"其它分支"}</p>
{
item.list && item.list.length>0 &&
<ul className="treeUl">
{
item.list.map((i,k)=>{
let last_commit = i.last_commit;
return(
<li>
<div className="treeinfo">
<Link to={`/${owner}/${projectsId}/tree/${turnbar(i.name)}`} className="task-hide">{i.name}</Link>
<div>
{
last_commit && last_commit.committer && last_commit.committer.id?
<Link to={`/${ last_commit.committer.login}`}>
<img style={{borderRadius:"50%"}} src={getImageUrl(`/${ last_commit.committer.image_url}`)} alt=""/>
<span className="mr3 color-grey-3" style={{fontWeight:"500"}}>{last_commit && last_commit.committer && last_commit.committer.name}</span>
</Link>
:
<React.Fragment>
<img style={{borderRadius:"50%"}} src={getImageUrl(`/${ last_commit.committer.image_url}`)} alt=""/>
<span className="mr3 color-grey-3" style={{fontWeight:"500"}}>{last_commit && last_commit.committer && last_commit.committer.name}</span>
</React.Fragment>
}
<span className="color-grey-3">更新于{last_commit && last_commit.time_from_now}</span>
</div>
</div>
<div className="treecopy">
<div>
<span>
<img src={Tree} alt="sha" width={"16px"}/>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(last_commit && last_commit.sha)}`}>{truncateCommitId(last_commit && last_commit.sha)}</Link>
<input type="text" id={`value${key}${k}`} value={`${truncateCommitId(last_commit && last_commit.sha)}`}/>
</span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${key}${k}`}/>
</div>
</div>
<div className="treeabout">
{
(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) &&
<Link to={`/${owner}/${projectsId}/compare/master...${i.name}`} className="btn-83">+ 合并请求</Link>
}
<Dropdown overlay={menu(i.zip_url,i.tar_url)} trigger={['click']} placement="bottomRight">
<a className="btn-83 ml15">下载<i className="iconfont icon-sanjiaoxing-down font-14"></i></a>
</Dropdown>
</div>
</li>
)
})
}
</ul>
}
</React.Fragment>
)
})
}
</div>
</Spin>
)
}
export default Index;

View File

@ -0,0 +1,101 @@
.branchSort{
font-weight: 500;
color: #333333;
font-size: 15px;
height: 20px;
line-height: 20px;
padding-left: 10px;
margin-top: 20px;
margin-bottom: 6px!important;
}
.treeUl{
background: #FAFCFF;
border-radius: 4px;
border: 1px solid rgba(42, 97, 255, 0.23);
li{
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
border-bottom: 1px solid rgba(42, 97, 255, 0.23);
&:last-child{
border-bottom: none;
}
.treeinfo{
width: 399px;
flex:1;
flex-direction: column;
&>a{
display: block;
width: 399px;
}
a:hover{
span{
color: #466AFF!important;
}
}
img{
height: 20px;
width: 20px;
margin-right: 5px;
}
}
.treeabout{
flex:1;
text-align: right;
}
}
}
.treecopy{
flex:1;
display: flex;
justify-content: center;
&>div{
height: 32px;
background: #FAFBFC;
border-radius: 4px;
border: 1px solid #D0D0D0;
position: relative;
z-index: 1;
display: flex;
align-items: center;
&>span{
padding:0px 15px;
border-right: 1px solid rgba(153, 153, 153, 0.4);
height: 100%;
img{
margin-right: 4px;
}
a{
color: #466AFF;
&:hover{
text-decoration: underline;
}
}
}
&>i{
margin:0px 12px;
color: #333!important;
}
input{
position: absolute;
z-index: 0;
opacity: 0;
top: 32px;
}
}
}
.new-conmmit{
width: 30px;
height: 18px;
line-height: 18px;
display: block;
background: #FF6832;
color: white;
font-size: 12px;
border-radius: 4px;
}
.icon-a-yuanquan2x{
color: #466AFF;
}

View File

@ -0,0 +1,22 @@
import { Button } from 'antd';
import React from 'react';
import './version.scss';
function Empty({operation,addFunc}) {
return(
<div className="emptyPanel color-grey-3">
<i className="iconfont icon-banbenicon font-50 color-grey-3" style={{height:"50px",lineHeight:"50px",marginBottom:"13px"}}></i>
<span className="weight font-26 mb15">这里暂未发布过任何版本</span>
<span className="weight400" style={{textAlign:"center",lineHeight:"20px"}}>发行版功能基于仓库中的历史标记<br/>建议使用类似 V1.0 的版本标记作为发布点</span>
<div className="operation">
{
operation ?
<Button type={"primary"} onClick={addFunc} className="btnblue" style={{width:"118px",height:"36px"}}>发布新版本</Button>
:
<span className="color-grey-3 weight font-16">该项目暂时没有发布版本</span>
}
</div>
</div>
)
}
export default Empty;

View File

@ -0,0 +1,41 @@
import React from 'react';
import { Switch , Route } from 'react-router';
import Loadable from 'react-loadable';
import Loading from '../../../Loading';
import SubMenu from '../sub/SubMenu';
import "./version.scss";
const CoderRootVersion = Loadable({
loader: () => import('./version'),
loading: Loading,
})
const CoderRootVersionNew = Loadable({
loader: () => import('./New'),
loading: Loading,
})
function Index(props) {
const { projectsId , owner } = props.match.params;
return(
<div>
<SubMenu tab={"releases"} projectsId={projectsId} owner={owner}/>
<Switch>
<Route path="/:owner/:projectsId/releases/:versionId/update"
render={
(p) => (<CoderRootVersionNew {...props} {...p} />)
}
></Route>
<Route path="/:owner/:projectsId/releases/new"
render={
(p) => (<CoderRootVersionNew {...props} {...p} />)
}
></Route>
<Route path="/:owner/:projectsId/releases"
render={
(p) => (<CoderRootVersion {...props} {...p} />)
}
></Route>
</Switch>
</div>
)
}
export default Index;

View File

@ -0,0 +1,266 @@
import React, { useState, useEffect, forwardRef } from "react";
import styled from "styled-components";
import { AutoComplete , Input, Checkbox, Button, Form } from "antd";
import SelectBranch from '../../Branch/Select';
import Editor from "../../../modules/tpm/challengesnew/tpm-md-editor";
import Upload from "../../Upload/Index";
import Attachments from "../../Upload/attachment";
import axios from "axios";
import "./version.scss";
import { trim } from "lodash";
const { Option } = AutoComplete;
const Span = styled.span`
margin: 0px 15px;
color: #bbb;
line-height: 35px;
font-size:16px;
font-weight:400;
color:#666;
`;
export default Form.create()(
forwardRef(
(
{ form, projectDetail , match, showNotification, history },
ref
) => {
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const [tagList, setTagList] = useState(undefined);
const [desc, setDesc] = useState(null);
const [branch, setBranch ] = useState(null);
const [fileList, setFileList] = useState(undefined);
const [attachment, setAttachment] = useState(undefined);
const [options , setOptions] = useState(undefined);
const stable = history && history.location && history.location.state.stable;
const { projectsId, versionId , owner } = match.params;
useEffect(()=>{
if(projectDetail && projectDetail.default_branch){
setBranch(projectDetail.default_branch);
}
},[projectDetail])
useEffect(() => {
if (versionId) {
const url = `/${owner}/${projectsId}/releases/${versionId}/edit.json`;
axios.get(url).then(result => {
if (result) {
setFieldsValue(result.data);
setDesc(result.data.body);
setAttachment(result.data.attachments);
}
});
}
}, [versionId]);
useEffect(() => {
if (projectsId) {
const url = `/${owner}/${projectsId}/tags.json`;
axios
.get(url,{params:{
limit:1000
}})
.then(result => {
if (result) {
setTagList(result.data);
setOptions(renderTagList(result.data));
}
})
.catch(error => {
console.log(error);
});
}
}, [projectsId]);
function renderTagList(list) {
if (list) {
let array = list.map((item, key) => {
return (
<Option key={key} value={item.name}>
{item.name}
</Option>
);
});
return array || undefined;
}
}
function submit() {
validateFields((err, value) => {
if(err)return;
if (versionId) {
let url = `/${owner}/${projectsId}/releases/${versionId}.json`;
axios
.put(url, {
...value,
body: desc,
attachment_ids: fileList,
target_commitish:branch
})
.then(result => {
if (result) {
showNotification("版本修改成功!");
history.push(`/${owner}/${projectsId}/releases`);
}
});
} else {
let url = `/${owner}/${projectsId}/releases.json`;
axios.post(url, {
...value,
body: desc,
attachment_ids: fileList
})
.then(result => {
if (result) {
showNotification("版本发布成功!");
history.push(`/${owner}/${projectsId}/releases`);
}
});
}
});
}
//
function changeAuto(value){
let l = tagList.filter(item=>item.name.indexOf(value) > -1);
setOptions(renderTagList(l));
}
function changeBranch(params) {
setBranch(params);
}
return (
<div className="df pt15">
<Form className="versionForm">
<div className="itemInline">
<Form.Item>
{getFieldDecorator("tag_name",
{ rules:[
{ required: true, message: "请输入获取或选择一个标签" },
{ validator: (rule,val,callback) =>{
if(val.length>30 || val.indexOf(' ')>0 || val.match(/^\s+$/) || trim(val).length!=val.length){
callback('无效的标签名称请参考右侧建议命名标签并确认长度在1~30个字符之间');
}else{
callback();
}
}}],
validateFirst: true
})(
<AutoComplete
placeholder="标记一个版本"
onChange={changeAuto}
style={{ width: "200px" }}
>
{options}
</AutoComplete>
)}
</Form.Item>
<Span>@</Span>
<SelectBranch
repo_id={projectDetail && projectDetail.repo_id}
projectsId={projectsId}
branch={branch}
changeBranch={changeBranch}
owner={owner}
history={history}
tagflag={false}
branchList={projectDetail && projectDetail.branches && projectDetail.branches.list}
></SelectBranch>
<p className="font-12 color-grey-6 weight400">选择一个已经存在的标签或者在发布时新建一个标签</p>
</div>
<Form.Item className="pt20">
{getFieldDecorator("name",
{ rules:[
{ required: true, message: "请输入发行版的标题" },
{ validator: (rule,val,callback) =>{
if(val.length>50){
callback('标题长度在1~50个字符之间');
}else{
callback();
}
}}],
validateFirst: true
})(
<Input placeholder="发行版的标题" />
)}
</Form.Item>
<Editor
placeholder={"描述此发行版"}
height={200}
mdID={`version-comments-description`}
initValue={desc}
onChange={setDesc}
noStorage={true}
/>
<div className="mt5 dragBox">
<Upload
className="versionStyle"
isComplete={true}
load={setFileList}
icon={
<i className="iconfont icon-shangchuanicon dragIcon" />
}
size={100}
showNotification={showNotification}
/>
{versionId && attachment && attachment.length > 0 ? (
<Attachments
attachments={attachment}
showNotification={showNotification}
canDelete={true}
/>
) : (
""
)}
</div>
<Form.Item className="prerelease">
{getFieldDecorator("prerelease",
{ rules:[],
validateFirst: true
})(
<Checkbox defaultChecked={!stable}>这是一个预览版本</Checkbox>
)}
</Form.Item>
<p className="pt20" style={{borderTop:"1px solid #eee"}}>
<Button onClick={submit} type="primary" className="mr30 btnblue">
{versionId ? "保存" : "创建"}发行版
</Button>
<Button
onClick={() =>history.push(`/${owner}/${projectsId}/releases`)} className="btngrey"
>取消</Button>
</p>
</Form>
<div className="versionTips">
<div className="infosTip">
<p className="font-16 mb14 weight">标签命名建议</p>
<p className="mb15">
通常的做法是在版本名称前加上字母 v 前缀 v1.0 或者 v2.3.4
</p>
<p>
如果标签不适合在生产环境下使用请在版本名称后添加预发行版本例如v0.2-alpha
或者 v5.9-beta.3
</p>
</div>
<div className="infosTip">
<p className="font-16 mb14 weight">语义化版本</p>
<p>
如果你是第一次发布版本我们强烈建议你阅读<a href='https://semver.org/lang/zh-CN' target='_blank' className="color-blue">语义化版本</a>
</p>
</div>
<div className="infosTip">
<p className="font-16 mb14 weight">附件大小说明</p>
<p>
单个附件不能超过 100MGVP 项目200M每个仓库总附件不可超过
1G推荐项目不可超过 5GGVP 项目不可超过
20G附件总容量统计包括仓库附件和发行版附件
</p>
</div>
</div>
</div>
);
}
)
);

View File

@ -0,0 +1,150 @@
import React, { useEffect , useState } from "react";
import { Link } from 'react-router-dom';
import { Spin , Button } from 'antd';
import { getImageUrl } from 'educoder';
import {truncateCommitId} from '../../common/util';
import Empty from './Empty';
import './version.scss';
import axios from 'axios';
import Tree from '../img/tree-black.png';
import RenderHtml from '../../../components/render-html';
import User from "../../Component/User";
function version(props) {
const [ data , setData ] = useState(undefined);
const [ releases , setReleases ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId ,owner } = props.match.params;
const { location } = props;
const type = props.projectDetail && props.projectDetail.type;
const turnFromNew = location && location.query && location.query.turnFromNew;
useEffect(()=>{
getIssueList();
},[])
// 获取列表数据
function getIssueList(){
const url = `/${owner}/${projectsId}/releases.json`;
axios.get(url).then((result) => {
if (result) {
setData(result.data);
const { releases = [] } = result.data;
//默认第一个展开body参数)
releases.length && (releases[0].bodyshow = true);
setReleases(result.data.releases);
setIsSpin(false);
}
}).catch((error) => {
console.log(error);
})
}
// 显示版本描述
function showBody(key,flag){
var lists = releases.concat();
lists[key].bodyshow = !flag ? true : false;
lists.splice();
setReleases(lists);
}
//删除
function deleteRelease(releaseId) {
if(releaseId){
axios.delete(`/${owner}/${projectsId}/releases/${releaseId}.json`).then((result)=>{
if(result){
getIssueList();
}
})
}
}
function release(item,key){
return (
<div className="versionInfo" key={key}>
<span className="versionInfo_left">
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
<span className="color-grey-3 mt15 font-12">
<i className="iconfont icon-biaoqianicon mr3 font-14"></i>
<Link className="hover" to={`/${owner}/${projectsId}/tree/${item.tag_name}`} >{item.tag_name}</Link>
</span>
<span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/>
<Link className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(item.sha)}</Link>
</span>
</span>
<div className="versionInfo_right">
<div className="versionName">
<Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">{item.name}</Link>
<span>
{data && data.user_admin_permission && type !== 2 && <Link to={{pathname:`/${owner}/${projectsId}/releases/${item.version_id}/update`,state:{"stable":item.draft==="稳定"}}} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>}
{data && data.user_admin_permission && type !== 2 && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
</span>
</div>
<span className="color-grey-3 mb15 version-user">
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>showBody(key,item.bodyshow)}></i>
<User
id={item.id}
url={(item.image_url && getImageUrl(`/${item.image_url}`)) || "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
name={item.user_name}
login={item.user_login}
/>
<span className="ml5">发布于{item.created_at}</span>
</span>
{
item.bodyshow &&
<div className="body-show">
<RenderHtml className="break_word_comments imageLayerParent" value={item.body || ''} url={props.history.location}/>
</div>
}
<RenderHtml />
<p className="versionFile">
{/* 发行版附件下载 */}
{item.attachments && item.attachments.map((item)=>{
return(<a href={item.url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.title}</a>)
})}
{/* 发行版下载包 */}
<a href={item.tarball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.tag_name}.TAR.gz</a>
<a href={item.zipball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.tag_name}.ZIP</a>
</p>
</div>
</div>
)
}
function renderList(releases){
if (releases && releases.length > 0) {
return (
<React.Fragment>
{
data && data.user_admin_permission && type !== 2 &&
<div className="addReleaseBtn">
<Button type={"primary"} onClick={addFunc} className="btnblue" style={{height:"36px"}}>发布新版本</Button>
</div>
}
<div>
{!turnFromNew ? releases.map((item, key) => release(item,key)) : release(releases[0],0)}
</div>
</React.Fragment>
)
} else if (releases && releases.length === 0) {
return (
<Empty
operation={data && data.user_admin_permission && type !== 2}
addFunc={addFunc}
/>
)
} else{
return (<div></div>)
}
}
function addFunc(){
props.history.push({pathname:`/${owner}/${projectsId}/releases/new`,state:{stable:true}});
}
return (
<div className="releaseIndex">
<div className="releasesVersion">
<Spin spinning={isSpin}>
{renderList(releases)}
</Spin>
</div>
</div>
)
}
export default version;

View File

@ -0,0 +1,357 @@
.topWrapper {
padding: 20px 0;
box-sizing: border-box;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #EEEEEE;
align-items: center;
}
.topWrapper_btn_new {
background: #fff;
color: #5091FF!important;
padding:0px 12px;
text-align: center;
height: 32px;
line-height: 32px;
border-radius: 4px;
border:1px solid #5091FF;
}
.versionInfo{
display: flex;
width: 100%;
}
.versionInfo_left{
display: flex;
width: 182px;
flex-direction: column;
align-items: flex-end;
padding-right: 15px;
&>.color-grey-3{
max-width: 10rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.versionInfo_right{
flex: 1;
display: flex;
flex-direction: column;
align-items: flex-start;
border-left: 1px solid #eee;
position: relative;
padding: 0px 30px 60px 24px;
&::before{
position: absolute;
left: -4px;
top:0px;
content: '';
width: 8px;
height: 8px;
background-color: #466AFF;
border-radius: 50%;
}
.sendAuthorImg{
width: 20px;
height: 20px;
border-radius: 50%;
margin-right: 5px;
}
.body-show{
padding: 5px 10px 10px 10px;
}
& .version-user>a>span{
display: inline-block;
& img{
width: 20px;
height: 20px;
}
}
}
.versionTag{
display: inline;
padding:0px 9px;
color: #fff;
position: relative;
margin-top: -8px;
height: 22px;
line-height: 20px;
border-radius: 4px;
&::before{
position: absolute;
content: "";
width: 0;
height: 0px;
border-left: 4px solid #cccccc;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-right: 4px solid transparent;
z-index: 9;
top: 6px;
right: -9px;
}
&:after{
width: 0px;
height: 0px;
top:6px;
right: -7px;
position: absolute;
border-left:4px solid #fff;
border-top:4px solid transparent;
border-bottom:4px solid transparent;
border-right:4px solid transparent;
content:'';
z-index:10;
}
}
.versionFile{
margin-top: 5px;
padding-top: 20px;
border-top: 1px solid #eee;
// width: 100%;
a{
display: block;
color: #333;
font-weight: 400;
height: 20px;
margin-bottom: 10px;
}
}
.versionTag.yellow{
border: 1px solid #FBBC06;
color: #FBBC06;
&::before{
border-left-color: #FBBC06;
}
}
.versionTag.green{
border: 1px solid #2DB44D;
color: #2DB44D;
&::before{
border-left-color: #2DB44D;
}
}
.versionTag.orange{
border: 1px solid #FF6E23;
color: #FF6E23;
&::before{
border-left-color: #FF6E23;
}
}
.addReleaseBtn{
text-align: right;
margin-bottom: 30px;
}
.versionName{
font-size: 16px;
color: #333;
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 18px;
line-height: 18px;
margin-top: -5px;
}
.versionmilepostleft{
padding: 15px;
margin-right: 50px;
width: 80%;
}
.topWrapper_btn_close {
background: #504b4b;
color: #FFFFFF!important;
padding:0px 12px;
text-align: center;
height: 32px;
line-height: 32px;
border-radius: 4px;
}
.topWrapper_btn_delete {
background: #da1010;
color: #FFFFFF!important;
padding:0px 12px;
text-align: center;
height: 32px;
line-height: 32px;
border-radius: 4px;
}
.versionrighe{
flex: 2;
}
.versionleft{
flex: 1;
text-align: right;
display: flex;
justify-content: right;
}
/* .version_line{
display: flex;
height: 30px;
margin: auto;
border-left:1px solid #eee;
} */
.version_line_one{
display: flex;
height: 45px;
margin: auto;
border-left:1px solid #eee;
}
.version_line_tpw{
display: flex;
height: 80px;
margin: auto;
border-left:1px solid #eee;
}
.versiondiv{
display: flex;
}
.verwinth{
width: 80%;
}
/*开启中 关闭中*/
.opendversionetail{
display: inline-block;
background: #21ba45;
color: #ffffff!important;
padding:0px 5px;
text-align: center;
height: 25px;
/*width: 110px;*/
border-radius: 4px;
line-height: 25px;
}
.closedversionetail{
display: inline-block;
background: #e60b0b;
color: #ffffff!important;
padding:0px 5px;
text-align: center;
height: 25px;
/*width: 110px;*/
border-radius: 4px;
line-height: 25px;
}
.versionrectangle {
width: 8px;
height: 8px;
border-radius: 100%;
margin-top: 15px;
margin-left: -4px;
margin-bottom: 10px;
background: rgb(83, 81, 81);
}
.ver-middle{
vertical-align: middle;
}
/* new */
.versionForm{
flex:1;
padding-right: 40px;
box-sizing: border-box;
.ant-select-auto-complete.ant-select .ant-input:hover,.ant-input:hover {
border-color: rgba(153, 153, 153, 0.8);
}
}
.versionTips{
width:268px;
box-sizing: border-box;
}
.infosTip{
border-bottom: 1px solid #EEEEEE;
color: #333;
padding-bottom: 26px;
margin-bottom: 26px;
font-weight: 400;
text-align: justify;
&:last-child{
border-bottom: none;
}
}
.dragBox{
background: rgba(153, 153, 153, 0.04);
border-radius: 4px;
border: 1px dashed #d9d9d9;
padding:20px;
.versionStyle{
border: none!important;
padding-bottom:20px;
.dragIcon{
font-size: 40px!important;
color: #666!important;
line-height: 40px;
height: 40px;
margin-bottom: 14px;
display: block;
}
}
.ant-upload-list-item:hover .ant-upload-list-item-info {
background-color: rgba(239, 244, 255, 1);
}
.ant-upload-list-item-info{
padding:0px 20px 0px 8px;
&>span{
display: flex;
align-items: center;
}
}
}
.set-ant-row .ant-row{
display: flex;
height: 20px;
align-items: center;
}
.itemInline{
display: flex;
align-items: flex-start;
position: relative;
&>p{
position: absolute;
bottom: -5px;
}
}
.itemInline .ant-row{
margin-bottom: 0px;
}
.prerelease{
padding-top: 20px;
.ant-form-item-control{
height: 20px;
line-height: 20px;
}
}
.releaseIndex{
margin: 30px auto;
width: 1200px;
}
.emptyPanel{
width: 100%;
background: #FAFCFF;
border-radius: 4px;
border: 1px solid rgba(42, 97, 255, 0.23);
min-height: 418px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.operation{
width: 400px;
border-top: 1px solid #eee;
padding-top: 34px;
text-align: center;
margin-top: 30px;
}
}
.ant-form-item-control{
line-height: initial;
}

View File

@ -0,0 +1,448 @@
import React, { Component } from 'react';
import { Input, Select, Spin, Alert } from 'antd';
import axios from 'axios';
import MergeForm from './merge_form';
import MergeFooter from './merge_footer';
import '../Order/order.css';
import './merge.css';
/**
* 根据url获取目标仓库目标分支源仓库源分支
* 路由规则owner/projectId/compare/merge...pullowner:pullBranch
* 可能存在的情况
* 1代码库首页跳转仓库相同目标分支为默认分支owner/projectId/compare/pullBranch
* 2代码库分支列表仓库相同目标分支为默认分支owner/projectId/compare/pullBranch
* 3合并请求列表页新建无数据时的提示仓库相同目标都为默认分支owner/projectId/compare
* 4新建页面切换分支切换目标仓库刷新页面等存在所有可能情况
*/
function getBranchParams(pathname) {
const result = {
// 目标仓库所有者
mergeOwner: undefined,
// 目标分支
mergeBranch: 'master',
// 源仓库所有者
pullOwner: undefined,
// 源分支
pullBranch: 'master',
// 仓库名称
projectId: undefined,
};
// 去掉第一个字符/
const _pathname = pathname.slice(1);
const [ownerProject, branchUrl] = _pathname.split('/compare');
const [mergeOwner, projectId] = ownerProject.split('/');
// 同仓库时
result.mergeOwner = mergeOwner;
result.pullOwner = mergeOwner;
result.projectId = projectId;
if (branchUrl) {
// 如果存在具体的分支
const _branchUrl = branchUrl.slice(1);
if (_branchUrl.indexOf('...') > -1) {
// 存在源分支与目标分支
const [mergeBranch, pullObj] = _branchUrl.split('...');
result.mergeBranch = mergeBranch;
if (pullObj.indexOf(':') > -1) {
// 存在源仓库
const [pullOwner, pullBranch] = pullObj.split(':');
result.pullOwner = pullOwner;
result.pullBranch = pullBranch;
} else {
result.pullBranch = pullObj;
}
} else {
result.pullBranch = _branchUrl;
}
}
return result;
}
const Option = Select.Option;
class CreateMerge extends Component {
constructor(props) {
super(props);
const { pullBranch, mergeBranch } = getBranchParams(
this.props.location.pathname
);
this.state = {
data: undefined,
pullBranches: undefined,
mergeBranches: undefined,
mergeProjects: undefined,
merge: mergeBranch || 'master',
pull: pullBranch || 'master',
id: undefined,
// isFork: false,
projects_names: undefined,
isSpin: true,
showMessage: false,
merge_head: false, // 是否向fork后的源项目发起合并请求
defaultMessage: '必须选择不同的分支',
project_id: undefined, // 当前项目的id也即开始发送合并请求的源项目id
merge_project_user: undefined,
comparesData: undefined, //提交和文件的内容保存compare接口返回的数据
// 比较分支时的加载效果
isCompareSpin: true,
// 是否是初次加载用这个字段来控制提示组件和文件组件的显示、隐藏比直接用isCompareSpin交互友好些
isFirstLoading: true,
};
}
componentDidMount = () => {
// 初始化时根据url获取目标仓库、分支源仓库、分支
// 再获取对应的仓库列表、分支列表
// 再调用比较接口
const branchParams = getBranchParams(this.props.location.pathname);
this.getMergeInfo(branchParams);
};
componentDidUpdate = (preProps) => {
// url变化触发时切换源分支、切换目标仓库、切换目标分支回退
const oldPathname = preProps.location.pathname;
const newPathname = this.props.location.pathname;
if (oldPathname !== newPathname) {
const branchParams = getBranchParams(newPathname);
this.getMergeInfo(branchParams);
}
};
//获取新建合并请求数据
getMergeInfo = (branchParams) => {
this.setState({ isSpin: true });
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
branchParams;
const url = `/${pullOwner}/${projectId}/pulls/new.json`;
axios
.get(url)
.then((result) => {
if (result) {
// 如果url上的分支不存在取默认值master
const noMergeBranch =
(result.data.branches || []).filter(
(branch) => branch.name === mergeBranch
).length === 0;
const noPullBranch =
(result.data.branches || []).filter(
(branch) => branch.name === pullBranch
).length === 0;
this.setState({
// isFork: result.data.is_fork,
projects_names: result.data.projects_names,
mergeProjects: result.data.merge_projects,
pullBranches: result.data.branches,
mergeBranches: result.data.branches,
project_id: result.data.project_id,
id: result.data.id,
merge: mergeBranch,
pull: pullBranch,
});
//判断源分支是否存在
if(noPullBranch){
this.setState({
showMessage: true,
defaultMessage:'源分支不存在',
isCompareSpin: false,
});
}else{
if(pullOwner === mergeOwner){
if (!noMergeBranch) {
this.compareProject(true, branchParams);
} else {
this.setState({
showMessage: true,
defaultMessage:'目标分支不存在',
isCompareSpin: false,
});
}
}else{
this.getBranchList(branchParams);
}
}
}
this.setState({ isSpin: false });
})
.catch((error) => {
this.setState({ isSpin: false });
console.log(error);
});
};
// compare接口获取分支对比信息
compareProject = (sameProject, branchParams) => {
// const { project } = this.props;
// const { owner, projectsId } = this.props.match.params;
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
branchParams;
let url = `/${mergeOwner}/${projectId}/compare`;
if (sameProject) {
url += `/${pullBranch}...${mergeBranch}.json`;
} else {
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`;
}
this.setState({ isSpin: false, isCompareSpin: true });
axios
.get(url)
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
showMessage: false,
});
} else {
this.setState({
showMessage: true,
defaultMessage: result.data.message,
});
}
this.setState({
comparesData: result.data,
});
}
this.setState({
isFirstLoading: false,
isSpin: false,
isCompareSpin: false,
});
})
.catch((error) => {
this.setState({ isSpin: false, isCompareSpin: false });
});
};
// 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询
getBranchList = (branchParams) => {
const { mergeOwner, projectId, mergeBranch } = branchParams;
this.setState({ isSpin: true });
const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`;
axios
.get(url)
.then((result) => {
if (result) {
const noMergeBranch =
(result.data || []).filter((branch) => branch.name === mergeBranch)
.length === 0;
this.setState({
mergeBranches: result.data,
showMessage: noMergeBranch,
defaultMessage: '目标分支不存在',
isCompareSpin: false,
});
!noMergeBranch && this.compareProject(false, branchParams);
}
this.setState({ isSpin: false });
})
.catch((error) => {
this.setState({ isSpin: false });
console.log(error);
});
};
// 切换分支事件
selectBrach = (type, value) => {
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
getBranchParams(this.props.location.pathname);
let _url = `/${mergeOwner}/${projectId}/compare/`;
// type为pull时pullBranch取value否则取原有值
// type为pull时mergeBranch取原有值否则取value
let _pullBranch = type === 'pull' ? value : pullBranch;
let _mergeBranch = type === 'pull' ? mergeBranch : value;
if (pullOwner === mergeOwner) {
// 如果仓库相同, compare/目标分支...源分支
_url += `${_mergeBranch}...${_pullBranch}`;
} else {
// 如果仓库不同, compare/目标分支...源分支
_url += `${_mergeBranch}...${pullOwner}:${_pullBranch}`;
}
this.props.history.push(_url);
};
// 切换仓库响应事件,目前仅目标分支可切换仓库
selectProjectName = (value) => {
const { projects_names, id } = this.state;
const { pullOwner, pullBranch } = getBranchParams(
this.props.location.pathname
);
let arr =
projects_names && projects_names.filter((item) => item.id === value);
let identifier = arr && arr[0].project_id;
let login = arr && arr[0].project_user_login;
// 目标仓库与源仓库不是一个仓库
let is_fork = parseInt(value, 10) !== parseInt(id, 10);
this.setState({
isSpin: true,
// merge_head: is_fork,
data: {
is_original: is_fork,
fork_project_id: is_fork ? id : '',
merge_user_login: is_fork
? projects_names[0].project_user_login
: undefined,
},
});
if (login === pullOwner) {
// 如果切换后, 仓库与源仓库一致了
this.props.history.push(
`/${login}/${identifier}/compare/master...${pullBranch}`
);
} else {
this.props.history.push(
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
);
}
// this.newMergelist(login, identifier);
};
// 渲染分支列表
renderBrances = (list) => {
if (list && list.length > 0) {
return list.map((item, key) => {
return (
<Option key={key + 1} value={item.name}>
{item.name}
</Option>
);
});
}
};
// 渲染项目列表
renderProjectNames = (list) => {
if (list && list.length > 0) {
return list.map((item, key) => {
return (
<Option key={key + 1} value={item.id}>
{item.project_name}
</Option>
);
});
}
};
// 渲染html内容
withHtml = (html) => {
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
};
render() {
const {
data,
pullBranches,
mergeBranches,
mergeProjects,
pull,
merge,
isSpin,
isCompareSpin,
isFirstLoading,
showMessage,
defaultMessage,
projects_names,
id,
comparesData,
} = this.state;
let { project } = this.props;
return (
<div>
<Spin spinning={isSpin || isCompareSpin}>
<div className="main">
<div className="merge-header width100 inline-block">
<div className="width40 pull-left">
<div className="color-grey-3 mb10 fwb">源分支:</div>
<Input.Group compact className="display-flex">
<Select
value={id}
className="hide-1 task-hide flex1"
disabled
>
{this.renderProjectNames(projects_names)}
</Select>
<Select
value={pull}
onSelect={(e) => this.selectBrach('pull', e)}
showSearch
className="merge-flex1 flex1 matchwidth"
dropdownMatchSelectWidth={false}
dropdownClassName="overlihide"
>
{this.renderBrances(pullBranches)}
</Select>
</Input.Group>
</div>
<div className="width10 pull-left text-center mt25">
<i
className={'iconfont icon-youjiang color-grey-c font-32'}
></i>
</div>
<div className="width40 pull-left">
<div>
<div className="color-grey-3 mb10 fwb">目标分支:</div>
<Input.Group compact className="display-flex">
<Select
value={project && project.id}
className="hide-1 task-hide flex1"
onSelect={(e) => this.selectProjectName(e)}
>
{this.renderProjectNames(mergeProjects)}
</Select>
<Select
value={merge}
onSelect={(e) => this.selectBrach('merge', e)}
showSearch
className="merge-flex1 flex1 matchwidth"
dropdownMatchSelectWidth={false}
dropdownClassName="overlihide"
>
{this.renderBrances(mergeBranches)}
</Select>
</Input.Group>
</div>
</div>
</div>
{/* 非加载状态且有提示 */}
{!isCompareSpin && showMessage && (
<div className="mb20">
<Alert
description={this.withHtml(defaultMessage)}
type="error"
/>
</div>
)}
{/* 非加载状态且可以提交 */}
{!isCompareSpin && !showMessage && (
<MergeForm
{...this.props}
merge_type="new"
data={data}
merge={merge}
pull={pull}
files_count={
comparesData &&
comparesData.diff &&
comparesData.diff.files_count
}
commits_count={comparesData && comparesData.commits_count}
></MergeForm>
)}
</div>
{!isFirstLoading && (
<MergeFooter
{...this.props}
merge={merge}
pull={pull}
comparesData={comparesData}
></MergeFooter>
)}
</Spin>
</div>
);
}
}
export default CreateMerge;

View File

@ -1,17 +1,24 @@
import React ,{useEffect,useState } from 'react';
import { truncateCommitId } from '../common/util';
import { AlignCenter , FlexAJ } from '../Component/layout';
import { Button } from 'antd';
import { Tooltip,Progress } from 'antd';
import './merge.css';
import './Index.scss';
function Files({data,history,owner,projectsId}){
function Files({ data,history,owner,projectsId , parentsSha }){
const [ files , setFiles ] = useState(data && data.files);
const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径");
const [ isOpen, setIsOpen] = useState(false);
useEffect(()=>{
if(data){
setFiles(data.files);
}
},[data])
},[data]);
useEffect(()=>{
document.addEventListener('click',()=>{setIsOpen(false)})
})
function showDown(flag,index,isBin){
if(!isBin){
@ -22,35 +29,86 @@ function Files({data,history,owner,projectsId}){
}
}
function copyFileName(fileName){
var copyCont = document.createElement('input');
copyCont.defaultValue = fileName;
document.body.appendChild(copyCont);
copyCont.select(); //
document.execCommand("Copy"); //
copyCont.className = 'copyCont';
copyCont.style.display='none';
setCopyfileTipTitle("复制成功");
}
const folderOpen = (
<div className="folders">
<div className="folderList">
{files && files.map((item, key) => {
return (
<a href={`#value${key}`}>
<FlexAJ className="filesInfo" key={key} onClick={() => {item.flag && showDown(item.flag, key, item.isBin);setIsOpen(false);}}>
<AlignCenter>
<i className="iconfont icon-wenjianicon mr4"></i>
<span className="cursor-pointer" data-clipboard-text={item.name}>{item.name}</span>
</AlignCenter>
<div className="see-file">
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改${item.addition + item.deletion > 0 ? "":""}${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
{item.addition >0 && <span className="color-green ml10">+{item.addition}</span>}
{item.deletion >0 && <span className="color-red ml10">-{item.deletion}</span>}
</Tooltip>
</div>
</FlexAJ>
</a>
)
})}
</div>
</div>
)
return(
<div>
<AlignCenter className="color-grey-9 pb10" style={{borderBottom:"1px solid #eee"}}>
<i className="iconfont icon-sanjiaoxing-down mr5"></i>
<span>
共有<span className="color-grey-3"> {data && data.files_count} 个文件被更改</span>包括
<div onClick={(e)=>{e.nativeEvent.stopImmediatePropagation()}}>
<AlignCenter className="color-grey-9" style={{position:'relative'}}>
<div onClick={()=>{setIsOpen(!isOpen)}}>
<i className={`iconfont mr5 ${isOpen? "font-18 icon-sanjiaoxing-down":"font-16 icon-triangle"}`}></i>
<span className="color-grey-6 update-file-count">
共有<span className="color-grey-3"> {data && data.files_count} 个文件 </span>被更改包括
{ data && data.total_addition ? <span className="color-green"> {data && data.total_addition} 次插入</span>:"" }
{ data && data.total_addition && data.total_deletion ? " 和 ":""}
{ data && data.total_deletion ? <span className="color-red"> {data && data.total_deletion} 次删除</span>:""}
</span>
</span>
</div>
{isOpen && folderOpen}
</AlignCenter>
{
files && files.length>0 &&
<div>
<div className="fileList">
{
files.map((item,key)=>{
return(
<div className="files" key={key}>
<FlexAJ className="filesInfo" style={{cursor:item.isBin ? "default":"pointer"}} onClick={()=>showDown(item.flag,key,item.isBin)}>
<a id= {`value${key}`} className="anchorPoint"></a>
<FlexAJ className="filesInfo">
<AlignCenter>
{!item.isBin ? <i className={!item.flag?"iconfont icon-xiajiantou font-16 mr15 color-grey-9":"iconfont icon-youjiantou font-16 mr15 color-grey-9"}></i>:""}
<i className="iconfont icon-wenjia font-16 mr8 color-grey-9"></i>
<span>{item.name}</span>
{!item.isBin ? <i className={!item.flag?"iconfont icon-sanjiaoxing-down color-grey-9 mt4":"iconfont icon-triangle font-15 color-grey-9"} onClick={()=>showDown(item.flag,key,item.isBin)}></i>:""}
<span className="cursor-pointer" data-clipboard-text={item.name} onClick={()=>showDown(item.flag,key,item.isBin)}>{item.name}</span>
<Tooltip
title={copyfileTipTitle}
onVisibleChange={()=>setCopyfileTipTitle("复制文件路径")}
>
<i className="iconfont icon-fuzhiicon ml6" onClick={()=>copyFileName(item.name)}></i>
</Tooltip>
</AlignCenter>
<span>
<Button className="mr20" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}/${item.name}`)}}>查看文件</Button>
<span className="color-green">+{item.addition}</span>
<span className="color-red ml20">-{item.deletion}</span>
</span>
<div className="see-file">
<Tooltip placement="top" title={`${item.addition + item.deletion}处更改${item.addition + item.deletion > 0 ? "":""} ${item.addition > 0 ? item.addition + "处添加" : ""}${item.addition > 0 && item.deletion > 0 ? "和" : ""}${item.deletion > 0 ? item.deletion + "处删除" : ""}`}>
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
<span className="ml10">{item.addition+item.deletion}</span>
</Tooltip>
{
!item.isSubmodule &&
<span className="see-file-btn" onClick={()=>{history.push(`/${owner}/${projectsId}${item.isDeleted ? `/commits/${truncateCommitId(parentsSha)}`:`/tree/${truncateCommitId(item.sha)}/${item.name}`}`)}}>查看文件</span>
}
</div>
</FlexAJ>
{
item.sections && item.sections.length >= 1 && !item.flag &&

View File

@ -18,4 +18,86 @@
.pr_tags_closed{
border:1px solid #FA6400;
color: #FA6400;
}
.update-file-count{
cursor: pointer;
& .color-grey-3{
font-weight: bold;
}
}
.fileList{
.sc-bxivhb{
width: 55rem;
overflow: hidden;
white-space: normal;
word-break: break-all;
}
.see-file{
width: 14rem;
.ml10{
display: inline-block;
width: 4.5rem;
cursor: default;
}
span{
width: 7%;
}
}
.anchorPoint{
position: relative;
top: -5rem;
display: block;
height: 0;
}
}
.filesInfo{
background: #FAFCFF;
border-color:rgba(42, 97, 255, 0.23);
.ant-progress-line {
width: 5rem;
}
.ant-progress-inner{
background-color: #D14A4A;
}
}
.folders,.ant-anchor{
margin-left: 0;
padding-left: 0;
}
.folders{
position: absolute;
z-index: 2;
left: 0px;
top: 37px;
color: #333333;
width: 75rem;
box-shadow: 0px 4px 8px 2px rgba(212, 212, 212, 0.5);
border-radius: 4px;
border: 1px solid rgba(153, 153, 153, 0.32);
.ant-anchor-link-active > .ant-anchor-link-title {
color: #466AFF;
}
.ant-anchor-link {
padding: 0px;
}
.folderList{
max-height: 275px;
overflow:auto;
.files{
border: 0px;
}
.filesInfo {
padding: 10px 18px 10px 15px;
height: 55px;
background: #FFF;
border-bottom: 1px solid #EEEEEE;
&:hover{
background: #F3F4F6;
}
.color-green,.color-red{
width: 3%;
text-align: right;
}
}
}
}

View File

@ -228,7 +228,7 @@ class MergeDetail extends Component {
<div>
{
data && data.issue.user_permission ?
<Link to={`/${owner}/${projectsId}/pulls/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
<Link to={`/${owner}/${projectsId}/pulls/${mergeid}/edit`} className="color-blue fr">编辑</Link>
: ''
}
</div>

View File

@ -62,9 +62,9 @@ class MergeItem extends Component {
<p className="mb15 df" style={{ alignItems: "center" }}>
<i className={`iconfont icon-hebingqingqiu1 font-14 mr3 i_${status}`}></i>
<Link
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}`}
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
style={{ maxWidth: "300px" }}
style={{ maxWidth: "600px" }}
>
{item.name}
</Link>
@ -110,7 +110,7 @@ class MergeItem extends Component {
<Tag className="pr-branch-tag">
<Link
to={`/${item.is_original ? item.fork_project_user : owner}/${ item.is_original ? item.fork_project_identifier : projectsId }/tree/${turnbar(item.pull_request_head)}`}
className="maxW200px hide-1 ver-middle"
className="maxW200px task-hide ver-middle" style={{maxWidth:"200px"}}
>
{item.is_original
? item.fork_project_user
@ -134,7 +134,7 @@ class MergeItem extends Component {
<Tag className="pr-branch-tag">
<Link
to={`/${owner}/${projectsId}/tree/${turnbar(item.pull_request_base)}`}
className="maxW200px hide-1 ver-middle"
className="maxW200px task-hide ver-middle" style={{maxWidth:"200px"}}
>
{/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
{project_author_name}:{item.pull_request_base}
@ -175,7 +175,7 @@ class MergeItem extends Component {
{item.journals_count ? (
<Link
className="mr5 color-grey-8"
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}`}
>
<i className="iconfont icon-huifu1 font-15 mr5 ver-middle"></i>
{item.journals_count}
@ -196,7 +196,7 @@ class MergeItem extends Component {
>
<div className="grid-item mr15 color-grey-9">
<Link
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/updatemerge`}
to={`/${owner}/${projectsId}/pulls/${item.pull_request_id}/edit`}
className="color-grey-9"
>
<i className="iconfont icon-bianji3 font-14 mr5"></i>

View File

@ -0,0 +1,210 @@
import React, { Component } from 'react';
import { Tabs, Spin } from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import Commits from './Commits';
import Comments from '../comments/comments';
import Files from './Files';
import '../Order/order.css';
import './merge.css';
const { TabPane } = Tabs;
class MergeFooter extends Component {
constructor(props) {
super(props);
this.state = {
commitsData: [],
filesData: undefined,
isSpin: false,
activeKey: '1',
commitCount: 0,
filesCount: 0,
//
commentsTotalCount: 0,
};
}
componentDidMount() {
this.Init();
// 便
this.props.bindFootRef && this.props.bindFootRef(this);
}
componentDidUpdate(prevProps) {
// tab退taburltab
const newPathname = this.props.location.pathname;
const prevPathname = prevProps.location.pathname;
if (newPathname !== prevPathname) {
this.Init(true);
}
}
Init = (isTabChange) => {
const { data, location, match } = this.props;
const { pathname } = location;
const { projectsId, owner, mergeId } = match.params;
let activeKey = '1';
if (pathname.indexOf('commits') > -1) {
activeKey = '2';
this.getCommit(owner, projectsId, mergeId);
} else if (pathname.indexOf('files') > -1) {
activeKey = '3';
this.getFile(owner, projectsId, mergeId);
}
if (isTabChange && activeKey === '1') {
this.refreshComment();
}
this.setState({
activeKey: activeKey,
commitCount: data && data.commits_count,
filesCount: data && data.files_count,
});
};
bindCommentRef = (commentRef) => {
this.childComment = commentRef;
}
refreshComment = () => {
this.childComment && this.childComment.getjournalslist();
}
getCommit = (owner, projectsId, mergeId) => {
this.setState({ isSpin: true });
const url = `/${owner}/${projectsId}/pulls/${mergeId}/commits.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
commitsData: result.data.commits,
commitCount: result.data.commits_count,
});
}
this.setState({ isSpin: false });
})
.catch((error) => {
this.setState({ isSpin: false });
});
};
getFile = (owner, projectsId, mergeId) => {
this.setState({ isSpin: true });
const url = `/${owner}/${projectsId}/pulls/${mergeId}/files.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
filesData: result.data,
filesCount: result.data.files_count,
});
}
this.setState({ isSpin: false });
})
.catch((error) => {
this.setState({ isSpin: false });
});
};
render() {
const { projectsId, owner, mergeId } = this.props.match.params;
const { order_id, data = {} } = this.props;
const {
isSpin,
activeKey,
filesCount,
commitCount,
filesData,
commitsData = [],
} = this.state;
// Comment0
const commentsTotalCount = parseInt(
this.state.commentsTotalCount || data.comments_total_count || 0,
10
);
return (
<div className="main mergeRequest" style={{ paddingTop: '0px' }}>
<Spin spinning={isSpin}>
<Tabs
activeKey={activeKey}
className="custom-commit-tabs"
animated={false}
>
<TabPane
tab={
<Link to={`/${owner}/${projectsId}/pulls/${mergeId}`}>
<span className="font-16">评论</span>
{commentsTotalCount > 0 && (
<span className="tabNum">{commentsTotalCount}</span>
)}
</Link>
}
key="1"
>
<Comments
order_id={order_id}
showNotification={this.props.showNotification}
only_show_content={true}
updateCommentsNum={(commentsCount) => {
this.setState({ commentsTotalCount: commentsCount || 0 });
}}
{...this.props}
bindCommentRef={this.bindCommentRef}
/>
</TabPane>
{commitCount > 0 && (
<TabPane
tab={
<Link to={`/${owner}/${projectsId}/pulls/${mergeId}/commits`}>
<span className="font-16">提交</span>
{commitCount > 0 && (
<span className="tabNum">{commitCount}</span>
)}
</Link>
}
key="2"
>
{commitsData.length > 0 && (
<Commits
{...this.props}
commits={commitsData}
projectsId={projectsId}
owner={owner}
></Commits>
)}
</TabPane>
)}
{filesCount > 0 && (
<TabPane
tab={
<Link to={`/${owner}/${projectsId}/pulls/${mergeId}/files`}>
<span className="font-16">文件</span>
{filesCount > 0 && (
<span className="tabNum">{filesCount}</span>
)}
</Link>
}
key="3"
>
<Files
{...this.props}
data={filesData}
projectsId={projectsId}
owner={owner}
/>
</TabPane>
)}
</Tabs>
</Spin>
</div>
);
}
}
export default MergeFooter;

View File

@ -1,7 +1,6 @@
import React, { Component } from "react";
import { Tabs } from 'antd';
import { Link } from "react-router-dom";
import { AlignCenter } from '../Component/layout';
import axios from "axios";
import { getImageUrl } from "educoder";
import {
@ -11,7 +10,6 @@ import {
Dropdown,
Icon,
Menu,
Select,
Tag,
Button,
Alert,
@ -19,9 +17,8 @@ import {
import "./merge.css";
import RenderHtml from "../../components/render-html";
import "../Order/order.css";
import MergeFooter from "./merge_footer";
import MergeLinkFooter from "./MergeLinkFooter";
const Option = Select.Option;
const TextArea = Input.TextArea;
function turnbar(str){
@ -61,6 +58,11 @@ class MessageCount extends Component {
// this.clickBody();
};
bindFootRef = (footRef) => {
this.footRef = footRef;
}
clickBody=()=>{
document.body.addEventListener('click', e => {
let name = e.target.className;
@ -150,6 +152,8 @@ class MessageCount extends Component {
});
const { getDetail } = this.props;
getDetail && getDetail();
// 调用子组件的方法刷新评论列表
this.footRef && this.footRef.refreshComment();
} else {
this.setState({ SpinMerge: false });
}
@ -283,13 +287,13 @@ class MessageCount extends Component {
conflict_files && conflict_files.length>0 &&
<div>
<p className="mt10 font-16 pt10" style={{borderTop:"1px solid #f9d7d5"}}>如下文件有代码冲突</p>
<p>
<div>
{
conflict_files.map((i,k)=>{
return <p>{i}</p>
return <p key={k}>{i}</p>
})
}
</p>
</div>
</div>
}
</div>
@ -336,11 +340,11 @@ class MessageCount extends Component {
<div>
<div className="main">
<div>
<div className="grid-item-top pb20 border-1f">
<div>
<div className="pb20 border-1f df">
<div className="flex1">
<div className="ver-middle">
<span className="mr10 ver-middle">
<span className="font-18 fwb">
<span className="font-18 fwb" style={{wordBreak:"break-all"}}>
{data.issue.subject}
</span>
</span>
@ -362,9 +366,9 @@ class MessageCount extends Component {
<Tag className="pr-branch-tag">
<Link
to={`/${data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}/${data.pull_request.is_original?data.project_identifier:projectsId}/tree/${turnbar(data.pull_request && data.pull_request.head)}`}
className="ver-middle"
className="ver-middle task-hide" style={{maxWidth:"200px"}} title={`${data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: ${data.pull_request && data.pull_request.head}`}
>
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: {turnbar(data.pull_request && data.pull_request.head)}
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: {data.pull_request && data.pull_request.head}
</Link>
</Tag>
<span className="mr8 ver-middle">
@ -377,7 +381,7 @@ class MessageCount extends Component {
<Tag className="pr-branch-tag">
<Link
to={`/${owner}/${projectsId}/tree/${data.pull_request.base}`}
className="ver-middle"
className="ver-middle task-hide" style={{maxWidth:"200px"}} title={`${data.issue.project_author_name}:${data.pull_request.base}`}
>
{data.issue.project_author_name}:{data.pull_request.base}
</Link>
@ -441,14 +445,13 @@ class MessageCount extends Component {
</span>
</div>
</div>
<div className="ml10">
<div className="mt15 text-right" style={{display:"flex",justifyContent:"flex-end"}}>
<div className="ml10 text-right">
{operate && (
<Button
type="green"
ghost
className="ml20"
onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/UpdateMerge`);}}
onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/edit`);}}
>
编辑
</Button>
@ -465,7 +468,6 @@ class MessageCount extends Component {
</Button>
)}
</div>
</div>
</div>
{
data.issue.description ?
@ -543,7 +545,7 @@ class MessageCount extends Component {
onChange={this.changbodypr}
/>
</div>
<p
<div
className="clearfix mt15"
style={{ display: this.state.buttonshow }}
>
@ -558,19 +560,19 @@ class MessageCount extends Component {
取消
</Button>
</Spin>
</p>
</div>
</div>
</Spin>
)}
</div>
</div>
<MergeFooter
footer_type={true}
<MergeLinkFooter
order_id={data && data.issue.id}
{...this.props}
{...this.state}
></MergeFooter>
bindFootRef={this.bindFootRef}
></MergeLinkFooter>
</div>
) : (
""

View File

@ -6,6 +6,11 @@ import "./merge.css";
import MergeForm from "./merge_form";
import MergeFooter from "./merge_footer";
const Option = Select.Option;
/**
* 此文件已废弃新文件为CreateMerge.js
* 2021.10.12
*/
class NewMerge extends Component {
constructor(props) {
super(props);
@ -110,6 +115,7 @@ class NewMerge extends Component {
const { author , identifier } =oldProject;
url += `/${mergeBranch}...${author && author.login}/${identifier}:${localBranch}.json`;
}
this.setState({isSpin: true});
axios.get(url).then(result=>{
if(result){
if (result.data.status === 0) {
@ -128,7 +134,9 @@ class NewMerge extends Component {
comparesData:result.data
})
}
}).catch(error=>{})
}).catch(error=>{
this.setState({isSpin: false});
})
}
}
@ -191,7 +199,7 @@ class NewMerge extends Component {
// this.ischeckmerge();
let { id ,merge , pull } = this.state;
if(type==="pull"){
this.props.history.push(`/${owner}/${projectsId}/pulls/new/${pull}`)
this.props.history.push(`/${owner}/${projectsId}/compare/${pull}`)
this.compareProject(id,value,merge);
}else{
this.compareProject(id,pull,value);
@ -213,7 +221,7 @@ class NewMerge extends Component {
merge_user_login: is_fork_id ? projects_names[0].project_user_login : undefined
}
})
this.props.history.push(`/${login}/${identifier}/pulls/new`);
this.props.history.push(`/${login}/${identifier}/compare`);
this.newMergelist(login,identifier);
};

View File

@ -64,12 +64,12 @@ class UpdateMerge extends Component {
<div className="color-grey-3 mb10 fwb">源分支:</div>
<Input.Group compact className="display-flex">
<Button className="merge-header-button maxW50 hide-1 task-hide">
<Button className="merge-header-button flex1 maxW50 hide-1 task-hide" disabled>
{data.is_original ? `${data.fork_project_user_name}/${data.fork_project_identifier}` : `${data.project_author}/${data.project_name}`}
</Button>
<Select
defaultValue={data.is_original ? `${data.fork_project_user}:${pull}` : `${pull}`}
className="minW50 merge-flex1"
className="minW50 merge-flex1 flex1 matchwidth"
disabled
></Select>{" "}
</Input.Group>{" "}
@ -83,12 +83,12 @@ class UpdateMerge extends Component {
<div>
<div className="color-grey-3 mb10 fwb"> 目标分支 : </div>{" "}
<Input.Group compact className="display-flex">
<Button className="merge-header-button maxW50 hide-1 task-hide">
<Button className="merge-header-button flex1 maxW50 hide-1 task-hide" disabled>
{`${data.project_author}/${data.project_name}`}
</Button>
<Select
defaultValue={data.is_original ? `${data.project_login}:${merge}` : `${merge}`}
className="minW50 merge-flex1"
className="minW50 merge-flex1 flex1 matchwidth"
disabled
></Select>{" "}
</Input.Group>{" "}

View File

@ -40,6 +40,7 @@ form .ant-cascader-picker, form .ant-select {
}
.merge-header-button{
background:rgba(241,248,255,1);
text-align: left;
}
.width70{
width:70%;
@ -152,13 +153,23 @@ form .ant-cascader-picker, form .ant-select {
margin-top: 15px;
border-radius: 2px;
}
.see-file-btn{
color: #466AFF;
cursor: pointer;
}
.filesInfo{
padding:10px 15px;
background-color: #fafafa;
}
.filesInfo .cursor-pointer{
cursor: pointer;
}
.filesContent{
border-top: 1px solid #ddd;
}
.icon-fuzhiicon:hover{
color: #466AFF;
}
.linesContent{
display: flex;
min-height: 30px;
@ -198,4 +209,17 @@ form .ant-cascader-picker, form .ant-select {
}
.linesContent.add{
background: rgba(48, 232, 132, 0.15);
}
}
.mergeRequest .folders{
/* width: 72rem; */
width: 100%;
}
.matchwidth .ant-select-selection__rendered{
width: 200px;
}
.overlihide li{
max-width: 450px;
}

View File

@ -213,7 +213,7 @@ class merge extends Component {
checkOperation() {
const { projectsId,owner } = this.props.match.params;
this.props.history.push(`/${owner}/${projectsId}/pulls/new`);
this.props.history.push(`/${owner}/${projectsId}/compare/master...master`);
}
render() {
const { projectsId , owner } = this.props.match.params;

View File

@ -1,169 +1,84 @@
import React, { Component } from "react";
import { Tabs, Spin } from "antd";
import "../Order/order.css";
import "./merge.css";
import Commits from "./Commits";
import Comments from "../comments/comments";
import Files from "./Files";
import axios from 'axios';
import React, { Component } from 'react';
import { Tabs } from 'antd';
import Commits from './Commits';
import Files from './Files';
import '../Order/order.css';
import './merge.css';
const { TabPane } = Tabs;
class MergeFooter extends Component {
constructor(props){
constructor(props) {
super(props);
this.state={
pageData:undefined,
commitsData:undefined,
filesData:undefined,
isSpin:false,
activeKey:"1",
commitCount:0,
filesCount:0
}
}
componentDidMount=()=>{
const { footer_type ,data } = this.props;
if(footer_type){
const { projectsId , owner , mergeId } = this.props.match.params;
this.getCommit(owner,projectsId,mergeId);
this.getFile(owner,projectsId,mergeId);
}
this.setState({
activeKey:footer_type ? "1" : "2",
commitCount:data && data.commits_count,
filesCount:data && data.files_count
})
}
componentDidUpdate=(prevProps)=>{
const { comparesData } = this.props;
const { footer_type } = this.props;
if(footer_type){
const { data } = this.props;
if(data !== prevProps.data){
this.setState({
commitCount:data && data.commits_count,
filesCount:data && data.files_count
})
}
}
if(comparesData !== prevProps.comparesData){
this.setState({
activeKey:footer_type ? "1" : "2"
})
this.changeTab(footer_type ? "1" : "2");
}
this.state = {
activeKey: '1',
};
}
changeTab=(index)=>{
changeTab = (index) => {
this.setState({
isSpin:true
})
this.setState({
activeKey:index
})
const { footer_type , comparesData } = this.props;
const { projectsId , owner , mergeId } = this.props.match.params;
if(footer_type){
if(index === "2"){
this.getCommit(owner,projectsId,mergeId);
}else if(index === "3"){
this.getFile(owner,projectsId,mergeId);
}else{
this.setState({
isSpin:false
})
}
}else{
this.setState({
commitsData:comparesData.commits,
filesData:comparesData.diff,
commitCount:comparesData.commits_count,
filesCount:comparesData.diff && comparesData.diff.files_count,
isSpin:false
})
}
}
getCommit =(owner,projectsId,mergeId)=>{
const url = `/${owner}/${projectsId}/pulls/${mergeId}/commits.json`;
axios.get(url).then(result=>{
if(result){
this.setState({
commitsData:result.data.commits,
isSpin:false,
commitCount:result.data.commits_count
})
}
}).catch(error=>{})
}
getFile =(owner,projectsId,mergeId)=>{
const url = `/${owner}/${projectsId}/pulls/${mergeId}/files.json`;
axios.get(url).then(result=>{
if(result){
this.setState({
filesData:result.data,
isSpin:false,
filesCount:result.data.files_count,
})
}
}).catch(error=>{})
}
activeKey: index,
});
};
render() {
const { projectsId , owner } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
const { comparesData = {} } = this.props;
const { commits, diff, commits_count } = comparesData;
const { activeKey } = this.state;
const { footer_type, order_id, data , comparesData } = this.props;
let { isSpin , activeKey , filesCount, commitCount , filesData , commitsData } = this.state;
return (
!footer_type && !comparesData || (comparesData && ((comparesData.commits && comparesData.commits.length===0)||(comparesData && !comparesData.diff)) )?"":
<div className="main" style={{paddingTop:"0px"}}>
<Spin spinning={isSpin}>
<Tabs
activeKey={activeKey}
className="custom-commit-tabs"
animated={false}
onChange={this.changeTab}
>
{
footer_type &&
<TabPane
tab={
<span><span className="font-16">评论</span>
{data && parseInt(data.comments_count) > 0 && <span className="tabNum">{data.comments_count}</span>}
</span>
} key="1">
<Comments
order_id={order_id}
showNotification={this.props.showNotification}
only_show_content={true}
{...this.props}
/>
</TabPane>
}
{
commitsData && commitsData.length > 0 &&
<TabPane tab={<span><span className="font-16">提交</span>
{commitCount > 0 && <span className="tabNum">{commitCount}</span>}
</span>} key="2">
<Commits {...this.props} commits={commitsData} projectsId={projectsId} owner={owner}></Commits>
</TabPane>
}
{
filesData && filesData.files && filesData.files.length>0 &&
<TabPane tab={
<span><span className="font-16">文件</span>
{filesCount > 0 && <span className="tabNum">{filesCount}</span>}
</span>
} key="3">
<Files {...this.props} data={filesData} projectsId={projectsId} owner={owner}/>
</TabPane>
}
</Tabs>
</Spin>
return (commits && commits.length === 0) || !diff ? (
''
) : (
<div className="main mergeRequest" style={{ paddingTop: '0px' }}>
<Tabs
activeKey={activeKey}
className="custom-commit-tabs"
animated={false}
onChange={this.changeTab}
>
{commits && commits.length > 0 && (
<TabPane
tab={
<span>
<span className="font-16">提交</span>
{commits_count > 0 && (
<span className="tabNum">{commits_count}</span>
)}
</span>
}
key="1"
>
<Commits
{...this.props}
commits={commits}
projectsId={projectsId}
owner={owner}
></Commits>
</TabPane>
)}
{diff && diff.files && diff.files.length > 0 && (
<TabPane
tab={
<span>
<span className="font-16">文件</span>
{diff.files_count > 0 && (
<span className="tabNum">{diff.files_count}</span>
)}
</span>
}
key="3"
>
<Files
{...this.props}
data={diff}
projectsId={projectsId}
owner={owner}
/>
</TabPane>
)}
</Tabs>
</div>
);
}

View File

@ -165,7 +165,8 @@ class MergeForm extends Component {
this.setState({
isSpin: false,
});
this.props.history.push(`/${owner}/${projectsId}/pulls`);
const { pull_request_id } = result.data;
this.props.history.push(`/${owner}/${projectsId}/pulls/${pull_request_id}`);
const { getDetail } = this.props;
getDetail && getDetail();
} else {
@ -195,7 +196,7 @@ class MergeForm extends Component {
isSpin: false,
});
this.props.history.push(
`/${owner}/${projectsId}/pulls/${mergeId}/Messagecount`
`/${owner}/${projectsId}/pulls/${mergeId}`
);
} else {
this.setState({
@ -264,7 +265,7 @@ class MergeForm extends Component {
},
],
initialValue: title,
})(<Input placeholder="标题" maxLength={50} />)}
})(<Input placeholder="标题" maxLength={200} />)}
</Form.Item>
<MDEditor
placeholder={"请输入合并请求的描述..."}
@ -287,7 +288,7 @@ class MergeForm extends Component {
type="default"
className="ml30"
onClick={()=>{
this.props.history.push(merge_type === "new" ? `/${owner}/${projectsId}/pulls` : `/${owner}/${projectsId}/pulls/${mergeId}/detail`)
this.props.history.push(merge_type === "new" ? `/${owner}/${projectsId}/pulls` : `/${owner}/${projectsId}/pulls/${mergeId}`)
}}
>
<span className="plr10">取消</span>

View File

@ -12,7 +12,7 @@ class Nodata extends Component{
<h3>欢迎使用合并请求</h3>
<div className="color-grey-8">
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/${owner}/${projectsId}/pulls/new`}>合并请求</Link>
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/${owner}/${projectsId}/compare/master...master`}>合并请求</Link>
</div>
</div>
</div>

View File

@ -285,12 +285,16 @@ class Index extends Component {
if(value.indexOf("/") > -1){
let arr = value.split("/");
let first = arr[arr.length-1];
if(first.indexOf(".git") > -1){
if(first.indexOf(".") > -1){
let second = first.split('.')[0];
if(!second)return;
this.props.form.setFieldsValue({
repository_name:second
})
}else{
this.props.form.setFieldsValue({
repository_name:first
})
}
}
}
@ -351,7 +355,7 @@ class Index extends Component {
required: true, message: '请填写镜像版本库地址'
}],
})(
<Input placeholder="请输入需要导入到本项目的仓库地址" onChange={this.ChangeAddr} />
<Input placeholder="请输入需要导入到本项目的仓库地址" onBlur={this.ChangeAddr} />
)}
</Form.Item>
<p className="formTip color-orange">示例https://github.com/facebook/reack.git</p>

View File

@ -65,16 +65,18 @@ class Index extends Component {
<FileLanguage language={language} select_language={this.select_language}></FileLanguage>
</div>
</div>
<Meditor
{...this.props}
{...this.state}
filepath={`${file_path}`}
language = {language}
content={undefined}
readOnly={false}
editorType="new"
descName={filename && `Add ${filename}`}
></Meditor>
<div className="editorBorder">
<Meditor
{...this.props}
{...this.state}
filepath={`${file_path}`}
language = {language}
content={undefined}
readOnly={false}
editorType="new"
descName={filename && `Add ${filename}`}
></Meditor>
</div>
</div>
</div>
</React.Fragment>

View File

@ -83,8 +83,8 @@ class UserSubmitComponent extends Component {
if (result.data && result.data.name) {
this.props.showNotification("文件新建成功!");
if(submitType === "1"){
const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname);
const { getDetail } = this.props;
getDetail && getDetail();
}
let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;
this.props.history.push(url);
@ -147,6 +147,7 @@ class UserSubmitComponent extends Component {
const { current_user, filepath, projectDetail , currentBranch } = this.props;
const { editor_type } = this.props;
let b = currentBranch || branch;
return (
<div>
<span className="df" style={{ alignItems: "center" }}>

View File

@ -8,7 +8,13 @@
border: 1px solid #d9d9d9!important;
border-right: none!important;
}
.editorBorder .editorBorderBox{
border:1px solid #eee;
border-radius: 2px;
}
.editorBorder .editorBorderSubmitBox{
padding:20px 0px!important;
}
.userScrew{
margin:20px 0px;
border:1px solid #f4f4f4;
@ -39,7 +45,7 @@
z-index: 1;
}
.ant-input-group .ant-input:focus{
border-right: 1px solid #d9d9d9!important;
border-right: 1px solid rgba(70, 106, 255, 1)!important;
}
.ant-btn-primary.grey{
border:1px solid #BBBBBB;

View File

@ -1,5 +1,7 @@
import React, { Component } from "react";
import Editor from "react-monaco-editor";
// import {UnControlled as CodeMirror} from 'react-codemirror2'
import UserSubmitComponent from "./UserSubmitComponent";
import "./index.css";
@ -10,6 +12,7 @@ class m_editor extends Component {
super(props);
this.state = {
editorValue: this.props.content,
prevHeight:0
};
}
componentDidUpdate=(prevProps)=>{
@ -41,42 +44,92 @@ class m_editor extends Component {
folding: true,
foldingStrategy: "indentation", // 代码可分小段折叠
automaticLayout: true, // 自适应布局
// overviewRulerBorder: false, // 不要滚动条的边框
// scrollBeyondLastLine: false, // 取消代码后面一大段空白
overviewRulerBorder: false, // 不要滚动条的边框
scrollBeyondLastLine: false, // 取消代码后面一大段空白
minimap: {
// 不要小地图
enabled: false,
},
};
const handleEditorMount = (editor, monaco) => {
editor.onDidChangeModelDecorations(() => {
requestAnimationFrame(updateEditorHeight); // folding
});
const updateEditorHeight = () => {
const editorElement = editor.getDomNode();
if (!editorElement) {
return;
}
const padding = 40;
const lineHeight = editor.getOption(
monaco.editor.EditorOption.lineHeight
);
const lineCount = editor.getModel().getLineCount() || 1;
let height =
editor.getTopForLineNumber(lineCount + 1) +
lineHeight +
padding ;
if(height<400){height = 400;}
if (this.state.prevHeight !== height) {
this.setState({
prevHeight:height
})
// setPrevHeight(height);
editorElement.style.height = `${height}px`;
editor.layout();
}
};
updateEditorHeight(); // typing
};
return (
<React.Fragment>
<div>
<div className="branchTable" style={{border:"1px solid #eee"}}>
<Editor
height="400px"
language={language ? language : "plaintext"}
theme={"vs-grey"}
placeholder="请输入内容"
value={editorValue}
options={editor_options}
onChange={this.changeEditor}
editorWillMount={this.editorWillMount}
/>
</div>
{!readOnly && (
<div style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}
filepath={`${this.props.filepath}`}
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}
></UserSubmitComponent>
</div>
)}
</div>
<div className="editorBorderBox">
<Editor
language={language ? language : "plaintext"}
theme={"vs-grey"}
placeholder="请输入内容"
value={editorValue}
options={editor_options}
onChange={this.changeEditor}
editorWillMount={this.editorWillMount}
editorDidMount={handleEditorMount}
/>
{/* <CodeMirror
value={editorValue}
options={{
theme: 'monokai',
mode: 'JavaScript',
extraKeys: {"Ctrl": "autocomplete"},//ctrl可以弹出提示
styleActiveLine: true,
lineNumbers: true,
readOnly:true
}}
/> */}
</div>
{!readOnly && (
<div className="editorBorderSubmitBox" style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}
filepath={`${this.props.filepath}`}
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}
></UserSubmitComponent>
</div>
)}
</React.Fragment>
);
}

View File

@ -1,7 +1,7 @@
import React , { Component } from 'react';
import nodata from './Images/nodata.png';
import './css/index.scss';
class Nodata extends Component{
render(){
const { _html , small } = this.props;

View File

@ -10,10 +10,6 @@ const Apply = Loadable({
loader: () => import("./Apply"),
loading: Loading,
});
const Notify = Loadable({
loader: () => import("./Notify"),
loading: Loading,
});
const UndoEvent = Loadable({
loader: () => import("./UndoEvent"),
loading: Loading,
@ -23,7 +19,7 @@ function Index(props){
const pathname = props.history.location.pathname;
const user = props.user;
const [ menu , setMenu ] = useState("notify");
const [ menu , setMenu ] = useState("undo");
const [ messagesCount , setMessagesCount ] = useState(0);
const [ transferCount , setTransferCount ] = useState(0);
const [ applyCount , setApplyCount ] = useState(0);
@ -48,10 +44,6 @@ function Index(props){
useEffect(()=>{
if(pathname && username){
if(pathname === `/${username}/notice`){
setMenu("notify");
changeNum(user.undo_messages);
}
if(pathname === `/${username}/notice/undo`){
setMenu("undo");
}
if(pathname === `/${username}/notice/apply`){
@ -83,14 +75,8 @@ function Index(props){
return (
<div>
<ul className="noticeMenu">
<li className={menu === "notify" ? "active":""}>
<Link to={`/${username}/notice`} onClick={changeNum}>
<span>通知</span>
{messagesCount ? <span className="unNum">{messagesCount}</span>:""}
</Link>
</li>
<li className={menu === "undo" ? "active":""}>
<Link to={`/${username}/notice/undo`}>
<Link to={`/${username}/notice`}>
<span>接收仓库</span>
{transferCount ? <span className="unNum">{transferCount}</span>:""}
</Link>
@ -109,16 +95,10 @@ function Index(props){
return <Apply {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/:username/notice/undo"
render={(p) => {
return <UndoEvent {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
<Route
path="/:username/notice"
render={(p) => {
return <Notify {...props} {...p} deleteEvent={deleteEvent}/>;
return <UndoEvent {...props} {...p} deleteEvent={deleteEvent}/>;
}}
></Route>
</Switch>

View File

@ -1,11 +1,13 @@
import React, { Component } from "react";
import React from "react";
import OrderItem from './order_form'
class CopyDetail extends Component {
render() {
return (
<OrderItem form_type="copy" {...this.props}></OrderItem>
)
}
function CopyDetail(props){
const operate = props.match.params.operate;
console.log(operate);
return(
<OrderItem form_type="copy" {...props}></OrderItem>
)
}
export default CopyDetail;
export default CopyDetail;

View File

@ -123,22 +123,25 @@ class Detail extends Component {
//复制
copydetail = () => {
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}/copy.json`;
axios
.post(url, {
project_id: projectsId,
id: orderId,
})
.then((result) => {
if (result) {
this.props.history.push(
`/${owner}/${projectsId}/issues/${result.data.issue_id}/copyetail`
);
}
})
.catch((error) => {
console.log(error);
});
// const url = `/${owner}/${projectsId}/issues/${orderId}/copy.json`;
// axios
// .post(url, {
// project_id: projectsId,
// id: orderId,
// })
// .then((result) => {
// if (result) {
// this.props.history.push(
// `/${owner}/${projectsId}/issues/${result.data.issue_id}/copyetail`
// );
// }
// })
// .catch((error) => {
// console.log(error);
// });
this.props.history.push(
`/${owner}/${projectsId}/issues/${orderId}/copyetail`
);
};
// 翻页
@ -230,7 +233,7 @@ class Detail extends Component {
: "合并请求"}
</span>
<span className="font-16 fwb">{data && data.subject}</span>
<span className="font-16 fwb" style={{wordBreak:"break-all"}}>{data && data.subject}</span>
</span>
{data && data.priority && (

View File

@ -1,11 +1,11 @@
import React, { Component } from "react";
import React from "react";
import OrderForm from './order_form'
class UpdateDetail extends Component {
render() {
return (
<OrderForm form_type="edit" {...this.props}></OrderForm>
)
}
function CopyDetail(props){
const operateName = props.match.params.operateName;
return(
<OrderForm form_type={operateName === "copyetail" ? "copy":"edit"} {...props}></OrderForm>
)
}
export default UpdateDetail;
export default CopyDetail;

View File

@ -153,7 +153,7 @@ class order_form extends Component {
values.issue_tag_ids = [values.issue_tag_ids];
}
const { description, start_date, due_date, issue_type } = this.state;
if (form_type === "new") {
if (form_type !== "edit") {
const url = `/${owner}/${projectsId}/issues.json`;
axios.post(url, {
...values,
@ -178,7 +178,6 @@ class order_form extends Component {
this.setState({
isSpin: false,
});
console.log(error);
});
} else {
const url = `/${owner}/${projectsId}/issues/${orderId}.json`;
@ -321,7 +320,7 @@ class order_form extends Component {
message: "请填写易修标题",
},
]
})(<Input placeholder="标题" size="large" maxLength={80}/>)}
})(<Input placeholder="标题" size="large" maxLength={200}/>)}
</Form.Item>
<div className="quillContent">
<MDEditor

View File

@ -14,6 +14,16 @@ import { Link } from 'react-router-dom';
import './Index.scss';
const MyNoticeIndex = Loadable({
loader: () => import("./notice/myNotice/Index"),
loading: Loading,
});
const NoticeManager = Loadable({
loader: () => import("./notice/manager/Index"),
loading: Loading,
});
const SSHNew = Loadable({
loader: () => import("./sub/New"),
loading: Loading,
@ -26,9 +36,16 @@ const SSHIndex = Loadable({
loader: () => import("./sub/SSH"),
loading: Loading,
});
const PrivateLetter = Loadable({
loader: () => import("./notice/privateLetter/Index"),
loading: Loading,
});
function Index(props){
const { current_user } = props;
const { current_user,mygetHelmetapi } = props;
const { pathname } = props.location;
const notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice;
return(
<div className="newMain clearfix whiteBack">
@ -39,18 +56,41 @@ function Index(props){
<img src={getImageUrl(`/${current_user && current_user.image_url}`)} alt=""/>
<span>{current_user && current_user.username}</span>
</div>
<ul className="securityUl">
<ul className="securityUl ul-border-buttom">
<li>个人信息</li>
<li className={pathname.indexOf("/settings/profile")>-1 ?"active":""}><Link to={`/settings/profile`}><i className="iconfont icon-gerenziliao mr5 font-14"></i>基本资料</Link></li>
<li className={pathname.indexOf("/settings/profile")>-1 ?"active":""}><Link to={`/settings/profile`}><i className="iconfont icon-gerenziliao mr5 font-14"></i><span className="text-shodow-bold">基本资料</span></Link></li>
</ul>
{notice_url && <ul className="securityUl ul-border-buttom">
<li>消息通知</li>
<li className={(pathname.indexOf("/settings/notice")>-1 && pathname.indexOf("/settings/notice/config") == -1) || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}><Link to={"/settings/notice"}><i className="iconfont icon-wodetongzhi"></i><span className="text-shodow-bold">我的通知</span></Link></li>
<li className={pathname.indexOf("/settings/notice/config")>-1 ?"active":""}><Link to={'/settings/notice/config'}><i className="iconfont icon-tongzhiguanli"></i><span className="text-shodow-bold">通知管理</span></Link></li>
</ul>}
<ul className="securityUl">
<li>安全设置</li>
<li className={pathname.indexOf("/settings/SSH")>-1 ?"active":""}><Link to={`/settings/SSH`}><i className="iconfont icon-xuanzhongssh_icon mr5 font-14"></i>SSH密钥</Link></li>
<li className={pathname.indexOf("/settings/SSH")>-1 ?"active":""}><Link to={`/settings/SSH`}><i className="iconfont icon-xuanzhongssh_icon mr5 font-14"></i><span className="text-shodow-bold">SSH密钥</span></Link></li>
</ul>
</div>
<LongWidth>
<Gap>
<Switch>
<Route
path="/settings/notice/config"
render={(p) => (
<NoticeManager {...props} {...p}/>
)}
></Route>
<Route
path="/settings/notice/privateLetter"
render={(p)=>(
<PrivateLetter{...props} {...p}/>
)}
></Route>
<Route
path="/settings/notice"
render={(p) => (
<MyNoticeIndex {...props} {...p}/>
)}
></Route>
<Route
path="/settings/SSH/new"
render={(p) => (
@ -74,7 +114,6 @@ function Index(props){
</LongWidth>
</Box>
</div>
</div>
)
}

View File

@ -8,42 +8,44 @@
width: 198px;
border: 1px solid rgba(153, 153, 153, 0.22);
border-radius: 4px;
min-height: 400px;
// min-height: 400px;
margin-bottom: 30px;
.userDetail{
background: rgba(153, 153, 153, 0.05);
border-radius: 4px 4px 0px 0px;
padding:20px 25px;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: center;
height: 105px;
img{
height: 48px;
width: 48px;
border-radius: 50%;
margin-right: 12px;
}
span{
font-size: 16px;
color: #333;
max-width: 90px;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-weight: 500;
}
}
.securityUl{
padding:20px 16px;
padding-left: 17px;
color: #333;
margin-bottom: 0px;
padding-bottom: 0px;
padding-bottom: 12px;
padding-top: 5px;
li{
font-size: 14px;
margin-top: 10px;
margin-bottom: 10px;
height: 27px;
line-height: 27px;
position: relative;
cursor: pointer;
cursor: default;
a{
color: #666;
&:hover{
@ -52,32 +54,57 @@
}
&.active a{
color: #333;
}
&:first-child{
font-size: 16px;
.text-shodow-bold{
font-weight: 400;
text-shadow: 0.5px 0 #333;
}
}
&.active::before{
position: absolute;
left: -16px;
top:0px;
height: 100%;
width: 2px;
left: -18px;
top:6px;
height: 15px;
width: 3px;
border-radius: 2px;
content: "";
background-color: #2A61FF;
background-color: #466AFF;
}
i{
font-size: 14px !important;
margin-right: 8px;
}
}
}
.ul-border-buttom{
border-bottom: 1px solid rgba(153, 153, 153, 0.22);
padding-bottom: 5px;
}
}
.sshHead{
display: flex;
align-items: center;
padding:15px 20px;
padding:6px 0px;
margin-bottom: 15px;
justify-content: space-between;
border-bottom: 1px solid #EEEEEE;
&>span{
&>.text-shadow07{
font-size: 18px;
font-weight: 400;
color: #333333;
text-shadow: 0.5px 0 #333;
}
&>.add-SSH-title{
font-size: 16px;
font-weight: 400;
color: #333333;
text-shadow: 0.5px 0 #333;
}
& .but25{
padding:0 12px;
}
}
.ant-list-item{
padding:20px;
border-bottom: 1px solid #eee!important;
@ -109,7 +136,7 @@
.questionLink{
padding:15px 20px;
a{
color: #4B7AFF;
color: #466AFF;
&:hover{
text-decoration: underline;
}
@ -147,4 +174,23 @@
flex:1;
}
}
}
.but25{
margin-bottom: 5px;
background-color: #466AFF;
color: #fff;
border-color: #466AFF;
&:hover{
opacity: 0.8;
background-color: #466AFF;
border-color: #466AFF;
}
&:active{
opacity: 1;
background-color: #466AFF;
border-color: #466AFF;
}
}
.blue-Purple{
color: #466AFF !important;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,46 @@
import fetch from './fetch';
// 获取消息列表
export function noticePages(params) {
return fetch({
url: '/api/notice/noticePages',
method: 'get',
params
});
}
// 获取单个notice
export function getNotice(params) {
return fetch({
url: '/api/notice/getNotice',
method: 'get',
params
});
}
//新增notice
export function addNotice(data) {
return fetch({
url: '/api/notice/createNotice',
method: 'post',
data: data
});
}
//更新notice
export function updateNotice(data) {
return fetch({
url: '/api/notice/updateNotice',
method: 'PUT',
data: data
});
}
//删除notice
export function deleteNotice(data) {
return fetch({
url: '/api/notice/deleteNotice',
method: 'DELETE',
data,
});
}

View File

@ -0,0 +1,10 @@
import javaFetch from '../../javaFetch';
const developUrl = "https://test-search.trustie.net";
const testUrl = "https://test-search.trustie.net";
const productUrl = "https://wiki-api.trustie.net";
const { service, actionUrl } = javaFetch(productUrl, testUrl, developUrl);
export const httpUrl = actionUrl;
export default service;

View File

@ -0,0 +1,79 @@
import { Checkbox } from "antd";
import React, { useEffect, useState } from "react";
import axios from 'axios';
import './Index.scss';
function NoticeManager(props){
const {current_user} = props;
const [settingTypes, setSettingTypes] = useState();
const [userNotification, setUserNotification] = useState();
const [userEmail, setUserEmail] = useState();
function onChange(type,e,setting){
let notification_body = userNotification;
let email_body = userEmail;
if(type){//
notification_body[setting] = e.target.checked;
}else{//
email_body[setting] = e.target.checked;
}
axios.post(`/users/${current_user.login}/template_message_settings/update_setting.json`,{
setting:{
notification_body:notification_body,
email_body:email_body
}
}).then(response=>{
if(response && response.status === 0){
getUserSettings();
}
})
}
function getUserSettings(){
axios.get(`/users/${current_user.login}/template_message_settings.json`).then((response)=>{
if(response && response.status === 200 ){
setUserEmail(response.data.email_body);
setUserNotification(response.data.notification_body);
}
})
}
useEffect(()=>{
axios.get("/template_message_settings.json").then(response => {
if (response && response.status === 200) {
setSettingTypes(response.data.setting_types);
}
})
getUserSettings();
},[])
return(
<div className="notice01">
<div className="sshHead">
<span className="text-shadow07">通知管理</span>
</div>
<div>
<span className="notice-manager-tip">您可以通过通知管理来选择接受通知的方式</span>
{settingTypes && userNotification && userEmail && settingTypes.map((item,key)=>{
return(
item.type_name && <div key={key}>
<div className="manager-cont-top">{item.type_name}</div>
{item.settings.map((i, k) => {
const setting = item.type.substring(item.type.indexOf("::")+2)+"::"+i.key;
return (
<div className="manager-cont" key={k}>
<div className="manager-cont-title">{i.name}</div>
<Checkbox disabled = {i.notification_disabled} defaultChecked={userNotification[setting]} onChange={(e)=>{onChange(true,e,setting)}}>站内信</Checkbox>
<Checkbox disabled = {i.email_disabled} defaultChecked={userEmail[setting]} onChange={(e)=>{onChange(false,e,setting)}}>邮件</Checkbox>
</div>
)
})}
</div>
)
})}
</div>
</div>
)
}
export default NoticeManager;

View File

@ -0,0 +1,87 @@
.notice-manager-tip{
font-size:16px;
font-weight:400;
}
.manager-cont-top{
font-size: 14px;
font-weight: 600;
height: 44px;
padding-left: 20px;
background: #FAFCFF;
border: 1px solid #89a4f7;
line-height: 44px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
margin-top: 25px;
}
.manager-cont{
padding: 8px 20px 6px;
display: flex;
align-items: center;
font-size: 14px;
.manager-cont-title{
width: 320px;
}
}
.notice01{
.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
border-color: white;
}
.ant-checkbox-disabled .ant-checkbox-inner {
background-color: #999999 !important;
border-color: #999999 !important;
}
.ant-checkbox-checked .ant-checkbox-inner {
background-color: #466AFF;
border: #466AFF;
}
.ant-checkbox-checked::after{
border: 1px solid #466AFF;
}
.ant-checkbox-wrapper:hover .ant-checkbox-inner, .ant-checkbox:hover .ant-checkbox-inner, .ant-checkbox-input:focus + .ant-checkbox-inner,.ant-radio-checked .ant-radio-inner,.ant-radio-wrapper:hover .ant-radio, .ant-radio:hover .ant-radio-inner, .ant-radio-input:focus + .ant-radio-inner {
border-color: #466AFF;
}
.ant-checkbox + span,.manager-cont-title {
color: #000000;
}
.ant-radio-inner::after{
background-color:#466AFF;
}
.but25{
background-color: #466AFF;
color: #fff;
border-color: #466AFF;
&:hover{
opacity: 0.8;
background-color: #466AFF;
border-color: #466AFF;
}
&:active{
opacity: 1;
background-color: #466AFF;
border-color: #466AFF;
}
}
::-webkit-scrollbar {
width: 5px; /*对垂直流动条有效*/
}
/*定义滑块颜色、内阴影及圆角*/
::-webkit-scrollbar-thumb {
border-radius: 6px;
box-shadow: inset 0 0 6px #FFF;
background-color: #D4D4D4;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px #fff;
background-color: #FFF;
}
}

View File

@ -0,0 +1,274 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { Badge, Button, Checkbox, Menu, Pagination } from 'antd';
import DelModal from '../../../Component/ModalFun';
import NoneData from '../../../Nodata.js';
import { noticeSourceType } from '../../../common/static';
import './Index.scss';
import '../manager/Index.scss'
function MyNotice(props) {
let { current_user, resetUserInfo, location, mygetHelmetapi, history}= props;
//tab
let popover = location && location.query && location.query.noticeType;
let pageSize = 15;
const [noticeType, setNoticeType] = useState(popover==="atme"?"2":"0");//tab
const [selectedNum, setSelectedNum] = useState(0);//@
const [isBatchDelete, setIsBatchDelete] = useState(false);//@
const [batchDeleteCheckedAll, setBatchDeleteCheckAll] = useState(false);//@--
const [noticeUnreadCount, setNoticeUnreadCount] = useState();//
// const [letterUnreadCount, setLetterUnreadCount] = useState(0);//
const [atUnreadCount, setAtUnreadCount] = useState();//@
const [messageList, setMessageList] = useState([]);
const [messTotalCount, setMessTotalCount] = useState();//
const [currentPage, setCurrentPage] = useState(1);//
const [onlyUnread, setOnlyUnread] = useState();
//访/settings/profile
//访/explore
useEffect(()=>{
let notice = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice;
let login = current_user && current_user.login;
if(!login){
history.push(`/explore`);
}else if(!notice){
history.push(`/settings/profile`);
}
},[mygetHelmetapi])
useEffect(()=>{
popover==="atme" ? setNoticeType("2"):setNoticeType("0");
},[popover])
useEffect(()=>{
resetUserInfo();
},[noticeUnreadCount,atUnreadCount])
useEffect(() => {
getMessageList();
}, [noticeType, onlyUnread, currentPage, current_user])
function getMessageList() {
const params = {
type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "",
status: onlyUnread ? onlyUnread : "",
limit: pageSize,
page: currentPage,
};
current_user && axios.get(`/users/${current_user.login}/messages.json`, {
params: params,
}).then((response) => {
if(response && response.data){
setNoticeUnreadCount(response.data.unread_notification);
setAtUnreadCount(response.data.unread_atme);
setMessageList(response.data.messages);
setMessTotalCount(response.data.total_count);
}
});
}
function readNotice(id){
if(id && current_user){
const params = {
type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "",
ids:id,
};
axios.post(`/users/${current_user.login}/messages/read.json`,params).then((response)=>{
if(response.status === 200){
getMessageList();
//
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
}
});
}
}
function handleClick(e) {
setNoticeType(e.key);
setCurrentPage(1);
setOnlyUnread();
if (e.key != "2") {
setIsBatchDelete(false);
}
}
function onChange(e) {
var checkboxNum = 0;
let messageListNew=messageList.slice();
messageListNew.map((item)=>{
if(item.id===e.target.value){
item.checkedBatch = e.target.checked;
}
item.checkedBatch?checkboxNum++:"";
});
setMessageList(messageListNew);
setSelectedNum(checkboxNum);
setBatchDeleteCheckAll(checkboxNum === messageList.length);
}
function onChangeAll(e) {
setBatchDeleteCheckAll(e.target.checked);
setSelectedNum(e.target.checked?messageList.length:0);
let messageListNew=messageList.slice();
messageListNew.map((item)=>{
item.checkedBatch = e.target.checked;
});
setMessageList(messageListNew);
}
function deleteNotice(id) {
const ids = [];
if(!id){
messageList.map(item=>{
item.checkedBatch && ids.push(item.id);
});
}
DelModal({
title: noticeType === "1" ? '删除私信用户' : id ? '删除消息' : '批量删除',
contentTitle: noticeType === "1" ? '您确定要删除与 xxx 的聊天吗?' : id ? '您确定要删除这条@我消息吗?' : '您确定要删除选中的' + selectedNum + '条消息吗?',
content: noticeType === "1" ? '此操作将删除与xxx的聊天框和xxx的所有聊天记录请进行确认以防数据的丢失' : id ? '此操作将删除这条消息,请进行确认以防数据的丢失' : '此操作将删除选中的' + selectedNum + '条消息,请进行确认以防数据的丢失',
onOk: () => {
const params = {
type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "",
ids:id?id:ids,
};
axios.delete(`/users/${current_user.login}/messages.json`,{
data:params,
}).then((response)=>{
if(response.status === 200){
getMessageList();
//
let totlaPage = Math.ceil((messTotalCount-1)/pageSize);
setCurrentPage(currentPage>=totlaPage? totlaPage : currentPage);
setSelectedNum(0);
setBatchDeleteCheckAll(false);
}
});
}
});
}
function cancelBatchDelete(){
setIsBatchDelete(false);
setSelectedNum(0);
//
let messageListNew=messageList.slice();
messageListNew.map((item)=>{
item.checkedBatch = false;
});
setMessageList(messageListNew);
setBatchDeleteCheckAll(false);
}
//
function turnToMess(item){
if(item.notification_url){
window.open(`${item.notification_url}`);
readNotice([item.id]);
}
}
return (
<div className="notice01">
<div className="sshHead">
<Menu mode="horizontal" selectedKeys={noticeType} onClick={handleClick}>
<Menu.Item key="0"><Badge count={noticeUnreadCount} title="">系统通知</Badge></Menu.Item>
{/* <Menu.Item key="1" id="item-private"><Badge count={0}>私信</Badge></Menu.Item> */}
<Menu.Item key="2"><Badge count={atUnreadCount}>@</Badge></Menu.Item>
</Menu>
{(noticeType==="0" && noticeUnreadCount>0) || (noticeType==="2"&& atUnreadCount>0) ? <button className="but25" onClick={()=>{readNotice([-1])}}>所有{noticeType === "0" ? "系统通知" : noticeType === "1" ? "私信" : "@我"}一键已读</button>:""}
</div>
<div className={isBatchDelete ? "invisible " : "visible"}>
<div className="vertical-center-style">
{onlyUnread===1 || messageList && messageList.length>0 ? <Checkbox checked={onlyUnread} onChange={(e) => e.target.checked ? setOnlyUnread(1) : setOnlyUnread()}>仅看未读{noticeType === "1" ? `私信12` : noticeType === "0" ? `消息(${noticeUnreadCount}` : `消息(${atUnreadCount}`}</Checkbox>:""}
</div>
{noticeType === "2" && messageList && messageList.length > 0 ? <button className="batchDeleteBut" onClick={() => { setIsBatchDelete(true); }}>批量删除</button> : ""}
</div>
{messageList && messageList.length===0 ? <NoneData _html="暂无相关消息"/>:""}
{messageList && messageList.length>0 && <div className={isBatchDelete ? 'visible' : 'invisible'}>
<div className="vertical-center-style">
<Checkbox onChange={onChangeAll} checked={batchDeleteCheckedAll}>全选</Checkbox>
&nbsp;&nbsp;&nbsp;已选择&nbsp;<span className="numberSpan">{selectedNum}</span>&nbsp;
</div>
<div>
<button onClick={cancelBatchDelete}>取消</button>&nbsp;&nbsp;&nbsp;&nbsp;
<button className="deleteBut" onClick={selectedNum > 0 ? ()=>deleteNotice() : () => { }}>删除</button>
</div>
</div>}
{messageList && messageList.map(item => {
//
if (noticeType === "0") {
//
return (
<div className="mynotice-content vertical-center-style" key={item.id}>
<div className="mynotice-cont stretch-style">
{item.status === 1 ? <Badge color="#FA2020" /> : <span className="system-notice-blank"></span>}
<i className={"iconfont "+noticeSourceType[item.source]}></i>
<span className={`sysNotice-length ${item.notification_url?'highlightSpan':''}`} onClick={() => {turnToMess(item)}} dangerouslySetInnerHTML={{__html: item.content}}></span>
</div>
<div className="mynotice-cont vertical-center-style float-left-little">
<span className={item.status === 1?"timeSpan":""}>{item.time_ago}</span>
{item.status === 1 && <span className="invisable-read" onClick={()=>readNotice([item.id])}>标记为已读</span>}
</div>
</div>
)
} else if (noticeType === "2") {
//@
return (
<div className={`mynotice-content vertical-center-style ${isBatchDelete?'batchDel':''}`} key={item.id}>
<div className="mynotice-cont vertical-center-style">
<Checkbox value={item.id} className={isBatchDelete ? 'visible-checkbox' : 'invisible-checkbox'} onChange={onChange} checked={item.checkedBatch}></Checkbox>
{item.sender && <img src={`https://testforgeplus.trustie.net//${item.sender.image_url}`} className="currentImg" onClick={()=>{window.open(`/${item.sender && item.sender.login}`);}}/>}
<div className={`atme-notice-text stretch-style ${item.notification_url && 'highlightSpan'}`} onClick={() => {turnToMess(item)}}>
{item.status === 1 ? <Badge color="#FA2020"/> : <span className="system-notice-blank"></span>}
{item.sender && <span className="atme-length" dangerouslySetInnerHTML={{__html: "<b class = 'atme-notice-name'>" + item.sender.name+ "</b> "+ item.content +" 中@我"}}></span>}
</div>
</div>
<div className="mynotice-cont vertical-center-style">
<span className={!isBatchDelete && item.status === 1?"timeSpan":""}>{item.time_ago}</span>
{!isBatchDelete && item.status === 1 && <span className="invisable-read" onClick={()=>readNotice([item.id])}>标记为已读</span>}&nbsp;&nbsp;&nbsp;
{!isBatchDelete && <span className="invisable-read float-left-little" onClick={()=>deleteNotice([item.id])}>删除</span>}
</div>
</div>
)
} else{
//
{/* <div className="mynotice-content vertical-center-style">
<Badge count={95}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img" /></Badge>
<div className="private-letter-right">
<div>
<span>蒋宇航</span>
<span className="timeSpan">4分钟前</span>
<a onClick={deleteNotice}>删除</a>
</div>
<div onClick={() => props.history.push('/settings/notice/privateLetter')}>
<span className="highlightSpan letter-length-limit">最好的OpenStack控制台对标OpenStack社区Horizon项目,最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
</div>
</div>
</div> */}
}
})}
{/* 分页 */}
{!isBatchDelete && <div className="paging">
<Pagination
simple
current = {currentPage}
pageSize={pageSize}
onChange={(page)=>{setCurrentPage(page)}}
total = {messTotalCount}
hideOnSinglePage
></Pagination>
</div>}
</div>
)
}
export default MyNotice;

View File

@ -0,0 +1,259 @@
.whiteBack .boies .sshHead{
padding:0 10px 0px 0px;
}
.sshHead{
.ant-badge{
font-size: 16px;
color: #333333;
}
.ant-menu-item{
padding:0px;
margin-right:34px!important;
height: 34px;
width: 64px;
text-align: center;
line-height: 0px;
position: relative;
}
li.ant-menu-item, .ant-menu-horizontal > .ant-menu-item {
border-bottom: 0px;
}
& .ant-menu-item-selected{
color: #333333;
font-weight: 400;
text-shadow: 0.5px 0 #333;
border-bottom: 2px solid #2A61FF !important;
}
.ant-badge-count, .ant-badge-dot, .ant-badge .ant-scroll-number-custom-component {
right: -6px;
-webkit-box-shadow: 0 0 0 0;
box-shadow: 0 0 0 0;
}
.ant-badge-multiple-words {
padding: 0 0px;
}
.ant-menu-horizontal {
border-bottom: 0px solid #e8e8e8;
}
button{
padding:0 5px;
}
}
button {
color: #333333;
background: #FAFBFC;
border: 1px solid #D0D0D0;
border-radius: 4px;
height: 32px;
}
button:hover {
background: #F3F4F6;
}
button:active {
background: #EBECF0;
}
.deleteBut{
color: #DF0002;
}
.deleteBut:hover{
background: #DF0002;
border: 1px solid #DF0002;
color:#FFFFFF;
}
.deleteBut:active{
background: #CE0002;
border: 1px solid #CE0002;
color:#FFFFFF;
}
.mynotice-content {
justify-content: space-between;
padding: 15px 0 15px 10px;
border-bottom: 1px solid #EEEEEE;
color: #333333;
&:hover{
background: #F3F4F6;
}
& img{
cursor: pointer;
}
& b{
font-weight: 400;
text-shadow: 0.5px 0 #333;
}
& .invisable-read{
display: none;
}
&:hover .invisable-read{
display: block;
color: #466AFF;
opacity: 0.6;
cursor: pointer;
&:hover{
opacity: 1;
}
}
&:hover .timeSpan{
display: none;
}
i{
font-size: 16px !important;
margin-right: 5px;
}
.boldSpan{
font-weight: 400;
text-shadow: 0.5px 0 0 #333;
margin: 0 8px;
}
& .currentImg{
width: 40px;
height: 40px;
margin-left: 0px;
}
& .private-letter-img + .ant-badge-count{
top: 2px;
right: 5px;
height: 18px;
min-width: 18px;
line-height: 18px;
padding: 0 0;
}
& .highlightSpan:hover{
color: #466AFF;
cursor: pointer;
}
.mynotice-cont{
padding:0;
cursor: default;
& .visible-checkbox{
margin-right: 10px;
}
& .invisible-checkbox{
display: none;
}
.atme-notice-text{
margin-left: 6px;
& .atme-notice-name{
margin: 0 0 ;
}
& .atme-length{
max-width: 48rem;
word-break: break-all;
}
}
}
& .ant-badge-count, .ant-badge-dot, .ant-badge .ant-scroll-number-custom-component {
-webkit-box-shadow: 0 0 0 0;
box-shadow: 0 0 0 0;
top: 3px;
right: 4px;
min-width: 8px;
height: 8px;
}
& .system-notice-blank{
margin-right: 14px;
}
}
.batchDel{
& .currentImg, & .atme-notice-text{
pointer-events: none;
}
}
.baselineDiv{
align-items: baseline;
}
.invisible {
display: none;
}
.visible {
display: flex;
justify-content: space-between;
height: 30px;
padding: 0 10px;
color: #333333;
margin-bottom: 5px;
button{
padding:0px 12px;
}
.batchDeleteBut{
border:1px solid #466AFF;
color: #466AFF;
}
}
.private-letter-right {
flex: auto;
margin: 0px 10px 0 16px;
& div{
display: flex;
justify-content: space-between;
}
}
.letter-length-limit{
max-width: 50rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.sysNotice-length{
max-width: 52rem;
word-break: break-all;
}
.numberSpan{
color: #466AFF;
}
.vertical-center-style{
display: flex;
align-items: center;
}
.stretch-style{
display: flex;
align-items: baseline;
}
.float-left-little{
margin-right: 10px;
}
.float-right-little{
margin-left: 12px;
}
.paging{
text-align: center;
margin: 12px;
}

View File

@ -0,0 +1,200 @@
import React, { useState, useEffect } from 'react';
import './Index.scss'
import '../manager/Index.scss'
import { Button, Input, Icon, Badge } from 'antd';
import { Link } from 'react-router-dom';
function PrivateLetter(props){
const { TextArea,Search } = Input;
function deleteNotice(){
alert("删除消息");
}
return(
<div className="private-letter notice01">
<div className="pl-content">
<div className="pl-name vertical-center-style">
<Link to="/settings/notice/myNotice"><i className="iconfont icon-zuojiantou"></i></Link>
<span>蒋宇航</span>
</div>
<div className="plcontent-list">
<div className="vertical-center-style plclo">
<img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg"/>
<div className="message-bubble mb-other"></div>
<div className="notice-content vertical-center-style">
嗨在吗哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
<a className="pld01">删除</a>
</div>
<span>2021-08-29 11:59</span>
</div>
<div className="notice-my vertical-center-style plclo">
<img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg"/>
<div className="message-bubble"></div>
<div className="notice-content vertical-center-style">
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
<a className="pld01">删除</a>
</div>
<span>2021-08-29 11:59</span>
</div>
</div>
<div className="private-letter-present">
<div>
<img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg"/>
<TextArea className="private-letter-cont" rows="2" />
</div>
<div className="presentNotice">
<Button className="private-letter-cont-mt25 but25" type="primary">发送</Button>
</div>
</div>
</div>
<div className="pl-list">
<div className="list-sort vertical-center-style">
<Search
className=""
placeholder="搜索用户"
enterButton={<i className="iconfont icon-sousuo"></i>}
onSearch={value => console.log(value)}
style={{ width: 265 }}
/>
</div>
<div className="list-scroll">
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
<div className="list-scroll-content vertical-center-style">
<Badge count={5}><img src="https://testforgeplus.trustie.net//system/lets/letter_avatars/2/D/208_124_118/120.png" className="currentImg private-letter-img"/></Badge>
<div className="private-letter-list-content-right">
<div className="ls-cont vertical-center-style">
<span>蒋宇航</span>
<span className="private-letter-list-content-right-content-top-timeSpan">4分钟前</span>
</div>
<div className="ls-cont vertical-center-style">
<span className="ls-content-span">最好的OpenStack控制台对标OpenStack社区Horizon项目在易用性页面性能等方面进行深度优化提供简单控制台</span>
<a onClick={deleteNotice}>删除</a>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
export default PrivateLetter;

View File

@ -0,0 +1,192 @@
.private-letter{
border-radius: 4px 4px 0px 0px;
border: 1px solid rgba(151, 151, 151, 0.24);
display: flex;
.currentImg{
width: 40px;
height: 40px;
margin-left: 0px;
}
& .private-letter-img + .ant-badge-count{
top: 2px;
right: 5px;
}
}
.pl-content{
flex: auto;
.pl-name{
height: 3rem;
border-bottom: 1px solid #EEEEEE;
&>a{
position: relative;
left: 26px;
color:#999999;
}
span{
font-size: 16px;
font-weight: 600;
color: #333333;
flex: auto;
text-align: center;
}
}
.plcontent-list{
height: 24rem;
padding:20px;
overflow-y: scroll;
.plclo{
margin-bottom: 30px;
}
.notice-my{
flex-direction: row-reverse;
& .pld01{
left: 0;
}
}
& .notice-content{
padding:8px 10px;
background: #F4F4F4;
border-radius:5px;
position: relative;
max-width: 20rem;
.pld01{
display: none;
}
&:hover .pld01{
display: block;
position: absolute;
right: 0;
bottom: -2em;
color: #999999;
font-size: 12px;
&:hover{
color: #666666;
}
}
}
& .message-bubble{
position:relative;
width:0;
height:0;
font-size:0;
border:solid 8px;
border-color:#FFFFFF #FFFFFF #FFFFFF #F4F4F4;
}
& .mb-other{
border-color:#FFFFFF #F4F4F4 #FFFFFF #FFFFFF;
}
& span{
margin: 0 10px;
font-size: 12px;
color: #999999;
line-height: 17px;
}
}
.private-letter-present{
padding:20px 20px;
& div{
display: flex;
align-items: center;
justify-content: flex-end;
flex: auto;
}
.private-letter-cont-mt25{
margin-top: 8px;
padding:0 22px;
}
.private-letter-cont, .private-letter-cont .ant-input-suffix{
background-color: #fafafa !important;
margin-left: 17px;
}
.private-letter-cont{
resize:none;
&:hover,&:focus{
background-color: #fafafa !important;
}
}
}
}
.pl-list{
width: 30%;
border-left: 1px solid #EEEEEE;
.list-sort{
justify-content: center;
height: 3rem;
border-bottom: 1px solid #EEEEEE;
& .ant-btn-primary{
width: 2.3rem;
color: #466AFF;
background: #eff2ff;
border: 1px solid rgba(151, 151, 151, 0.24);
}
& .ant-btn{
padding: 0;
}
// & .ant-input:hover{
// border: 1px solid red !important;
// }
}
.list-scroll{
height: 32.4rem;
overflow-y: scroll;
}
.list-scroll-content{
padding: 10px 10px 15px 15px;
border-bottom: 1px solid #EEEEEE;
// &:last-child{
// border-bottom: 0px;
// }
&:hover{
background: #F3F4F6;
}
& a{
display: none;
}
&:hover a{
display: block;
color: #466AFF;
}
}
.ls-cont{
width: 13rem;
// flex: auto;
margin-left: 15px;
justify-content: space-between;
& .ls-content-span{
max-width: 11rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.vertical-center-style{
display: flex;
align-items: center;
}
img{
width: 45x;
height: 45px;
}

View File

@ -34,7 +34,7 @@ function New({ form , showNotification , history }) {
return(
<div>
<div className="sshHead">
<span><Link to={`/settings/SSH`} className="color-blue">SSH密钥</Link><i className="iconfont icon-youjiantou ml5 mr5 font-12"></i>添加SSH密钥</span>
<span className="add-SSH-title"><Link to={`/settings/SSH`} className="blue-Purple">SSH密钥</Link><i className="iconfont icon-youjiantou ml5 mr5 font-12"></i>添加SSH密钥</span>
</div>
<Form className="sshForm">
<Form.Item label="标题" validateStatus={msg && msg.status === 10001 ? "error":undefined} help={msg && msg.status === 10001 ? msg.message:undefined}>
@ -51,7 +51,7 @@ function New({ form , showNotification , history }) {
<TextArea placeholder="支持以'ssh-rsa','ssh-dss','ssh-ed25519','ecdsa-sha2-nistp256','ecdsa-sha2-nistp384','ecdsa-sha2-nistp521'开头" autoSize={{ minRows: 6, maxRows: 6 }}/>
)}
</Form.Item>
<Button type="primary" style={{width:"100px"}} onClick={submit}>确定</Button>
<button style={{width:"100px"}} onClick={submit} className="but25">确定</button>
</Form>
</div>
)

View File

@ -55,8 +55,8 @@ function SSH(props) {
<DeleteBox visible={visible} onCancel={()=>setVisible(false)} onSuccess={onSuccess}/>
<SSHDetail visible={visibleDesc} onCancel={()=>setVisibleDesc(false)} desc={content}/>
<div className="sshHead">
<span>SSH密钥</span>
<Button type="primary" size="large" onClick={()=>props.history.push('/settings/SSH/new')}>添加SSH密钥</Button>
<span className="text-shadow07">SSH密钥</span>
<button type="primary" size="large" onClick={()=>props.history.push('/settings/SSH/new')} className="but25">添加SSH密钥</button>
</div>
{
list && list.length > 0 &&
@ -64,7 +64,7 @@ function SSH(props) {
{
list.map((i,k)=>{
return(
<List.Item>
<List.Item key={i.id}>
<img src={miyao} alt=""/>
<div>
<p className="color-grey-3"><a className="task-hide" style={{display:"block",fontWeight:"500"}} onClick={()=>{setContent(i);setVisibleDesc(true)}}>{i.name}</a></p>

Some files were not shown because too many files have changed in this diff Show More