diff --git a/src/forge/Component/User.jsx b/src/forge/Component/User.jsx
index 1c6bf9a9..8701e607 100644
--- a/src/forge/Component/User.jsx
+++ b/src/forge/Component/User.jsx
@@ -20,7 +20,7 @@ export default ({ url , name , column })=>{
`;
return(
-
+ { url && }
{name}
)
diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx
index 41b69004..58e941d2 100644
--- a/src/forge/Main/CoderDepot.jsx
+++ b/src/forge/Main/CoderDepot.jsx
@@ -1,6 +1,6 @@
import React , { useEffect , useState } from 'react';
import { WhiteBack , Box , LongWidth , ShortWidth , Gap , AlignCenter , FlexAJ } from '../Component/layout';
-import { Dropdown , Menu , Divider , Spin } from 'antd';
+import { Dropdown , Menu , Divider , Spin, Button } from 'antd';
import { getImageUrl } from "educoder";
import { Link } from 'react-router-dom';
import CloneAddress from '../Branch/CloneAddress';
@@ -242,7 +242,10 @@ function CoderDepot(props){
onClose={()=>setVisible(false)}
list = {mainFlag ? dirInfo : undefined}
/>
-
setVisible(true)}>
+ setVisible(true)}>
+
+ 目录
+
}
- { type === "dir" && 文件}
- 下载
+ { type === "dir" &&
+
+
+
+ }
+
+
+
{
@@ -358,7 +367,7 @@ function CoderDepot(props){
简介
{projectDetail.permission && (projectDetail.permission==="Admin" || projectDetail.permission==="Owner") && setOpenModal(true)} className="iconfont icon-anquanshezhi color-grey-9 font-15">}
- {desc && {desc}
}
+ {desc && {desc}
}
{
website &&
diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js
deleted file mode 100644
index e151689d..00000000
--- a/src/forge/Main/CoderRootDirectory.js
+++ /dev/null
@@ -1,516 +0,0 @@
-import React, { Component } from "react";
-import { Menu, Spin } from "antd";
-import { getImageUrl } from "educoder";
-import { Link } from "react-router-dom";
-
-import './list.css';
-import SelectBranch from '../Branch/Select';
-import CloneAddress from '../Branch/CloneAddress';
-import RootTable from './RootTable';
-import CoderRootFileDetail from './CoderRootFileDetail';
-import { truncateCommitId } from '../common/util';
-import RenderHtml from '../../components/render-html';
-import Nodata from '../Nodata';
-
-import axios from "axios";
-/**
- * address:http和SSH,http_url(对应git地址)
- * filePath:点击目录时当前目录的路径
- * subfileType:保存当前点击目录的文件类型(显示目录列表时才显示新建文件,如果点击的是文件就不显示新建文件按钮)
- * readMeContent:根目录下面的readme文件内容
- */
-function getPathUrl(array,index){
- if(array && array.length>0 && index){
- let str = "";
- for(let i=0;i {
- this.setState({
- address,
- });
- };
-
- componentDidMount = () => {
- this.Init();
- this.getBranchs();
- };
- // 获取分支列表
- getBranchs=()=>{
- const { projectsId , owner } = this.props.match.params;
- axios.get(`/${owner}/${projectsId}/branches.json`).then(result=>{
- this.setState({
- branchList:result.data
- })
- }).catch((error)=>{})
- }
-
- componentDidUpdate = (prevState) => {
- const { location } = this.props;
- const prevlocation = prevState && prevState.location;
- if (location !== prevlocation) {
- this.setState({
- isSpin: true,
- });
- this.Init();
- }
- };
-
- Init = () => {
- let { pathname } = this.props.history.location;
- const { branchName , owner , projectsId } = this.props.match.params;
- const { defaultBranch } = this.props;
- let branch = branchName || defaultBranch;
- if (pathname && (pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1)) {
- let url = pathname.split(`/tree/${branchName}/`)[1];
- this.setState({treeValue:url})
- this.getFileDetail(decodeURI(url),branch);
- } else {
- this.getProjectRoot(branch);
- }
- };
-
- // 页面地址返回到主目录
- returnMain = (branch) => {
- const { projectsId , owner , branchName } = this.props.match.params;
- this.setState({
- readOnly:true,
- treeValue:undefined
- })
- this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/tree/${branchName}`:""}`);
- this.getProjectRoot(branch);
- };
-
- // 获取根目录
- getProjectRoot = (branch) => {
- const { projectsId , owner } = this.props.match.params;
- const url = `/${owner}/${projectsId}/entries.json`;
- axios.get(url, { params: { ref: branch } })
- .then((result) => {
- if (result) {
- let last_commit = result.data && result.data.last_commit;
- let entries = result.data && result.data.entries;
- this.setState({
- filePath: undefined,
- fileDetail: [],
- isSpin: false,
- branchLastCommit: last_commit && last_commit.commit,
- lastCommitAuthor:
- last_commit && (last_commit.author || (last_commit.commit && last_commit.commit.author)),
- zip_url: result.data.zip_url,
- tar_url: result.data.tar_url
- });
- if (entries && entries.length > 0) {
- this.renderData(entries);
- }
- this.setState({
- rootList: entries,
- subFileType: true,
- });
- }
- }).catch((error) => {});
- };
-
- ChangeFile = (arr, readOnly) => {
- const { projectsId , owner } = this.props.match.params;
- //点击直接跳转页面 加载一次路由
- this.props.history.push(`/projects/${owner}/${projectsId}/tree/${arr.path}`);
- this.setState({
- readOnly: readOnly,
- chooseType:"file"
- });
- };
-
- // 获取子目录
- getFileDetail = (path, ref) => {
- this.setState({
- filePath: decodeURI(path),
- });
- const { projectsId , owner , branchName } = this.props.match.params;
- const { chooseType } = this.state;
- const url = `/${owner}/${projectsId}/sub_entries.json`;
- axios.get(url,{
- params:{
- filepath:path,
- ref:ref || branchName,
- type:chooseType
- }
- }).then((result)=>{
- let entries = result.data && result.data.entries;
- this.setState({
- isSpin:false
- })
- if(result){
- if(entries){
- // 返回对象entries.type则是文件类型,否则是文件夹
- if(entries.type){
- this.setState({
- fileDetail:[entries],
- rootList:[],
- subFileType:false
- })
- }else{
- this.setState({
- fileDetail:[],
- rootList:entries,
- branchLastCommit:result.data.last_commit && result.data.last_commit.commit,
- lastCommitAuthor:result.data.last_commit && (result.data.last_commit.author || (result.data.last_commit.commit && result.data.last_commit.commit.author))
- })
- this.renderData(entries);
- }
- }else{
- this.setState({
- fileDetail:[],
- rootList:[],
- isSpin:false,
- subFileType:false
- })
- }
- }
- })
- .catch((error) => {
- this.setState({
- isSpin:false
- })
- console.log(error);
- });
- };
-
- renderData = (data) => {
- const rootList = [];
- const readMeContent = [];
- const readMeFile = [];
- data && data.map((item, key) => {
- rootList.push({
- key,
- message: item.commit && item.commit.message,
- ...item,
- });
- if (item.is_readme_file) {
- readMeContent.push({ ...item });
- readMeFile.push({ ...item });
- }
- });
- this.setState({
- rootList: rootList,
- readMeContent,
- readMeFile,
- });
- };
-
- // 点击跳转到子目录
- goToSubRoot=(path,type,filename)=>{
- this.setState({
- chooseType:type
- })
- const { projectsId, owner , branchName } = this.props.match.params;
- const { defaultBranch } = this.props;
- this.props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || defaultBranch}`}${path?`/${path}`:""}`);
- if(filename.substring(filename.length - 3) === ".md"){
- this.setState({
- md:true
- })
- }else{
- this.setState({
- md:false
- })
- }
- };
-
- // readme文件内容
- renderReadMeContent = (readMeContent, permission) => {
- const { fileDetail, readMeFile } = this.state;
- if (fileDetail && fileDetail.length !== 0) {
- return;
- }
- if (readMeContent && readMeContent.length > 0) {
- return (
-
-
-
- {readMeContent[0].content ?
-
- :
- 暂无~
- }
-
-
- );
- }
- };
-
- // 选择分支
- changeBranch = (value) => {
- const { projectsId , owner } = this.props.match.params;
- const { treeValue } = this.state;
- let url = `/projects/${owner}/${projectsId}${value && `/tree/${value}`}${treeValue ? `/${treeValue}`:""}`;
- this.props.history.push(url);
- }
-
- // 子目录路径返回链接
- returnUlr=(url)=>{
- this.setState({
- chooseType:"dir",
- readOnly:true,
- treeValue:url
- })
- const { projectsId , owner , branchName } = this.props.match.params;
- this.props.history.push(`/projects/${owner}/${projectsId}/tree${branchName?`/${branchName}`:""}/${url}`);
- }
-
- onEdit=(readOnly)=>{
- this.setState({
- readOnly
- })
- }
-
- downloadUrl = (zip_url,tar_url) => {
- return(
-
- )
- }
-
- title = (branchLastCommit,lastCommitAuthor) => {
- if (branchLastCommit) {
- const { projectsId , owner } = this.props.match.params;
- return (
-
- {lastCommitAuthor ? (
-
- {lastCommitAuthor.login ? (
-
-
- {lastCommitAuthor.name}
-
- ) : (
- {lastCommitAuthor.name}
- )}
-
- ) : (
- ""
- )}
-
- {branchLastCommit.message}
-
-
{branchLastCommit.time_from_now}
-
- {truncateCommitId(branchLastCommit.sha)}
-
-
- );
- }else{
- return false;
- }
- }
-
-
- render(){
- const { branchLastCommit , lastCommitAuthor , rootList ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url , branchList} = this.state;
- const { isManager , isDeveloper , projectDetail , platform , defaultBranch } = this.props;
-
- const { projectsId , owner , branchName } = this.props.match.params;
- let branch = branchName || defaultBranch;
-
- const columns = [
- {
- key:"name",
- dataIndex: 'name',
- width:"30%",
- render: (text,item) => (
- this.goToSubRoot(item.path,item.type,text)} className="ml12 task-hide" style={{ display: "block", maxWidth: "345px" }}>
- {text}
-
- ),
- },
- {
- key:"message",
- dataIndex: "message",
- width: "60%",
- render: (text, item) =>
- item.commit && item.commit.message ?
-
- {item.commit.message}
-
- : ""
- },
- {
- key:"time_from_now",
- dataIndex: "time_from_now",
- width: "10%",
- className: "edu-txt-right",
- render: (text, item) =>
- item.commit && item.commit.time_from_now ?
-
- {item.commit.time_from_now}
-
- :""
- },
- ];
- const urlRoot = filePath === undefined ? "" : `/${filePath}`;
- let array = filePath && filePath.split("/");
- return (
-
-
-
-
-
- {subFileType && (projectDetail && parseInt(projectDetail.type)) !== 2 && (isManager || isDeveloper) && platform && (
-
-
-
- 上传文件
-
-
-
-
- 新建文件
-
-
-
- )}
- {projectDetail && projectDetail.clone_url && (
-
- )}
-
-
- {/* 主目录列表 */}
- {rootList && rootList.length > 0 && (
-
this.title(branchLastCommit,lastCommitAuthor)}
- >
- )}
- {/* 子目录列表、文件 */}
- {fileDetail && fileDetail.length > 0 && (
-
- )}
- {
- (rootList && rootList.length === 0) && (fileDetail && fileDetail.length === 0) &&
- }
- { rootList && this.renderReadMeContent(readMeContent, isManager || isDeveloper)}
-
-
- );
- }
-}
-export default CoderRootDirectory;
diff --git a/src/forge/Main/CoderRootIndex.js b/src/forge/Main/CoderRootIndex.js
index 4dd531bc..ceff9d9f 100644
--- a/src/forge/Main/CoderRootIndex.js
+++ b/src/forge/Main/CoderRootIndex.js
@@ -13,10 +13,6 @@ const UploadFile = Loadable({
loader: () => import('../Newfile/upload_file'),
loading: Loading,
})
-const CoderRootDirectory = Loadable({
- loader: () => import('./CoderRootDirectory'),
- loading: Loading,
-})
const CoderRootCommit = Loadable({
loader: () => import('./CoderRootCommit'),
loading: Loading,
diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js
index 43194996..1deeba36 100644
--- a/src/forge/Main/Detail.js
+++ b/src/forge/Main/Detail.js
@@ -120,6 +120,10 @@ const DevAbout = Loadable({
loader: () => import('../About/Index'),
loading: Loading,
})
+const Source = Loadable({
+ loader: () => import('../Source/Index'),
+ loading: Loading,
+})
const DevIndex = Loadable({
loader: () => import('../DevOps/Index'),
loading: Loading,
@@ -145,6 +149,8 @@ function checkPathname(projectsId,owner,pathname){
name="setting"
}else if(url.indexOf(`/devops`)>-1){
name="devops"
+ }else if(url.indexOf(`/source`)>-1){
+ name="source"
}
}
return name;
@@ -532,6 +538,12 @@ class Detail extends Component {
:
+ {/* 资源 */}
+ ()
+ }
+ >
{/* 主页 */}
div{
border-bottom: 1px solid #EEEEEE;
diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx
index a3197306..fbdf5541 100644
--- a/src/forge/Main/sub/DetailBanner.jsx
+++ b/src/forge/Main/sub/DetailBanner.jsx
@@ -66,6 +66,16 @@ function DetailBanner({ list , owner , projectsId , isManager , url , pathname ,
:""
}
+ {
+ item.menu_name === "source" &&
+
+
+
+ 资源库
+ {projectDetail && projectDetail.source_count ? {projectDetail.source_count} :""}
+
+
+ }
{
item.menu_name === "versions" &&
diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js
index fdffad36..90b1b6a7 100644
--- a/src/forge/Settings/Collaborator.js
+++ b/src/forge/Settings/Collaborator.js
@@ -11,7 +11,7 @@ function Collaborator(props){
const [ newGroupId , setNewGroupId] = useState(undefined);
const {projectsId ,owner} = props.match.params;
- const author = props.projectDetail && props.projectDetail.author;
+ const author = props && props.projectDetail && props.projectDetail.author;
function getID(id){
setNewId(id);
diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx
new file mode 100644
index 00000000..475bda0c
--- /dev/null
+++ b/src/forge/Source/Index.jsx
@@ -0,0 +1,17 @@
+import React from 'react';
+import './Index.scss';
+import { Blueback , FlexAJ } from '../Component/layout';
+
+function Index(props){
+ return(
+
+ )
+}
+export default Index;
\ No newline at end of file
diff --git a/src/forge/Source/Index.scss b/src/forge/Source/Index.scss
new file mode 100644
index 00000000..4338c5a9
--- /dev/null
+++ b/src/forge/Source/Index.scss
@@ -0,0 +1,11 @@
+.sourcePanel{
+ width: 1200px;
+ margin: 20px auto;
+ background: #fff;
+ border-radius: 2px;
+ box-shadow: 0px 0px 4px rgba(0,0,0,0.1);
+ .headtitle{
+ padding:15px 20px;
+ border-bottom: 1px solid #eee;
+ }
+}
\ No newline at end of file