move some optional packages to new repository

This commit is contained in:
Xuan Sang LE
2020-05-20 23:13:28 +02:00
parent 36d1797c24
commit 5cabfc4569
159 changed files with 52544 additions and 58 deletions

11
ActivityMonitor/Makefile Normal file
View File

@ -0,0 +1,11 @@
coffee_files = main.coffee
jsfiles =
cssfiles = main.css
copyfiles = scheme.html package.json
PKG_NAME=ActivityMonitor
include ../pkg.mk

View File

@ -0,0 +1,3 @@
# Activity monitor
This simple application show the current running AntOS processes

View File

@ -0,0 +1,3 @@
# Activity monitor
This simple application show the current running AntOS processes

View File

@ -0,0 +1,131 @@
(function() {
void 0;
var ActivityMonitor, _APP, _PM;
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public
// License v3.0, see the LICENCE file for more information
// This program is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// You should have received a copy of the GNU General Public License
//along with this program. If not, see https://www.gnu.org/licenses/.
_PM = this.OS.PM;
_APP = this.OS.APP;
ActivityMonitor = class ActivityMonitor extends this.OS.GUI.BaseApplication {
constructor(args) {
super("ActivityMonitor", args);
}
main() {
var header;
this.scheme.set("apptitle", "Activity Monitor");
this.grid = this.find("mygrid");
this.on("btclick", (e) => {
var app, data, item;
if (e.id !== "btkill") {
return;
}
item = this.grid.get("selectedRow");
if (!item) {
return;
}
data = item.get("data")[0];
app = _PM.appByPid(data.text);
if (app) {
return app.quit(true);
}
});
header = [
{
width: 50,
text: "__(Pid)"
},
{
text: "__(Name)"
},
{
text: "__(Type)",
width: 80
},
{
width: 80,
text: "__(Alive (ms))"
}
];
this.gdata = {
processes: {},
alive: []
};
this.grid.set("header", header);
return this.monitor();
}
monitor() {
var now;
//get all current running process
this.gdata.alive = [];
now = (new Date()).getTime();
$.each(_PM.processes, (i, d) => {
return $.each(d, (j, a) => {
if (this.gdata.processes[a.pid]) {
this.gdata.processes[a.pid][3].text = now - a.birth;
this.gdata.processes[a.pid][3].domel.update(); //add it
} else {
this.gdata.processes[a.pid] = [
{
text: a.pid
},
{
icon: _APP[a.name].type === 1 ? _APP[a.name].meta.icon : a.icon,
iconclass: _APP[a.name].type === 1 ? _APP[a.name].meta.iconclass : a.iconclass,
text: a.name
},
{
text: _APP[a.name].type === 1 ? "__(Application)" : "__(Service)"
},
{
text: now - a.birth
}
];
this.grid.push(this.gdata.processes[a.pid]);
}
return this.gdata.alive.push(a.pid);
});
});
$.each(this.gdata.processes, (i, e) => {
if (($.inArray(Number(i), this.gdata.alive)) < 0) {
this.grid.remove(this.gdata.processes[i].domel);
this.gdata.processes[i] = void 0;
return delete this.gdata.processes[i];
}
});
return this.timer = setTimeout((() => {
return this.monitor();
}), 500);
}
cleanup(e) {
if (this.timer) {
return clearTimeout(this.timer);
}
}
};
ActivityMonitor.singleton = true;
this.OS.register("ActivityMonitor", ActivityMonitor);
}).call(this);

View File

@ -0,0 +1,13 @@
{
"app":"ActivityMonitor",
"name":"Activity monitor",
"description":"Processes monitor and manager",
"info":{
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-heartbeat",
"mimes":["none"]
}

View File

@ -0,0 +1,11 @@
<afx-app-window data-id = "am-window" apptitle="" width="400" height="300">
<afx-hbox>
<div data-width="7"></div>
<afx-vbox>
<div data-height="7"></div>
<afx-grid-view data-id = "mygrid"></afx-grid-view>
<afx-button data-height="30" data-id = "btkill" text = "__(Kill process)" iconclass="fa fa-times"></afx-button>
</afx-vbox>
<div data-width="7"></div>
</afx-hbox>
</afx-app-window>

Binary file not shown.

View File

@ -0,0 +1,97 @@
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
# AnTOS Web desktop is is licensed under the GNU General Public
# License v3.0, see the LICENCE file for more information
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
#along with this program. If not, see https://www.gnu.org/licenses/.
_PM = this.OS.PM
_APP = this.OS.APP
class ActivityMonitor extends this.OS.GUI.BaseApplication
constructor: (args) ->
super "ActivityMonitor", args
main: () ->
@scheme.set "apptitle", "Activity Monitor"
@grid = @find "mygrid"
@on "btclick", (e) =>
return unless e.id == "btkill"
item = @grid.get "selectedRow"
return unless item
data = item.get("data")[0]
app = _PM.appByPid data.text
app.quit(true) if app
header = [
{
width: 50,
text: "__(Pid)"
},
{
text: "__(Name)"
},
{
text: "__(Type)",
width: 80
},
{
width: 80,
text: "__(Alive (ms))"
}
]
@gdata = {
processes: {}
alive: []
}
@grid.set "header", header
@monitor()
monitor: () ->
#get all current running process
@gdata.alive = []
now = (new Date).getTime()
$.each _PM.processes, (i, d) =>
$.each d , (j, a) =>
if @gdata.processes[a.pid] #update it
@gdata.processes[a.pid][3].text = now - a.birth
@gdata.processes[a.pid][3].domel.update()
else #add it
@gdata.processes[a.pid] = [
{ text: a.pid },
{
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,
text: a.name
},
{
text: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"
},
{
text: now - a.birth
}
]
@grid.push @gdata.processes[a.pid]
@gdata.alive.push a.pid
$.each @gdata.processes, (i, e) =>
if ($.inArray (Number i), @gdata.alive) < 0
@grid.remove @gdata.processes[i].domel
@gdata.processes[i] = undefined
delete @gdata.processes[i]
@timer = setTimeout (() => @monitor()), 500
cleanup: (e) ->
clearTimeout @timer if @timer
ActivityMonitor.singleton = true
this.OS.register "ActivityMonitor", ActivityMonitor

13
ActivityMonitor/main.css Normal file
View File

@ -0,0 +1,13 @@
afx-app-window[data-id="am-window"] afx-button{
margin: 3px;
}
afx-app-window[data-id="am-window"] afx-grid-view afx-grid-row afx-grid-cell{
padding:5px;
}
afx-app-window[data-id="am-window"] afx-grid-view .grid_row_header afx-grid-cell{
border: 1px solid #a6a6a6;
padding: 5px;
}

View File

@ -0,0 +1,13 @@
{
"app":"ActivityMonitor",
"name":"Activity monitor",
"description":"Processes monitor and manager",
"info":{
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.0.1-a",
"category":"System",
"iconclass":"fa fa-heartbeat",
"mimes":["none"]
}

View File

View File

@ -0,0 +1,11 @@
<afx-app-window data-id = "am-window" apptitle="" width="400" height="300">
<afx-hbox>
<div data-width="7"></div>
<afx-vbox>
<div data-height="7"></div>
<afx-grid-view data-id = "mygrid"></afx-grid-view>
<afx-button data-height="30" data-id = "btkill" text = "__(Kill process)" iconclass="fa fa-times"></afx-button>
</afx-vbox>
<div data-width="7"></div>
</afx-hbox>
</afx-app-window>