diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d71bc9e2c..aba950566 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,10 +1,7 @@
-
-
-
-
+
@@ -14,10 +11,10 @@
-
+
-
-
+
+
@@ -26,10 +23,10 @@
-
+
-
-
+
+
@@ -38,27 +35,45 @@
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -67,13 +82,10 @@
-
-
+
+
-
-
-
@@ -82,8 +94,8 @@
-
-
+
+
@@ -94,8 +106,8 @@
-
-
+
+
@@ -103,17 +115,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
- nHeader
- 点赞
- fork
- .push(
- QuillForEditor
- setContents
- isedit
Educoder
title
textcount
@@ -131,18 +148,25 @@
请输入合并
journal-list-item
issue-tag-show
- 创建工单
创建
.map((item,key)=>{
.map((item,key)
评论成
该合并请求可以进行自动合并操作
+ 没有
+ 创建工单
+ 可读权限
+ sub_entries
+ 可读
+ icon-bianji
+ readOnly
+ isRe
$PROJECT_DIR$
$PROJECT_DIR$/src
- $PROJECT_DIR$/src/forge
$PROJECT_DIR$/src/forge/Merge
+ $PROJECT_DIR$/src/forge
@@ -169,15 +193,16 @@
-
-
+
+
+
@@ -214,14 +239,14 @@
-
+
-
+
@@ -275,17 +300,18 @@
-
+
-
+
+
-
+
@@ -297,8 +323,8 @@
-
-
+
+
@@ -319,6 +345,32 @@
+
+
+
@@ -453,15 +505,6 @@
-
-
-
-
-
-
-
-
-
@@ -524,13 +567,6 @@
-
-
-
-
-
-
-
@@ -541,31 +577,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -586,16 +602,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -612,16 +618,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -677,63 +673,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -743,7 +686,7 @@
-
+
@@ -753,5 +696,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js
index c8a85bca2..971126330 100644
--- a/src/forge/Main/CoderRootBranch.js
+++ b/src/forge/Main/CoderRootBranch.js
@@ -1,6 +1,7 @@
import React , { Component } from 'react';
import { Link } from "react-router-dom";
import { Dropdown , Menu , Icon , Tooltip } from 'antd';
+import { truncateCommitId } from '../common/util';
import './list.css'
import { branch } from 'recompose';
@@ -21,7 +22,7 @@ class CoderRootBranch extends Component {
if(branchList && branchList.length>0){
return(
-
+
{
@@ -32,7 +33,7 @@ class CoderRootBranch extends Component {
{item.name}
{/*{item.name}*/}
- {item.last_commit && item.last_commit.id}
+ {item.last_commit && truncateCommitId(item.last_commit.id)}
{/*{item.last_commit && item.last_commit.id}*/}
{item.last_commit && item.last_commit.message}
最后更新于{item.last_commit && item.last_commit.time_from_now}
@@ -40,7 +41,7 @@ class CoderRootBranch extends Component {
创建合并请求
-
+
@@ -75,4 +76,4 @@ class CoderRootBranch extends Component {
}
-export default CoderRootBranch;
\ No newline at end of file
+export default CoderRootBranch;
diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js
index d77e4ec2c..54315c867 100644
--- a/src/forge/Main/CoderRootCommit.js
+++ b/src/forge/Main/CoderRootCommit.js
@@ -1,6 +1,7 @@
import React , { Component } from 'react';
import { Table , Spin } from 'antd';
import { getImageUrl } from 'educoder';
+import { truncateCommitId } from '../common/util'
import SelectBranch from '../Branch/SelectBranch';
import Top from './DetailTop';
@@ -92,7 +93,7 @@ class CoderRootCommit extends Component{
title:"SHA",
dataIndex: 'sha',
render: (text) => (
- {text}
+ {truncateCommitId(text)}
)
},{
title:"备注",
@@ -124,7 +125,7 @@ class CoderRootCommit extends Component{
const Pagination =()=> {
if(dataCount > limit){
- return(
+ return(
@@ -153,4 +154,4 @@ class CoderRootCommit extends Component{
)
}
}
-export default CoderRootCommit;
\ No newline at end of file
+export default CoderRootCommit;
diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js
index ef818de7d..6f1b397a5 100644
--- a/src/forge/Main/CoderRootDirectory.js
+++ b/src/forge/Main/CoderRootDirectory.js
@@ -11,6 +11,7 @@ import CloneAddress from '../Branch/CloneAddress';
import RootTable from './RootTable';
import CoderRootFileDetail from './CoderRootFileDetail';
import NullData from './NullData';
+import { truncateCommitId } from '../common/util';
import axios from 'axios';
/**
@@ -233,7 +234,7 @@ class CoderRootDirectory extends Component{
:""
}
- {branchLastCommit.last_commit.id}
+ {truncateCommitId(branchLastCommit.last_commit.id)}
{branchLastCommit.last_commit.message}
{branchLastCommit.last_commit.time_from_now}
diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js
index b30e3d294..d15dbbf5c 100644
--- a/src/forge/Main/CoderRootFileDetail.js
+++ b/src/forge/Main/CoderRootFileDetail.js
@@ -4,7 +4,7 @@ import { Popconfirm, Result } from 'antd';
import './list.css';
import axios from 'axios';
-import CodeMirror from 'react-codeMirror';
+import CodeMirror from 'react-codemirror';
require('codemirror/lib/codemirror.css');
require('codemirror/mode/javascript/javascript');
require('codemirror/mode/xml/xml');
@@ -46,7 +46,7 @@ class CoderRootFileDetail extends Component{
}
// 编辑文件
-
+
changeMmirror=(e,e1,value)=>{
this.setState({
value
@@ -108,7 +108,7 @@ class CoderRootFileDetail extends Component{
render(){
const { detail , current_user , isManager , isReporter , isDeveloper } = this.props;
const { readOnly ,value } = this.state;
- let flag = current_user && current_user.login && (isManager || isReporter);
+ let flag = current_user && current_user.login && (isManager || isDeveloper);
var options = {
lineNumbers: true,
mode: 'javascript',
@@ -166,4 +166,4 @@ class CoderRootFileDetail extends Component{
}
}
-export default CoderRootFileDetail;
\ No newline at end of file
+export default CoderRootFileDetail;
diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js
index 05376c6c0..17536164d 100644
--- a/src/forge/Main/Detail.js
+++ b/src/forge/Main/Detail.js
@@ -242,14 +242,16 @@ class Detail extends Component{
const { project_id } = this.state;
const url = `/projects/${project_id}/forks.json`;
axios.post(url).then(result=>{
- if(result && result.data.status === 0){
- this.props.history.push(`/projects/${result.data.id}/coders`);
- this.props.showNotification(result.data.message);
- this.setState({
+ if (result) {
+ if (result.data.status === 0) {
+ this.props.history.push(`/projects/${result.data.id}/coders`);
+ }
+ this.setState({
isSpin:false
})
- }else{
- this.props.showNotification(result.data.message);
+ this.props.showNotification(result.data.message);
+ } else {
+ this.props.showNotification(`服务器开小差了`);
}
}).catch(error=>{
console.log(error);
diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js
index 294616766..5920f0ff0 100644
--- a/src/forge/New/Index.js
+++ b/src/forge/New/Index.js
@@ -290,10 +290,11 @@ class Index extends Component{
required: true, message: '请填写仓库名称'
}],
})(
-
+
)}
-
好的存储库名称使用简单、深刻和独特的关键字
+ {/*好的存储库名称使用简单、深刻和独特的关键字
*/}
+ {/* */}
diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js
index a14a4788e..1514e08bb 100644
--- a/src/forge/Order/Detail.js
+++ b/src/forge/Order/Detail.js
@@ -504,7 +504,7 @@ class Detail extends Component{
value={ data && data.description}
/> */}
- {data&&data.description===""?没有描述:this.commentCtx(data && data.description)}
+ {data&&data.description&&(data.description.length > 0)?this.commentCtx(data.description): 没有描述}
{
data && data.attachments && data.attachments.length > 0 ?
diff --git a/src/forge/Order/Milepost.js b/src/forge/Order/Milepost.js
index 91a041d8b..d6403ae78 100644
--- a/src/forge/Order/Milepost.js
+++ b/src/forge/Order/Milepost.js
@@ -75,7 +75,7 @@ class Milepost extends Component{
updatestatusemile=(status,arr)=>{
const { projectsId } = this.props.match.params;
- const url = `/projects/${projectsId}/versions/${arr.id}/update_status`;
+ const url = `/projects/${projectsId}/versions/${arr.id}/update_status.json`;
const { current_user } = this.props;
axios.post(url,{
project_id:projectsId,
@@ -98,7 +98,7 @@ class Milepost extends Component{
closemile=(arr)=>{
const { projectsId } = this.props.match.params;
- const url = `/projects/${projectsId}/versions/${arr.id}`;
+ const url = `/projects/${projectsId}/versions/${arr.id}.json`;
axios.delete(url,{ data: {
project_id: projectsId,
id: arr.id
diff --git a/src/forge/common/util.js b/src/forge/common/util.js
new file mode 100644
index 000000000..66a5b4c1e
--- /dev/null
+++ b/src/forge/common/util.js
@@ -0,0 +1,6 @@
+
+export function truncateCommitId(str) {
+ if (str.length > 11) {
+ return str.substring(0, 10)
+ }
+}
diff --git a/src/modules/page/main/CodeRepositoryView.js b/src/modules/page/main/CodeRepositoryView.js
index 5dd87f6a0..05c430243 100644
--- a/src/modules/page/main/CodeRepositoryView.js
+++ b/src/modules/page/main/CodeRepositoryView.js
@@ -11,7 +11,7 @@ import Tree, { TreeNode } from 'rc-tree';
import 'rc-tree/assets/index.css';
import classNames from 'classnames'
-// import CodeMirror from 'react-codeMirror'
+// import CodeMirror from 'react-codemirror'
import axios from 'axios'
import _ from 'lodash'
@@ -52,12 +52,12 @@ class CodeRepositoryView extends Component {
}
componentDidUpdate(prevProps, prevState, snapshot) {
const { game, challenge, hide_code, tabIndex, } = this.props
-
+
if ( // 初始化 或者 game切换
- !this.treeExpanded && challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 ||
- game && (!prevProps.game
+ !this.treeExpanded && challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 ||
+ game && (!prevProps.game
|| prevProps.game.identifier !== this.props.game.identifier) ) {
-
+
if (!this.treeExpanded) {
this.treeExpanded = true
const _path = challenge.multiPath ? challenge.path[0] : challenge.path;
@@ -77,8 +77,8 @@ class CodeRepositoryView extends Component {
})
}
- if (game && (!prevProps.game
- || prevProps.game.identifier !== this.props.game.identifier)) {
+ if (game && (!prevProps.game
+ || prevProps.game.identifier !== this.props.game.identifier)) {
// 切换关卡时切换到第一个tab
// 如果隐藏code tab,就只有一个ssh tab了
if (hide_code == true) {
@@ -90,12 +90,12 @@ class CodeRepositoryView extends Component {
}
}
- componentDidMount() {
+ componentDidMount() {
// 隐藏code tab,则显示ssh tab(81)
if (this.props.hide_code === true) {
this.tabIndexChange(81)
}
-
+
//显示所有代码文件
$(".code-file-tab").hover(function(){
// var ulwidth=$("#blacktab_nav").width();
@@ -119,22 +119,22 @@ class CodeRepositoryView extends Component {
const expandedKeys = this.state.expandedKeys.slice(0)
const _index = expandedKeys.indexOf(selectedKeys[0]);
if (_index == -1) {
- expandedKeys.push(selectedKeys[0])
+ expandedKeys.push(selectedKeys[0])
} else {
expandedKeys.splice( _index, 1)
}
this.setState({ expandedKeys })
}
-
+
this.props.onTreeSelect(selectedKeys, info)
- }
+ }
buildTree() {
// TODO http://localhost:3007/tasks/xgffnuomytpj 这个实训没有文件树
const { fileTreeData, onLoadData, fileTreeSelectedKeys } = this.props;
if (!fileTreeData || fileTreeData.length === 0) {
return ""
}
-
+
const loop = (data) => {
return data.map((item) => {
@@ -147,8 +147,8 @@ class CodeRepositoryView extends Component {
});
};
const treeNodes = loop(fileTreeData);
-
-
+
+
// selectable={false}
return (
{
- domArray.push(
+ domArray.push(
this.onPathChange(index, true) } >
- {item}
+ {item}
)
})
-
+
return (
- {domArray}
+ {domArray}
)
}
@@ -209,11 +209,11 @@ class CodeRepositoryView extends Component {
axios.get(url,
{
// withCredentials: true
- }
- ).then((response) => {
+ }
+ ).then((response) => {
tabIndex && $(`#codetab_con_${tabIndex}`).html('') // 清空 ‘正在连接命令行服务...’
- if (response.data.game_id) {
+ if (response.data.game_id) {
// 重置ssh状态
this.setSSHClosed(false);
@@ -227,7 +227,7 @@ class CodeRepositoryView extends Component {
var line_h = (navigator.userAgent.indexOf('Chrome') >= 0 ? 18 : 19);
var rows = Math.round(h / line_h);
var cols = parseInt(w / 9.9);
-
+
response.data.width = w;
response.data.height = h;
response.data.line_h = line_h;
@@ -237,7 +237,7 @@ class CodeRepositoryView extends Component {
// this.loadSshInIframe( response.data, tabIndex )
this.loadSshNormal(response.data, tabIndex, isReInit)
-
+
}
// console.log(response)
}).catch((error) => {
@@ -257,7 +257,7 @@ class CodeRepositoryView extends Component {
// $(".game_webssh").css({"min-height":h, "max-height":h});
const container = $(`#codetab_con_${tabIndex}`);
// ReactDOM.unmountComponentAtNode(container)
- // ReactDOM.render(, container);
// this.setState({
// sshData: data
@@ -273,7 +273,7 @@ class CodeRepositoryView extends Component {
, height, width, line_h, rows, cols, } = data
let _domain = webssh_url || 'https://webssh.educoder.net';
- // window.location.host === "www.educoder.net" ?
+ // window.location.host === "www.educoder.net" ?
// 'https://webssh.educoder.net'
// : 'https://testwebssh.educoder.net'
const html = ``
@@ -286,9 +286,9 @@ class CodeRepositoryView extends Component {
if ($(`#codetab_con_${index} .terminal.xterm`).length === 1) { // 已经初始化过了
return;
}
-
+
this.initSsh($, index);
-
+
}
/** multi ssh */
setSSHClosed = (isClose) => {
@@ -318,7 +318,7 @@ class CodeRepositoryView extends Component {
close_ssh_cocket_iframe = (id) => {
/*
关闭连接,清空tab content
- */
+ */
let _w = $(`.game_webssh_${id}`)[0].contentWindow
_w && _w.postMessage({tp: 'close_ssh_cocket'}, "*");
$(`#codetab_con_${id}`).html('')
@@ -326,7 +326,7 @@ class CodeRepositoryView extends Component {
close_ssh_cocket_normal = (id) => {
/*
关闭连接,清空tab content
- */
+ */
// let _w = $(`.game_webssh_${id}`)[0].contentWindow
// _w && _w.postMessage({tp: 'close_ssh_cocket'}, "*");
// $(`#codetab_con_${id}`).html('')
@@ -338,7 +338,7 @@ class CodeRepositoryView extends Component {
this.tabIndexChange(STABLE_SSH_TAB_ID)
this.setState({ addtionalSSHArray })
// game_webssh_${tabIndex} TODO
-
+
this.close_ssh_cocket_normal(id)
e.stopPropagation();
}
@@ -379,7 +379,7 @@ class CodeRepositoryView extends Component {
width={300}
open={drawerOpen}
-
+
onClose={() => showFilesDrawer( false )}
>
{ loadingFirstRepoFiles ? (
@@ -390,7 +390,7 @@ class CodeRepositoryView extends Component {
-
+
{ hide_code === false && - tabIndexChange(0)}>
代码文件
@@ -402,23 +402,23 @@ class CodeRepositoryView extends Component {
: "" }
-
+
}
- {shixun.webssh !== 0 &&
- - this.tabIndexChange(STABLE_SSH_TAB_ID)}>
命令行
}
- {
+ {
addtionalSSHArray.map( (item, index) => {
- return (- this.tabIndexChange(item)}>
命令行{index + 1}
this.onSSHTabClose(item, e)}>
-
@@ -429,7 +429,7 @@ class CodeRepositoryView extends Component {
}
{/* */}
- { shixun.webssh !== 0 && shixun.multi_webssh == true && addtionalSSHArray.length < totalAddtionalTabCount
+ { shixun.webssh !== 0 && shixun.multi_webssh == true && addtionalSSHArray.length < totalAddtionalTabCount
&& sshIsClosed === false &&
-
+
}
-
+
{ tabIndex === 0 &&
{codeStatus === 0 ? '已修改' : (codeStatus === 1 ? '保存中...' : '已保存' ) }
}
-
+
{/* 没必要显示这个,注释掉了 */}
- {/* { !isEditablePath &&
+ {/* { !isEditablePath &&
{currentPath}
-
+
} */}
{this.props.readRepoTimeout === true ? :
-
{/**/}
@@ -536,17 +536,17 @@ class CodeRepositoryView extends Component {
}
-
{/* { tabIndex === STABLE_SSH_TAB_ID && this.state.sshData && } */}
-
-
-
@@ -554,13 +554,13 @@ class CodeRepositoryView extends Component {
);
}
}
-/*
+/*
<%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %>
- , overflow: 'scroll' ref="editor"
+ , overflow: 'scroll' ref="editor"
-
*/
-export default CodeRepositoryView;
\ No newline at end of file
+export default CodeRepositoryView;
diff --git a/src/modules/test/codemirror/TestCodeMirror.js b/src/modules/test/codemirror/TestCodeMirror.js
index f451bc356..08ca32f15 100644
--- a/src/modules/test/codemirror/TestCodeMirror.js
+++ b/src/modules/test/codemirror/TestCodeMirror.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
-import CodeMirror from 'react-codeMirror'
+import CodeMirror from 'react-codemirror'
require('codemirror/lib/codemirror.css');
require('codemirror/mode/javascript/javascript');
@@ -28,13 +28,13 @@ class TestCodeMirror extends Component {
componentDidMount() {
var readOnlyLines = [0,1,2,3,8];
-
+
this.refs.editor.getCodeMirror().on('beforeChange',function(cm,change) {
console.log('change.from.line', change.from.line)
- if ( readOnlyLines.indexOf(change.from.line) !== -1
+ if ( readOnlyLines.indexOf(change.from.line) !== -1
// 有问题:如果用回车将有内容的行挤到不可编辑的行,那么无法删除掉不可编辑行里的内容了
// 解决办法:将所需的行数固定写好,禁用掉回车键。
- // || change.from.line > ( readOnlyLines[readOnlyLines.length -1] + 1 )
+ // || change.from.line > ( readOnlyLines[readOnlyLines.length -1] + 1 )
) {
change.cancel();
}
@@ -60,4 +60,4 @@ class TestCodeMirror extends Component {
}
}
-export default TestCodeMirror;
\ No newline at end of file
+export default TestCodeMirror;