|
|
@ -1,309 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
import CodeRepositoryView from './CodeRepositoryView'
|
|
|
|
import CodeRepositoryView from './CodeRepositoryView'
|
|
|
|
|
|
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
|
|
import './CodeRepositoryView.css'
|
|
|
|
import './CodeRepositoryView.css'
|
|
|
|
|
|
|
|
|
|
|
|
// 自己处理path,加上父节点的path, 这里是处理树节点了,所以是set key
|
|
|
|
// 自己处理path,加上父节点的path, 这里是处理树节点了,所以是set key
|
|
|
|
function addPrePath(treeData, parentNodePath) {
|
|
|
|
function addPrePath(treeData, parentNodePath) {
|
|
|
|
return treeData.map(item => {
|
|
|
|
return treeData.map(item => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
...item,
|
|
|
|
key: `${parentNodePath}/${item.name}`
|
|
|
|
key: `${parentNodePath}/${item.name}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function getNewTreeData(treeData, curKey, child, level) {
|
|
|
|
function getNewTreeData(treeData, curKey, child, level) {
|
|
|
|
const loop = (data) => {
|
|
|
|
const loop = (data) => {
|
|
|
|
data.forEach((item) => {
|
|
|
|
data.forEach((item) => {
|
|
|
|
// 这里不能用indexOf 同一级可能出现test目录和test.py文件
|
|
|
|
// 这里不能用indexOf 同一级可能出现test目录和test.py文件
|
|
|
|
if (item.key == curKey) {
|
|
|
|
if (item.key == curKey) {
|
|
|
|
child = addPrePath(child, curKey);
|
|
|
|
child = addPrePath(child, curKey);
|
|
|
|
item.children = child;
|
|
|
|
item.children = child;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (item.children) {
|
|
|
|
if (item.children) {
|
|
|
|
loop(item.children);
|
|
|
|
loop(item.children);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
loop(treeData);
|
|
|
|
loop(treeData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fileData2TreeData(repoFilesData) {
|
|
|
|
function fileData2TreeData(repoFilesData) {
|
|
|
|
const fileTreeData = [];
|
|
|
|
if(repoFilesData!=null){
|
|
|
|
repoFilesData.forEach((item) => {
|
|
|
|
const fileTreeData = [];
|
|
|
|
if (item.kind === 'file') {
|
|
|
|
repoFilesData.forEach((item) => {
|
|
|
|
fileTreeData.push({
|
|
|
|
if (item.kind === 'file') {
|
|
|
|
key: item.path,
|
|
|
|
fileTreeData.push({
|
|
|
|
name: item.name,
|
|
|
|
key: item.path,
|
|
|
|
isLeaf: true
|
|
|
|
name: item.name,
|
|
|
|
})
|
|
|
|
isLeaf: true
|
|
|
|
} else {
|
|
|
|
})
|
|
|
|
fileTreeData.push({
|
|
|
|
} else {
|
|
|
|
key: item.path,
|
|
|
|
fileTreeData.push({
|
|
|
|
name: item.name,
|
|
|
|
key: item.path,
|
|
|
|
// isLeaf: false
|
|
|
|
name: item.name,
|
|
|
|
})
|
|
|
|
// isLeaf: false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return fileTreeData;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return fileTreeData;
|
|
|
|
|
|
|
|
}
|
|
|
|
class CodeRepositoryViewContainer extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
constructor(props) {
|
|
|
|
|
|
|
|
super(props)
|
|
|
|
class CodeRepositoryViewContainer extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
this.showFilesDrawer = this.showFilesDrawer.bind(this)
|
|
|
|
constructor(props) {
|
|
|
|
this.onRepositoryViewExpand = this.onRepositoryViewExpand.bind(this)
|
|
|
|
super(props)
|
|
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
this.showFilesDrawer = this.showFilesDrawer.bind(this)
|
|
|
|
drawerOpen: false,
|
|
|
|
this.onRepositoryViewExpand = this.onRepositoryViewExpand.bind(this)
|
|
|
|
loadingFirstRepoFiles: false,
|
|
|
|
|
|
|
|
fileTreeData: "",
|
|
|
|
this.state = {
|
|
|
|
fileTreeSelectedKeys: [],
|
|
|
|
drawerOpen: false,
|
|
|
|
codeRepositoryViewExpanded: false,
|
|
|
|
loadingFirstRepoFiles: false,
|
|
|
|
tabIndex: 0,
|
|
|
|
fileTreeData: "",
|
|
|
|
|
|
|
|
fileTreeSelectedKeys: [],
|
|
|
|
settingDrawerOpen: false
|
|
|
|
codeRepositoryViewExpanded: false,
|
|
|
|
}
|
|
|
|
tabIndex: 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
showSettingDrawer = (open) => {
|
|
|
|
settingDrawerOpen: false
|
|
|
|
this.setState({settingDrawerOpen: open})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tabIndexChange = (index) => {
|
|
|
|
showSettingDrawer = (open) => {
|
|
|
|
this.setState({tabIndex: index});
|
|
|
|
this.setState({settingDrawerOpen: open})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onRepositoryViewExpand() {
|
|
|
|
tabIndexChange = (index) => {
|
|
|
|
window.repository_extend_and_zoom();
|
|
|
|
this.setState({tabIndex: index});
|
|
|
|
this.setState({
|
|
|
|
}
|
|
|
|
evaluateViewExpanded: !this.state.evaluateViewExpanded
|
|
|
|
onRepositoryViewExpand() {
|
|
|
|
}, () => {
|
|
|
|
window.repository_extend_and_zoom();
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.setState({
|
|
|
|
window.__tpiOnResize()
|
|
|
|
evaluateViewExpanded: !this.state.evaluateViewExpanded
|
|
|
|
}, 300)
|
|
|
|
}, () => {
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
}
|
|
|
|
window.__tpiOnResize()
|
|
|
|
|
|
|
|
}, 300)
|
|
|
|
showFilesDrawer(open) {
|
|
|
|
})
|
|
|
|
if (this.props.loading === true) {
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
showFilesDrawer(open) {
|
|
|
|
if (!this.state.fileTreeData) {
|
|
|
|
if (this.props.loading === true) {
|
|
|
|
this.fetchRepoFiles();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.state.fileTreeData) {
|
|
|
|
this.setState({
|
|
|
|
this.fetchRepoFiles();
|
|
|
|
drawerOpen: open,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
loadRepoFiles = () => {
|
|
|
|
drawerOpen: open,
|
|
|
|
if (!this.state.fileTreeData) {
|
|
|
|
})
|
|
|
|
this.fetchRepoFiles();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loadRepoFiles = () => {
|
|
|
|
}
|
|
|
|
if (!this.state.fileTreeData) {
|
|
|
|
|
|
|
|
this.fetchRepoFiles();
|
|
|
|
componentWillReceiveProps(newProps, oldProps) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentWillReceiveProps(newProps, oldProps) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
|
|
|
|
|
|
const { game, challenge } = this.props
|
|
|
|
}
|
|
|
|
if (this.props.game && (!prevProps.game || prevProps.game.identifier !== this.props.game.identifier) ) {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[0] : challenge.path ]
|
|
|
|
const { game, challenge } = this.props
|
|
|
|
})
|
|
|
|
if (this.props.game && (!prevProps.game || prevProps.game.identifier !== this.props.game.identifier) ) {
|
|
|
|
// 初始化
|
|
|
|
this.setState({
|
|
|
|
} else if (this.state.fileTreeSelectedKeys.length === 0 && challenge && challenge.path) {
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[0] : challenge.path ]
|
|
|
|
this.setState({
|
|
|
|
})
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[0] : challenge.path ]
|
|
|
|
// 初始化
|
|
|
|
})
|
|
|
|
} else if (this.state.fileTreeSelectedKeys.length === 0 && challenge && challenge.path) {
|
|
|
|
} else if (challenge && prevProps && prevProps.challenge
|
|
|
|
this.setState({
|
|
|
|
&& challenge.pathIndex != prevProps.challenge.pathIndex
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[0] : challenge.path ]
|
|
|
|
&& challenge.pathIndex !== -1) {
|
|
|
|
})
|
|
|
|
this.setState({
|
|
|
|
} else if (challenge && prevProps && prevProps.challenge
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[challenge.pathIndex] : challenge.path ]
|
|
|
|
&& challenge.pathIndex != prevProps.challenge.pathIndex
|
|
|
|
})
|
|
|
|
&& challenge.pathIndex !== -1) {
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
}
|
|
|
|
fileTreeSelectedKeys: [ challenge.multiPath ? challenge.path[challenge.pathIndex] : challenge.path ]
|
|
|
|
|
|
|
|
})
|
|
|
|
handleDialogClose() {
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
}
|
|
|
|
dialogOpen: false
|
|
|
|
|
|
|
|
})
|
|
|
|
handleDialogClose() {
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
onLoadData = (treeNode) => {
|
|
|
|
dialogOpen: false
|
|
|
|
if (treeNode.props.children && treeNode.props.children.length) {
|
|
|
|
})
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
}
|
|
|
|
resolve();
|
|
|
|
onLoadData = (treeNode) => {
|
|
|
|
});
|
|
|
|
if (treeNode.props.children && treeNode.props.children.length) {
|
|
|
|
}
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
resolve();
|
|
|
|
this.fetchRepoFiles(treeNode, resolve, reject)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
map2OldData = (treeData) => {
|
|
|
|
this.fetchRepoFiles(treeNode, resolve, reject)
|
|
|
|
if (!treeData || treeData.length === 0) return treeData;
|
|
|
|
});
|
|
|
|
treeData = treeData.map(item => {
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
map2OldData = (treeData) => {
|
|
|
|
kind: item.type == "blob" ? "file" : "dir", // blob->file tree->dir
|
|
|
|
if (!treeData || treeData.length === 0) return treeData;
|
|
|
|
path: item.name,
|
|
|
|
treeData = treeData.map(item => {
|
|
|
|
name: item.name
|
|
|
|
return {
|
|
|
|
}
|
|
|
|
kind: item.type == "blob" ? "file" : "dir", // blob->file tree->dir
|
|
|
|
})
|
|
|
|
path: item.name,
|
|
|
|
return treeData;
|
|
|
|
name: item.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
fetchRepoFiles(treeNode, resolve, reject) {
|
|
|
|
return treeData;
|
|
|
|
// http://localhost:3000/api/v1/games/829al3mst4fy/entries?path=src/step1&rev=master
|
|
|
|
}
|
|
|
|
if (!this.props.challenge || !this.props.game) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
fetchRepoFiles(treeNode, resolve, reject) {
|
|
|
|
}
|
|
|
|
// http://localhost:3000/api/v1/games/829al3mst4fy/entries?path=src/step1&rev=master
|
|
|
|
// var ar = this.props.challenge.path.split('/');
|
|
|
|
if (!this.props.challenge || !this.props.game) {
|
|
|
|
// ar.length = ar.length - 2;
|
|
|
|
return;
|
|
|
|
// var _path = ar.join('/');
|
|
|
|
}
|
|
|
|
var _path = treeNode ? treeNode.props.eventKey : '' ;
|
|
|
|
// var ar = this.props.challenge.path.split('/');
|
|
|
|
if (_path.charAt(0) === '/') {
|
|
|
|
// ar.length = ar.length - 2;
|
|
|
|
_path = _path.substring(1)
|
|
|
|
// var _path = ar.join('/');
|
|
|
|
}
|
|
|
|
var _path = treeNode ? treeNode.props.eventKey : '' ;
|
|
|
|
// var url = `/api/v1/games/${this.props.game.identifier}/entries?path=${_path}&rev=master&gpid=${this.props.myshixun.gpid}`
|
|
|
|
if (_path.charAt(0) === '/') {
|
|
|
|
let url = `/myshixuns/${this.props.myshixun.identifier}/repository.json`
|
|
|
|
_path = _path.substring(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// var url = `/api/v1/games/${this.props.game.identifier}/entries?path=${_path}&rev=master&gpid=${this.props.myshixun.gpid}`
|
|
|
|
if (!this.state.fileTreeData || this.state.fileTreeData.length === 0) {
|
|
|
|
let url = `/myshixuns/${this.props.myshixun.identifier}/repository.json`
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
loadingFirstRepoFiles: true,
|
|
|
|
|
|
|
|
})
|
|
|
|
if (!this.state.fileTreeData || this.state.fileTreeData.length === 0) {
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
var that = this;
|
|
|
|
loadingFirstRepoFiles: true,
|
|
|
|
axios.post(url, {
|
|
|
|
})
|
|
|
|
path: _path
|
|
|
|
}
|
|
|
|
// withCredentials: true,
|
|
|
|
var that = this;
|
|
|
|
})
|
|
|
|
axios.post(url, {
|
|
|
|
.then((response) => {
|
|
|
|
path: _path
|
|
|
|
const repoFilesData = this.map2OldData(response.data.trees)
|
|
|
|
// withCredentials: true,
|
|
|
|
if (!this.state.fileTreeData || this.state.fileTreeData.length === 0) { // 还没树节点,没加载过
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((response) => {
|
|
|
|
const fileTreeData = fileData2TreeData(repoFilesData)
|
|
|
|
const repoFilesData = this.map2OldData(response.data.trees)
|
|
|
|
this.setState({
|
|
|
|
if (!this.state.fileTreeData || this.state.fileTreeData.length === 0) { // 还没树节点,没加载过
|
|
|
|
fileTreeData,
|
|
|
|
|
|
|
|
loadingFirstRepoFiles: false,
|
|
|
|
const fileTreeData = fileData2TreeData(repoFilesData)
|
|
|
|
});
|
|
|
|
this.setState({
|
|
|
|
} else {
|
|
|
|
fileTreeData,
|
|
|
|
var _treeNode = treeNode;
|
|
|
|
loadingFirstRepoFiles: false,
|
|
|
|
var _eventKey = _treeNode.props.eventKey;
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
const fileTreeData = that.state.fileTreeData;
|
|
|
|
var _treeNode = treeNode;
|
|
|
|
// 新的数组放置到treenode下
|
|
|
|
var _eventKey = _treeNode.props.eventKey;
|
|
|
|
|
|
|
|
|
|
|
|
const tempFileTreeData = fileData2TreeData(repoFilesData)
|
|
|
|
const fileTreeData = that.state.fileTreeData;
|
|
|
|
|
|
|
|
// 新的数组放置到treenode下
|
|
|
|
getNewTreeData(fileTreeData, _eventKey, tempFileTreeData, 2);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
const tempFileTreeData = fileData2TreeData(repoFilesData)
|
|
|
|
fileTreeData,
|
|
|
|
|
|
|
|
})
|
|
|
|
getNewTreeData(fileTreeData, _eventKey, tempFileTreeData, 2);
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
fileTreeData,
|
|
|
|
resolve && resolve();
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(function (error) {
|
|
|
|
resolve && resolve();
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
reject && reject();
|
|
|
|
})
|
|
|
|
});
|
|
|
|
.catch(function (error) {
|
|
|
|
}
|
|
|
|
console.log(error);
|
|
|
|
onTreeSelect = (selectedKeys, info) => {
|
|
|
|
reject && reject();
|
|
|
|
const isLeaf = info.node.props.isLeaf;
|
|
|
|
});
|
|
|
|
if (isLeaf) { // 叶子节点
|
|
|
|
}
|
|
|
|
selectedKeys.length && this.setState({
|
|
|
|
onTreeSelect = (selectedKeys, info) => {
|
|
|
|
fileTreeSelectedKeys: selectedKeys
|
|
|
|
const isLeaf = info.node.props.isLeaf;
|
|
|
|
})
|
|
|
|
if (isLeaf) { // 叶子节点
|
|
|
|
const { fetchRepositoryCode, onPathChange, showSnackbar, challenge } = this.props;
|
|
|
|
selectedKeys.length && this.setState({
|
|
|
|
|
|
|
|
fileTreeSelectedKeys: selectedKeys
|
|
|
|
const nodePath = info.node.props.eventKey;
|
|
|
|
})
|
|
|
|
// 设置pathIndex为-1,那么代码文件下拉可以切回可编辑的文件
|
|
|
|
const { fetchRepositoryCode, onPathChange, showSnackbar, challenge } = this.props;
|
|
|
|
if (!challenge.multiPath) { // 单path任务 多path任务 path是数组
|
|
|
|
|
|
|
|
if (challenge.path.trim() == nodePath.trim()) {
|
|
|
|
const nodePath = info.node.props.eventKey;
|
|
|
|
if (challenge.pathIndex === 0) {
|
|
|
|
// 设置pathIndex为-1,那么代码文件下拉可以切回可编辑的文件
|
|
|
|
showSnackbar(`当前编辑文件已经是${nodePath}`)
|
|
|
|
if (!challenge.multiPath) { // 单path任务 多path任务 path是数组
|
|
|
|
} else {
|
|
|
|
if (challenge.path.trim() == nodePath.trim()) {
|
|
|
|
onPathChange(0)
|
|
|
|
if (challenge.pathIndex === 0) {
|
|
|
|
}
|
|
|
|
showSnackbar(`当前编辑文件已经是${nodePath}`)
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
onPathChange(0)
|
|
|
|
onPathChange(-1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let isCurrentFile = false;
|
|
|
|
onPathChange(-1)
|
|
|
|
let cur_index = -1;
|
|
|
|
}
|
|
|
|
if (challenge.path && challenge.path.forEach) {
|
|
|
|
} else {
|
|
|
|
challenge.path.forEach((item, index) => {
|
|
|
|
let isCurrentFile = false;
|
|
|
|
if (nodePath == item) {
|
|
|
|
let cur_index = -1;
|
|
|
|
isCurrentFile = true;
|
|
|
|
if (challenge.path && challenge.path.forEach) {
|
|
|
|
cur_index = index;
|
|
|
|
challenge.path.forEach((item, index) => {
|
|
|
|
}
|
|
|
|
if (nodePath == item) {
|
|
|
|
})
|
|
|
|
isCurrentFile = true;
|
|
|
|
}
|
|
|
|
cur_index = index;
|
|
|
|
if (isCurrentFile) {
|
|
|
|
}
|
|
|
|
onPathChange(cur_index)
|
|
|
|
})
|
|
|
|
showSnackbar(`当前编辑文件已经是${nodePath}`)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (isCurrentFile) {
|
|
|
|
onPathChange(-1)
|
|
|
|
onPathChange(cur_index)
|
|
|
|
}
|
|
|
|
showSnackbar(`当前编辑文件已经是${nodePath}`)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (nodePath) {
|
|
|
|
onPathChange(-1)
|
|
|
|
const filetype = nodePath.split('.').pop().toLowerCase();
|
|
|
|
}
|
|
|
|
if (filetype == 'jpg' || filetype == 'png' || filetype == 'gif' || filetype == 'jpeg'
|
|
|
|
}
|
|
|
|
|| filetype == 'jar'
|
|
|
|
if (nodePath) {
|
|
|
|
|| filetype == 'doc' || filetype == 'pdf' || filetype == 'xsl' || filetype == 'ppt') {
|
|
|
|
const filetype = nodePath.split('.').pop().toLowerCase();
|
|
|
|
showSnackbar(`不支持加载${filetype}类型的文件。`)
|
|
|
|
if (filetype == 'jpg' || filetype == 'png' || filetype == 'gif' || filetype == 'jpeg'
|
|
|
|
return;
|
|
|
|
|| filetype == 'jar'
|
|
|
|
}
|
|
|
|
|| filetype == 'doc' || filetype == 'pdf' || filetype == 'xsl' || filetype == 'ppt') {
|
|
|
|
fetchRepositoryCode(null, nodePath, 1);
|
|
|
|
showSnackbar(`不支持加载${filetype}类型的文件。`)
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
console.error('no eventKey:', info.node)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fetchRepositoryCode(null, nodePath, 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
console.error('no eventKey:', info.node)
|
|
|
|
// /shixuns/mnf6b7z3/shixun_discuss?challenge_id=88
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
// /shixuns/mnf6b7z3/shixun_discuss?challenge_id=88
|
|
|
|
<React.Fragment>
|
|
|
|
render() {
|
|
|
|
{this.props.isOnlyContainer == true ?
|
|
|
|
|
|
|
|
React.Children.map(this.props.children, child => {
|
|
|
|
return (
|
|
|
|
if(!child) {
|
|
|
|
<React.Fragment>
|
|
|
|
return ''
|
|
|
|
{this.props.isOnlyContainer == true ?
|
|
|
|
}
|
|
|
|
React.Children.map(this.props.children, child => {
|
|
|
|
return React.cloneElement(child, Object.assign({...this.state}, {
|
|
|
|
if(!child) {
|
|
|
|
loadRepoFiles: this.loadRepoFiles,
|
|
|
|
return ''
|
|
|
|
onTreeSelect: this.onTreeSelect,
|
|
|
|
}
|
|
|
|
onLoadData: this.onLoadData,
|
|
|
|
return React.cloneElement(child, Object.assign({...this.state}, {
|
|
|
|
}))
|
|
|
|
loadRepoFiles: this.loadRepoFiles,
|
|
|
|
})
|
|
|
|
onTreeSelect: this.onTreeSelect,
|
|
|
|
|
|
|
|
onLoadData: this.onLoadData,
|
|
|
|
:
|
|
|
|
}))
|
|
|
|
|
|
|
|
})
|
|
|
|
<CodeRepositoryView {...this.props}
|
|
|
|
|
|
|
|
{...this.state}
|
|
|
|
:
|
|
|
|
showFilesDrawer={this.showFilesDrawer}
|
|
|
|
|
|
|
|
loadRepoFiles={this.loadRepoFiles}
|
|
|
|
<CodeRepositoryView {...this.props}
|
|
|
|
onLoadData={this.onLoadData}
|
|
|
|
{...this.state}
|
|
|
|
onTreeSelect={ this.onTreeSelect }
|
|
|
|
showFilesDrawer={this.showFilesDrawer}
|
|
|
|
onRepositoryViewExpand={this.onRepositoryViewExpand}
|
|
|
|
loadRepoFiles={this.loadRepoFiles}
|
|
|
|
tabIndexChange={this.tabIndexChange}
|
|
|
|
onLoadData={this.onLoadData}
|
|
|
|
showSettingDrawer={this.showSettingDrawer}
|
|
|
|
onTreeSelect={ this.onTreeSelect }
|
|
|
|
></CodeRepositoryView> }
|
|
|
|
onRepositoryViewExpand={this.onRepositoryViewExpand}
|
|
|
|
</React.Fragment>
|
|
|
|
tabIndexChange={this.tabIndexChange}
|
|
|
|
);
|
|
|
|
showSettingDrawer={this.showSettingDrawer}
|
|
|
|
}
|
|
|
|
></CodeRepositoryView> }
|
|
|
|
}
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
|
|
);
|
|
|
|
export default CodeRepositoryViewContainer;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default CodeRepositoryViewContainer;
|
|
|
|