@yuneta/gobj-ui 7.25.17 → 7.25.19
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 +69 -3
- package/dist/gobj-ui.cjs.js +126 -30
- package/dist/gobj-ui.es.js +126 -30
- package/package.json +2 -2
- package/src/c_g6_nodes_tree.js +23 -0
- package/src/c_yui_node.js +71 -0
- package/src/c_yui_schema_editor.js +20 -10
- package/src/c_yui_treedb_graph.js +49 -6
- package/src/c_yui_treedb_topic_with_form.js +23 -0
- package/src/c_yui_treedb_topics.js +43 -9
- package/src/c_yui_uplot.js +10 -5
- package/src/form_json_expand.wiring.test.js +121 -0
- package/src/g6_graphs_write_owed.wiring.test.js +37 -0
- package/src/node_nav_events.wiring.test.js +150 -0
- package/src/schema_editor_reload.wiring.test.js +37 -0
- package/src/treedb_graph_writes.wiring.test.js +71 -3
- package/src/treedb_topics_transport.wiring.test.js +111 -7
- package/src/uplot_add_serie.test.js +92 -0
package/README.md
CHANGED
|
@@ -227,6 +227,16 @@ seen*:
|
|
|
227
227
|
for its treedb nodes, so the graph tab returns to `<graph>/<topic>` with its
|
|
228
228
|
focus and the data tab to the topic that was open.
|
|
229
229
|
|
|
230
|
+
- **A node hears every event of the navs it projects** (they are its pure
|
|
231
|
+
children). Since `7.25.19` it declares all three, in every state -- a ZONE
|
|
232
|
+
projection outlives the path, so a root that is off it still hears its
|
|
233
|
+
rail: `EV_NAV_CLICKED` (a navigation), `EV_NAV_ITEM_CLOSE` (handed to the
|
|
234
|
+
shell, which re-publishes it to the app, as for the shell's own closable
|
|
235
|
+
items) and `EV_DRAWER_CLOSE_REQUESTED` (the node closes its own drawer
|
|
236
|
+
projection: the shell's `yui_shell_close_drawer()` knows only the shell's
|
|
237
|
+
navs). Before, the last two answered *"Event NOT DEFINED in state"*, and so
|
|
238
|
+
did a click on a zone nav of a root in `ST_OFF`.
|
|
239
|
+
|
|
230
240
|
- **`nav_mode` — the three shapes as one runtime knob.** The two bullets above
|
|
231
241
|
describe what a tree *declares*; `nav_mode` is how a user *chooses* between
|
|
232
242
|
the shapes without the app rewriting anything:
|
|
@@ -581,7 +591,15 @@ Two layout facts the browser taught this component, both worth keeping:
|
|
|
581
591
|
the two-view toggle did when the list was two long), plus `EV_REFRESH` /
|
|
582
592
|
`EV_SHOW` / `EV_HIDE` / `EV_LANGUAGE_CHANGED`.
|
|
583
593
|
- Output event: `EV_EXPAND_PATH {path, size}` (`EVF_OUTPUT_EVENT`) — the parent
|
|
584
|
-
must declare it in its own FSM (CHILD subscription model)
|
|
594
|
+
must declare it in its own FSM (CHILD subscription model), and ANSWER it: the
|
|
595
|
+
stub shows "loading" until `EV_SUBTREE_LOADED` or `EV_SUBTREE_ERROR` arrives.
|
|
596
|
+
A host that cannot read a subtree says so with the error, as
|
|
597
|
+
`C_YUI_TREEDB_TOPIC_WITH_FORM` does for its schema, cell and table viewers
|
|
598
|
+
since `7.25.19` (before, it declared nothing: *"Event NOT DEFINED"*):
|
|
599
|
+
```js
|
|
600
|
+
gobj_send_event(src, "EV_SUBTREE_ERROR",
|
|
601
|
+
{path: kw.path, error: t("this part cannot be loaded here")}, gobj);
|
|
602
|
+
``` That is the ONLY
|
|
585
603
|
one, on purpose: this viewer is a child of its host and subscribes it to
|
|
586
604
|
everything it publishes, so every output event is a mandatory declaration in
|
|
587
605
|
every host's FSM. The graph child's `EV_JSON_ITEM_CLICKED` stops here
|
|
@@ -989,6 +1007,50 @@ hold the list again; the cell and a delete's question count either shape. The
|
|
|
989
1007
|
search box no longer finds a parent row by the id of one of its children: to
|
|
990
1008
|
find what hangs from a row, click its hook.
|
|
991
1009
|
|
|
1010
|
+
### What a write says to the host: `EV_RECORD_WRITTEN`
|
|
1011
|
+
|
|
1012
|
+
`C_YUI_TREEDB_TOPICS` and `C_YUI_TREEDB_GRAPH` publish `EV_RECORD_WRITTEN`
|
|
1013
|
+
when a write of THEIRS is answered with success: a host whose work is not
|
|
1014
|
+
finished with the record (a schema editor, a pending Apply) needs that, and the
|
|
1015
|
+
`EV_TREEDB_NODE_*` events cannot tell its own writes from anybody else's. The
|
|
1016
|
+
graph does not report `__graphs__`, its own bookkeeping.
|
|
1017
|
+
|
|
1018
|
+
```js
|
|
1019
|
+
// kw of EV_RECORD_WRITTEN
|
|
1020
|
+
{
|
|
1021
|
+
treedb_name: "treedb_test", // the view's own treedb
|
|
1022
|
+
topic_name: "yunos", // the topic written (the CHILD's, for a link)
|
|
1023
|
+
record: {id: "1", x: 1, y: 2}, // the node the store answered, as written
|
|
1024
|
+
created: false, // true for a NEW record (see below)
|
|
1025
|
+
command: "update-node", // create/update/delete-node, link/unlink-nodes
|
|
1026
|
+
parent_ref: "realms^r1^yunos", // graph, link/unlink only
|
|
1027
|
+
child_ref: "yunos^1" // graph, link/unlink only
|
|
1028
|
+
}
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
Since `7.25.18` every field carries what it says. They were read from the
|
|
1032
|
+
answer's command frame, which carries back only the request's
|
|
1033
|
+
`__md_command__` -- `C_IEVENT_CLI` and gui_agent's `C_AGENT_TREEDB_LINK` both
|
|
1034
|
+
do -- so `treedb_name` and `record` arrived empty, and a link named no topic.
|
|
1035
|
+
`treedb_name` is now the view's, `record` is the node the answer carries (a
|
|
1036
|
+
delete answers the node deleted, a link the child), and a link echoes its topic
|
|
1037
|
+
and refs in `__md_command__`.
|
|
1038
|
+
|
|
1039
|
+
Since `7.25.19` the topics view publishes a successful **delete** too (it
|
|
1040
|
+
published nothing: the answer went to an empty `break`), and `created` is
|
|
1041
|
+
TRUE for its **+New**: that goes out as an `update-node` with `create_only`,
|
|
1042
|
+
so comparing the command with `"create-node"` answered `false` for every
|
|
1043
|
+
record the table created. The request now echoes `created: true` in its
|
|
1044
|
+
`__md_command__`. The graph creates with `create-node`, and says so the same
|
|
1045
|
+
way.
|
|
1046
|
+
|
|
1047
|
+
```js
|
|
1048
|
+
// the table's +New, answered
|
|
1049
|
+
{treedb_name: "treedb_test", topic_name: "users", record: {id: "n1"}, created: true, command: "update-node"}
|
|
1050
|
+
// a row deleted, answered with the node deleted
|
|
1051
|
+
{treedb_name: "treedb_test", topic_name: "roles", record: {id: "x"}, created: false, command: "delete-node"}
|
|
1052
|
+
```
|
|
1053
|
+
|
|
992
1054
|
### Read-only treedbs: `readonly`
|
|
993
1055
|
|
|
994
1056
|
`C_YUI_TREEDB_TOPICS` and `C_YUI_TREEDB_GRAPH` take a **`readonly`** attr; the
|
|
@@ -1815,8 +1877,12 @@ the history buttons -- they decide the Save from `history.canUndo()`, and they
|
|
|
1815
1877
|
run on every history change, every change of mode and every redraw of the
|
|
1816
1878
|
theme -- and a refusal heard in reading was never shown. The engine now keeps
|
|
1817
1879
|
the topic as owed: the Save stays lit while one is, in edition and on entering
|
|
1818
|
-
it; the Save that writes the topic again pays it,
|
|
1819
|
-
forgets it (the view holds what the backend holds)
|
|
1880
|
+
it; the Save that writes the topic again pays it, a reload of the data
|
|
1881
|
+
forgets it (the view holds what the backend holds), and so does an ECHO of the
|
|
1882
|
+
topic's `__graphs__` record (since `7.25.19`): the echo is what the backend
|
|
1883
|
+
holds, taken as shown and as saved, so nothing is owed any more. Before, a
|
|
1884
|
+
refused Save #1 answered after Save #2's echo -- or another browser saving the
|
|
1885
|
+
topic -- left the Save lit with nothing to write until a reload.
|
|
1820
1886
|
|
|
1821
1887
|
```js
|
|
1822
1888
|
gobj_send_event(engine, "EV_GRAPHS_WRITE_REFUSED", {topic: "users"}, host); // Save lit
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -10901,7 +10901,7 @@ function register_c_yui_map() {
|
|
|
10901
10901
|
*
|
|
10902
10902
|
* Graphics, Charts with uPlot
|
|
10903
10903
|
*
|
|
10904
|
-
* Copyright (c) 2025, ArtGins.
|
|
10904
|
+
* Copyright (c) 2025-2026, ArtGins.
|
|
10905
10905
|
* All Rights Reserved.
|
|
10906
10906
|
***********************************************************************/
|
|
10907
10907
|
/***************************************************************
|
|
@@ -11151,8 +11151,8 @@ function ac_add_serie(gobj, event, kw, src) {
|
|
|
11151
11151
|
let colors = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "colors");
|
|
11152
11152
|
if (!Array.isArray(colors) || !colors.length) colors = CHART_PALETTE;
|
|
11153
11153
|
let color = colors[Math.max(0, idx - 1) % colors.length];
|
|
11154
|
-
(0
|
|
11155
|
-
(0
|
|
11154
|
+
if (kw.stroke === void 0) kw.stroke = color.stroke;
|
|
11155
|
+
if (kw.fill === void 0) kw.fill = color.fill;
|
|
11156
11156
|
uplot$4.addSeries(kw);
|
|
11157
11157
|
return 0;
|
|
11158
11158
|
}
|
|
@@ -16020,7 +16020,7 @@ function ac_hide_diff(gobj, event, kw, src) {
|
|
|
16020
16020
|
* document has no backend to ask for it: the SOURCE truncated
|
|
16021
16021
|
* it, and that is the answer, to the viewer that asked.
|
|
16022
16022
|
***************************************************************/
|
|
16023
|
-
function ac_expand_path(gobj, event, kw, src) {
|
|
16023
|
+
function ac_expand_path$1(gobj, event, kw, src) {
|
|
16024
16024
|
(0, _yuneta_gobj_js.gobj_send_event)(src, "EV_SUBTREE_ERROR", {
|
|
16025
16025
|
path: kw && kw.path || "",
|
|
16026
16026
|
error: (0, i18next.t)("collapsed in the source")
|
|
@@ -16081,7 +16081,7 @@ function create_gclass$12(gclass_name) {
|
|
|
16081
16081
|
],
|
|
16082
16082
|
[
|
|
16083
16083
|
"EV_EXPAND_PATH",
|
|
16084
|
-
ac_expand_path,
|
|
16084
|
+
ac_expand_path$1,
|
|
16085
16085
|
null
|
|
16086
16086
|
]
|
|
16087
16087
|
]],
|
|
@@ -16118,7 +16118,7 @@ function create_gclass$12(gclass_name) {
|
|
|
16118
16118
|
],
|
|
16119
16119
|
[
|
|
16120
16120
|
"EV_EXPAND_PATH",
|
|
16121
|
-
ac_expand_path,
|
|
16121
|
+
ac_expand_path$1,
|
|
16122
16122
|
null
|
|
16123
16123
|
]
|
|
16124
16124
|
]],
|
|
@@ -24924,9 +24924,20 @@ function treedb_nodes$1(gobj, treedb_name, topic_name, options, page, purpose) {
|
|
|
24924
24924
|
return 0;
|
|
24925
24925
|
}
|
|
24926
24926
|
/************************************************************
|
|
24927
|
+
* The record a write answered: the node the store wrote (an
|
|
24928
|
+
* update or a create), deleted, or the child of a link. The
|
|
24929
|
+
* answer's frame carries back only `__md_command__`, never the
|
|
24930
|
+
* request's own record.
|
|
24931
|
+
************************************************************/
|
|
24932
|
+
function answered_record$1(data) {
|
|
24933
|
+
if (data && typeof data === "object" && !Array.isArray(data)) return data;
|
|
24934
|
+
if (Array.isArray(data) && data[0] && typeof data[0] === "object") return data[0];
|
|
24935
|
+
return {};
|
|
24936
|
+
}
|
|
24937
|
+
/************************************************************
|
|
24927
24938
|
* Command to remote service
|
|
24928
24939
|
************************************************************/
|
|
24929
|
-
function treedb_update_node$1(gobj, treedb_name, topic_name, record, options, form_write) {
|
|
24940
|
+
function treedb_update_node$1(gobj, treedb_name, topic_name, record, options, form_write, created) {
|
|
24930
24941
|
let command = "update-node";
|
|
24931
24942
|
let gobj_remote_yuno = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "gobj_remote_yuno");
|
|
24932
24943
|
let kw = {
|
|
@@ -24938,6 +24949,7 @@ function treedb_update_node$1(gobj, treedb_name, topic_name, record, options, fo
|
|
|
24938
24949
|
};
|
|
24939
24950
|
kw.__md_command__ = { topic_name };
|
|
24940
24951
|
if (form_write) kw.__md_command__.form_write = form_write;
|
|
24952
|
+
if (created) kw.__md_command__.created = true;
|
|
24941
24953
|
let ret = (0, _yuneta_gobj_js.gobj_command)(gobj_remote_yuno, command, kw, gobj);
|
|
24942
24954
|
if (ret) {
|
|
24943
24955
|
(0, _yuneta_gobj_js.log_error)(ret);
|
|
@@ -24961,7 +24973,11 @@ function treedb_delete_node$1(gobj, treedb_name, topic_name, record, options) {
|
|
|
24961
24973
|
};
|
|
24962
24974
|
kw.__md_command__ = { topic_name };
|
|
24963
24975
|
let ret = (0, _yuneta_gobj_js.gobj_command)(gobj_remote_yuno, command, kw, gobj);
|
|
24964
|
-
if (ret)
|
|
24976
|
+
if (ret) {
|
|
24977
|
+
(0, _yuneta_gobj_js.log_error)(ret);
|
|
24978
|
+
return -1;
|
|
24979
|
+
}
|
|
24980
|
+
return 0;
|
|
24965
24981
|
}
|
|
24966
24982
|
/************************************************************
|
|
24967
24983
|
* True on a phone-width viewport (Bulma's mobile breakpoint).
|
|
@@ -25244,17 +25260,18 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
25244
25260
|
break;
|
|
25245
25261
|
case "create-node":
|
|
25246
25262
|
case "update-node":
|
|
25263
|
+
case "delete-node":
|
|
25247
25264
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_RECORD_WRITTEN", {
|
|
25248
|
-
treedb_name: (0, _yuneta_gobj_js.
|
|
25265
|
+
treedb_name: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name"),
|
|
25249
25266
|
topic_name: (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0),
|
|
25250
|
-
record: (
|
|
25251
|
-
created: command === "create-node",
|
|
25267
|
+
record: answered_record$1(data),
|
|
25268
|
+
created: command === "create-node" || kw_command.created === true,
|
|
25252
25269
|
command
|
|
25253
25270
|
});
|
|
25271
|
+
if (command === "delete-node") break;
|
|
25254
25272
|
settle_form_write(gobj.priv.form_writes, (0, _yuneta_gobj_js.kw_get_int)(gobj, kw_command, "form_write", 0, 0), (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0));
|
|
25255
25273
|
answer_form_write(gobj, get_gobj_formtable(gobj, (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0)), (0, _yuneta_gobj_js.kw_get_int)(gobj, kw_command, "form_write", 0, 0), true);
|
|
25256
25274
|
break;
|
|
25257
|
-
case "delete-node": break;
|
|
25258
25275
|
default: (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)} Command unknown: ${command}`);
|
|
25259
25276
|
}
|
|
25260
25277
|
return 0;
|
|
@@ -25522,7 +25539,7 @@ function ac_create_record(gobj, event, kw, src) {
|
|
|
25522
25539
|
create: true,
|
|
25523
25540
|
create_only: true,
|
|
25524
25541
|
autolink: true
|
|
25525
|
-
}, form_write) < 0) {
|
|
25542
|
+
}, form_write, true) < 0) {
|
|
25526
25543
|
answer_form_write(gobj, src, form_write, false);
|
|
25527
25544
|
return -1;
|
|
25528
25545
|
}
|
|
@@ -29440,6 +29457,24 @@ function refuse_if_readonly$2(gobj, event) {
|
|
|
29440
29457
|
* From external, at the beginning, load all topic data
|
|
29441
29458
|
************************************************************/
|
|
29442
29459
|
/***************************************************************
|
|
29460
|
+
* One of MY json viewers (the schema, a cell, the table's records)
|
|
29461
|
+
* met a `__collapsed__` sentinel and the reader opened it. The
|
|
29462
|
+
* viewer never fetches: it asks its host, and waits on "loading"
|
|
29463
|
+
* until it is answered. This view holds records, not a store it can
|
|
29464
|
+
* read a subtree of -- the lazy drill is `print-tranger`, which the
|
|
29465
|
+
* TOPICS view runs for its own viewer, over a whole tranger -- so the
|
|
29466
|
+
* answer is that it cannot, and the viewer shows that on the stub
|
|
29467
|
+
* instead of loading for ever.
|
|
29468
|
+
***************************************************************/
|
|
29469
|
+
function ac_expand_path(gobj, event, kw, src) {
|
|
29470
|
+
let path = kw && kw.path || "";
|
|
29471
|
+
(0, _yuneta_gobj_js.gobj_send_event)(src, "EV_SUBTREE_ERROR", {
|
|
29472
|
+
path,
|
|
29473
|
+
error: (0, i18next.t)("this part cannot be loaded here")
|
|
29474
|
+
}, gobj);
|
|
29475
|
+
return 0;
|
|
29476
|
+
}
|
|
29477
|
+
/***************************************************************
|
|
29443
29478
|
* The language changed (the shell publishes it after the app switched).
|
|
29444
29479
|
*
|
|
29445
29480
|
* The column headers carry their key (col_label's title formatter emits a
|
|
@@ -30733,6 +30768,11 @@ function create_gclass$5(gclass_name) {
|
|
|
30733
30768
|
ac_show_schema,
|
|
30734
30769
|
null
|
|
30735
30770
|
],
|
|
30771
|
+
[
|
|
30772
|
+
"EV_EXPAND_PATH",
|
|
30773
|
+
ac_expand_path,
|
|
30774
|
+
null
|
|
30775
|
+
],
|
|
30736
30776
|
[
|
|
30737
30777
|
"EV_CELL_EDITED",
|
|
30738
30778
|
ac_cell_edited,
|
|
@@ -30848,6 +30888,7 @@ function create_gclass$5(gclass_name) {
|
|
|
30848
30888
|
["EV_CHANGE_LOCALE", 0],
|
|
30849
30889
|
["EV_REFRESH", 0],
|
|
30850
30890
|
["EV_SHOW_SCHEMA", 0],
|
|
30891
|
+
["EV_EXPAND_PATH", 0],
|
|
30851
30892
|
["EV_CELL_EDITED", 0],
|
|
30852
30893
|
["EV_REPULL_PAGE", 0],
|
|
30853
30894
|
["EV_PAGE_LOADED", 0],
|
|
@@ -65865,6 +65906,22 @@ function ac_graphs_write_refused(gobj, event, kw, src) {
|
|
|
65865
65906
|
return 0;
|
|
65866
65907
|
}
|
|
65867
65908
|
/************************************************************
|
|
65909
|
+
* An echo of a `__graphs__` record is what the backend holds for
|
|
65910
|
+
* its topic now, and the view has just taken it as shown and as
|
|
65911
|
+
* saved: a write of that topic owed from an earlier refusal is
|
|
65912
|
+
* owed no more. Left owed, the Save stayed lit with nothing to
|
|
65913
|
+
* write -- the plan compares the two, and they are equal -- until
|
|
65914
|
+
* a reload: a refused Save #1 answered after Save #2 landed, or
|
|
65915
|
+
* another browser saving the topic, did exactly that.
|
|
65916
|
+
************************************************************/
|
|
65917
|
+
function settle_owed_graphs_write(gobj, rec) {
|
|
65918
|
+
let priv = gobj.priv;
|
|
65919
|
+
let topic_name = rec && rec.topic;
|
|
65920
|
+
if (!topic_name || !priv._graphs_writes_owed[topic_name]) return;
|
|
65921
|
+
delete priv._graphs_writes_owed[topic_name];
|
|
65922
|
+
update_history_buttons(gobj);
|
|
65923
|
+
}
|
|
65924
|
+
/************************************************************
|
|
65868
65925
|
* Node created, from subscription
|
|
65869
65926
|
************************************************************/
|
|
65870
65927
|
function ac_node_created(gobj, event, kw, src) {
|
|
@@ -65876,6 +65933,7 @@ function ac_node_created(gobj, event, kw, src) {
|
|
|
65876
65933
|
if (topic_name === "__graphs__") {
|
|
65877
65934
|
priv.__graphs__.push(node);
|
|
65878
65935
|
build_graph_properties(gobj);
|
|
65936
|
+
settle_owed_graphs_write(gobj, node);
|
|
65879
65937
|
return 0;
|
|
65880
65938
|
}
|
|
65881
65939
|
if (!priv.descs[topic_name]) {
|
|
@@ -65911,6 +65969,7 @@ function ac_node_updated(gobj, event, kw, src) {
|
|
|
65911
65969
|
}
|
|
65912
65970
|
if (!found) priv.__graphs__.push(node);
|
|
65913
65971
|
apply_graphs_echo(priv._graph_properties, priv._saved_graph_properties, priv.__graphs__, node);
|
|
65972
|
+
settle_owed_graphs_write(gobj, node);
|
|
65914
65973
|
return 0;
|
|
65915
65974
|
}
|
|
65916
65975
|
let desc = priv.descs[topic_name];
|
|
@@ -68408,6 +68467,29 @@ function treedb_delete_node(gobj, treedb_name, topic_name, record, options) {
|
|
|
68408
68467
|
if (ret) (0, _yuneta_gobj_js.log_error)(ret);
|
|
68409
68468
|
}
|
|
68410
68469
|
/************************************************************
|
|
68470
|
+
* What a link or an unlink asks back with its answer: the
|
|
68471
|
+
* topic of the CHILD (the node a link saves) and both refs.
|
|
68472
|
+
* `child_ref` is "topic^id", `parent_ref` "topic^id^hook".
|
|
68473
|
+
************************************************************/
|
|
68474
|
+
function link_echo(parent_ref, child_ref) {
|
|
68475
|
+
return {
|
|
68476
|
+
topic_name: typeof child_ref === "string" ? child_ref.split("^")[0] : "",
|
|
68477
|
+
parent_ref,
|
|
68478
|
+
child_ref
|
|
68479
|
+
};
|
|
68480
|
+
}
|
|
68481
|
+
/************************************************************
|
|
68482
|
+
* The record a write answered: the node the store wrote (an
|
|
68483
|
+
* update or a create), deleted, or the child of a link. The
|
|
68484
|
+
* answer's frame carries back only `__md_command__`, never the
|
|
68485
|
+
* request's own record.
|
|
68486
|
+
************************************************************/
|
|
68487
|
+
function answered_record(data) {
|
|
68488
|
+
if (data && typeof data === "object" && !Array.isArray(data)) return data;
|
|
68489
|
+
if (Array.isArray(data) && data[0] && typeof data[0] === "object") return data[0];
|
|
68490
|
+
return {};
|
|
68491
|
+
}
|
|
68492
|
+
/************************************************************
|
|
68411
68493
|
* Command to remote service
|
|
68412
68494
|
************************************************************/
|
|
68413
68495
|
function treedb_link_nodes(gobj, treedb_name, parent_ref, child_ref, options) {
|
|
@@ -68424,6 +68506,7 @@ function treedb_link_nodes(gobj, treedb_name, parent_ref, child_ref, options) {
|
|
|
68424
68506
|
child_ref,
|
|
68425
68507
|
options: options || {}
|
|
68426
68508
|
};
|
|
68509
|
+
kw.__md_command__ = link_echo(parent_ref, child_ref);
|
|
68427
68510
|
let ret = (0, _yuneta_gobj_js.gobj_command)(priv.gobj_remote_yuno, command, kw, gobj);
|
|
68428
68511
|
if (ret) (0, _yuneta_gobj_js.log_error)(ret);
|
|
68429
68512
|
}
|
|
@@ -68444,6 +68527,7 @@ function treedb_unlink_nodes(gobj, treedb_name, parent_ref, child_ref, options)
|
|
|
68444
68527
|
child_ref,
|
|
68445
68528
|
options: options || {}
|
|
68446
68529
|
};
|
|
68530
|
+
kw.__md_command__ = link_echo(parent_ref, child_ref);
|
|
68447
68531
|
let ret = (0, _yuneta_gobj_js.gobj_command)(priv.gobj_remote_yuno, command, kw, gobj);
|
|
68448
68532
|
if (ret) (0, _yuneta_gobj_js.log_error)(ret);
|
|
68449
68533
|
}
|
|
@@ -68658,13 +68742,20 @@ function ac_mt_command_answer$1(gobj, event, kw, src) {
|
|
|
68658
68742
|
case "link-nodes":
|
|
68659
68743
|
case "unlink-nodes":
|
|
68660
68744
|
if (result < 0 && command === "update-node") graphs_write_refused(gobj, (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0), (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "graph_topic", "", 0));
|
|
68661
|
-
if (result >= 0 && (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0) !== "__graphs__")
|
|
68662
|
-
|
|
68663
|
-
|
|
68664
|
-
|
|
68665
|
-
|
|
68666
|
-
|
|
68667
|
-
|
|
68745
|
+
if (result >= 0 && (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0) !== "__graphs__") {
|
|
68746
|
+
let written = {
|
|
68747
|
+
treedb_name: priv.treedb_name,
|
|
68748
|
+
topic_name: (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0),
|
|
68749
|
+
record: answered_record(data),
|
|
68750
|
+
created: command === "create-node",
|
|
68751
|
+
command
|
|
68752
|
+
};
|
|
68753
|
+
if (command === "link-nodes" || command === "unlink-nodes") {
|
|
68754
|
+
written.parent_ref = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "parent_ref", "", 0);
|
|
68755
|
+
written.child_ref = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "child_ref", "", 0);
|
|
68756
|
+
}
|
|
68757
|
+
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_RECORD_WRITTEN", written);
|
|
68758
|
+
}
|
|
68668
68759
|
break;
|
|
68669
68760
|
default: (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)} Command unknown: ${command}`);
|
|
68670
68761
|
}
|
|
@@ -72913,8 +73004,12 @@ function current_topic(gobj) {
|
|
|
72913
73004
|
* One line for what the whole view has to say: loading, empty,
|
|
72914
73005
|
* or the reason nothing loaded. Carries its i18n key, so it
|
|
72915
73006
|
* follows a language change like any other text.
|
|
73007
|
+
*
|
|
73008
|
+
* `detail` is a NAME (a treedb, a topic) shown as it is, unless
|
|
73009
|
+
* `detail_is_key` says it is a key: a name is not text to
|
|
73010
|
+
* translate, and a topic called `nodes` is not "Nodos".
|
|
72916
73011
|
***************************************************************/
|
|
72917
|
-
function show_notice(gobj, key, detail) {
|
|
73012
|
+
function show_notice(gobj, key, detail, detail_is_key) {
|
|
72918
73013
|
let $notice = $of(gobj, ".SCHEMA_NOTICE");
|
|
72919
73014
|
if (!$notice) return;
|
|
72920
73015
|
clear($notice);
|
|
@@ -72931,14 +73026,15 @@ function show_notice(gobj, key, detail) {
|
|
|
72931
73026
|
},
|
|
72932
73027
|
(0, i18next.t)(key)
|
|
72933
73028
|
]));
|
|
72934
|
-
if (detail && detail !== key)
|
|
72935
|
-
"
|
|
72936
|
-
{
|
|
72937
|
-
|
|
72938
|
-
|
|
72939
|
-
|
|
72940
|
-
|
|
72941
|
-
|
|
73029
|
+
if (detail && detail !== key) {
|
|
73030
|
+
let attrs = { class: "SCHEMA_NOTICE_DETAIL yui-text-quiet ml-2" };
|
|
73031
|
+
if (detail_is_key) attrs.i18n = `${detail}`;
|
|
73032
|
+
$notice.appendChild((0, _yuneta_gobj_js.createElement2)([
|
|
73033
|
+
"span",
|
|
73034
|
+
attrs,
|
|
73035
|
+
detail_is_key ? (0, i18next.t)(`${detail}`) : `${detail}`
|
|
73036
|
+
]));
|
|
73037
|
+
}
|
|
72942
73038
|
}
|
|
72943
73039
|
/***************************************************************
|
|
72944
73040
|
* A button of the toolbar. Every one carries an icon and a
|
|
@@ -73125,7 +73221,7 @@ function render(gobj) {
|
|
|
73125
73221
|
return;
|
|
73126
73222
|
}
|
|
73127
73223
|
if (state === "ST_IDLE") {
|
|
73128
|
-
show_notice(gobj, priv.load_error ? "cannot load the schemas" : "not connected", priv.load_error);
|
|
73224
|
+
show_notice(gobj, priv.load_error ? "cannot load the schemas" : "not connected", priv.load_error, true);
|
|
73129
73225
|
destroy_diagram(gobj);
|
|
73130
73226
|
clear($body);
|
|
73131
73227
|
return;
|