mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Add polling
This commit is contained in:
parent
79bfcf226b
commit
6e7fd2ca95
@ -82,11 +82,9 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
|
|||||||
|
|
||||||
for ( let i=0; i < indent_level; i++ ) {
|
for ( let i=0; i < indent_level; i++ ) {
|
||||||
const last_cell = i === indent_level - 1;
|
const last_cell = i === indent_level - 1;
|
||||||
console.log('last_cell', last_cell);
|
|
||||||
console.log('last_item', last_item);
|
|
||||||
Indent({
|
Indent({
|
||||||
has_trunk: (last_cell && ( ! last_item )) ||
|
has_trunk: (last_cell && ( ! last_item )) ||
|
||||||
(!last_cell && !parent_last_item[i]),
|
(!last_cell && !parent_last_item[i+1]),
|
||||||
has_branch: last_cell
|
has_branch: last_cell
|
||||||
}).appendTo(el);
|
}).appendTo(el);
|
||||||
}
|
}
|
||||||
@ -127,6 +125,9 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
|
|||||||
if ( typeof el.el === 'function' ) el = el.el();
|
if ( typeof el.el === 'function' ) el = el.el();
|
||||||
el_tbody.appendChild(el);
|
el_tbody.appendChild(el);
|
||||||
return this;
|
return this;
|
||||||
|
},
|
||||||
|
clear () {
|
||||||
|
el_tbody.innerHTML = '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -159,7 +160,6 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
|
|||||||
el_taskarea.appendChild(tasktable.el());
|
el_taskarea.appendChild(tasktable.el());
|
||||||
|
|
||||||
const iter_tasks = (items, { indent_level, parent_last_item }) => {
|
const iter_tasks = (items, { indent_level, parent_last_item }) => {
|
||||||
console.log('aaah', parent_last_item);
|
|
||||||
for ( let i=0 ; i < items.length; i++ ) {
|
for ( let i=0 ; i < items.length; i++ ) {
|
||||||
const row = Row();
|
const row = Row();
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
@ -186,9 +186,16 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const processes = [svc_process.get_init()];
|
const interval = setInterval(() => {
|
||||||
|
tasktable.clear();
|
||||||
|
const processes = [svc_process.get_init()];
|
||||||
|
iter_tasks(processes, { indent_level: 0, parent_last_item: [] });
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
w.on_close = () => {
|
||||||
|
clearInterval(interval);
|
||||||
|
}
|
||||||
|
|
||||||
iter_tasks(processes, { indent_level: 0, parent_last_item: [] });
|
|
||||||
w_body.appendChild(el_taskarea);
|
w_body.appendChild(el_taskarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1683,12 +1683,13 @@ window.launch_app = async (options)=>{
|
|||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
let el_win;
|
let el_win;
|
||||||
|
let process;
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// Explorer
|
// Explorer
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
if(options.name === 'explorer'){
|
if(options.name === 'explorer'){
|
||||||
const process = new PseudoProcess({
|
process = new PseudoProcess({
|
||||||
uuid,
|
uuid,
|
||||||
name: 'explorer',
|
name: 'explorer',
|
||||||
parent: options.parent_instance_id,
|
parent: options.parent_instance_id,
|
||||||
@ -1728,7 +1729,7 @@ window.launch_app = async (options)=>{
|
|||||||
// All other apps
|
// All other apps
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
else{
|
else{
|
||||||
const portal = new PortalProcess({
|
process = new PortalProcess({
|
||||||
uuid,
|
uuid,
|
||||||
name: app_info.name,
|
name: app_info.name,
|
||||||
parent: options.parent_instance_id,
|
parent: options.parent_instance_id,
|
||||||
@ -1738,7 +1739,7 @@ window.launch_app = async (options)=>{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const svc_process = globalThis.services.get('process');
|
const svc_process = globalThis.services.get('process');
|
||||||
svc_process.register(portal);
|
svc_process.register(process);
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
// iframe_url
|
// iframe_url
|
||||||
@ -1887,9 +1888,14 @@ window.launch_app = async (options)=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(el_win).on('remove', () => {
|
(async () => {
|
||||||
svc_process.unregister(portal.uuid);
|
const el = await el_win;
|
||||||
});
|
console.log('RESOV', el);
|
||||||
|
$(el).on('remove', () => {
|
||||||
|
const svc_process = globalThis.services.get('process');
|
||||||
|
svc_process.unregister(process.uuid);
|
||||||
|
});
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.open_item = async function(options){
|
window.open_item = async function(options){
|
||||||
|
@ -53,7 +53,7 @@ export class ProcessService extends Service {
|
|||||||
this.processes_map.delete(uuid);
|
this.processes_map.delete(uuid);
|
||||||
this.processes.splice(this.processes.indexOf(process), 1);
|
this.processes.splice(this.processes.indexOf(process), 1);
|
||||||
|
|
||||||
const parent_list = this.uuid_to_treelist.get(process.parent.uuid);
|
const parent_list = this.uuid_to_treelist.get(process.parent);
|
||||||
parent_list.splice(parent_list.indexOf(process), 1);
|
parent_list.splice(parent_list.indexOf(process), 1);
|
||||||
|
|
||||||
const children = this.uuid_to_treelist.get(process.uuid);
|
const children = this.uuid_to_treelist.get(process.uuid);
|
||||||
|
Loading…
Reference in New Issue
Block a user