KernelDeimos пре 1 година
родитељ
комит
6e7fd2ca95
3 измењених фајлова са 26 додато и 13 уклоњено
  1. 13 6
      src/UI/UIWindowTaskManager.js
  2. 12 6
      src/helpers.js
  3. 1 1
      src/services/ProcessService.js

+ 13 - 6
src/UI/UIWindowTaskManager.js

@@ -82,11 +82,9 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
 
         for ( let i=0; i < indent_level; i++ ) {
             const last_cell = i === indent_level - 1;
-            console.log('last_cell', last_cell);
-            console.log('last_item', last_item);
             Indent({
                 has_trunk: (last_cell && ( ! last_item )) ||
-                    (!last_cell && !parent_last_item[i]),
+                    (!last_cell && !parent_last_item[i+1]),
                 has_branch: last_cell
             }).appendTo(el);
         }
@@ -127,6 +125,9 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
                 if ( typeof el.el === 'function' ) el = el.el();
                 el_tbody.appendChild(el);
                 return this;
+            },
+            clear () {
+                el_tbody.innerHTML = '';
             }
         };
     };
@@ -159,7 +160,6 @@ const UIWindowTaskManager = async function UIWindowTaskManager () {
     el_taskarea.appendChild(tasktable.el());
 
     const iter_tasks = (items, { indent_level, parent_last_item }) => {
-        console.log('aaah', parent_last_item);
         for ( let i=0 ; i < items.length; i++ ) {
             const row = Row();
             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);
 }
 

+ 12 - 6
src/helpers.js

@@ -1683,12 +1683,13 @@ window.launch_app = async (options)=>{
     // -----------------------------------
 
     let el_win;
+    let process;
 
     //------------------------------------
     // Explorer
     //------------------------------------
     if(options.name === 'explorer'){
-        const process = new PseudoProcess({
+        process = new PseudoProcess({
             uuid,
             name: 'explorer',
             parent: options.parent_instance_id,
@@ -1728,7 +1729,7 @@ window.launch_app = async (options)=>{
     // All other apps
     //------------------------------------
     else{
-        const portal = new PortalProcess({
+        process = new PortalProcess({
             uuid,
             name: app_info.name,
             parent: options.parent_instance_id,
@@ -1738,7 +1739,7 @@ window.launch_app = async (options)=>{
             }
         });
         const svc_process = globalThis.services.get('process');
-        svc_process.register(portal);
+        svc_process.register(process);
 
         //-----------------------------------
         // iframe_url
@@ -1887,9 +1888,14 @@ window.launch_app = async (options)=>{
         }
     }
 
-    $(el_win).on('remove', () => {
-        svc_process.unregister(portal.uuid);
-    });
+    (async () => {
+        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){

+ 1 - 1
src/services/ProcessService.js

@@ -53,7 +53,7 @@ export class ProcessService extends Service {
         this.processes_map.delete(uuid);
         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);
 
         const children = this.uuid_to_treelist.get(process.uuid);