mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
add services
This commit is contained in:
@ -14,7 +14,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
|
||||
app = _PM.appByPid item[0].value
|
||||
app.quit() if app
|
||||
|
||||
header = [{width:50,value:"Pid"},{value:"Name"},{width:100,value:"Alive (ms)"}]
|
||||
header = [{width:50,value:"Pid"},{value:"Name"}, {value:"Type", width:75},{width:70,value:"Alive (ms)"}]
|
||||
@gdata =
|
||||
processes:{}
|
||||
alive:[]
|
||||
@ -29,11 +29,14 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
|
||||
$.each _PM.processes, (i,d)->
|
||||
$.each d , (j,a)->
|
||||
if me.gdata.processes[a.pid] #update it
|
||||
me.gdata.processes[a.pid][2].value = now - a.birth
|
||||
me.gdata.processes[a.pid][3].value = now - a.birth
|
||||
else #add it
|
||||
me.gdata.processes[a.pid] = [
|
||||
{value:a.pid},
|
||||
{icon:_APP[a.name].meta.icon,iconclass:_APP[a.name].meta.iconclass,value:a.name},
|
||||
{icon:if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
|
||||
iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
|
||||
value:a.name},
|
||||
{value: if _APP[a.name].type == 1 then "Application" else "Service"}
|
||||
{value: now - a.birth}
|
||||
]
|
||||
me.gdata.alive.push a.pid
|
||||
|
@ -13,7 +13,7 @@ NC=\033[0m
|
||||
main: title clean js css copy
|
||||
|
||||
title:
|
||||
@echo "$(BLUE)======= Package Terminal =======$(NC)"
|
||||
@echo "$(BLUE)======= Package DummyApp =======$(NC)"
|
||||
|
||||
coffee:
|
||||
- mkdir build
|
@ -1,6 +1,6 @@
|
||||
class Terminal extends this.OS.GUI.BaseApplication
|
||||
class DummyApp extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "Terminal"
|
||||
super "DummyApp"
|
||||
main: () ->
|
||||
self = @
|
||||
@on "btclick", (e)->
|
||||
@ -19,7 +19,7 @@ class Terminal extends this.OS.GUI.BaseApplication
|
||||
tdata = {
|
||||
name: 'My Tree',
|
||||
nodes: [
|
||||
{ name: 'hello', icon:'packages/NotePad/icon.png'},
|
||||
{ name: 'hello', icon:'fa fa-car'},
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
@ -76,5 +76,12 @@ class Terminal extends this.OS.GUI.BaseApplication
|
||||
list.set "onlistselect", (e)->
|
||||
console.log e
|
||||
|
||||
Terminal.singleton = false
|
||||
this.OS.register "Terminal",Terminal
|
||||
@scheme.set "apptitle", "AntOS feature showcase"
|
||||
|
||||
@scheme.contextmenuHandler = (e, m) ->
|
||||
mdata = [ { text: " Child 1" }, { text: "child2", child: [{text: "sub child", child:[{text:"sub sub child"}] }]}]
|
||||
m.set "items", mdata
|
||||
m.show(e)
|
||||
|
||||
DummyApp.singleton = false
|
||||
this.OS.register "DummyApp",DummyApp
|
12
src/packages/DummyApp/package.json
Normal file
12
src/packages/DummyApp/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"app":"DummyApp",
|
||||
"name":"DummyApp",
|
||||
"description":"App for test",
|
||||
"author":{
|
||||
"name": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-user-circle-o",
|
||||
"mimes":["*"]
|
||||
}
|
@ -14,7 +14,7 @@ class NotePad extends this.OS.GUI.BaseApplication
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: true,
|
||||
fontSize: "10pt"
|
||||
fontSize: "9pt"
|
||||
}
|
||||
@.editor.completers.push {getCompletions:(editor, session, pos, prefix, callback)->}
|
||||
@.editor.getSession().setUseWrapMode true
|
||||
@ -34,8 +34,7 @@ class NotePad extends this.OS.GUI.BaseApplication
|
||||
l = me.editor.session.getLength()
|
||||
$(stat).html "Row #{c.row}, col #{c.column}, lines: #{l}"
|
||||
stup(0)
|
||||
@.editor.getSession().selection.on "changeCursor", (e)->
|
||||
stup(e)
|
||||
@.editor.getSession().selection.on "changeCursor", (e)->stup(e)
|
||||
|
||||
@on "resize", ()-> me.editor.resize()
|
||||
@on "focus", ()->me.editor.focus()
|
||||
|
@ -1,9 +1,16 @@
|
||||
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"] {
|
||||
margin: 2px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"]{
|
||||
margin:2px;
|
||||
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"] div.list-container{
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="notepad"] span[data-id="editorstat"]{
|
||||
padding:5px;
|
||||
display: inline-block;
|
||||
}
|
||||
afx-app-window[data-id="notepad"] afx-vbox[data-id="bottom-vbox"]{
|
||||
background-color: #dfdfdf;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
|
||||
</afx-hbox-->
|
||||
<div data-id="datarea"></div>
|
||||
<afx-vbox data-height="30">
|
||||
<afx-vbox data-height="30" data-id="bottom-vbox">
|
||||
<div ><span data-id = "editorstat"></span></div>
|
||||
<afx-list-view data-width="170" data-id = "modelist" dropdown = "true" width="150"></afx-list-view>
|
||||
|
||||
|
34
src/packages/wTerm/Makefile
Normal file
34
src/packages/wTerm/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles = xterm.js
|
||||
|
||||
cssfiles = xterm.css main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
BLUE=\033[1;34m
|
||||
NC=\033[0m
|
||||
|
||||
main: title clean js css copy
|
||||
|
||||
title:
|
||||
@echo "$(BLUE)======= Package wTerm =======$(NC)"
|
||||
- rm -rf build/*
|
||||
|
||||
coffee:
|
||||
- mkdir build
|
||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
||||
- rm build/*.coffee.js
|
||||
|
||||
js: coffee
|
||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
||||
|
||||
css:
|
||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
||||
|
||||
copy:
|
||||
cp -rf $(copyfiles) build/
|
||||
clean:
|
||||
- rm -rf build/*
|
71
src/packages/wTerm/main.coffee
Normal file
71
src/packages/wTerm/main.coffee
Normal file
@ -0,0 +1,71 @@
|
||||
class wTerm extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "wTerm"
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "Terminal"
|
||||
@mterm = @find "myterm"
|
||||
@term = new Terminal { cursorBlink: true }
|
||||
@term.on "key", (d, e) ->
|
||||
me.socket.send "i#{d}" if me.socket
|
||||
@term.on 'title', () -> console.log "title change"
|
||||
@term.open @mterm
|
||||
@socket = null
|
||||
#@on "resize", () -> me.resizeContent()
|
||||
@on "focus", () -> me.term.focus()
|
||||
# handle the paste event
|
||||
area = ($ ".xterm-helper-textarea", @mterm)[0]
|
||||
area.onpaste = (e) ->
|
||||
#ifreturn false unless @socket
|
||||
pastedText = undefined
|
||||
if window.clipboardData and window.clipboardData.getData #IE
|
||||
pastedText = window.clipboardData.getData 'Text'
|
||||
else if e.clipboardData and e.clipboardData.getData
|
||||
pastedText = e.clipboardData.getData 'text/plain'
|
||||
return false unless pastedText
|
||||
# send by chunk, to ease the handle on server side
|
||||
len = pastedText.length
|
||||
chunklen = len / 1000 + if (len % 1000 == 0) then 0 else 1
|
||||
for i in [0..(len - 1)]
|
||||
end = if (i + 1) * 1000 > len then len else (i + 1) * 1000
|
||||
me.term.write pastedText.substring i * 1000, end
|
||||
#self.socket.send("i"+ substr.replace(/\n/g,"\r\n"))
|
||||
@openSession()
|
||||
@on "vboxchange", (e) -> me.resizeContent e.w, e.h
|
||||
|
||||
resizeContent: (w, h) ->
|
||||
ex = @term.rowContainer.firstElementChild
|
||||
oldhtml = ($ ex).html()
|
||||
($ ex).css "display", "inline"
|
||||
($ ex).html "W"
|
||||
ncol = parseInt (w / ($ ex).width())
|
||||
nrow = parseInt (h / ($ ex).height())
|
||||
($ ex).css "display", ""
|
||||
($ ex).html oldhtml
|
||||
@term.resize ncol, nrow
|
||||
return if not @socket or (@socket.readyState isnt @socket.OPEN)
|
||||
#initialGeometry = @.term.proposeGeometry()
|
||||
#cols = initialGeometry.cols
|
||||
#rows = initialGeometry.rows
|
||||
#console.log "send", "s#{ncol}:#{nrow}"
|
||||
@socket.send "s#{ncol}:#{nrow}"
|
||||
|
||||
openSession: () ->
|
||||
me = @
|
||||
@term.clear()
|
||||
@term.focus()
|
||||
@socket = new WebSocket "ws://" + window.location.host + "/wterm"
|
||||
@socket.onopen = () ->
|
||||
#el.style.display = "none"
|
||||
me.resizeContent (($ me.mterm).width()) , (($ me.mterm).height())
|
||||
me.term.focus()
|
||||
|
||||
@socket.onmessage = (e) -> me.term.write e.data if me.term and e.data
|
||||
@socket.onclose = () ->
|
||||
me.socket = null
|
||||
console.log "socket closed"
|
||||
#el.style.display = "block"
|
||||
exit: (e)->
|
||||
@socket.close() if @socket
|
||||
this.OS.register "wTerm",wTerm
|
0
src/packages/wTerm/main.css
Normal file
0
src/packages/wTerm/main.css
Normal file
@ -1,5 +1,5 @@
|
||||
{
|
||||
"app":"Terminal",
|
||||
"app":"wTerm",
|
||||
"name":"Unix terminal like",
|
||||
"description":"Access Unix terminal from web",
|
||||
"author":{
|
5
src/packages/wTerm/scheme.html
Normal file
5
src/packages/wTerm/scheme.html
Normal file
@ -0,0 +1,5 @@
|
||||
<afx-app-window apptitle="Preview" width="600" height="400">
|
||||
<afx-vbox data-id = "mybox">
|
||||
<div data-id="myterm" ></div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
2261
src/packages/wTerm/xterm.css
Executable file
2261
src/packages/wTerm/xterm.css
Executable file
File diff suppressed because it is too large
Load Diff
5132
src/packages/wTerm/xterm.js
Executable file
5132
src/packages/wTerm/xterm.js
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user