@xuda.io/runtime-bundle 1.0.961 → 1.0.963

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.
@@ -27492,34 +27492,141 @@ func.UI.worker.init = async function (SESSION_ID) {
27492
27492
 
27493
27493
  let last_job_in_queue = 0;
27494
27494
  // let run_stat;
27495
+ // const job_iterator = async function () {
27496
+ // let from_job_num_to_run = last_job_in_queue;
27497
+ // last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
27498
+
27499
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
27500
+ // // idle
27501
+ // this.attempt = 0;
27502
+ // if (UI_WORKER_OBJ.jobs.length) {
27503
+ // // clearInterval(this._interval);
27504
+ // for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
27505
+ // // if (val.job_num < from_job_num_to_run) continue;
27506
+ // try {
27507
+ // if (val.stat) {
27508
+ // break;
27509
+ // }
27510
+
27511
+ // await func.UI.worker.execute(val.SESSION_ID, val);
27512
+ // // break;
27513
+ // } catch (err) {
27514
+ // console.error(err);
27515
+ // }
27516
+ // }
27517
+ // }
27518
+ // } else {
27519
+ // //busy
27520
+
27521
+ // this.attempt++;
27522
+ // }
27523
+ // };
27524
+
27495
27525
  const job_iterator = async function () {
27496
27526
  let from_job_num_to_run = last_job_in_queue;
27497
27527
  last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
27498
27528
 
27499
- if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
27500
- // idle
27501
- this.attempt = 0;
27502
- if (UI_WORKER_OBJ.jobs.length) {
27503
- // clearInterval(this._interval);
27504
- for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
27505
- // if (val.job_num < from_job_num_to_run) continue;
27506
- try {
27507
- if (val.stat) {
27508
- break;
27509
- }
27529
+ // if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
27530
+ // idle
27531
+ this.attempt = 0;
27532
+ if (UI_WORKER_OBJ.jobs.length) {
27533
+ let running_job_children_elements = [];
27534
+ let active_job_children_elements = [];
27535
+ for (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
27536
+ try {
27537
+ if (val.stat === 'busy') continue;
27538
+
27539
+ if (!val.elementP) {
27540
+ func.UI.worker.execute(val.SESSION_ID, val);
27541
+ continue;
27542
+ }
27543
+
27544
+ const active_xu_ui_id = val.elementP.attr('xu-ui-id');
27545
+ if (!active_xu_ui_id) continue;
27510
27546
 
27511
- await func.UI.worker.execute(val.SESSION_ID, val);
27512
- // break;
27513
- } catch (err) {
27514
- console.error(err);
27547
+ const running_job_obj = UI_WORKER_OBJ.jobs[0];
27548
+
27549
+ const running_xu_ui_id = running_job_obj?.elementP?.attr('xu-ui-id');
27550
+ if (!running_xu_ui_id) continue;
27551
+
27552
+ $.each(running_job_obj.elementP.find('*'), function (key, val) {
27553
+ const xu_ui_id = val.elementP.attr('xu-ui-id');
27554
+ if (!xu_ui_id) return true;
27555
+ running_job_children_elements.push(xu_ui_id);
27556
+ });
27557
+
27558
+ $.each(val.elementP.find('*'), function (key, val) {
27559
+ const xu_ui_id = val.elementP.attr('xu-ui-id');
27560
+ if (!xu_ui_id) return true;
27561
+ active_job_children_elements.push(xu_ui_id);
27562
+ });
27563
+
27564
+ // skip - if job element exist in the active job ui as child element
27565
+ if (running_job_children_elements.includes(active_xu_ui_id)) {
27566
+ continue;
27515
27567
  }
27568
+
27569
+ // abort - if active job element exist in the current job ui (parent element changed)
27570
+ if (active_job_children_elements.includes(running_xu_ui_id)) {
27571
+ $.each(active_job_children_elements, function (key, val) {
27572
+ const $elm = $(`[xu-ui-id=${val}]`);
27573
+ if (!$elm.length) return true;
27574
+ if (!$elm.data().xuData) return true;
27575
+ $elm.data().xuData.pending_to_delete = true;
27576
+ });
27577
+
27578
+ func.UI.worker.delete_job(SESSION_ID, running_job_obj.job_num);
27579
+ break;
27580
+ }
27581
+
27582
+ // execute - if active job element not exist the current job ui and not detected as parent element
27583
+ func.UI.worker.execute(val.SESSION_ID, val);
27584
+ continue;
27585
+
27586
+ // active_job_children_elements = [];
27587
+ // if (val.elementP) {
27588
+ // // get active_job children elements only if job handle ui job (not update)
27589
+ // $.each(val.elementP.find('*'), function (key, val) {
27590
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
27591
+ // if (!xu_ui_id) return true;
27592
+ // active_job_children_elements.push(xu_ui_id);
27593
+ // });
27594
+ // func.UI.worker.execute(val.SESSION_ID, val);
27595
+ // continue;
27596
+ // } else {
27597
+ // // non ui job
27598
+ // await func.UI.worker.execute(val.SESSION_ID, val);
27599
+ // break;
27600
+ // }
27601
+
27602
+ // if (UI_WORKER_OBJ.jobs.length > 1 && val.elementP) {
27603
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
27604
+ // if (!xu_ui_id) continue;
27605
+ // // skip - if job element exist in the active job ui as child element
27606
+ // if (active_job_children_elements.includes(xu_ui_id)) {
27607
+ // continue;
27608
+ // }
27609
+ // // abort - if active job element exist in the current job ui (parent element changed)
27610
+ // $.each(val.elementP.find('*'), function (key, val) {
27611
+ // const xu_ui_id = val.elementP.attr('xu-ui-id');
27612
+ // if (!xu_ui_id) return true;
27613
+ // active_job_children_elements.push(xu_ui_id);
27614
+ // });
27615
+ // // execute - if active job element not exist the current job ui and not detected as parent element
27616
+ // const active_job = UI_WORKER_OBJ.jobs[0];
27617
+ // }
27618
+
27619
+ // break;
27620
+ } catch (err) {
27621
+ console.error(err);
27516
27622
  }
27517
27623
  }
27518
- } else {
27519
- //busy
27520
-
27521
- this.attempt++;
27522
27624
  }
27625
+ // } else {
27626
+ // //busy
27627
+
27628
+ // this.attempt++;
27629
+ // }
27523
27630
  };
27524
27631
 
27525
27632
  this._interval = setInterval(job_iterator, 1);
@@ -27606,7 +27713,7 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
27606
27713
  var job_index = func.UI.worker.find_job_index(SESSION_ID, jobNoP);
27607
27714
 
27608
27715
  if (!UI_WORKER_OBJ.jobs[job_index]) {
27609
- UI_WORKER_OBJ.stat = null;
27716
+ // UI_WORKER_OBJ.stat = null;
27610
27717
  return;
27611
27718
  }
27612
27719
 
@@ -27618,20 +27725,20 @@ func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
27618
27725
  if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
27619
27726
  return;
27620
27727
  }
27621
- UI_WORKER_OBJ.stat = null;
27728
+ // UI_WORKER_OBJ.stat = null;
27622
27729
 
27623
27730
  UI_WORKER_OBJ.jobs.splice(job_index, 1);
27624
27731
  };
27625
27732
  func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
27626
27733
  var job_index = func.UI.worker.find_job_index(SESSION_ID, queue_obj.job_num);
27627
- if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
27628
- if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
27629
- return;
27630
- }
27631
- if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
27632
- UI_WORKER_OBJ.stat = null;
27633
- return;
27634
- }
27734
+ // if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
27735
+ // if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
27736
+ // return;
27737
+ // }
27738
+ // if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
27739
+ // UI_WORKER_OBJ.stat = null;
27740
+ // return;
27741
+ // }
27635
27742
 
