Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
3e5a2f02
A
algorithm-visualizer
项目概览
tianyazhichiC
/
algorithm-visualizer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
algorithm-visualizer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3e5a2f02
编写于
7月 19, 2018
作者:
J
Jason Park
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add facebook share and add todo's
上级
b44161ee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
5 deletion
+7
-5
src/backend/controllers/tracers.js
src/backend/controllers/tracers.js
+1
-0
src/frontend/components/App/index.jsx
src/frontend/components/App/index.jsx
+2
-1
src/frontend/components/Header/index.jsx
src/frontend/components/Header/index.jsx
+4
-4
未找到文件。
src/backend/controllers/tracers.js
浏览文件 @
3e5a2f02
...
@@ -25,6 +25,7 @@ const getJsWorker = (req, res, next) => {
...
@@ -25,6 +25,7 @@ const getJsWorker = (req, res, next) => {
const
execute
=
(
imageId
,
srcPath
,
command
,
ErrorClass
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
execute
=
(
imageId
,
srcPath
,
command
,
ErrorClass
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
libPath
=
getLibPath
();
const
libPath
=
getLibPath
();
// TODO: memory limit + time limit + space limit?
const
dockerCommand
=
`docker run --rm -w=/usr/judge -t -v=
${
libPath
}
:/usr/bin/tracers:ro -v=
${
srcPath
}
:/usr/judge:rw -e MAX_TRACES=1000000 -e MAX_TRACERS=100
${
imageId
}
`
;
const
dockerCommand
=
`docker run --rm -w=/usr/judge -t -v=
${
libPath
}
:/usr/bin/tracers:ro -v=
${
srcPath
}
:/usr/judge:rw -e MAX_TRACES=1000000 -e MAX_TRACERS=100
${
imageId
}
`
;
child_process
.
exec
(
`
${
dockerCommand
}
${
command
}
`
,
(
error
,
stdout
,
stderr
)
=>
{
child_process
.
exec
(
`
${
dockerCommand
}
${
command
}
`
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
return
reject
(
new
ErrorClass
(
stdout
));
if
(
error
)
return
reject
(
new
ErrorClass
(
stdout
));
...
...
src/frontend/components/App/index.jsx
浏览文件 @
3e5a2f02
...
@@ -127,6 +127,7 @@ class App extends React.Component {
...
@@ -127,6 +127,7 @@ class App extends React.Component {
.
catch
(
this
.
props
.
showErrorToast
);
.
catch
(
this
.
props
.
showErrorToast
);
}
}
// TODO: warn before loading or quiting if not saved
loadAlgorithm
({
categoryKey
,
algorithmKey
,
gistId
})
{
loadAlgorithm
({
categoryKey
,
algorithmKey
,
gistId
})
{
const
{
ext
}
=
this
.
props
.
env
;
const
{
ext
}
=
this
.
props
.
env
;
let
fetchPromise
=
null
;
let
fetchPromise
=
null
;
...
@@ -142,7 +143,7 @@ class App extends React.Component {
...
@@ -142,7 +143,7 @@ class App extends React.Component {
contributors
:
undefined
,
contributors
:
undefined
,
},
{
},
{
name
:
`code.
${
ext
}
`
,
name
:
`code.
${
ext
}
`
,
content
:
''
,
content
:
''
,
// TODO: put import statements as default
contributors
:
undefined
,
contributors
:
undefined
,
}],
}],
});
});
...
...
src/frontend/components/Header/index.jsx
浏览文件 @
3e5a2f02
...
@@ -4,7 +4,6 @@ import InputRange from 'react-input-range';
...
@@ -4,7 +4,6 @@ import InputRange from 'react-input-range';
import
AutosizeInput
from
'
react-input-autosize
'
;
import
AutosizeInput
from
'
react-input-autosize
'
;
import
screenfull
from
'
screenfull
'
;
import
screenfull
from
'
screenfull
'
;
import
Promise
from
'
bluebird
'
;
import
Promise
from
'
bluebird
'
;
import
{
withRouter
}
from
'
react-router-dom
'
;
import
{
FontAwesomeIcon
}
from
'
@fortawesome/react-fontawesome
'
;
import
{
FontAwesomeIcon
}
from
'
@fortawesome/react-fontawesome
'
;
import
faAngleRight
from
'
@fortawesome/fontawesome-free-solid/faAngleRight
'
;
import
faAngleRight
from
'
@fortawesome/fontawesome-free-solid/faAngleRight
'
;
import
faCaretDown
from
'
@fortawesome/fontawesome-free-solid/faCaretDown
'
;
import
faCaretDown
from
'
@fortawesome/fontawesome-free-solid/faCaretDown
'
;
...
@@ -16,7 +15,7 @@ import faExpandArrowsAlt from '@fortawesome/fontawesome-free-solid/faExpandArrow
...
@@ -16,7 +15,7 @@ import faExpandArrowsAlt from '@fortawesome/fontawesome-free-solid/faExpandArrow
import
faGithub
from
'
@fortawesome/fontawesome-free-brands/faGithub
'
;
import
faGithub
from
'
@fortawesome/fontawesome-free-brands/faGithub
'
;
import
faTrashAlt
from
'
@fortawesome/fontawesome-free-solid/faTrashAlt
'
;
import
faTrashAlt
from
'
@fortawesome/fontawesome-free-solid/faTrashAlt
'
;
import
faSave
from
'
@fortawesome/fontawesome-free-solid/faSave
'
;
import
faSave
from
'
@fortawesome/fontawesome-free-solid/faSave
'
;
import
fa
Share
from
'
@fortawesome/fontawesome-free-solid/faShare
'
;
import
fa
Facebook
from
'
@fortawesome/fontawesome-free-brands/faFacebook
'
;
import
faStar
from
'
@fortawesome/fontawesome-free-solid/faStar
'
;
import
faStar
from
'
@fortawesome/fontawesome-free-solid/faStar
'
;
import
{
GitHubApi
}
from
'
/apis
'
;
import
{
GitHubApi
}
from
'
/apis
'
;
import
{
classes
,
refineGist
}
from
'
/common/util
'
;
import
{
classes
,
refineGist
}
from
'
/common/util
'
;
...
@@ -26,7 +25,6 @@ import { Button, Ellipsis, ListItem } from '/components';
...
@@ -26,7 +25,6 @@ import { Button, Ellipsis, ListItem } from '/components';
import
{
tracerManager
}
from
'
/core
'
;
import
{
tracerManager
}
from
'
/core
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
@
withRouter
@
connect
(({
current
,
env
})
=>
({
current
,
env
}),
actions
)
@
connect
(({
current
,
env
})
=>
({
current
,
env
}),
actions
)
class
Header
extends
React
.
Component
{
class
Header
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -86,6 +84,7 @@ class Header extends React.Component {
...
@@ -86,6 +84,7 @@ class Header extends React.Component {
.
then
(
algorithm
=>
this
.
props
.
setCurrent
(
categoryKey
,
algorithmKey
,
algorithm
.
gistId
,
algorithm
.
titles
,
algorithm
.
files
))
.
then
(
algorithm
=>
this
.
props
.
setCurrent
(
categoryKey
,
algorithmKey
,
algorithm
.
gistId
,
algorithm
.
titles
,
algorithm
.
files
))
.
then
(
this
.
props
.
loadScratchPapers
)
.
then
(
this
.
props
.
loadScratchPapers
)
.
catch
(
this
.
props
.
showErrorToast
);
.
catch
(
this
.
props
.
showErrorToast
);
// TODO: create a new gist in case of permission error
}
}
deleteGist
()
{
deleteGist
()
{
...
@@ -127,7 +126,8 @@ class Header extends React.Component {
...
@@ -127,7 +126,8 @@ class Header extends React.Component {
onClick
=
{
()
=>
this
.
saveGist
()
}
>
Save
</
Button
>
onClick
=
{
()
=>
this
.
saveGist
()
}
>
Save
</
Button
>
<
Button
icon
=
{
faTrashAlt
}
primary
disabled
=
{
!
gistId
}
onClick
=
{
()
=>
this
.
deleteGist
()
}
<
Button
icon
=
{
faTrashAlt
}
primary
disabled
=
{
!
gistId
}
onClick
=
{
()
=>
this
.
deleteGist
()
}
confirmNeeded
>
Delete
</
Button
>
confirmNeeded
>
Delete
</
Button
>
<
Button
icon
=
{
faShare
}
primary
disabled
=
{
gistId
===
'
new
'
}
onClick
=
{
()
=>
this
.
shareLink
()
}
>
Share
</
Button
>
<
Button
icon
=
{
faFacebook
}
primary
disabled
=
{
gistId
===
'
new
'
}
href
=
{
`https://www.facebook.com/sharer/sharer.php?u=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
}
>
Share
</
Button
>
<
Button
icon
=
{
faExpandArrowsAlt
}
primary
<
Button
icon
=
{
faExpandArrowsAlt
}
primary
onClick
=
{
()
=>
this
.
handleClickFullScreen
()
}
>
Fullscreen
</
Button
>
onClick
=
{
()
=>
this
.
handleClickFullScreen
()
}
>
Fullscreen
</
Button
>
</
div
>
</
div
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录