Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BlackPearl
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
BlackPearl
Commits
f3489387
Commit
f3489387
authored
Oct 18, 2017
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9ad52f27
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
12708 additions
and
13 deletions
+12708
-13
server.js
app/blackPearl/controller/debug/server.js
+94
-0
url-edit-bottom-bar-ctrl.js
app/blackPearl/view/app/ctrl/url/url-edit-bottom-bar-ctrl.js
+15
-0
url-edit-ctrl.js
app/blackPearl/view/app/ctrl/url/url-edit-ctrl.js
+7
-7
debug.js
app/blackPearl/view/app/service/debug.js
+22
-0
url_edit.html
app/blackPearl/view/app/template/url/url_edit.html
+29
-3
main.html
app/blackPearl/view/views/main.html
+2
-0
main_ide.css
app/black_pearl_assest/css/main_ide.css
+6
-3
_worker-javascript.js
app/black_pearl_assest/js/ace/_worker-javascript.js
+12528
-0
dump.rdb
dump.rdb
+0
-0
package.json
package.json
+1
-0
start_docker_image.sh
shell_script/start_docker_image.sh
+2
-0
stop_docker_image.sh
shell_script/stop_docker_image.sh
+2
-0
No files found.
app/blackPearl/controller/debug/server.js
0 → 100644
View file @
f3489387
var
cproc
=
require
(
'
child_process
'
);
var
execSync
=
cproc
.
execSync
;
const
exec
=
cproc
.
exec
;
const
spawn
=
cproc
.
spawn
;
var
os
=
require
(
'
os
'
);
var
ifaces
=
os
.
networkInterfaces
();
let
ip
=
"
0.0.0.0
"
;
function
getIp
(){
let
ip
=
""
Object
.
keys
(
ifaces
).
forEach
(
function
(
ifname
)
{
var
alias
=
0
;
ifaces
[
ifname
].
forEach
(
function
(
iface
)
{
if
(
'
IPv4
'
!==
iface
.
family
||
iface
.
internal
!==
false
)
{
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
return
;
}
if
(
alias
>=
1
)
{
// this single interface has multiple ipv4 addresses
// console.log(ifname + ':' + alias, iface.address);
}
else
{
// this interface has only one ipv4 adress
if
(
ifname
==
"
en0
"
){
ip
=
iface
.
address
;
}
// console.log(ifname, iface.address);
}
++
alias
;
});
});
}
getIp
();
const
redis
=
require
(
'
redis
'
);
const
bluebird
=
require
(
"
bluebird
"
);
const
client
=
redis
.
createClient
(
'
6379
'
,
'
127.0.0.1
'
);
exports
.
initial
=
async
function
(){
await
this
.
bindDefault
();
let
_this
=
this
;
//初始化一个docker镜像
let
port
=
10091
;
//parseInt( Math.random(80000)*100000) + 10000;
var
re_str
=
execSync
(
`docker run --privileged -d -p
${
port
}
:3000 192.168.4.36/playground/debug_image /sbin/init`
);
var
id
=
String
(
re_str
).
replace
(
/
\n
/
,
""
);
client
.
set
(
`
${
_this
.
request
.
ip
}
docker`
,
id
);
spawn
(
"
sh
"
,[
"
./shell_script/start_docker_image.sh
"
,
id
]);
this
.
response
.
body
=
{
data
:
`http://
${
ip
}
:
${
port
}
`
}
return
}
exports
.
initial
.
__method__
=
"
ALL
"
;
exports
.
have_image
=
async
function
()
{
await
this
.
bindDefault
();
// 判断是否有活跃的镜像,如果有则提示已经存在,可能要关闭之前的
return
}
exports
.
have_image
.
__method__
=
'
ALL
'
;
exports
.
run
=
async
function
()
{
await
this
.
bindDefault
();
// 启动一个docker镜像
//
/*
一个IP只能启动一个镜像,再申请的时候,如果已经存在活跃的镜像,就要关闭之前的镜像,重新启动一个
return {id:返回的是这个镜像的ID,port:本地demo服务端口1,port2:本地xterm的端口号}
*/
return
}
exports
.
run
.
__method__
=
'
ALL
'
;
exports
.
stop
=
async
function
()
{
//关闭并退出docker镜像
let
_this
=
this
;
let
id
=
await
client
.
getAsync
(
`
${
_this
.
request
.
ip
}
docker`
).
then
(
function
(
records
){
try
{
return
records
}
catch
(
error
)
{
return
error
}
});
if
(
id
!=
null
){
spawn
(
"
sh
"
,[
"
./shell_script/stop_docker_image.sh
"
,
id
]);
this
.
response
.
body
=
{
code
:
"
0000
"
}
}
else
{
this
.
response
.
body
=
{
code
:
"
0001
"
}
}
return
}
exports
.
stop
.
__method__
=
'
GET
'
;
app/blackPearl/view/app/ctrl/url/url-edit-bottom-bar-ctrl.js
0 → 100644
View file @
f3489387
function
UrlEditBottomBarCtrl
(
$scope
,
Debug
)
{
//点击以后,启动当前的
//请求服务器获取一个ID,
//服务器随机生成一个port ,创建一个docker服务。返回前端一个URL
//
$scope
.
openTerm
=
function
(
event
){
Debug
.
initTerm
({},
function
(
res
){
setTimeout
(
function
(){
window
.
open
(
res
.
data
);
},
2000
)
})
}
}
UrlEditBottomBarCtrl
.
$inject
=
[
"
$scope
"
,
"
Debug
"
];
BP
.
controller
(
"
UrlEditBottomBarCtrl
"
,
UrlEditBottomBarCtrl
);
\ No newline at end of file
app/blackPearl/view/app/ctrl/url/url-edit-ctrl.js
View file @
f3489387
function
u
rlEditCtrl
(
$scope
,
Project
,
Url
,
TemplateUrlRoute
)
{
function
U
rlEditCtrl
(
$scope
,
Project
,
Url
,
TemplateUrlRoute
)
{
$scope
.
current_template
=
null
;
$scope
.
current_template
=
null
;
$scope
.
current_page
=
{};
$scope
.
current_page
=
{};
$scope
.
current_fide
=
{};
$scope
.
current_fide
=
{};
...
@@ -200,12 +200,12 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
...
@@ -200,12 +200,12 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
}
}
}
}
var
js_mode
=
ace
.
require
(
"
ace/mode/javascript
"
).
Mode
// var js_mode = ace.require("ace/mode/javascript_worker
").Mode
$scope
.
finishenOn
=
function
(
item
)
{
$scope
.
finishenOn
=
function
(
item
)
{
console
.
log
(
item
);
console
.
log
(
item
);
item
.
editor
=
ace
.
edit
(
item
.
id
);
item
.
editor
=
ace
.
edit
(
item
.
id
);
item
.
editor
.
getSession
().
setMode
(
new
js_mode
()
);
item
.
editor
.
getSession
().
setMode
(
"
ace/mode/javascript
"
);
item
.
editor
.
setTheme
(
"
ace/theme/twilight
"
);
item
.
editor
.
setTheme
(
"
ace/theme/twilight
"
);
item
.
editor
.
setValue
(
item
.
tree_fide
.
data
.
fun
);
item
.
editor
.
setValue
(
item
.
tree_fide
.
data
.
fun
);
item
.
editor
.
gotoLine
(
1
,
0
,
true
);
item
.
editor
.
gotoLine
(
1
,
0
,
true
);
...
@@ -375,7 +375,7 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
...
@@ -375,7 +375,7 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
if
(
reg
.
test
(
$scope
.
modal
.
value
))
{
if
(
reg
.
test
(
$scope
.
modal
.
value
))
{
toastr
.
warning
(
"
请不要输入中文
"
)
toastr
.
warning
(
"
请不要输入中文
"
)
}
else
{
}
else
{
console
.
log
(
$scope
.
current_url
)
//
console.log($scope.current_url)
TemplateUrlRoute
.
save
({
TemplateUrlRoute
.
save
({
key
:
$scope
.
modal
.
value
,
key
:
$scope
.
modal
.
value
,
fun
:
template_fun_str
,
fun
:
template_fun_str
,
...
@@ -383,7 +383,7 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
...
@@ -383,7 +383,7 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
url
:
$scope
.
current_url
.
_id
,
url
:
$scope
.
current_url
.
_id
,
devices
:
[]
devices
:
[]
},
function
(
res
)
{
},
function
(
res
)
{
console
.
log
(
res
);
//
console.log(res);
//tree,template_file中插入一个child
//tree,template_file中插入一个child
template_file
.
children
.
push
(
new
fide
().
init
(
TemplateUrlRoute
,
template_file
,
res
.
key
,
false
,
template_file
.
deep
+
1
,
res
));
template_file
.
children
.
push
(
new
fide
().
init
(
TemplateUrlRoute
,
template_file
,
res
.
key
,
false
,
template_file
.
deep
+
1
,
res
));
$scope
.
modal
.
value
=
""
;
$scope
.
modal
.
value
=
""
;
...
@@ -397,5 +397,5 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
...
@@ -397,5 +397,5 @@ function urlEditCtrl($scope, Project, Url, TemplateUrlRoute) {
}
}
}
}
urlEditCtrl
.
$inject
=
[
"
$scope
"
,
"
Project
"
,
"
Url
"
,
"
TemplateUrlRoute
"
];
UrlEditCtrl
.
$inject
=
[
"
$scope
"
,
"
Project
"
,
"
Url
"
,
"
TemplateUrlRoute
"
];
BP
.
controller
(
"
urlEditCtrl
"
,
urlEditCtrl
);
BP
.
controller
(
"
UrlEditCtrl
"
,
UrlEditCtrl
);
\ No newline at end of file
\ No newline at end of file
app/blackPearl/view/app/service/debug.js
0 → 100644
View file @
f3489387
BP
.
factory
(
"
Debug
"
,
[
"
$resource
"
,
function
(
$resource
)
{
var
res
=
$resource
(
"
/debug/server
"
,
{
_id
:
"
@_id
"
},
{
initTerm
:{
url
:
"
/debug/server/initial
"
,
method
:
"
GET
"
},
stop
:{
url
:
"
/debug/server/stop
"
,
method
:
"
GET
"
},
open
:{
url
:
"
/debug/server/open
"
,
method
:
"
GET
"
}
}
);
return
res
;
}
]);
app/blackPearl/view/app/template/url/url_edit.html
View file @
f3489387
<div
class=
"ide_1 ide_grid_vertical full_screen"
ng-controller=
"
u
rlEditCtrl"
>
<div
class=
"ide_1 ide_grid_vertical full_screen"
ng-controller=
"
U
rlEditCtrl"
>
<div
class=
"ide top"
style=
"padding:0.5em 2em;"
>
<div
class=
"ide top"
style=
"padding:0.5em 2em;"
>
<div
style=
"display:inline"
>
<div
style=
"display:inline"
>
<div
style=
"float:left;width:3em;height:100%"
>
<div
style=
"float:left;width:3em;height:100%"
>
...
@@ -31,12 +31,38 @@
...
@@ -31,12 +31,38 @@
<div
class=
"ide right"
>
<div
class=
"ide right"
>
<div
class=
"ide tab"
ng-include=
"'/blackPearl/view/app/template/url/component/tap.html'"
>
</div>
<div
class=
"ide tab"
ng-include=
"'/blackPearl/view/app/template/url/component/tap.html'"
>
</div>
<div
class=
"ide board ide_hide"
ng-class=
"{'ide_active':current_page.id == page.id}"
ng-repeat=
"page in pages"
>
<div
class=
"ide board ide_hide"
ng-class=
"{'ide_active':current_page.id == page.id}"
ng-repeat=
"page in pages"
>
<div
id=
"{[page.id]}"
ready-on=
"finishenOn(page)"
style=
"width:100%;height:50em;position:absolute"
>
<div
id=
"{[page.id]}"
ready-on=
"finishenOn(page)"
style=
"width:100%;height:50em;position:absolute"
>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"ide foot"
>
<div
class=
"ide foot"
ng-controller=
"UrlEditBottomBarCtrl"
>
<div
class=
"horizontal_line"
style=
"position:absolute; top:0px;height:5px;width:100%;background-colot:black"
>
</div>
<!-- <div class="foot_content" style="position:absolute; top:5px;bottom:25px;width:100%;background-colot:red">
asdf
</div> -->
<div
class=
"panel-container column"
style=
"flex-grow: 0; flex-basis: auto;bottom:0px;position:absolute;width:100%;top:5px"
>
<!-- react-text: 107 -->
<!-- /react-text -->
<div
class=
"panel"
>
<div
class=
"bar side-bar bottom"
>
<div
class=
"side-bar-label active"
ng-click=
"openTerm()"
>
<div
class=
"side-bar-label-container"
>
<div
class=
"side-bar-label-content"
>
<span
class=
"fa-stack fa-lg"
>
<i
class=
"fa fa-square fa-stack-1x"
></i>
<i
class=
"fa fa-terminal fa-stack fa-inverse"
></i>
</span>
<span>
<span
id=
"panel.bottom.terminal"
>
终端
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
ng-include=
"'/blackPearl/view/app/template/url/component/modal.html'"
></div>
<div
ng-include=
"'/blackPearl/view/app/template/url/component/modal.html'"
></div>
</div>
</div>
\ No newline at end of file
app/blackPearl/view/views/main.html
View file @
f3489387
...
@@ -54,10 +54,12 @@
...
@@ -54,10 +54,12 @@
<script
src=
"/blackPearl/view/app/service/templateUrlRoute.js"
></script>
<script
src=
"/blackPearl/view/app/service/templateUrlRoute.js"
></script>
<script
src=
"/blackPearl/view/app/service/uploadfile.js"
></script>
<script
src=
"/blackPearl/view/app/service/uploadfile.js"
></script>
<script
src=
"/blackPearl/view/app/service/endecode.js"
></script>
<script
src=
"/blackPearl/view/app/service/endecode.js"
></script>
<script
src=
"/blackPearl/view/app/service/debug.js"
></script>
<!-- DEBUG CTRL -->
<!-- DEBUG CTRL -->
<script
src=
"/blackPearl/view/app/ctrl/app-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/app-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/project/project-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/project/project-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/url/url-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/url/url-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/url/url-edit-bottom-bar-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/url/url-edit-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/url/url-edit-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/device/device-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/device/device-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/endecode/endecode-ctrl.js"
></script>
<script
src=
"/blackPearl/view/app/ctrl/endecode/endecode-ctrl.js"
></script>
...
...
app/black_pearl_assest/css/main_ide.css
View file @
f3489387
...
@@ -5523,7 +5523,7 @@
...
@@ -5523,7 +5523,7 @@
}
}
.ide_grid_vertical
.content
{
.ide_grid_vertical
.content
{
top
:
47px
;
top
:
47px
;
bottom
:
2
6px
;
bottom
:
7
6px
;
}
}
.ide_grid_vertical
.content
>
div
{
.ide_grid_vertical
.content
>
div
{
top
:
0px
;
top
:
0px
;
...
@@ -5544,9 +5544,12 @@
...
@@ -5544,9 +5544,12 @@
left
:
253px
;
left
:
253px
;
border
:
0px
;
border
:
0px
;
}
}
.horizontal_line
{
}
.ide_grid_vertical
.foot
{
.ide_grid_vertical
.foot
{
height
:
26
px
;
height
:
35
px
;
bottom
:
0
px
;
bottom
:
42
px
;
border-color
:
#ebebeb
;
border-color
:
#ebebeb
;
background-color
:
#e5e5e5
;
background-color
:
#e5e5e5
;
}
}
...
...
app/black_pearl_assest/js/ace/_worker-javascript.js
0 → 100644
View file @
f3489387
This diff is collapsed.
Click to expand it.
dump.rdb
View file @
f3489387
No preview for this file type
package.json
View file @
f3489387
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
"node"
:
">=7.6.0"
"node"
:
">=7.6.0"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
stanford-classifier
"
:
""
,
"bluebird"
:
"
3.4.6
"
,
"bluebird"
:
"
3.4.6
"
,
"
bytes
"
:
"
^2.4.0
"
,
"
bytes
"
:
"
^2.4.0
"
,
"
co
"
:
"
^4.6.0
"
,
"
co
"
:
"
^4.6.0
"
,
...
...
shell_script/start_docker_image.sh
0 → 100644
View file @
f3489387
#!/bin/bash
docker
exec
${
1
}
pm2 start /root/xterm.js/demo/app.js
--node-args
=
"--harmony"
-n
xterm
shell_script/stop_docker_image.sh
0 → 100644
View file @
f3489387
#!/bin/bash
docker stop
${
1
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment