@xuda.io/runtime-bundle 1.0.962 → 1.0.964

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8357,34 +8357,141 @@ func.UI.worker.init = async function (SESSION_ID) {
8357
8357
 
8358
8358
  let last_job_in_queue = 0;
8359
8359
  // let run_stat;
8360
+ // const job_iterator = async function () {
8361
+ // let from_job_num_to_run = last_job_in_queue;
8362
+ // last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
8363
+
8364
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8365
+ // // idle
8366
+ // this.attempt = 0;
8367
+ // if (UI_WORKER_OBJ.jobs.length) {
8368
+ // // clearInterval(this._interval);
8369
+ // for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8370
+ // // if (val.job_num < from_job_num_to_run) continue;
8371
+ // try {
8372
+ // if (val.stat) {
8373
+ // break;
8374
+ // }
8375
+
8376
+ // await func.UI.worker.execute(val.SESSION_ID, val);
8377
+ // // break;
8378
+ // } catch (err) {
8379
+ // console.error(err);
8380
+ // }
8381
+ // }
8382
+ // }
8383
+ // } else {
8384
+ // //busy
8385
+
8386
+ // this.attempt++;
8387
+ // }
8388
+ // };
8389
+
8360
8390
  const job_iterator = async function () {
8361
8391
  let from_job_num_to_run = last_job_in_queue;
8362
8392
  last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
8363
8393
 
8364
- if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8365
- // idle
8366
- this.attempt = 0;
8367
- if (UI_WORKER_OBJ.jobs.length) {
8368
- // clearInterval(this._interval);
8369
- for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8370
- // if (val.job_num < from_job_num_to_run) continue;
8371
- try {
8372
- if (val.stat) {
8373
- break;
8374
- }
8394
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8395
+ // idle
8396
+ this.attempt = 0;
8397
+ if (UI_WORKER_OBJ.jobs.length) {
8398
+ let running_job_children_elements = [];
8399
+ let active_job_children_elements = [];
8400
+ for (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8401
+ try {
8402
+ if (val.stat === 'busy') continue;
8375
8403
 
8376
- await func.UI.worker.execute(val.SESSION_ID, val);
8377
- // break;
8378
- } catch (err) {
8379
- console.error(err);
8404
+ if (!val.elementP) {
8405
+ func.UI.worker.execute(val.SESSION_ID, val);
8406
+ continue;
8380
8407
  }
8408
+
8409
+ const active_xu_ui_id = val.elementP.attr('xu-ui-id');
8410
+ if (!active_xu_ui_id) continue;
8411
+
8412
+ const running_job_obj = UI_WORKER_OBJ.jobs[0];
8413
+
8414
+ const running_xu_ui_id = running_job_obj?.elementP?.attr('xu-ui-id');
8415
+ if (!running_xu_ui_id) continue;
8416
+
8417
+ $.each(running_job_obj.elementP.find('*'), function (key, val) {
8418
+ const xu_ui_id = $(val).attr('xu-ui-id');
8419
+ if (!xu_ui_id) return true;
8420
+ running_job_children_elements.push(xu_ui_id);
8421
+ });
8422
+
8423
+ $.each(val.elementP.find('*'), function (key, val) {
8424
+ const xu_ui_id = $(val).attr('xu-ui-id');
8425
+ if (!xu_ui_id) return true;
8426
+ active_job_children_elements.push(xu_ui_id);
8427
+ });
8428
+
8429
+ // skip - if job element exist in the active job ui as child element
8430
+ if (running_job_children_elements.includes(active_xu_ui_id)) {
8431
+ continue;
8432
+ }
8433
+
8434
+ // abort - if active job element exist in the current job ui (parent element changed)
8435
+ if (active_job_children_elements.includes(running_xu_ui_id)) {
8436
+ $.each(active_job_children_elements, function (key, val) {
8437
+ const $elm = $(`[xu-ui-id=${val}]`);
8438
+ if (!$elm.length) return true;
8439
+ if (!$elm.data().xuData) return true;
8440
+ $elm.data().xuData.pending_to_delete = true;
8441
+ });
8442
+
8443
+ func.UI.worker.delete_job(SESSION_ID, running_job_obj.job_num);
8444
+ break;
8445
+ }
8446
+
8447
+ // execute - if active job element not exist the current job ui and not detected as parent element
8448
+ func.UI.worker.execute(val.SESSION_ID, val);
8449
+ continue;
8450
+
8451
+ // active_job_children_elements = [];
8452
+ // if (val.elementP) {
8453
+ // // get active_job children elements only if job handle ui job (not update)
8454
+ // $.each(val.elementP.find('*'), function (key, val) {
8455
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8456
+ // if (!xu_ui_id) return true;
8457
+ // active_job_children_elements.push(xu_ui_id);
8458
+ // });
8459
+ // func.UI.worker.execute(val.SESSION_ID, val);
8460
+ // continue;
8461
+ // } else {
8462
+ // // non ui job
8463
+ // await func.UI.worker.execute(val.SESSION_ID, val);
8464
+ // break;
8465
+ // }
8466
+
8467
+ // if (UI_WORKER_OBJ.jobs.length > 1 && val.elementP) {
8468
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8469
+ // if (!xu_ui_id) continue;
8470
+ // // skip - if job element exist in the active job ui as child element
8471
+ // if (active_job_children_elements.includes(xu_ui_id)) {
8472
+ // continue;
8473
+ // }
8474
+ // // abort - if active job element exist in the current job ui (parent element changed)
8475
+ // $.each(val.elementP.find('*'), function (key, val) {
8476
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8477
+ // if (!xu_ui_id) return true;
8478
+ // active_job_children_elements.push(xu_ui_id);
8479
+ // });
8480
+ // // execute - if active job element not exist the current job ui and not detected as parent element
8481
+ // const active_job = UI_WORKER_OBJ.jobs[0];
8482
+ // }
8483
+
8484
+ // break;
8485
+ } catch (err) {
8486
+ console.error(err);
8381
8487
  }
8382
8488
  }
8383
- } else {
8384
- //busy
8385
-
8386
- this.attempt++;
8387
8489
  }
8490
+ // } else {
8491
+ // //busy
8492
+
8493
+ // this.attempt++;
8494
+ // }
8388
8495
  };
8389
8496
 
8390
8497
  this._interval = setInterval(job_iterator, 1);
@@ -8471,7 +8578,7 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
8471
8578
  var job_index = func.UI.worker.find_job_index(SESSION_ID, jobNoP);
8472
8579
 
8473
8580
  if (!UI_WORKER_OBJ.jobs[job_index]) {
8474
- UI_WORKER_OBJ.stat = null;
8581
+ // UI_WORKER_OBJ.stat = null;
8475
8582
  return;
8476
8583
  }
8477
8584
 
@@ -8483,20 +8590,20 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
8483
8590
  if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
8484
8591
  return;
8485
8592
  }
8486
- UI_WORKER_OBJ.stat = null;
8593
+ // UI_WORKER_OBJ.stat = null;
8487
8594
 
8488
8595
  UI_WORKER_OBJ.jobs.splice(job_index, 1);
8489
8596
  };
8490
8597
  func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8491
8598
  var job_index = func.UI.worker.find_job_index(SESSION_ID, queue_obj.job_num);
8492
- if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
8493
- if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8494
- return;
8495
- }
8496
- if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
8497
- UI_WORKER_OBJ.stat = null;
8498
- return;
8499
- }
8599
+ // if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
8600
+ // if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8601
+ // return;
8602
+ // }
8603
+ // if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
8604
+ // UI_WORKER_OBJ.stat = null;
8605
+ // return;
8606
+ // }
8500
8607
 
