@yuneta/gobj-ui 7.27.33 → 7.27.34

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.
package/README.md CHANGED
@@ -3367,7 +3367,10 @@ in every other answer. Then a read asked BEFORE a set and answered after it
3367
3367
  does not unlock what the set locked: without it, a card's own read answered
3368
3368
  after a tick showed the levels before the set, enabled, for one round trip. A
3369
3369
  host that leaves `set_id` out of its answers keeps working as before: the view
3370
- matches an answer by its gclass.
3370
+ matches an answer by its gclass. A host that echoes it is expected to REPLACE
3371
+ the pending read of a gclass with the read of a newer set of that gclass (as
3372
+ gui_agent does), so a newer set of the gclass an open viewer waits for moves
3373
+ the viewer's wait to the newer number (7.27.34): the older answer never comes.
3371
3374
 
3372
3375
  ```js
3373
3376
  /* the host, after the last command of a set: */
@@ -3376,7 +3379,9 @@ gobj_send_event(priv.view.tree, "EV_TRACE_INFO",
3376
3379
  /* a plain read (a card was opened): */
3377
3380
  gobj_send_event(priv.view.tree, "EV_TRACE_INFO",
3378
3381
  Object.assign({gclass: "C_TCP", set_id: null}, the_four_answers), gobj);
3379
- ``` Ask `view-gobj-tree` for the fields the view reads,
3382
+ ```
3383
+
3384
+ Ask `view-gobj-tree` for the fields the view reads,
3380
3385
  by name (`options=[...]`): its default leaves out `gclass` and `fullname`, and
3381
3386
  `play_methods` is what keeps a gobj with nothing to play from reading paused.
3382
3387
 
@@ -55176,6 +55176,7 @@ function set_trace_levels(gobj, target, scope, levels, set) {
55176
55176
  if (viewer) {
55177
55177
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
55178
55178
  if (lock_viewer_for_set(gobj, shown, priv.set_in_flight)) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55179
+ else if (priv.viewer_awaits && priv.viewer_awaits === target.gclass) priv.viewer_awaits_set = set_id;
55179
55180
  }
55180
55181
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_TRACE_LEVEL", {
55181
55182
  scope,
@@ -55171,6 +55171,7 @@ function set_trace_levels(gobj, target, scope, levels, set) {
55171
55171
  if (viewer) {
55172
55172
  let shown = gobj_read_str_attr(viewer, "gclass_name");
55173
55173
  if (lock_viewer_for_set(gobj, shown, priv.set_in_flight)) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55174
+ else if (priv.viewer_awaits && priv.viewer_awaits === target.gclass) priv.viewer_awaits_set = set_id;
55174
55175
  }
55175
55176
  gobj_publish_event(gobj, "EV_SET_TRACE_LEVEL", {
55176
55177
  scope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.33",
3
+ "version": "7.27.34",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -3910,6 +3910,11 @@ function set_trace_levels(gobj, target, scope, levels, set)
3910
3910
  let shown = gobj_read_str_attr(viewer, "gclass_name");
3911
3911
  if(lock_viewer_for_set(gobj, shown, priv.set_in_flight)) {
3912
3912
  gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
3913
+ } else if(priv.viewer_awaits && priv.viewer_awaits === target.gclass) {
3914
+ /* The host replaces the pending read of a gclass with the one
3915
+ * of this newer set: the answer the viewer waited for will
3916
+ * come under this set's number, not the older one's. */
3917
+ priv.viewer_awaits_set = set_id;
3913
3918
  }
3914
3919
  }
3915
3920
 
@@ -689,4 +689,42 @@ describe("C_YUI_GOBJ_TREE_JS, source remote: a host that says which set it answe
689
689
  expect(viewer_box(viewer, "traffic").disabled).toBe(false);
690
690
  expect(problems()).toEqual([]);
691
691
  });
692
+
693
+ /* REV-CLOUD V41.2.1: the host REPLACES the pending read of a gclass
694
+ * with the one of a newer set of that gclass, so the read the
695
+ * viewer waits for (the yuno's, of an older set) never comes. */
696
+ test("a newer set of the gclass the viewer waits for: it waits for the newer one", async () => {
697
+ const {view, viewer} = await open_tcp_viewer();
698
+ gobj_read_attr(view, "$container").querySelector(".GOBJ_TREE_YUNO_TRACES_BUTTON").click();
699
+ gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, YUNO_INFO, {set_id: null}), host);
700
+
701
+ /* S1: a set of the yuno's scope; the viewer of C_TCP waits for C_YUNO */
702
+ const ev_kw = row_of(view, "ev_kw");
703
+ ev_kw.$global.checked = true;
704
+ ev_kw.$global.dispatchEvent(fake_event("change"));
705
+ const s1 = last_set_id();
706
+ expect(viewer_box(viewer, "traffic").disabled).toBe(true);
707
+ gobj_send_event(view, "EV_LOAD_TREE", {tree: TREE, set_id: s1}, host);
708
+
709
+ /* S2: a gobj set on the root's card, before the C_YUNO read of S1 */
710
+ gobj_send_event(view, "EV_NODE_CLICK",
711
+ {id: node_id_of(view, "C_YUNO^gate"), client_x: 10, client_y: 10}, view);
712
+ const {$gobj} = row_of(view, "machine");
713
+ $gobj.checked = true;
714
+ $gobj.dispatchEvent(fake_event("change"));
715
+ const s2 = last_set_id();
716
+ expect(s2).not.toBe(s1);
717
+ wanted.length = 0;
718
+
719
+ /* the host sends only the C_YUNO read of S2: S1's was replaced */
720
+ gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, YUNO_INFO,
721
+ {global_on: ["machine", "ev_kw"], set_id: s2}), host);
722
+ expect(wanted.map((w) => [w.event, w.kw.gclass, w.kw.set_id]))
723
+ .toEqual([["EV_TRACE_INFO_WANTED", "C_TCP", s2]]);
724
+ gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, TCP_INFO,
725
+ {global_levels: YUNO_INFO.global_levels,
726
+ gclass_on: ["connections", "ev_kw"], global_on: ["ev_kw"], set_id: s2}), host);
727
+ expect(viewer_box(viewer, "traffic").disabled).toBe(false);
728
+ expect(problems()).toEqual([]);
729
+ });
692
730
  });