Merge branch 'develop'
This commit is contained in:
commit
2d2deec224
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "educoder",
|
"name": "forge",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
@ -3888,11 +3888,6 @@
|
||||||
"randomfill": "^1.0.3"
|
"randomfill": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crypto-js": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npm.taobao.org/crypto-js/download/crypto-js-4.0.0.tgz",
|
|
||||||
"integrity": "sha1-KQSrJnep0EKFai6i74DekuSjbcw="
|
|
||||||
},
|
|
||||||
"crypto-random-string": {
|
"crypto-random-string": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
|
||||||
|
@ -20480,6 +20475,16 @@
|
||||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"xterm": {
|
||||||
|
"version": "4.8.1",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/xterm/download/xterm-4.8.1.tgz",
|
||||||
|
"integrity": "sha1-FVoXKaQ+Gom0BlJOIsVjQznjnKE="
|
||||||
|
},
|
||||||
|
"xterm-addon-fit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/xterm-addon-fit/download/xterm-addon-fit-0.4.0.tgz",
|
||||||
|
"integrity": "sha1-BuDF0KaqrPsAnvVl76HIHpPZAZM="
|
||||||
|
},
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "3.2.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
|
||||||
|
|
|
@ -111,7 +111,9 @@
|
||||||
"webpack-dev-server": "^3.10.3",
|
"webpack-dev-server": "^3.10.3",
|
||||||
"webpack-manifest-plugin": "^2.2.0",
|
"webpack-manifest-plugin": "^2.2.0",
|
||||||
"whatwg-fetch": "2.0.3",
|
"whatwg-fetch": "2.0.3",
|
||||||
"wrap-md-editor": "^0.2.20"
|
"wrap-md-editor": "^0.2.20",
|
||||||
|
"xterm": "4.8.1",
|
||||||
|
"xterm-addon-fit": "0.4.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node --max_old_space_size=15360 scripts/start.js",
|
"start": "node --max_old_space_size=15360 scripts/start.js",
|
||||||
|
|
|
@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
|
||||||
// 判断网络是否连接
|
// 判断网络是否连接
|
||||||
initOnlineOfflineListener();
|
initOnlineOfflineListener();
|
||||||
|
|
||||||
var proxy = "https://forgeplus.trustie.net";
|
var proxy = "https://testforgeplus.trustie.net";
|
||||||
//响应前的设置
|
//响应前的设置
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export function getImageUrl(path) {
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
return `${local}/${path}`
|
return `${local}/${path}`
|
||||||
}
|
}
|
||||||
return `/${path}`;
|
return `${path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getImage(path) {
|
export function getImage(path) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ActivityItem extends Component {
|
||||||
}
|
}
|
||||||
<p className="itemLine mt10">
|
<p className="itemLine mt10">
|
||||||
<Link to={`/users/${item && item.user_login}`} className="show-user-link">
|
<Link to={`/users/${item && item.user_login}`} className="show-user-link">
|
||||||
<img alt="" src={getImageUrl(`images/${item.user_avatar}`)} className="createImage" />
|
<img alt="" src={getImageUrl(`/${item.user_avatar}`)} className="createImage" />
|
||||||
<span className="mr20">{item.user_name}</span>
|
<span className="mr20">{item.user_name}</span>
|
||||||
</Link>
|
</Link>
|
||||||
{item.created_at && <span className="color-grey-9">创建于<span className="ml2 color-grey-6">{item.created_at}</span></span>}
|
{item.created_at && <span className="color-grey-9">创建于<span className="ml2 color-grey-6">{item.created_at}</span></span>}
|
||||||
|
|
|
@ -42,7 +42,7 @@ function AddMember({getID,login}){
|
||||||
className="user_img radius"
|
className="user_img radius"
|
||||||
width="28"
|
width="28"
|
||||||
height="28"
|
height="28"
|
||||||
src={getImageUrl(`images/${item && item.image_url}`)}
|
src={getImageUrl(`/${item && item.image_url}`)}
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<span className="ml10" style={{ "vertical-align": "middle" }}>
|
<span className="ml10" style={{ "vertical-align": "middle" }}>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import './Component.scss';
|
||||||
function Cards({img , title, desc , rightBtn , src}){
|
function Cards({img , title, desc , rightBtn , src}){
|
||||||
return(
|
return(
|
||||||
<div className="cards">
|
<div className="cards">
|
||||||
{img &&<div className="img"><img src={getImageUrl(`images/${img}`)} alt=""/></div>}
|
{img &&<div className="img"><img src={getImageUrl(`/${img}`)} alt=""/></div>}
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<p className="titles">
|
<p className="titles">
|
||||||
<Link to={src}>{title}</Link>
|
<Link to={src}>{title}</Link>
|
||||||
|
|
|
@ -15,7 +15,7 @@ function Contributors({contributors,owner,projectsId}){
|
||||||
contributors && contributors.total_count > 0 ?
|
contributors && contributors.total_count > 0 ?
|
||||||
contributors.list.map((item,key)=>{
|
contributors.list.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
<Link key={key} to={`/users/${item.login}`}><img src={getImageUrl(`images/${item.image_url}`)} alt=""/></Link>
|
<Link key={key} to={`/users/${item.login}`}><img src={getImageUrl(`/${item.image_url}`)} alt=""/></Link>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
:""
|
:""
|
||||||
|
|
|
@ -45,7 +45,7 @@ const Div = styled.div`{
|
||||||
export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => {
|
export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => {
|
||||||
return (
|
return (
|
||||||
<Div>
|
<Div>
|
||||||
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`images/${img}`)} /></Link>
|
<Link to={`/users/${user && user.login}`}><Img src={getImageUrl(`/${img}`)} /></Link>
|
||||||
<div className="m-infos">
|
<div className="m-infos">
|
||||||
<Link to={`/users/${user && user.login}`}><Name>{name}</Name></Link>
|
<Link to={`/users/${user && user.login}`}><Name>{name}</Name></Link>
|
||||||
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>
|
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default ({ getUser })=>{
|
||||||
className="user_img radius"
|
className="user_img radius"
|
||||||
width="28"
|
width="28"
|
||||||
height="28"
|
height="28"
|
||||||
src={getImageUrl(`images/${item && item.image_url}`)}
|
src={getImageUrl(`/${item && item.image_url}`)}
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<span className="ml10" style={{ "vertical-align": "middle" }}>
|
<span className="ml10" style={{ "vertical-align": "middle" }}>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
|
||||||
import { Spin , Menu } from "antd";
|
import { Spin , Menu } from "antd";
|
||||||
import { FlexAJ, AlignCenter } from "../Component/layout";
|
import { FlexAJ, AlignCenter } from "../Component/layout";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import CodeSSH from './ssh/Index';
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
data,
|
data,
|
||||||
|
@ -37,6 +38,7 @@ export default ({
|
||||||
: p[0];
|
: p[0];
|
||||||
|
|
||||||
setStep(sub);
|
setStep(sub);
|
||||||
|
setNav("0");
|
||||||
if (sub && sub.status !== "skipped") {
|
if (sub && sub.status !== "skipped") {
|
||||||
getStep(pre.number, sub.number);
|
getStep(pre.number, sub.number);
|
||||||
}
|
}
|
||||||
|
@ -67,51 +69,55 @@ export default ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Spin spinning={spining}>
|
<React.Fragment>
|
||||||
{/* <Menu className="devopsNav" onClick={(e)=>{setNav(e.key)}} selectedKeys={[nav]} mode="horizontal">
|
{/* <Menu className="devopsNav" onClick={(e)=>{setNav(e.key)}} selectedKeys={[nav]} mode="horizontal">
|
||||||
<Menu.Item key={'0'} value="0">文件</Menu.Item>
|
<Menu.Item key={'0'} value="0">开发流水线</Menu.Item>
|
||||||
<Menu.Item key={'1'} value="1">命令行</Menu.Item>
|
<Menu.Item key={'1'} value="1">命令行</Menu.Item>
|
||||||
</Menu> */}
|
</Menu> */}
|
||||||
{
|
{
|
||||||
nav === "0" &&
|
nav === "0" &&
|
||||||
<div className="rightMainContent">
|
<Spin spinning={spining}>
|
||||||
{data && data.status !== "error" ? (
|
<div className="rightMainContent">
|
||||||
<div>
|
{data && data.status !== "error" ? (
|
||||||
<FlexAJ className="items">
|
|
||||||
<span>{step && step.name}</span>
|
|
||||||
<AlignCenter>
|
|
||||||
{step && step.duration_time}
|
|
||||||
<i className="iconfont icon-sanjiaoxing-down"></i>
|
|
||||||
</AlignCenter>
|
|
||||||
</FlexAJ>
|
|
||||||
<div>
|
<div>
|
||||||
{coders && coders.length > 0 ? (
|
<FlexAJ className="items">
|
||||||
coders.map((item, key) => {
|
<span>{step && step.name}</span>
|
||||||
return (
|
<AlignCenter>
|
||||||
<div className="opsDetailOut">
|
{step && step.duration_time}
|
||||||
<span>{key + 1}</span>
|
<i className="iconfont icon-sanjiaoxing-down"></i>
|
||||||
<p>{item.out}</p>
|
</AlignCenter>
|
||||||
</div>
|
</FlexAJ>
|
||||||
);
|
<div>
|
||||||
})
|
{coders && coders.length > 0 ? (
|
||||||
) : empty ? (
|
coders.map((item, key) => {
|
||||||
<div className="opsDetailOut">
|
return (
|
||||||
<span>1</span>
|
<div className="opsDetailOut">
|
||||||
<p>
|
<span>{key + 1}</span>
|
||||||
{stage && stage.name} – {step && step.name}: Skipped
|
<p>{item.out}</p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
);
|
||||||
) : (
|
})
|
||||||
""
|
) : empty ? (
|
||||||
)}
|
<div className="opsDetailOut">
|
||||||
|
<span>1</span>
|
||||||
|
<p>
|
||||||
|
{stage && stage.name} – {step && step.name}: Skipped
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
) : (
|
||||||
) : (
|
<div style={{ color: "red" }}>error:{data && data.error}</div>
|
||||||
<div style={{ color: "red" }}>error:{data && data.error}</div>
|
)}
|
||||||
)}
|
</div>
|
||||||
</div>
|
</Spin>
|
||||||
}
|
}
|
||||||
|
{
|
||||||
</Spin>
|
nav === "1" && <CodeSSH />
|
||||||
|
}
|
||||||
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import XmlPanel from "./XmlPanel";
|
||||||
|
import mediator from "./mediator";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
// const defaulturl = `http://47.111.130.18:48088`;
|
||||||
|
const defaultValue = {
|
||||||
|
host: "106.75.231.63",
|
||||||
|
port: "2021",
|
||||||
|
ws_url: "wss://pre-webssh.educoder.net/ws",
|
||||||
|
username: "root",
|
||||||
|
secret: "Dron_123123",
|
||||||
|
};
|
||||||
|
function Index() {
|
||||||
|
const [sshConfigData, setSshConfigData] = useState(undefined);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!sshConfigData) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
mediator.publish("create-socket", 1);
|
||||||
|
}, 300);
|
||||||
|
}, [sshConfigData]);
|
||||||
|
|
||||||
|
// 获取服务器连接信息
|
||||||
|
function init() {
|
||||||
|
const url = `/api/ci/pipelines/ssh_server.json`;
|
||||||
|
axios.get(url).then(result=>{
|
||||||
|
if(result && result.data){
|
||||||
|
setSshConfigData({...result.data})
|
||||||
|
}
|
||||||
|
}).catch(error=>{})
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<XmlPanel
|
||||||
|
sshConfigData={sshConfigData||{}}
|
||||||
|
sid={1}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default Index;
|
|
@ -0,0 +1,219 @@
|
||||||
|
import React, { useRef, useEffect, useState } from 'react';
|
||||||
|
import { Base64 } from 'js-base64';
|
||||||
|
|
||||||
|
import { Terminal } from 'xterm';
|
||||||
|
import 'xterm/css/xterm.css';
|
||||||
|
import mediator from './mediator';
|
||||||
|
import ResizeObserver from 'resize-observer-polyfill';
|
||||||
|
|
||||||
|
function getColsAndRows(width, height, term) {
|
||||||
|
let w = term._core._renderService.dimensions.actualCellWidth || 9.5;
|
||||||
|
let h = term._core._renderService.dimensions.actualCellHeight || 18;
|
||||||
|
const rows = Math.floor(height / h);
|
||||||
|
const cols = Math.floor(width / w);
|
||||||
|
return [cols, rows];
|
||||||
|
}
|
||||||
|
|
||||||
|
function onLayout(term, el) {
|
||||||
|
const ro = new ResizeObserver(entries => {
|
||||||
|
console.log(entries);
|
||||||
|
for (let entry of entries) {
|
||||||
|
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
|
||||||
|
const [cols, rows] = getColsAndRows(
|
||||||
|
entry.target.offsetWidth,
|
||||||
|
entry.target.offsetHeight,
|
||||||
|
term,
|
||||||
|
);
|
||||||
|
console.log('cols, rows', cols, rows);
|
||||||
|
term.resize(cols, rows);
|
||||||
|
mediator.publish('ssh-xterm-resize', {
|
||||||
|
columns: cols,
|
||||||
|
rows: rows,
|
||||||
|
width: entry.target.offsetWidth,
|
||||||
|
height: entry.target.offsetHeight,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ro.observe(el);
|
||||||
|
return ro;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TimeTicket = 30000;
|
||||||
|
|
||||||
|
//建立 websockt 来交互
|
||||||
|
//根据容器大小计算行数和列数并做到自适应
|
||||||
|
//socket 与 term 需要分开初始化 因为socket 可能重置连接
|
||||||
|
//mediator 监听消息,如果和id匹配,则建立连接,重置,或关闭连接
|
||||||
|
|
||||||
|
export default ({ sshConfigData, sid }) => {
|
||||||
|
const [term, setTerm] = useState(null);
|
||||||
|
|
||||||
|
const { ws_url, password, port, secret } = sshConfigData;
|
||||||
|
const el = useRef();
|
||||||
|
const socket = useRef();
|
||||||
|
const isFirstConnected = useRef(false);
|
||||||
|
|
||||||
|
//term init
|
||||||
|
useEffect(() => {
|
||||||
|
if (el.current && ws_url) {
|
||||||
|
const term = new Terminal({ fontSize: 16, rendererType: 'dom' });
|
||||||
|
term.open(el.current);
|
||||||
|
|
||||||
|
term.onData(data => {
|
||||||
|
if (socket.current) {
|
||||||
|
if (socket.current.readyState === 1) {
|
||||||
|
socket.current.send(JSON.stringify({ tp: 'client', data: data }));
|
||||||
|
mediator.publish('on-operating-ssh'); //有操作则自动延时
|
||||||
|
} else {
|
||||||
|
//断开连接后重连
|
||||||
|
// socket.current = null
|
||||||
|
// mediator.publish('create-socket', sid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
term.write('Connecting...');
|
||||||
|
setTerm(term);
|
||||||
|
const ro = onLayout(term, el.current);
|
||||||
|
return () => {
|
||||||
|
term.dispose();
|
||||||
|
ro.unobserve(el.current);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [ws_url, el.current]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (term && ws_url) {
|
||||||
|
function createSocket() {
|
||||||
|
const socketInstance = new WebSocket(ws_url);
|
||||||
|
socket.current = socketInstance;
|
||||||
|
|
||||||
|
socketInstance.onopen = () => {
|
||||||
|
let container = term.element.parentElement;
|
||||||
|
if (container) {
|
||||||
|
let width = container.offsetWidth;
|
||||||
|
let height = container.offsetHeight;
|
||||||
|
console.log('init', {
|
||||||
|
tp: 'init',
|
||||||
|
data: {
|
||||||
|
...sshConfigData,
|
||||||
|
secret: secret,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
rows: term.rows,
|
||||||
|
columns: term.cols,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
socketInstance.send(
|
||||||
|
JSON.stringify({
|
||||||
|
tp: 'init',
|
||||||
|
data: {
|
||||||
|
...sshConfigData,
|
||||||
|
secret: secret,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
rows: term.rows,
|
||||||
|
columns: term.cols,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
term.focus();
|
||||||
|
};
|
||||||
|
socketInstance.onerror = error => {
|
||||||
|
console.log(
|
||||||
|
'------in socket error----',
|
||||||
|
error,
|
||||||
|
socketInstance,
|
||||||
|
ws_url,
|
||||||
|
);
|
||||||
|
//连接报错后,重新请求资源
|
||||||
|
// mediator.publish('on-recreate-socket')
|
||||||
|
};
|
||||||
|
socketInstance.onmessage = event => {
|
||||||
|
if (!isFirstConnected.current) {
|
||||||
|
term.write('\r');
|
||||||
|
// term.focus()
|
||||||
|
setTimeout(() => {
|
||||||
|
// term.clear();
|
||||||
|
}, 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);
|
||||||
|
};
|
||||||
|
|
||||||
|
socketInstance.onclose = evt => {
|
||||||
|
if (tid) {
|
||||||
|
clearInterval(tid);
|
||||||
|
}
|
||||||
|
term.write('\r\nconnection closed');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const tid = setInterval(() => {
|
||||||
|
if (socket.current) {
|
||||||
|
socket.current.send(JSON.stringify({ tp: 'h' }));
|
||||||
|
}
|
||||||
|
}, TimeTicket);
|
||||||
|
|
||||||
|
const unSubCreate = mediator.subscribe('create-socket', id => {
|
||||||
|
if (sid === id) {
|
||||||
|
if (socket.current && socket.current.readyState === 1) {
|
||||||
|
term.focus();
|
||||||
|
} else {
|
||||||
|
createSocket();
|
||||||
|
}
|
||||||
|
term.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const unSubClose = mediator.subscribe('close-socket', id => {
|
||||||
|
if (sid === id) {
|
||||||
|
if (socket.current) {
|
||||||
|
socket.current.close();
|
||||||
|
isFirstConnected.current = false;
|
||||||
|
term.clear();
|
||||||
|
}
|
||||||
|
socket.current = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const unSubResize = mediator.subscribe('ssh-xterm-resize', option => {
|
||||||
|
if (socket.current && socket.current.readyState === 1) {
|
||||||
|
socket.current.send(
|
||||||
|
JSON.stringify({ tp: 'resize', data: { ...option } }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const unSubAddTime = mediator.subscribe('ssh-add-connect-time', () => {
|
||||||
|
if (socket.current && socket.current.readyState === 1) {
|
||||||
|
socket.current.send(JSON.stringify({ tp: 'overtime' }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unSubClose();
|
||||||
|
unSubCreate();
|
||||||
|
unSubResize();
|
||||||
|
unSubAddTime();
|
||||||
|
if (socket.current) {
|
||||||
|
socket.current.close();
|
||||||
|
isFirstConnected.current = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [term, ws_url, port]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={el} className="xterm-panel" style={{height:"100%"}}>
|
||||||
|
{!ws_url ? <p style={{ color: '#fff' }}>正在连接命令行服务...</p> : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,46 @@
|
||||||
|
function Mediator(obj) {
|
||||||
|
const channels = {};
|
||||||
|
|
||||||
|
const mediator = {
|
||||||
|
subscribe: function(channel, cb) {
|
||||||
|
if (!channels[channel]) {
|
||||||
|
channels[channel] = [];
|
||||||
|
}
|
||||||
|
channels[channel].push(cb);
|
||||||
|
return this.unsubscribe.bind(null, channel, cb);
|
||||||
|
},
|
||||||
|
|
||||||
|
unsubscribe: function(channel, cb) {
|
||||||
|
let rs = channels[channel];
|
||||||
|
let index = -1;
|
||||||
|
if (rs) {
|
||||||
|
for (let i = 0; i < rs.length; i++) {
|
||||||
|
if (rs[i].name === cb.name) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index >= 0) {
|
||||||
|
channels[channel].splice(index, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
publish: function(channel) {
|
||||||
|
if (!channels[channel]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
channels[channel].forEach(subscription => {
|
||||||
|
subscription.apply(null, args);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return obj ? Object.assign(obj, mediator) : mediator;
|
||||||
|
}
|
||||||
|
const mediator = new Mediator();
|
||||||
|
export default mediator;
|
|
@ -603,7 +603,7 @@ class NewHeader extends Component {
|
||||||
<a href={settings && settings.new_course.default_url} className={"fl mr30"} style={{minWidth:"45px"}}>
|
<a href={settings && settings.new_course.default_url} className={"fl mr30"} style={{minWidth:"45px"}}>
|
||||||
{
|
{
|
||||||
settings && settings.nav_logo_url ?
|
settings && settings.nav_logo_url ?
|
||||||
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(settings.nav_logo_url)}></img>
|
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(`/${settings.nav_logo_url}`)}></img>
|
||||||
:
|
:
|
||||||
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={logo}></img>
|
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={logo}></img>
|
||||||
}
|
}
|
||||||
|
@ -703,8 +703,7 @@ class NewHeader extends Component {
|
||||||
:
|
:
|
||||||
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}>
|
<div className="ml30 edu-menu-panel" style={{ height: "70px", lineHeight: "70px" }}>
|
||||||
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>
|
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>
|
||||||
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image"
|
<img alt="头像" className="radius" height="34" id="nh_user_logo" name="avatar_image" src={getImageUrl(`/${user.image_url}`)} width="34">
|
||||||
src={getImageUrl(`images/` + user.image_url)} width="34">
|
|
||||||
</img>
|
</img>
|
||||||
</a>
|
</a>
|
||||||
<ul className="edu-menu-list" style={{ top: '60px', textAlign: 'center' }}>
|
<ul className="edu-menu-list" style={{ top: '60px', textAlign: 'center' }}>
|
||||||
|
|
|
@ -315,7 +315,7 @@ function CoderDepot(props){
|
||||||
{
|
{
|
||||||
lastCommit &&
|
lastCommit &&
|
||||||
<div className="listtablehead">
|
<div className="listtablehead">
|
||||||
<User url={getImageUrl(`images/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
|
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
|
||||||
<div className={hideBtn && hide ? "ellipsistxt hide" :"ellipsistxt"}><p id="ptxt">{lastCommit && lastCommit.message}</p></div>
|
<div className={hideBtn && hide ? "ellipsistxt hide" :"ellipsistxt"}><p id="ptxt">{lastCommit && lastCommit.message}</p></div>
|
||||||
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
|
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,49 @@
|
||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import RenderHtml from '../../components/render-html';
|
import RenderHtml from '../../components/render-html';
|
||||||
|
import { Dropdown , Menu , Spin } from 'antd';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
const $ = window.$;
|
||||||
|
|
||||||
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
||||||
|
const [ menuList ,setMenuList ] = useState(undefined);
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(readme && readme.content){
|
||||||
|
let path = history.location.pathname;
|
||||||
|
const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) {
|
||||||
|
const anchor = el.id;
|
||||||
|
const level = el.tagName.replace("H", "");
|
||||||
|
const href = `#${anchor}`;
|
||||||
|
return { href:`${path}${href}`,text:el.textContent , level:level }
|
||||||
|
});
|
||||||
|
setMenuList(items);
|
||||||
|
}
|
||||||
|
},[readme])
|
||||||
|
|
||||||
|
function menu(){
|
||||||
|
if(menuList && menuList.length > 0){
|
||||||
|
let hash = history.location.hash;
|
||||||
|
return(
|
||||||
|
<Menu className="menuslist">
|
||||||
|
{
|
||||||
|
menuList.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Menu.Item key={item.id} className={decodeURI(hash).indexOf(item.text)>-1 ?"active":""}><Link to={`${item.href}`} style={{paddingLeft:`${item.level *10}px`}} title={item.text}>{item.text}</Link></Menu.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
return <Spin />
|
||||||
|
}
|
||||||
|
}
|
||||||
return(
|
return(
|
||||||
<div className="commonBox" id="readme">
|
<div className="commonBox" id="readme">
|
||||||
<div className="commonBox-title">
|
<div className="commonBox-title">
|
||||||
<span className="mr10">
|
<Dropdown overlay={menu()}>
|
||||||
<i className="iconfont icon-wenjian1 font-16 color-grey-9 fl mt3"></i>
|
<i className="iconfont icon-zhangjie1 font-16 color-grey-3 mr10"></i>
|
||||||
</span>
|
</Dropdown>
|
||||||
<span className="commonBox-title-read">README.md</span>
|
<span className="commonBox-title-read">README.md</span>
|
||||||
{
|
{
|
||||||
operate ?
|
operate ?
|
||||||
|
|
|
@ -140,11 +140,11 @@ class CoderRootCommit extends Component{
|
||||||
{
|
{
|
||||||
item.id ?
|
item.id ?
|
||||||
<Link to={`/users/${item.login}`} className="show-user-link">
|
<Link to={`/users/${item.login}`} className="show-user-link">
|
||||||
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
|
{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>
|
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
|
||||||
</Link>:
|
</Link>:
|
||||||
<span className="show-user-link">
|
<span className="show-user-link">
|
||||||
{item.image_url?<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr15 radius"/>:""}
|
{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>
|
<label className="font-14 color-grey-6" style={{verticalAlign:'middle'}}>{item.name ?`${item.name}:`:""}提交于 {item.time_from_now}</label>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,18 @@ class CoderRootFileDetail extends Component {
|
||||||
this.languages_total();
|
this.languages_total();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentDidUpdate=(prevProps)=>{
|
||||||
|
const { content } = this.props && this.props.detail;
|
||||||
|
const prevcontent = prevProps.detail && prevProps.detail.content;
|
||||||
|
if (content && prevcontent) {
|
||||||
|
if (prevcontent !== content){
|
||||||
|
this.setState({
|
||||||
|
description: content
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
languages_total = () => {
|
languages_total = () => {
|
||||||
const { detail } = this.props;
|
const { detail } = this.props;
|
||||||
const file_name = detail.path.split("/").pop().split(".").pop();
|
const file_name = detail.path.split("/").pop().split(".").pop();
|
||||||
|
@ -273,7 +285,7 @@ class CoderRootFileDetail extends Component {
|
||||||
{...this.state}
|
{...this.state}
|
||||||
language={language ? language : "javascript"}
|
language={language ? language : "javascript"}
|
||||||
filepath={`/${detail.path}`}
|
filepath={`/${detail.path}`}
|
||||||
content={detail.content}
|
content={description}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
editorType="update"
|
editorType="update"
|
||||||
currentBranch={currentBranch}
|
currentBranch={currentBranch}
|
||||||
|
|
|
@ -65,7 +65,7 @@ export default ({ match , history }) => {
|
||||||
<div className="f-wrap-between" style={{ alignItems: "center" }}>
|
<div className="f-wrap-between" style={{ alignItems: "center" }}>
|
||||||
<ul className="df">
|
<ul className="df">
|
||||||
<User
|
<User
|
||||||
url={(committer && getImageUrl(`images/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
|
url={(committer && getImageUrl(`/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
|
||||||
name={committer && committer.name}
|
name={committer && committer.name}
|
||||||
/>
|
/>
|
||||||
{committer && committer.time_from_now && <li className="ml20 mt2">{committer.time_from_now}</li>}
|
{committer && committer.time_from_now && <li className="ml20 mt2">{committer.time_from_now}</li>}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Menu, Input , Spin, Pagination , Popover , Select } from 'antd';
|
import { Menu, Input , Spin, Pagination , Popover , Select } from 'antd';
|
||||||
import { getUrl } from 'educoder';
|
import { getImageUrl } from 'educoder';
|
||||||
import '../css/index.scss'
|
import '../css/index.scss'
|
||||||
import './list.css';
|
import './list.css';
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
|
@ -271,7 +271,7 @@ class Index extends Component {
|
||||||
return(
|
return(
|
||||||
<div onClick={()=>this.getoDetail(item.author && item.author.login,item.identifier)}>
|
<div onClick={()=>this.getoDetail(item.author && item.author.login,item.identifier)}>
|
||||||
<div className="mainInfo">
|
<div className="mainInfo">
|
||||||
<img src={getUrl(`/images/${item.author && item.author.image_url}`)} alt=""/>
|
<img src={getImageUrl(`/${item.author && item.author.image_url}`)} alt=""/>
|
||||||
<p className="school">{item.name}</p>
|
<p className="school">{item.name}</p>
|
||||||
<p className="name">{item.author && item.author.name}</p>
|
<p className="name">{item.author && item.author.name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -286,4 +286,23 @@
|
||||||
.downMenu{
|
.downMenu{
|
||||||
box-shadow: 0px 0px 9px rgba(134, 134, 134,0.4);
|
box-shadow: 0px 0px 9px rgba(134, 134, 134,0.4);
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menuslist{
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding:10px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
.ant-dropdown-menu-item{
|
||||||
|
border-radius: 8px;
|
||||||
|
a{
|
||||||
|
width: 350px;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ant-dropdown-menu-item.active{
|
||||||
|
background-color: #e6f7ff;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ class IndexItem extends Component {
|
||||||
</a>
|
</a>
|
||||||
:
|
:
|
||||||
<Link to={item.author && (item.author.type === "Organization" ? `/organize/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
|
<Link to={item.author && (item.author.type === "Organization" ? `/organize/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
|
||||||
<img className="p-r-photo" alt="" src={getImageUrl(`${item.author && item.author.image_url}`)} ></img>
|
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
|
||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
<div className="p-r-Infos">
|
<div className="p-r-Infos">
|
||||||
|
|
|
@ -437,9 +437,6 @@
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border-bottom: 1px solid #d9d9d9;
|
border-bottom: 1px solid #d9d9d9;
|
||||||
}
|
}
|
||||||
.branchUl{
|
|
||||||
padding:0px 30px;
|
|
||||||
}
|
|
||||||
.branchUl li{
|
.branchUl li{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
|
@ -50,7 +50,7 @@ function Contribute(props){
|
||||||
list.map((item,key)=>{
|
list.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
<AlignCenter>
|
<AlignCenter>
|
||||||
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`images/${item.image_url}`)} width="50px" height="50px"/>
|
<img alt="" style={{borderRadius:"50%",marginRight:"10px"}} src={getImageUrl(`/${item.image_url}`)} width="50px" height="50px"/>
|
||||||
<div>
|
<div>
|
||||||
<Link to={`/users/${item.login}`} className="font-16">{item.name}</Link>
|
<Link to={`/users/${item.login}`} className="font-16">{item.name}</Link>
|
||||||
<p className="font-12 color-grey-9">提交{item.contributions}次</p>
|
<p className="font-12 color-grey-9">提交{item.contributions}次</p>
|
||||||
|
|
|
@ -22,7 +22,7 @@ function Commits({ commits , projectsId , owner }){
|
||||||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
|
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(item.sha)}`} className="color-blue">浏览代码</Link>
|
||||||
</FlexAJ>
|
</FlexAJ>
|
||||||
<AlignCenter className="mt15">
|
<AlignCenter className="mt15">
|
||||||
<User url={getImageUrl(`images/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>:提交于{item.time_from_now}</span>
|
<User url={getImageUrl(`/${item.committer && item.committer.image_url}`)} name={`${item.committer && item.committer.name}`}></User><span>:提交于{item.time_from_now}</span>
|
||||||
</AlignCenter>
|
</AlignCenter>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Popconfirm, Tag } from "antd";
|
import { Tag } from "antd";
|
||||||
|
import { AlignCenter } from '../Component/layout';
|
||||||
import { getImageUrl } from "educoder";
|
import { getImageUrl } from "educoder";
|
||||||
import "./merge.css";
|
import "./merge.css";
|
||||||
|
|
||||||
|
@ -74,13 +75,13 @@ class MergeItem extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="radius"
|
className="radius"
|
||||||
src={getImageUrl(`images/${item && item.avatar_url}`)}
|
src={getImageUrl(`/${item && item.avatar_url}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
<span>
|
<AlignCenter>
|
||||||
<Link
|
<Link
|
||||||
to={`/users/${item && item.author_login}`}
|
to={`/users/${item && item.author_login}`}
|
||||||
className="show-user-link color-grey-8 ml5"
|
className="show-user-link color-grey-8 ml5"
|
||||||
|
@ -124,7 +125,7 @@ class MergeItem extends Component {
|
||||||
</Link>
|
</Link>
|
||||||
</Tag>
|
</Tag>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</AlignCenter>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ul
|
<ul
|
||||||
|
|
|
@ -101,7 +101,7 @@ class MergeSubmit extends Component{
|
||||||
render: (text,item) => (
|
render: (text,item) => (
|
||||||
<span className="f-wrap-alignCenter">
|
<span className="f-wrap-alignCenter">
|
||||||
<Link to={`/users/${item.login}`} className="show-user-link">
|
<Link to={`/users/${item.login}`} className="show-user-link">
|
||||||
<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
|
<img src={getImageUrl(`/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
|
||||||
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
|
<label className="hide-1" style={{maxWidth:"75px",'vertical-align':'middle'}}>{text}</label>
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -12,6 +12,13 @@ class m_editor extends Component {
|
||||||
editorValue: this.props.content,
|
editorValue: this.props.content,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
componentDidUpdate=(prevProps)=>{
|
||||||
|
if(prevProps && this.props && this.props.content !== prevProps.content){
|
||||||
|
this.setState({
|
||||||
|
editorValue:this.props.content
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
changeEditor = (editorValue) => {
|
changeEditor = (editorValue) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
editorValue,
|
editorValue,
|
||||||
|
|
|
@ -212,7 +212,7 @@ class Detail extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="user_img"
|
className="user_img"
|
||||||
src={getImageUrl(`images/${data && data.author_picture}`)}
|
src={getImageUrl(`/${data && data.author_picture}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="50"
|
width="50"
|
||||||
height="50"
|
height="50"
|
||||||
|
|
|
@ -26,8 +26,8 @@ function Collaborator(props){
|
||||||
{
|
{
|
||||||
author && author.type === "Organization" ?
|
author && author.type === "Organization" ?
|
||||||
<span>
|
<span>
|
||||||
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>setNav("1")}>协作者管理</span>
|
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span>
|
||||||
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>setNav("2")}>团队管理</span>
|
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined)}}>团队管理</span>
|
||||||
</span>
|
</span>
|
||||||
:
|
:
|
||||||
<span className="font-18 text-black">协作者管理</span>
|
<span className="font-18 text-black">协作者管理</span>
|
||||||
|
|
|
@ -186,7 +186,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
|
||||||
className="show-user-link"
|
className="show-user-link"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={getImageUrl(`images/${text}`)}
|
src={getImageUrl(`/${text}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="32px"
|
width="32px"
|
||||||
height="32px"
|
height="32px"
|
||||||
|
|
|
@ -12,8 +12,7 @@ import axios from 'axios';
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
const sort = [
|
const sort = [
|
||||||
"按上传时间排序",
|
"按上传时间排序",
|
||||||
"按下载次数排序",
|
"按下载次数排序"
|
||||||
"按引用排序"
|
|
||||||
]
|
]
|
||||||
const limit = 15;
|
const limit = 15;
|
||||||
const https = 'https://testfiles.trustie.net';
|
const https = 'https://testfiles.trustie.net';
|
||||||
|
@ -191,7 +190,7 @@ function Index(props){
|
||||||
/>
|
/>
|
||||||
<div className="headtitle">
|
<div className="headtitle">
|
||||||
<FlexAJ>
|
<FlexAJ>
|
||||||
<span className="font-18">资源库(18)</span>
|
<span className="font-18">资源库{total ? <span>({total})</span>:""}</span>
|
||||||
{ current_user && current_user.login && (props.projectDetail && props.projectDetail.permission) ?
|
{ current_user && current_user.login && (props.projectDetail && props.projectDetail.permission) ?
|
||||||
<Blueback onClick={()=>{setId(undefined);setVisible(true);}}>上传资源</Blueback>:""
|
<Blueback onClick={()=>{setId(undefined);setVisible(true);}}>上传资源</Blueback>:""
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ export default (({ data , current_user , successFunc }) => {
|
||||||
data.map((item, key) => {
|
data.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<Cards
|
<Cards
|
||||||
|
user={item.user}
|
||||||
img={item.user.image_url}
|
img={item.user.image_url}
|
||||||
name={item.user.name}
|
name={item.user.name}
|
||||||
time={item.created_at}
|
time={item.created_at}
|
||||||
|
|
|
@ -30,8 +30,8 @@ export default (({projects}) => {
|
||||||
projects.map((item, key) => {
|
projects.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<Div>
|
<Div>
|
||||||
<Imgs src={item.project && getImageUrl(`images/${item.project.owner_image_url}`)}/>
|
<Imgs src={item.project && getImageUrl(`/${item.project.owner_image_url}`)}/>
|
||||||
<Link to={`/projects/${item.project.owner_name}/${item.project.identifier}`}>{item.project.name}</Link>
|
<Link to={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.name}</Link>
|
||||||
</Div>
|
</Div>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default ((props) => {
|
||||||
group ?
|
group ?
|
||||||
<div>
|
<div>
|
||||||
<AlignCenterBetween>
|
<AlignCenterBetween>
|
||||||
<span className="color-grey-3">{group.name}</span>
|
<span className="color-grey-3">{group.nickname}</span>
|
||||||
{group.is_member && !group.is_admin ?
|
{group.is_member && !group.is_admin ?
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确认离开团队吗?"
|
title="确认离开团队吗?"
|
||||||
|
|
|
@ -137,17 +137,39 @@ export default Form.create()(
|
||||||
history.push(`/organize/${OIdentifier}`);
|
history.push(`/organize/${OIdentifier}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkname(rule, value, callback){
|
||||||
|
if(!value){
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){
|
||||||
|
callback("只能使用英文字母和数字,以字母开头,长度为4到15个字符");
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Spin spinning={isSpin}>
|
<Spin spinning={isSpin}>
|
||||||
<WhiteBack className="mb30">
|
<WhiteBack className="mb30" style={{border:groupId?"none":"1px solid #eee"}}>
|
||||||
<Banner>{groupId ? "基本设置" : "新建团队"}</Banner>
|
<Banner>{groupId ? "基本设置" : "新建团队"}</Banner>
|
||||||
<Div>
|
<Div>
|
||||||
<Form>
|
<Form>
|
||||||
{helper(
|
{helper(
|
||||||
'团队名称:',
|
'团队标识:',
|
||||||
"name",
|
"name",
|
||||||
|
[
|
||||||
|
{ required: true, message: "请输入团队标识" },
|
||||||
|
{
|
||||||
|
validator:checkname
|
||||||
|
}
|
||||||
|
],
|
||||||
|
<Input placeholder="请输入团队标识" disabled={onwers}/>, true
|
||||||
|
)}
|
||||||
|
{helper(
|
||||||
|
'团队名称:',
|
||||||
|
"nickname",
|
||||||
[{ required: true, message: "请输入团队名称" }],
|
[{ required: true, message: "请输入团队名称" }],
|
||||||
<Input placeholder="请输入团队名称" disabled={onwers}/>, true
|
<Input placeholder="请输入团队名称"/>, true
|
||||||
)}
|
)}
|
||||||
{helper(
|
{helper(
|
||||||
<span className="mb5">团队描述:<span className="color-grey-8">(描述团队的目的或作用)</span></span>,
|
<span className="mb5">团队描述:<span className="color-grey-8">(描述团队的目的或作用)</span></span>,
|
||||||
|
|
|
@ -76,7 +76,7 @@ export default ((props) => {
|
||||||
width: "7%",
|
width: "7%",
|
||||||
render: (value, item) => {
|
render: (value, item) => {
|
||||||
return (
|
return (
|
||||||
<Img src={getImageUrl(`images/${item.user.image_url}`)}></Img>
|
<Img src={getImageUrl(`/${item.user.image_url}`)}></Img>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -180,7 +180,7 @@ function GroupProjectSetting(props) {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
title={<a href={`/projects/${item.project.owner_name}/${item.project.name}`}>{item.project.owner_name}/{item.project.name}</a>}
|
title={<a href={`/projects/${item.project.owner_login}/${item.project.identifier}`}>{item.project.owner_name}/{item.project.name}</a>}
|
||||||
/>
|
/>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -72,7 +72,7 @@ function RightBox({ OIdentifier , history , admin }) {
|
||||||
memberData.organization_users.map((item,key)=>{
|
memberData.organization_users.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
<div className="teammembers" key={key}>
|
<div className="teammembers" key={key}>
|
||||||
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`images/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
|
<Link to={`/users/${item.user && item.user.login}`}><Img src={getImageUrl(`/${item.user && item.user.image_url}`)} alt="" className="m-img"/></Link>
|
||||||
<div>
|
<div>
|
||||||
<Link to={`/users/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
|
<Link to={`/users/${item.user && item.user.login}`}><ListName>{item.user && item.user.name}</ListName></Link>
|
||||||
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间:{item.created_at}</Span></Align>
|
<Align><i className="iconfont icon-shijian color-green mr3 font-13"></i><Span>加入时间:{item.created_at}</Span></Align>
|
||||||
|
|
|
@ -169,7 +169,7 @@ export default Form.create()(
|
||||||
<Input value="-1" style={{width:"350px"}}/>
|
<Input value="-1" style={{width:"350px"}}/>
|
||||||
)}
|
)}
|
||||||
<p>选择头像:</p>
|
<p>选择头像:</p>
|
||||||
<UploadImage url={getImageUrl(`images/${image}`)} getImage={getImage}/>
|
<UploadImage url={getImageUrl(`/${image}`)} getImage={getImage}/>
|
||||||
<Button type={"primary"} onClick={updateDetail}>更新仓库设置</Button>
|
<Button type={"primary"} onClick={updateDetail}>更新仓库设置</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Div>
|
</Div>
|
||||||
|
|
|
@ -64,7 +64,7 @@ export default (({organizeDetail})=>{
|
||||||
width:"5%",
|
width:"5%",
|
||||||
render:(value)=>{
|
render:(value)=>{
|
||||||
return(
|
return(
|
||||||
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('images/'+value.image_url)}></Img> </Link>
|
value && <Link to={`/users/${value && value.login}`}><Img src={getImageUrl('/'+value.image_url)}></Img> </Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -78,7 +78,7 @@ function Detail(props){
|
||||||
detail &&
|
detail &&
|
||||||
<Cards
|
<Cards
|
||||||
src={`/organize/${detail.name}`}
|
src={`/organize/${detail.name}`}
|
||||||
title={detail.name}
|
title={detail.nickname}
|
||||||
desc={!buttonflag && detail.description}
|
desc={!buttonflag && detail.description}
|
||||||
img={detail.avatar_url}
|
img={detail.avatar_url}
|
||||||
rightBtn={
|
rightBtn={
|
||||||
|
|
|
@ -75,7 +75,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
||||||
return(
|
return(
|
||||||
<div key={key}>
|
<div key={key}>
|
||||||
<p className="g-head">
|
<p className="g-head">
|
||||||
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.name}</Link>
|
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
||||||
<span>
|
<span>
|
||||||
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
|
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
|
||||||
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
|
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
|
||||||
|
@ -86,7 +86,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
||||||
{
|
{
|
||||||
item.users && item.users.map((i,k)=>{
|
item.users && item.users.map((i,k)=>{
|
||||||
return(
|
return(
|
||||||
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`images/${i.image_url}`)}/></Link>
|
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
|
||||||
:
|
:
|
||||||
k === count ?
|
k === count ?
|
||||||
<Link to={`/organize/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
|
<Link to={`/organize/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ForkUsers extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="avatar-60"
|
className="avatar-60"
|
||||||
src={getImageUrl(`images/${item.image_url}`)}
|
src={getImageUrl(`/${item.image_url}`)}
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -18,7 +18,7 @@ class UserList extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="avatar-60"
|
className="avatar-60"
|
||||||
src={getImageUrl(`images/${item.image_url}`)}
|
src={getImageUrl(`/${item.image_url}`)}
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -118,7 +118,7 @@ class children_comments extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="radius"
|
className="radius"
|
||||||
src={getImageUrl(`images/${item && item.user_picture}`)}
|
src={getImageUrl(`/${item && item.user_picture}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="30"
|
width="30"
|
||||||
height="30"
|
height="30"
|
||||||
|
|
|
@ -82,7 +82,7 @@ class children_journals extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="radius"
|
className="radius"
|
||||||
src={getImageUrl(`images/${item && item.user_picture}`)}
|
src={getImageUrl(`/${item && item.user_picture}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="30"
|
width="30"
|
||||||
height="30"
|
height="30"
|
||||||
|
|
|
@ -375,7 +375,7 @@ class comments extends Component {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="radius"
|
className="radius"
|
||||||
src={getImageUrl(`images/${item && item.user_picture}`)}
|
src={getImageUrl(`/${item && item.user_picture}`)}
|
||||||
alt=""
|
alt=""
|
||||||
width="30"
|
width="30"
|
||||||
height="30"
|
height="30"
|
||||||
|
@ -471,7 +471,7 @@ class comments extends Component {
|
||||||
className="radius"
|
className="radius"
|
||||||
src={
|
src={
|
||||||
current_user && current_user.image_url
|
current_user && current_user.image_url
|
||||||
? getImageUrl(`images/${current_user.image_url}`)
|
? getImageUrl(`/${current_user.image_url}`)
|
||||||
: "images/avatars/User/b"
|
: "images/avatars/User/b"
|
||||||
}
|
}
|
||||||
alt=""
|
alt=""
|
||||||
|
@ -528,7 +528,7 @@ class comments extends Component {
|
||||||
className="radius"
|
className="radius"
|
||||||
src={
|
src={
|
||||||
current_user && current_user.image_url
|
current_user && current_user.image_url
|
||||||
? getImageUrl(`images/${current_user.image_url}`)
|
? getImageUrl(`/${current_user.image_url}`)
|
||||||
: "images/avatars/User/b"
|
: "images/avatars/User/b"
|
||||||
}
|
}
|
||||||
alt=""
|
alt=""
|
||||||
|
|
|
@ -150,7 +150,7 @@ class Infos extends Component {
|
||||||
<div className="list-l-Menu text-center pd20 ">
|
<div className="list-l-Menu text-center pd20 ">
|
||||||
<Avatar
|
<Avatar
|
||||||
size={110}
|
size={110}
|
||||||
src={getImageUrl(`images/${user && user.image_url}`)}
|
src={getImageUrl(`/${user && user.image_url}`)}
|
||||||
/>
|
/>
|
||||||
{user && user.user_identity && (
|
{user && user.user_identity && (
|
||||||
<div className="mt-n15 position-relative">
|
<div className="mt-n15 position-relative">
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { getImageUrl } from 'educoder';
|
||||||
function TeamItem({item,history}){
|
function TeamItem({item,history}){
|
||||||
return(
|
return(
|
||||||
<div onClick={()=>{history.push(`/organize/${item.name}`)}} style={{cursor:"pointer"}}>
|
<div onClick={()=>{history.push(`/organize/${item.name}`)}} style={{cursor:"pointer"}}>
|
||||||
<div className="imgBox"><img alt="" src={getImageUrl(`images/${item.avatar_url}`)}/></div>
|
<div className="imgBox"><img alt="" src={getImageUrl(`/${item.avatar_url}`)}/></div>
|
||||||
<div style={{flex:'1'}}>
|
<div style={{flex:'1'}}>
|
||||||
<span className="mb5 font-18 color-grey-3 task-hide">{item.name}</span>
|
<span className="mb5 font-18 color-grey-3 task-hide">{item.name}</span>
|
||||||
<div className="task-hide-2">
|
<div className="task-hide-2">
|
||||||
|
|
|
@ -1,34 +1,14 @@
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { SnackbarHOC,getImageUrl } from 'educoder';
|
import { getImageUrl } from 'educoder';
|
||||||
import '../courses/css/members.css';
|
import '../courses/css/members.css';
|
||||||
import "../courses/common/formCommon.css"
|
import "../courses/common/formCommon.css";
|
||||||
import '../courses/css/Courses.css';
|
import '../courses/css/Courses.css';
|
||||||
import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png';
|
import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png';
|
||||||
import educodernet from '../../../src/images/login/educodernet.png';
|
import educodernet from '../../../src/images/login/educodernet.png';
|
||||||
import LoginRegisterComponent from '../user/LoginRegisterComponent';
|
import LoginRegisterComponent from '../user/LoginRegisterComponent';
|
||||||
import FindPasswordComponent from '../user/FindPasswordComponent';
|
import FindPasswordComponent from '../user/FindPasswordComponent';
|
||||||
import passopen from "../../images/login/passopen.png";
|
|
||||||
//educoder登入页面
|
//educoder登入页面
|
||||||
var sectionStyle = {
|
|
||||||
"height": "100%",
|
|
||||||
"width": "100%",
|
|
||||||
"min-width": "1000px",
|
|
||||||
// makesure here is String确保这里是一个字符串,以下是es6写法
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
var imgback = {
|
|
||||||
" background-size":"cover",
|
|
||||||
"background-repeat":"no-repeat",
|
|
||||||
backgroundImage: `url(${beijintulogontwo})`,
|
|
||||||
}
|
|
||||||
var imgmian ={
|
|
||||||
width: "100%",
|
|
||||||
background: `url(${beijintulogontwo})`,
|
|
||||||
position: "relative",
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var newContainer={
|
var newContainer={
|
||||||
background: `url(${beijintulogontwo})`,
|
background: `url(${beijintulogontwo})`,
|
||||||
|
@ -89,11 +69,6 @@ class EducoderLogin extends Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
// console.log("EducoderLogin");
|
|
||||||
// console.log(this.props);
|
|
||||||
}
|
|
||||||
|
|
||||||
Setlogins=(i)=>{
|
Setlogins=(i)=>{
|
||||||
console.log("96ye");
|
console.log("96ye");
|
||||||
console.log(i)
|
console.log(i)
|
||||||
|
@ -120,9 +95,6 @@ class EducoderLogin extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let {showbool,loginstatus,logini} = this.state;
|
let {showbool,loginstatus,logini} = this.state;
|
||||||
// console.log("EducoderLogingetHelmetapi");
|
|
||||||
// console.log(this.props);
|
|
||||||
// console.log(this.props.mygetHelmetapi);
|
|
||||||
return (
|
return (
|
||||||
<div style={newContainer} className=" clearfix" >
|
<div style={newContainer} className=" clearfix" >
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ body>.-task-title {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-top:70px;
|
|
||||||
}
|
}
|
||||||
.newHeaders{
|
.newHeaders{
|
||||||
max-width: unset;
|
max-width: unset;
|
||||||
|
|
|
@ -427,6 +427,7 @@ export function TPMIndexHOC(WrappedComponent) {
|
||||||
tip={this._gLoadingTip || "加载中..."}
|
tip={this._gLoadingTip || "加载中..."}
|
||||||
>
|
>
|
||||||
<div className="newContainer newContainers">
|
<div className="newContainer newContainers">
|
||||||
|
<div style={{height:"70px"}}></div>
|
||||||
{
|
{
|
||||||
current_user &&
|
current_user &&
|
||||||
<WrappedComponent initCommonState={(user) => this.initCommonState(user)}
|
<WrappedComponent initCommonState={(user) => this.initCommonState(user)}
|
||||||
|
|
Loading…
Reference in New Issue