8501
8608
  if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8502
8609
  if (UI_WORKER_OBJ.jobs[job_index]) {
@@ -11336,6 +11443,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
11336
11443
  return;
11337
11444
  }
11338
11445
  }
11446
+
11339
11447
  UI_WORKER_OBJ.cache = {};
11340
11448
  const _session = SESSION_OBJ[SESSION_ID];
11341
11449
  if (glb.DEBUG_MODE) {
@@ -8358,34 +8358,141 @@ func.UI.worker.init = async function (SESSION_ID) {
8358
8358
 
8359
8359
  let last_job_in_queue = 0;
8360
8360
  // let run_stat;
8361
+ // const job_iterator = async function () {
8362
+ // let from_job_num_to_run = last_job_in_queue;
8363
+ // last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
8364
+
8365
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8366
+ // // idle
8367
+ // this.attempt = 0;
8368
+ // if (UI_WORKER_OBJ.jobs.length) {
8369
+ // // clearInterval(this._interval);
8370
+ // for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8371
+ // // if (val.job_num < from_job_num_to_run) continue;
8372
+ // try {
8373
+ // if (val.stat) {
8374
+ // break;
8375
+ // }
8376
+
8377
+ // await func.UI.worker.execute(val.SESSION_ID, val);
8378
+ // // break;
8379
+ // } catch (err) {
8380
+ // console.error(err);
8381
+ // }
8382
+ // }
8383
+ // }
8384
+ // } else {
8385
+ // //busy
8386
+
8387
+ // this.attempt++;
8388
+ // }
8389
+ // };
8390
+
8361
8391
  const job_iterator = async function () {
8362
8392
  let from_job_num_to_run = last_job_in_queue;
8363
8393
  last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
8364
8394
 
8365
- if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8366
- // idle
8367
- this.attempt = 0;
8368
- if (UI_WORKER_OBJ.jobs.length) {
8369
- // clearInterval(this._interval);
8370
- for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8371
- // if (val.job_num < from_job_num_to_run) continue;
8372
- try {
8373
- if (val.stat) {
8374
- break;
8375
- }
8395
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
8396
+ // idle
8397
+ this.attempt = 0;
8398
+ if (UI_WORKER_OBJ.jobs.length) {
8399
+ let running_job_children_elements = [];
8400
+ let active_job_children_elements = [];
8401
+ for (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
8402
+ try {
8403
+ if (val.stat === 'busy') continue;
8376
8404
 
8377
- await func.UI.worker.execute(val.SESSION_ID, val);
8378
- // break;
8379
- } catch (err) {
8380
- console.error(err);
8405
+ if (!val.elementP) {
8406
+ func.UI.worker.execute(val.SESSION_ID, val);
8407
+ continue;
8381
8408
  }
8409
+
8410
+ const active_xu_ui_id = val.elementP.attr('xu-ui-id');
8411
+ if (!active_xu_ui_id) continue;
8412
+
8413
+ const running_job_obj = UI_WORKER_OBJ.jobs[0];
8414
+
8415
+ const running_xu_ui_id = running_job_obj?.elementP?.attr('xu-ui-id');
8416
+ if (!running_xu_ui_id) continue;
8417
+
8418
+ $.each(running_job_obj.elementP.find('*'), function (key, val) {
8419
+ const xu_ui_id = $(val).attr('xu-ui-id');
8420
+ if (!xu_ui_id) return true;
8421
+ running_job_children_elements.push(xu_ui_id);
8422
+ });
8423
+
8424
+ $.each(val.elementP.find('*'), function (key, val) {
8425
+ const xu_ui_id = $(val).attr('xu-ui-id');
8426
+ if (!xu_ui_id) return true;
8427
+ active_job_children_elements.push(xu_ui_id);
8428
+ });
8429
+
8430
+ // skip - if job element exist in the active job ui as child element
8431
+ if (running_job_children_elements.includes(active_xu_ui_id)) {
8432
+ continue;
8433
+ }
8434
+
8435
+ // abort - if active job element exist in the current job ui (parent element changed)
8436
+ if (active_job_children_elements.includes(running_xu_ui_id)) {
8437
+ $.each(active_job_children_elements, function (key, val) {
8438
+ const $elm = $(`[xu-ui-id=${val}]`);
8439
+ if (!$elm.length) return true;
8440
+ if (!$elm.data().xuData) return true;
8441
+ $elm.data().xuData.pending_to_delete = true;
8442
+ });
8443
+
8444
+ func.UI.worker.delete_job(SESSION_ID, running_job_obj.job_num);
8445
+ break;
8446
+ }
8447
+
8448
+ // execute - if active job element not exist the current job ui and not detected as parent element
8449
+ func.UI.worker.execute(val.SESSION_ID, val);
8450
+ continue;
8451
+
8452
+ // active_job_children_elements = [];
8453
+ // if (val.elementP) {
8454
+ // // get active_job children elements only if job handle ui job (not update)
8455
+ // $.each(val.elementP.find('*'), function (key, val) {
8456
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8457
+ // if (!xu_ui_id) return true;
8458
+ // active_job_children_elements.push(xu_ui_id);
8459
+ // });
8460
+ // func.UI.worker.execute(val.SESSION_ID, val);
8461
+ // continue;
8462
+ // } else {
8463
+ // // non ui job
8464
+ // await func.UI.worker.execute(val.SESSION_ID, val);
8465
+ // break;
8466
+ // }
8467
+
8468
+ // if (UI_WORKER_OBJ.jobs.length > 1 && val.elementP) {
8469
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8470
+ // if (!xu_ui_id) continue;
8471
+ // // skip - if job element exist in the active job ui as child element
8472
+ // if (active_job_children_elements.includes(xu_ui_id)) {
8473
+ // continue;
8474
+ // }
8475
+ // // abort - if active job element exist in the current job ui (parent element changed)
8476
+ // $.each(val.elementP.find('*'), function (key, val) {
8477
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
8478
+ // if (!xu_ui_id) return true;
8479
+ // active_job_children_elements.push(xu_ui_id);
8480
+ // });
8481
+ // // execute - if active job element not exist the current job ui and not detected as parent element
8482
+ // const active_job = UI_WORKER_OBJ.jobs[0];
8483
+ // }
8484
+
8485
+ // break;
8486
+ } catch (err) {
8487
+ console.error(err);
8382
8488
  }
8383
8489
  }
8384
- } else {
8385
- //busy
8386
-
8387
- this.attempt++;
8388
8490
  }
8491
+ // } else {
8492
+ // //busy
8493
+
8494
+ // this.attempt++;
8495
+ // }
8389
8496
  };
8390
8497
 
8391
8498
  this._interval = setInterval(job_iterator, 1);
@@ -8472,7 +8579,7 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
8472
8579
  var job_index = func.UI.worker.find_job_index(SESSION_ID, jobNoP);
8473
8580
 
8474
8581
  if (!UI_WORKER_OBJ.jobs[job_index]) {
8475
- UI_WORKER_OBJ.stat = null;
8582
+ // UI_WORKER_OBJ.stat = null;
8476
8583
  return;
8477
8584
  }
8478
8585
 
@@ -8484,20 +8591,20 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
8484
8591
  if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
8485
8592
  return;
8486
8593
  }
8487
- UI_WORKER_OBJ.stat = null;
8594
+ // UI_WORKER_OBJ.stat = null;
8488
8595
 
8489
8596
  UI_WORKER_OBJ.jobs.splice(job_index, 1);
8490
8597
  };
8491
8598
  func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8492
8599
  var job_index = func.UI.worker.find_job_index(SESSION_ID, queue_obj.job_num);
8493
- if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
8494
- if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8495
- return;
8496
- }
8497
- if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
8498
- UI_WORKER_OBJ.stat = null;
8499
- return;
8500
- }
8600
+ // if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
8601
+ // if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8602
+ // return;
8603
+ // }
8604
+ // if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
8605
+ // UI_WORKER_OBJ.stat = null;
8606
+ // return;
8607
+ // }
8501
8608
 
8502
8609
  if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
8503
8610
  if (UI_WORKER_OBJ.jobs[job_index]) {
@@ -9063,6 +9170,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9063
9170
  return;
9064
9171
  }
9065
9172
  }
9173
+
9066
9174
  UI_WORKER_OBJ.cache = {};
9067
9175
  const _session = SESSION_OBJ[SESSION_ID];
9068
9176
  if (glb.DEBUG_MODE) {