@yuneta/gobj-ui 7.23.190 → 7.23.191
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/dist/gobj-ui.cjs.js +28 -9
- package/dist/gobj-ui.es.js +28 -9
- package/package.json +1 -1
- package/src/c_yui_treedb_topics.js +50 -32
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -24741,7 +24741,8 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24741
24741
|
let priv = gobj.priv;
|
|
24742
24742
|
let schema = !!(opts && opts.schema);
|
|
24743
24743
|
if (priv.json_win || priv.json_modal) {
|
|
24744
|
-
if (
|
|
24744
|
+
if (schema) request_schema_file(gobj);
|
|
24745
|
+
else request_print_tranger$1(gobj, "");
|
|
24745
24746
|
return;
|
|
24746
24747
|
}
|
|
24747
24748
|
if (!(0, _yuneta_gobj_js.gclass_find_by_name)("C_YUI_JSON")) {
|
|
@@ -24751,9 +24752,7 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24751
24752
|
}
|
|
24752
24753
|
let mobile = is_mobile$2();
|
|
24753
24754
|
let shell = yui_shell_of(gobj);
|
|
24754
|
-
let
|
|
24755
|
-
if (schema) jv_kw.json_data = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "descs");
|
|
24756
|
-
let jv = (0, _yuneta_gobj_js.gobj_create_service)(`treedb-topics-json-${(0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj))}`, "C_YUI_JSON", jv_kw, gobj);
|
|
24755
|
+
let jv = (0, _yuneta_gobj_js.gobj_create_service)(`treedb-topics-json-${(0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj))}`, "C_YUI_JSON", { subscriber: gobj }, gobj);
|
|
24757
24756
|
if (!jv) {
|
|
24758
24757
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot create the JSON viewer`);
|
|
24759
24758
|
return;
|
|
@@ -24809,7 +24808,8 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24809
24808
|
}
|
|
24810
24809
|
(0, _yuneta_gobj_js.gobj_start)(priv.json_win);
|
|
24811
24810
|
}
|
|
24812
|
-
if (
|
|
24811
|
+
if (schema) request_schema_file(gobj);
|
|
24812
|
+
else request_print_tranger$1(gobj, "");
|
|
24813
24813
|
}
|
|
24814
24814
|
/************************************************************
|
|
24815
24815
|
* Close the JSON viewer (user dismiss / teardown).
|
|
@@ -24845,6 +24845,19 @@ function close_json_viewer$1(gobj) {
|
|
|
24845
24845
|
* collapsed at 100 so a huge tranger stays a small payload of
|
|
24846
24846
|
* `__collapsed__` stubs the viewer expands on demand.
|
|
24847
24847
|
************************************************************/
|
|
24848
|
+
function request_schema_file(gobj) {
|
|
24849
|
+
let priv = gobj.priv;
|
|
24850
|
+
let remote = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "gobj_remote_yuno");
|
|
24851
|
+
if (!remote) {
|
|
24852
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: No gobj_remote_yuno defined`);
|
|
24853
|
+
return;
|
|
24854
|
+
}
|
|
24855
|
+
let ret = (0, _yuneta_gobj_js.gobj_command)(remote, "schema-file", { service: priv.treedb_name }, gobj);
|
|
24856
|
+
if (ret) (0, _yuneta_gobj_js.log_error)(ret);
|
|
24857
|
+
}
|
|
24858
|
+
/************************************************************
|
|
24859
|
+
* The whole tranger, for the raw-json viewer.
|
|
24860
|
+
************************************************************/
|
|
24848
24861
|
function request_print_tranger$1(gobj, path) {
|
|
24849
24862
|
let priv = gobj.priv;
|
|
24850
24863
|
let remote = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "gobj_remote_yuno");
|
|
@@ -24922,6 +24935,16 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
24922
24935
|
else (0, _yuneta_gobj_js.gobj_send_event)(jv, "EV_SET_JSON", { json: data }, gobj);
|
|
24923
24936
|
return 0;
|
|
24924
24937
|
}
|
|
24938
|
+
if (command === "schema-file") {
|
|
24939
|
+
let jv = gobj.priv.json_gobj;
|
|
24940
|
+
if (!jv || !(0, _yuneta_gobj_js.is_gobj)(jv) || (0, _yuneta_gobj_js.gobj_is_destroying)(jv)) return 0;
|
|
24941
|
+
if (result < 0) {
|
|
24942
|
+
yui_shell_show_error(yui_shell_of(gobj), comment || "schema-file failed", { t: i18next.t });
|
|
24943
|
+
return 0;
|
|
24944
|
+
}
|
|
24945
|
+
(0, _yuneta_gobj_js.gobj_send_event)(jv, "EV_SET_JSON", { json: data }, gobj);
|
|
24946
|
+
return 0;
|
|
24947
|
+
}
|
|
24925
24948
|
if (command === "get-asset") {
|
|
24926
24949
|
let asset_topic = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "topic_name", "", 0);
|
|
24927
24950
|
let req_id = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "req_id", "", 0);
|
|
@@ -25408,10 +25431,6 @@ function ac_open_json$1(gobj, event, kw, src) {
|
|
|
25408
25431
|
* one at a time, so it closes whatever was open first.
|
|
25409
25432
|
********************************************/
|
|
25410
25433
|
function ac_open_schema_json(gobj, event, kw, src) {
|
|
25411
|
-
if (!(0, _yuneta_gobj_js.is_object)((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "descs"))) {
|
|
25412
|
-
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema json with no descs`);
|
|
25413
|
-
return -1;
|
|
25414
|
-
}
|
|
25415
25434
|
open_json_viewer$1(gobj, { schema: true });
|
|
25416
25435
|
return 0;
|
|
25417
25436
|
}
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -24736,7 +24736,8 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24736
24736
|
let priv = gobj.priv;
|
|
24737
24737
|
let schema = !!(opts && opts.schema);
|
|
24738
24738
|
if (priv.json_win || priv.json_modal) {
|
|
24739
|
-
if (
|
|
24739
|
+
if (schema) request_schema_file(gobj);
|
|
24740
|
+
else request_print_tranger$1(gobj, "");
|
|
24740
24741
|
return;
|
|
24741
24742
|
}
|
|
24742
24743
|
if (!gclass_find_by_name("C_YUI_JSON")) {
|
|
@@ -24746,9 +24747,7 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24746
24747
|
}
|
|
24747
24748
|
let mobile = is_mobile$2();
|
|
24748
24749
|
let shell = yui_shell_of(gobj);
|
|
24749
|
-
let
|
|
24750
|
-
if (schema) jv_kw.json_data = gobj_read_attr(gobj, "descs");
|
|
24751
|
-
let jv = gobj_create_service(`treedb-topics-json-${clean_name(gobj_name(gobj))}`, "C_YUI_JSON", jv_kw, gobj);
|
|
24750
|
+
let jv = gobj_create_service(`treedb-topics-json-${clean_name(gobj_name(gobj))}`, "C_YUI_JSON", { subscriber: gobj }, gobj);
|
|
24752
24751
|
if (!jv) {
|
|
24753
24752
|
log_error(`${gobj_short_name(gobj)}: cannot create the JSON viewer`);
|
|
24754
24753
|
return;
|
|
@@ -24804,7 +24803,8 @@ function open_json_viewer$1(gobj, opts) {
|
|
|
24804
24803
|
}
|
|
24805
24804
|
gobj_start(priv.json_win);
|
|
24806
24805
|
}
|
|
24807
|
-
if (
|
|
24806
|
+
if (schema) request_schema_file(gobj);
|
|
24807
|
+
else request_print_tranger$1(gobj, "");
|
|
24808
24808
|
}
|
|
24809
24809
|
/************************************************************
|
|
24810
24810
|
* Close the JSON viewer (user dismiss / teardown).
|
|
@@ -24840,6 +24840,19 @@ function close_json_viewer$1(gobj) {
|
|
|
24840
24840
|
* collapsed at 100 so a huge tranger stays a small payload of
|
|
24841
24841
|
* `__collapsed__` stubs the viewer expands on demand.
|
|
24842
24842
|
************************************************************/
|
|
24843
|
+
function request_schema_file(gobj) {
|
|
24844
|
+
let priv = gobj.priv;
|
|
24845
|
+
let remote = gobj_read_pointer_attr(gobj, "gobj_remote_yuno");
|
|
24846
|
+
if (!remote) {
|
|
24847
|
+
log_error(`${gobj_short_name(gobj)}: No gobj_remote_yuno defined`);
|
|
24848
|
+
return;
|
|
24849
|
+
}
|
|
24850
|
+
let ret = gobj_command(remote, "schema-file", { service: priv.treedb_name }, gobj);
|
|
24851
|
+
if (ret) log_error(ret);
|
|
24852
|
+
}
|
|
24853
|
+
/************************************************************
|
|
24854
|
+
* The whole tranger, for the raw-json viewer.
|
|
24855
|
+
************************************************************/
|
|
24843
24856
|
function request_print_tranger$1(gobj, path) {
|
|
24844
24857
|
let priv = gobj.priv;
|
|
24845
24858
|
let remote = gobj_read_pointer_attr(gobj, "gobj_remote_yuno");
|
|
@@ -24917,6 +24930,16 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
24917
24930
|
else gobj_send_event(jv, "EV_SET_JSON", { json: data }, gobj);
|
|
24918
24931
|
return 0;
|
|
24919
24932
|
}
|
|
24933
|
+
if (command === "schema-file") {
|
|
24934
|
+
let jv = gobj.priv.json_gobj;
|
|
24935
|
+
if (!jv || !is_gobj(jv) || gobj_is_destroying(jv)) return 0;
|
|
24936
|
+
if (result < 0) {
|
|
24937
|
+
yui_shell_show_error(yui_shell_of(gobj), comment || "schema-file failed", { t });
|
|
24938
|
+
return 0;
|
|
24939
|
+
}
|
|
24940
|
+
gobj_send_event(jv, "EV_SET_JSON", { json: data }, gobj);
|
|
24941
|
+
return 0;
|
|
24942
|
+
}
|
|
24920
24943
|
if (command === "get-asset") {
|
|
24921
24944
|
let asset_topic = kw_get_str(gobj, kw_command, "topic_name", "", 0);
|
|
24922
24945
|
let req_id = kw_get_str(gobj, kw_command, "req_id", "", 0);
|
|
@@ -25403,10 +25426,6 @@ function ac_open_json$1(gobj, event, kw, src) {
|
|
|
25403
25426
|
* one at a time, so it closes whatever was open first.
|
|
25404
25427
|
********************************************/
|
|
25405
25428
|
function ac_open_schema_json(gobj, event, kw, src) {
|
|
25406
|
-
if (!is_object(gobj_read_attr(gobj, "descs"))) {
|
|
25407
|
-
log_error(`${gobj_short_name(gobj)}: schema json with no descs`);
|
|
25408
|
-
return -1;
|
|
25409
|
-
}
|
|
25410
25429
|
open_json_viewer$1(gobj, { schema: true });
|
|
25411
25430
|
return 0;
|
|
25412
25431
|
}
|
package/package.json
CHANGED
|
@@ -1699,11 +1699,11 @@ function open_json_viewer(gobj, opts)
|
|
|
1699
1699
|
let priv = gobj.priv;
|
|
1700
1700
|
let schema = !!(opts && opts.schema);
|
|
1701
1701
|
|
|
1702
|
-
/* Already open: just re-fetch
|
|
1703
|
-
* the `descs` this view already holds -- so a second click on a
|
|
1704
|
-
* viewer that is already showing it does nothing. */
|
|
1702
|
+
/* Already open: just re-fetch, whichever document it is showing. */
|
|
1705
1703
|
if(priv.json_win || priv.json_modal) {
|
|
1706
|
-
if(
|
|
1704
|
+
if(schema) {
|
|
1705
|
+
request_schema_file(gobj);
|
|
1706
|
+
} else {
|
|
1707
1707
|
request_print_tranger(gobj, "");
|
|
1708
1708
|
}
|
|
1709
1709
|
return;
|
|
@@ -1718,29 +1718,15 @@ function open_json_viewer(gobj, opts)
|
|
|
1718
1718
|
let mobile = is_mobile();
|
|
1719
1719
|
let shell = yui_shell_of(gobj);
|
|
1720
1720
|
|
|
1721
|
-
/* No `title`: the host titles it — the window's title bar on
|
|
1722
|
-
* desktop, the dialog's header on mobile. The viewer's own title
|
|
1723
|
-
* would land INSIDE that host, doubling it. */
|
|
1724
|
-
let jv_kw = {
|
|
1725
|
-
subscriber: gobj /* publishes EV_EXPAND_PATH to us */
|
|
1726
|
-
};
|
|
1727
|
-
if(schema) {
|
|
1728
|
-
/* The schema is here already and it is small: it goes in whole,
|
|
1729
|
-
* and no drill-down happens because nothing is collapsed.
|
|
1730
|
-
*
|
|
1731
|
-
* Written as `json_data: schema? descs : null` it cost two
|
|
1732
|
-
* errors on EVERY raw-json open: a `DTP_JSON` attr takes a dict
|
|
1733
|
-
* or a list, and gobj-js REFUSES a null with "attr must be a
|
|
1734
|
-
* json dict/list" -- and then json2data() fails and the create
|
|
1735
|
-
* carries on with the attr unset. An attr you have nothing to
|
|
1736
|
-
* say about is one you do not mention. */
|
|
1737
|
-
jv_kw.json_data = gobj_read_attr(gobj, "descs");
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
1721
|
let jv = gobj_create_service(
|
|
1741
1722
|
`treedb-topics-json-${clean_name(gobj_name(gobj))}`,
|
|
1742
1723
|
"C_YUI_JSON",
|
|
1743
|
-
|
|
1724
|
+
{
|
|
1725
|
+
/* No `title`: the host titles it — the window's title bar on
|
|
1726
|
+
* desktop, the dialog's header on mobile. The viewer's own
|
|
1727
|
+
* title would land INSIDE that host, doubling it. */
|
|
1728
|
+
subscriber: gobj /* publishes EV_EXPAND_PATH to us */
|
|
1729
|
+
},
|
|
1744
1730
|
gobj
|
|
1745
1731
|
);
|
|
1746
1732
|
if(!jv) {
|
|
@@ -1812,7 +1798,9 @@ function open_json_viewer(gobj, opts)
|
|
|
1812
1798
|
gobj_start(priv.json_win);
|
|
1813
1799
|
}
|
|
1814
1800
|
|
|
1815
|
-
if(
|
|
1801
|
+
if(schema) {
|
|
1802
|
+
request_schema_file(gobj);
|
|
1803
|
+
} else {
|
|
1816
1804
|
request_print_tranger(gobj, "");
|
|
1817
1805
|
}
|
|
1818
1806
|
}
|
|
@@ -1872,6 +1860,23 @@ function close_json_viewer(gobj)
|
|
|
1872
1860
|
* collapsed at 100 so a huge tranger stays a small payload of
|
|
1873
1861
|
* `__collapsed__` stubs the viewer expands on demand.
|
|
1874
1862
|
************************************************************/
|
|
1863
|
+
function request_schema_file(gobj)
|
|
1864
|
+
{
|
|
1865
|
+
let priv = gobj.priv;
|
|
1866
|
+
let remote = gobj_read_pointer_attr(gobj, "gobj_remote_yuno");
|
|
1867
|
+
if(!remote) {
|
|
1868
|
+
log_error(`${gobj_short_name(gobj)}: No gobj_remote_yuno defined`);
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
let ret = gobj_command(remote, "schema-file", {service: priv.treedb_name}, gobj);
|
|
1872
|
+
if(ret) {
|
|
1873
|
+
log_error(ret);
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/************************************************************
|
|
1878
|
+
* The whole tranger, for the raw-json viewer.
|
|
1879
|
+
************************************************************/
|
|
1875
1880
|
function request_print_tranger(gobj, path)
|
|
1876
1881
|
{
|
|
1877
1882
|
let priv = gobj.priv;
|
|
@@ -1985,6 +1990,26 @@ function ac_mt_command_answer(gobj, event, kw, src)
|
|
|
1985
1990
|
return 0;
|
|
1986
1991
|
}
|
|
1987
1992
|
|
|
1993
|
+
/*
|
|
1994
|
+
* The schema as it is STORED -- the `<treedb>.treedb_schema.json` of
|
|
1995
|
+
* the node -- which is NOT what `descs` answers: the file keys its
|
|
1996
|
+
* cols by name and carries the schema and topic versions. An older
|
|
1997
|
+
* backend has no such command and says so; the viewer shows that.
|
|
1998
|
+
*/
|
|
1999
|
+
if(command === "schema-file") {
|
|
2000
|
+
let jv = gobj.priv.json_gobj;
|
|
2001
|
+
if(!jv || !is_gobj(jv) || gobj_is_destroying(jv)) {
|
|
2002
|
+
return 0; /* viewer closed before its answer landed: benign */
|
|
2003
|
+
}
|
|
2004
|
+
if(result < 0) {
|
|
2005
|
+
yui_shell_show_error(yui_shell_of(gobj),
|
|
2006
|
+
comment || "schema-file failed", {t: t});
|
|
2007
|
+
return 0;
|
|
2008
|
+
}
|
|
2009
|
+
gobj_send_event(jv, "EV_SET_JSON", {json: data}, gobj);
|
|
2010
|
+
return 0;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
1988
2013
|
/*
|
|
1989
2014
|
* An asset, for a form's preview or a file popup. Before the generic
|
|
1990
2015
|
* error path too: an asset that cannot be served is SHOWN where it
|
|
@@ -2785,13 +2810,6 @@ function ac_open_json(gobj, event, kw, src)
|
|
|
2785
2810
|
********************************************/
|
|
2786
2811
|
function ac_open_schema_json(gobj, event, kw, src)
|
|
2787
2812
|
{
|
|
2788
|
-
if(!is_object(gobj_read_attr(gobj, "descs"))) {
|
|
2789
|
-
/* Not reachable by hand -- the button only exists while the
|
|
2790
|
-
* schema is on screen, which needs the descs -- so this is a
|
|
2791
|
-
* broken caller, not something to tell the reader about. */
|
|
2792
|
-
log_error(`${gobj_short_name(gobj)}: schema json with no descs`);
|
|
2793
|
-
return -1;
|
|
2794
|
-
}
|
|
2795
2813
|
open_json_viewer(gobj, {schema: true});
|
|
2796
2814
|
return 0;
|
|
2797
2815
|
}
|