27636
27743
  if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
27637
27744
  if (UI_WORKER_OBJ.jobs[job_index]) {
@@ -29756,7 +29863,7 @@ func.datasource.del = function (SESSION_ID, dsP) {
29756
29863
  perform_delete();
29757
29864
  };
29758
29865
 
29759
- func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_xu_for_refresh) {
29866
+ func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_xu_for_refresh, trigger) {
29760
29867
  return new Promise(async (resolve, reject) => {
29761
29868
  var _session = SESSION_OBJ[SESSION_ID];
29762
29869
 
@@ -29965,7 +30072,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
29965
30072
  return Math.min(...arr.map(Number));
29966
30073
  }
29967
30074
 
29968
- await func.UI.screen.refresh_xu_attributes(SESSION_ID, _.cloneDeep(fields_changed), null, null, findMin(datasource_changed), avoid_xu_for_refresh);
30075
+ await func.UI.screen.refresh_xu_attributes(SESSION_ID, _.cloneDeep(fields_changed), null, null, findMin(datasource_changed), avoid_xu_for_refresh, trigger);
29969
30076
  // await removed from the below function cause to dead lock Mar 3 25
29970
30077
  await func.UI.screen.refresh_screen(
29971
30078
  SESSION_ID,
@@ -31012,13 +31119,15 @@ func.UI.screen.call_embed = function (SESSION_ID, prog) {
31012
31119
  });
31013
31120
  func.UI.main.embed_prog_execute(SESSION_ID, prog);
31014
31121
  };
31015
- func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession_changed, avoid_xu_for_refresh) {
31016
- if (!_.isEmpty(SCREEN_BLOCKER_OBJ)) {
31017
- // let dom to finish
31018
- setTimeout(() => {
31019
- func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession_changed);
31020
- }, 100);
31021
- return;
31122
+ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession_changed, avoid_xu_for_refresh, trigger) {
31123
+ if (trigger !== 'click') {
31124
+ if (!_.isEmpty(SCREEN_BLOCKER_OBJ)) {
31125
+ // let dom to finish
31126
+ setTimeout(() => {
31127
+ func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession_changed);
31128
+ }, 100);
31129
+ return;
31130
+ }
31022
31131
  }
31023
31132
 
31024
31133
  UI_WORKER_OBJ.cache = {};
@@ -36782,7 +36891,7 @@ func.events.execute = async function (
36782
36891
  }
36783
36892
  }
36784
36893
 
36785
- await func.datasource.update(SESSION_ID, datasource_changes);
36894
+ await func.datasource.update(SESSION_ID, datasource_changes, null, null, triggerP);
36786
36895
 
36787
36896
  if (_ds.PARAM_OUT_INFO) {
36788
36897
  for await (const [key, val] of Object.entries(_ds.PARAM_OUT_INFO)) {