@yuneta/gobj-ui 7.25.9 → 7.25.10
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 +44 -12
- package/dist/gobj-ui.cjs.js +165 -60
- package/dist/gobj-ui.es.js +165 -60
- package/package.json +1 -1
- package/src/c_yui_schema_editor.js +210 -39
- package/src/schema_editor_reload.wiring.test.js +233 -3
- package/src/shell_modals.js +9 -1
- package/src/shell_toast_once.test.js +36 -1
package/README.md
CHANGED
|
@@ -2077,9 +2077,13 @@ that makes the schema file win over the literal), once, and puts it in use with
|
|
|
2077
2077
|
`apply-schema` and a restart of the owning yuno. Until 7.23.195 every write
|
|
2078
2078
|
here raised both numbers, so an edit half made was already the schema of the
|
|
2079
2079
|
next start. The topic list marks what this session wrote and has not saved,
|
|
2080
|
-
and the column screen says so in a banner;
|
|
2081
|
-
|
|
2082
|
-
|
|
2080
|
+
and the column screen says so in a banner; an `EV_REFRESH` -- the view's own
|
|
2081
|
+
Refresh button, or a host that sends one after a save -- forgets the drafts this
|
|
2082
|
+
session wrote, and the host's `EV_DRAFTS` replaces what it said before. The
|
|
2083
|
+
export (C literal and JSON) warns while there are drafts: the literal carries
|
|
2084
|
+
the versions a save publishes. Its two views are two named buttons (`schema as
|
|
2085
|
+
c source`, `schema as json`, i18n keys the consumer's locales carry), the one
|
|
2086
|
+
shown pressed.
|
|
2083
2087
|
|
|
2084
2088
|
**A draft survives a reload** (7.25.3). The mark of a write lived in the
|
|
2085
2089
|
session's memory only, so a reload of the page, a reconnect or a refresh of
|
|
@@ -2197,8 +2201,12 @@ else.
|
|
|
2197
2201
|
column form sends every field it shows, so its Save after a reload wrote
|
|
2198
2202
|
the OLD record over the newer one -- 7.25.8 told the operator to "try
|
|
2199
2203
|
again", which did exactly that. The import plan is forgotten when a load
|
|
2200
|
-
|
|
2201
|
-
|
|
2204
|
+
LEAVES (7.25.10: one that could not be sent keeps it), and a Yes that finds
|
|
2205
|
+
it gone is said (`the import plan is gone: preview it again`). A load that
|
|
2206
|
+
failed or never left replaced nothing, and the dialog stays with what was
|
|
2207
|
+
typed. A confirmation is a shell modal and outlives a load: its Yes in
|
|
2208
|
+
`ST_EMPTY` or `ST_IDLE` is refused with the same words, not *"NOT
|
|
2209
|
+
DEFINED"* (7.25.10).
|
|
2202
2210
|
|
|
2203
2211
|
```js
|
|
2204
2212
|
gobj_send_event(editor, "EV_EDIT_COLUMN", {col: "id"}, host); // form, model_gen N
|
|
@@ -2207,10 +2215,27 @@ else.
|
|
|
2207
2215
|
```
|
|
2208
2216
|
- **A load refused IN session keeps the model it was replacing** (7.25.9): a
|
|
2209
2217
|
routing adapter's deadline on a slow `nodes` answers -1 while the session
|
|
2210
|
-
is up. The records are put back, the screen and any open dialog stay,
|
|
2211
|
-
operator is told
|
|
2212
|
-
|
|
2213
|
-
|
|
2218
|
+
is up. The records are put back, the screen and any open dialog stay, and
|
|
2219
|
+
the operator is told
|
|
2220
|
+
`cannot read the schemas again: the ones shown may be out of date, your next change reads them first`.
|
|
2221
|
+
**The owed reload runs on the operator's next action** (7.25.10; before, it
|
|
2222
|
+
waited for a reconnect that never came while the session stayed up, and a
|
|
2223
|
+
form opened on the old model wrote over the newer record): an edit -- a
|
|
2224
|
+
form, a Save, a delete, a drag, a confirmation, Check, Export, Import, the
|
|
2225
|
+
orphans -- is refused with
|
|
2226
|
+
`the schemas shown may be out of date: they are read again, try again when they are in`
|
|
2227
|
+
and the model is read again (keeping the draft chips); a move goes where it
|
|
2228
|
+
was going and reads there. Not at once and not on a timer: a load refused
|
|
2229
|
+
on a deadline asked again at once is refused the same way, and one asked
|
|
2230
|
+
on a clock is polling. A Refresh asked while a load is in flight keeps the
|
|
2231
|
+
records of the model shown (7.25.10), not the half the first load got.
|
|
2232
|
+
Only a first load, with no model before it, ends on the empty screen.
|
|
2233
|
+
|
|
2234
|
+
```js
|
|
2235
|
+
// the load failed in session: model kept, reload owed
|
|
2236
|
+
gobj_send_event(editor, "EV_EDIT_COLUMN", {col: "id"}, host); // refused, said; ST_LOADING
|
|
2237
|
+
// ... the load lands: the same click now opens the form
|
|
2238
|
+
``` A write answered with no record reloads the model and
|
|
2214
2239
|
says what it did not send after it
|
|
2215
2240
|
(`the treedb did not describe a write back: the writes after it were not sent`).
|
|
2216
2241
|
- The toolbar offers Diagram, Check, Export, Import, New topic and New column
|
|
@@ -2220,8 +2245,10 @@ else.
|
|
|
2220
2245
|
was DONE makes the editor read the model again (at once, after the write in
|
|
2221
2246
|
flight, or on the reconnect), and it is a write for the host too: it
|
|
2222
2247
|
publishes `EV_RECORD_WRITTEN` and marks the topic of the record answered.
|
|
2223
|
-
Only
|
|
2224
|
-
|
|
2248
|
+
Only `EV_REFRESH` forgets what this session wrote -- the view's own Refresh
|
|
2249
|
+
button sends it, and a host may after a Save (the agent console does not:
|
|
2250
|
+
there the chips of this session stay until Refresh); the reloads the editor
|
|
2251
|
+
asks itself (the reconnect's, a late write's, the one a refused load owed)
|
|
2225
2252
|
keep the draft chips. Through a routing adapter that settled the
|
|
2226
2253
|
write on its OWN deadline the late answer does not reach the view -- the
|
|
2227
2254
|
adapter echoes a node event instead, which this view does not hear -- and
|
|
@@ -3170,7 +3197,12 @@ a modal
|
|
|
3170
3197
|
`MODAL` / `MODAL_BACKDROP` / `MODAL_CONTENT` / `MODAL_HEADER` / `MODAL_BACK` /
|
|
3171
3198
|
`MODAL_TITLE` (+ `MODAL_TITLE_PREFIX` / `MODAL_TITLE_KIND`) / `MODAL_CLOSE` /
|
|
3172
3199
|
`MODAL_BODY`, a confirm `CONFIRM*` and a toast
|
|
3173
|
-
`TOAST*`.
|
|
3200
|
+
`TOAST*`. Every button of that chrome -- each ✕, a dialog's back arrow, a
|
|
3201
|
+
confirmation's answers (`CONFIRM_BTN`) -- carries a translatable `title` and
|
|
3202
|
+
`aria-label` (7.25.10). An answer is named by its own label, so pass i18n
|
|
3203
|
+
KEYS as `yes_label` / `confirm_label` / … (`{yes_label: "install"}`): the
|
|
3204
|
+
defaults (`"Yes"`, `"Delete"`) are not lower-case and no validated locale
|
|
3205
|
+
can hold them.
|
|
3174
3206
|
|
|
3175
3207
|
Those names identify the *kind* of block, not the *instance*: every window in
|
|
3176
3208
|
the app is a `C_YUI_WINDOW`, every popup is a `MODAL`. To target **one**
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -3161,6 +3161,8 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3161
3161
|
{
|
|
3162
3162
|
class: "MODAL_BACK yui-dialog-back",
|
|
3163
3163
|
type: "button",
|
|
3164
|
+
title: (0, i18next.t)("back"),
|
|
3165
|
+
"data-i18n-title": "back",
|
|
3164
3166
|
"aria-label": (0, i18next.t)("back"),
|
|
3165
3167
|
"data-i18n-aria-label": "back"
|
|
3166
3168
|
},
|
|
@@ -3341,7 +3343,13 @@ function build_dialog(shell, message, buttons, opts) {
|
|
|
3341
3343
|
type: "button",
|
|
3342
3344
|
"data-modal-button-value": b.value
|
|
3343
3345
|
};
|
|
3344
|
-
if (typeof b.label === "string")
|
|
3346
|
+
if (typeof b.label === "string") {
|
|
3347
|
+
btn_attrs.i18n = b.label;
|
|
3348
|
+
btn_attrs.title = (0, i18next.t)(b.label);
|
|
3349
|
+
btn_attrs["data-i18n-title"] = b.label;
|
|
3350
|
+
btn_attrs["aria-label"] = (0, i18next.t)(b.label);
|
|
3351
|
+
btn_attrs["data-i18n-aria-label"] = b.label;
|
|
3352
|
+
}
|
|
3345
3353
|
return [
|
|
3346
3354
|
"button",
|
|
3347
3355
|
btn_attrs,
|
|
@@ -72102,9 +72110,10 @@ function write_options(op) {
|
|
|
72102
72110
|
* the owner's design of M36 (2026-09-21 review) every write here
|
|
72103
72111
|
* raised both versions, so an edit half made was already the
|
|
72104
72112
|
* schema of the next start. The topic list marks what this session
|
|
72105
|
-
* wrote and has not saved (the
|
|
72106
|
-
*
|
|
72107
|
-
*
|
|
72113
|
+
* wrote and has not saved (EV_REFRESH forgets it: the view's own
|
|
72114
|
+
* Refresh button sends it, and a host may after a save -- the
|
|
72115
|
+
* agent console's does not) and what the host says is not saved
|
|
72116
|
+
* (EV_DRAFTS, replaced whole each time it is sent).
|
|
72108
72117
|
*
|
|
72109
72118
|
* WHAT ELSE IS HERE, and why each is here and not somewhere else:
|
|
72110
72119
|
*
|
|
@@ -72382,6 +72391,45 @@ function built_on_a_replaced_model(gobj, event, kw) {
|
|
|
72382
72391
|
yui_shell_show_error(yui_shell_of(gobj), "the schemas were read again: open the dialog again", { t: i18next.t });
|
|
72383
72392
|
return true;
|
|
72384
72393
|
}
|
|
72394
|
+
/***************************************************************
|
|
72395
|
+
* The reload a load refused IN session left owed (a routing
|
|
72396
|
+
* adapter's deadline on a slow `nodes`, ac_mt_command_answer()):
|
|
72397
|
+
* the model shown is kept, and it may be older than the store.
|
|
72398
|
+
* The session is up, so no reconnect will ask for it again -- it
|
|
72399
|
+
* was owed for as long as the session lasted, and a form opened
|
|
72400
|
+
* on that model wrote every field of it over the newer record
|
|
72401
|
+
* (fifth independent review; A3 of the fourth, by another path).
|
|
72402
|
+
*
|
|
72403
|
+
* So the operator's NEXT action asks it. An edit -- a form, a
|
|
72404
|
+
* write, a confirmation, what reads the model whole (check,
|
|
72405
|
+
* export) -- is refused and said: it would be computed on what
|
|
72406
|
+
* the store may no longer hold, and the load that lands closes a
|
|
72407
|
+
* dialog built on the old model anyway (end_load()). A move is
|
|
72408
|
+
* not refused (reload_after_move()): it goes, and reads there.
|
|
72409
|
+
*
|
|
72410
|
+
* Not on a timer, and not at once: a load refused on a deadline
|
|
72411
|
+
* asked again at once is refused the same way, and one asked on a
|
|
72412
|
+
* clock is polling. Out of session nothing is asked; the reconnect
|
|
72413
|
+
* does it (ac_transport_state()). The reload keeps this session's
|
|
72414
|
+
* draft chips: the host did not ask for it.
|
|
72415
|
+
***************************************************************/
|
|
72416
|
+
function owes_reload(gobj) {
|
|
72417
|
+
let state = (0, _yuneta_gobj_js.gobj_current_state)(gobj);
|
|
72418
|
+
return gobj.priv.reload_on_open && transport_in_session(gobj) && state !== "ST_LOADING" && state !== "ST_SAVING";
|
|
72419
|
+
}
|
|
72420
|
+
function reload_first(gobj, event) {
|
|
72421
|
+
if (!owes_reload(gobj)) return false;
|
|
72422
|
+
gobj.priv.reload_on_open = false;
|
|
72423
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} refused, the schemas shown may be out of date: they are read again first`);
|
|
72424
|
+
yui_shell_show_error(yui_shell_of(gobj), "the schemas shown may be out of date: they are read again, try again when they are in", { t: i18next.t });
|
|
72425
|
+
request_model(gobj, true);
|
|
72426
|
+
return true;
|
|
72427
|
+
}
|
|
72428
|
+
function reload_after_move(gobj) {
|
|
72429
|
+
if (!owes_reload(gobj)) return 0;
|
|
72430
|
+
gobj.priv.reload_on_open = false;
|
|
72431
|
+
return request_model(gobj, true);
|
|
72432
|
+
}
|
|
72385
72433
|
/***************************
|
|
72386
72434
|
* The model
|
|
72387
72435
|
***************************/
|
|
@@ -72400,11 +72448,14 @@ function built_on_a_replaced_model(gobj, event, kw) {
|
|
|
72400
72448
|
* and a load that LANDS closes it (end_load()): it was built on the
|
|
72401
72449
|
* model the load replaced, and its Save sends every field it shows.
|
|
72402
72450
|
* An import plan is forgotten here for the same reason: it is a list
|
|
72403
|
-
* of writes computed against the model going away
|
|
72451
|
+
* of writes computed against the model going away -- once the load
|
|
72452
|
+
* has LEFT (one that could not be sent replaces nothing).
|
|
72404
72453
|
*
|
|
72405
|
-
* `keep_written`: a load
|
|
72406
|
-
*
|
|
72407
|
-
*
|
|
72454
|
+
* `keep_written`: a load nobody ASKED for -- the reconnect, a write
|
|
72455
|
+
* that turned out done, the reload a refused load owed -- keeps what
|
|
72456
|
+
* this session wrote. Only EV_REFRESH forgets it: the view's own
|
|
72457
|
+
* Refresh button, or a host that sends it (after a Save, say; the
|
|
72458
|
+
* agent console does not).
|
|
72408
72459
|
*
|
|
72409
72460
|
* A load that cannot leave WHOLE did not happen (out of session it
|
|
72410
72461
|
* is not even asked): the records the model was built on are put
|
|
@@ -72417,8 +72468,7 @@ function built_on_a_replaced_model(gobj, event, kw) {
|
|
|
72417
72468
|
function request_model(gobj, keep_written) {
|
|
72418
72469
|
let priv = gobj.priv;
|
|
72419
72470
|
if (!(0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "gobj_remote_yuno")) return -1;
|
|
72420
|
-
|
|
72421
|
-
let previous = priv.records;
|
|
72471
|
+
let previous = (0, _yuneta_gobj_js.gobj_current_state)(gobj) === "ST_LOADING" ? priv.records_before : priv.records;
|
|
72422
72472
|
priv.records_before = previous;
|
|
72423
72473
|
priv.records = {
|
|
72424
72474
|
treedbs: [],
|
|
@@ -72453,6 +72503,7 @@ function request_model(gobj, keep_written) {
|
|
|
72453
72503
|
end_load(gobj);
|
|
72454
72504
|
return -1;
|
|
72455
72505
|
}
|
|
72506
|
+
forget_import_plan(gobj);
|
|
72456
72507
|
priv.pending = left;
|
|
72457
72508
|
return 0;
|
|
72458
72509
|
}
|
|
@@ -72518,8 +72569,8 @@ function build_model(gobj) {
|
|
|
72518
72569
|
* Called ONLY when records arrive from the store: that is what a
|
|
72519
72570
|
* measurement of "changed since" can be measured against.
|
|
72520
72571
|
*
|
|
72521
|
-
* `written` is forgotten only by
|
|
72522
|
-
*
|
|
72572
|
+
* `written` is forgotten only by an EV_REFRESH (the view's own
|
|
72573
|
+
* Refresh button, or a host that sends one). Since M36 a write moves no
|
|
72523
72574
|
* version, so `written` is the draft chip of what this session
|
|
72524
72575
|
* wrote and no longer half of a version measurement: a reload of
|
|
72525
72576
|
* the reconnect, or of a write that turned out done, forgot the
|
|
@@ -72541,10 +72592,12 @@ function start_measuring(gobj) {
|
|
|
72541
72592
|
* until the host saves it (C_TREEDB's save-schema, which raises the
|
|
72542
72593
|
* versions of what changed). Two sources say a topic is one, and
|
|
72543
72594
|
* they are kept APART because they are forgotten differently:
|
|
72544
|
-
* - `written`: what THIS session wrote. Only
|
|
72545
|
-
*
|
|
72546
|
-
*
|
|
72547
|
-
*
|
|
72595
|
+
* - `written`: what THIS session wrote. Only EV_REFRESH forgets
|
|
72596
|
+
* it -- the view's own Refresh button sends it (in the agent
|
|
72597
|
+
* console that is the only sender), and a host may after a
|
|
72598
|
+
* Save; the reconnect's reload, the one owed after a write, a
|
|
72599
|
+
* refused load's and a late write's keep it (start_measuring(),
|
|
72600
|
+
* request_model());
|
|
72548
72601
|
* - `host_ids`: what the host said last (EV_DRAFTS), replaced WHOLE
|
|
72549
72602
|
* by the next EV_DRAFTS. Folded into `written`, a topic the host
|
|
72550
72603
|
* named once stayed a draft after the Save that published it.
|
|
@@ -74253,40 +74306,40 @@ function open_export(gobj, treedb) {
|
|
|
74253
74306
|
[
|
|
74254
74307
|
[
|
|
74255
74308
|
"div",
|
|
74256
|
-
{ class: "SCHEMA_EXPORT_TABS
|
|
74309
|
+
{ class: "SCHEMA_EXPORT_TABS buttons has-addons mb-2" },
|
|
74257
74310
|
[[
|
|
74258
|
-
"
|
|
74259
|
-
{
|
|
74311
|
+
"button",
|
|
74312
|
+
{
|
|
74313
|
+
class: "SCHEMA_EXPORT_TAB button selected_state",
|
|
74314
|
+
type: "button",
|
|
74315
|
+
"data-pane": "c",
|
|
74316
|
+
"aria-pressed": "true",
|
|
74317
|
+
title: (0, i18next.t)("schema as c source"),
|
|
74318
|
+
"data-i18n-title": "schema as c source",
|
|
74319
|
+
"aria-label": (0, i18next.t)("schema as c source"),
|
|
74320
|
+
"data-i18n-aria-label": "schema as c source"
|
|
74321
|
+
},
|
|
74260
74322
|
[[
|
|
74261
|
-
"
|
|
74262
|
-
{
|
|
74263
|
-
|
|
74264
|
-
|
|
74265
|
-
|
|
74266
|
-
|
|
74267
|
-
|
|
74268
|
-
|
|
74269
|
-
|
|
74270
|
-
|
|
74271
|
-
|
|
74272
|
-
|
|
74273
|
-
|
|
74274
|
-
|
|
74275
|
-
|
|
74276
|
-
|
|
74277
|
-
|
|
74278
|
-
|
|
74279
|
-
|
|
74280
|
-
|
|
74281
|
-
[[
|
|
74282
|
-
"a",
|
|
74283
|
-
{},
|
|
74284
|
-
[[
|
|
74285
|
-
"span",
|
|
74286
|
-
{},
|
|
74287
|
-
"JSON"
|
|
74288
|
-
]]
|
|
74289
|
-
]]
|
|
74323
|
+
"span",
|
|
74324
|
+
{},
|
|
74325
|
+
"C"
|
|
74326
|
+
]]
|
|
74327
|
+
], [
|
|
74328
|
+
"button",
|
|
74329
|
+
{
|
|
74330
|
+
class: "SCHEMA_EXPORT_TAB button",
|
|
74331
|
+
type: "button",
|
|
74332
|
+
"data-pane": "json",
|
|
74333
|
+
"aria-pressed": "false",
|
|
74334
|
+
title: (0, i18next.t)("schema as json"),
|
|
74335
|
+
"data-i18n-title": "schema as json",
|
|
74336
|
+
"aria-label": (0, i18next.t)("schema as json"),
|
|
74337
|
+
"data-i18n-aria-label": "schema as json"
|
|
74338
|
+
},
|
|
74339
|
+
[[
|
|
74340
|
+
"span",
|
|
74341
|
+
{},
|
|
74342
|
+
"JSON"
|
|
74290
74343
|
]]
|
|
74291
74344
|
]]
|
|
74292
74345
|
],
|
|
@@ -74356,7 +74409,10 @@ function open_export(gobj, treedb) {
|
|
|
74356
74409
|
let $text = $content.querySelector(".SCHEMA_EXPORT_TEXT");
|
|
74357
74410
|
for (let $tab of $content.querySelectorAll(".SCHEMA_EXPORT_TAB")) $tab.addEventListener("click", (evt) => {
|
|
74358
74411
|
evt.stopPropagation();
|
|
74359
|
-
for (let $other of $content.querySelectorAll(".SCHEMA_EXPORT_TAB"))
|
|
74412
|
+
for (let $other of $content.querySelectorAll(".SCHEMA_EXPORT_TAB")) {
|
|
74413
|
+
$other.classList.toggle("selected_state", $other === $tab);
|
|
74414
|
+
$other.setAttribute("aria-pressed", $other === $tab ? "true" : "false");
|
|
74415
|
+
}
|
|
74360
74416
|
$text.value = $tab.dataset.pane === "c" ? c_text : json_text;
|
|
74361
74417
|
});
|
|
74362
74418
|
$content.querySelector(".SCHEMA_EXPORT_COPY").addEventListener("click", (evt) => {
|
|
@@ -75078,7 +75134,7 @@ function ac_mt_command_answer(gobj, event, kw, src) {
|
|
|
75078
75134
|
priv.records = priv.records_before;
|
|
75079
75135
|
priv.records_before = null;
|
|
75080
75136
|
priv.reload_on_open = true;
|
|
75081
|
-
yui_shell_show_error(yui_shell_of(gobj), "cannot read the schemas again: the
|
|
75137
|
+
yui_shell_show_error(yui_shell_of(gobj), "cannot read the schemas again: the ones shown may be out of date, your next change reads them first", { t: i18next.t });
|
|
75082
75138
|
return end_load(gobj);
|
|
75083
75139
|
}
|
|
75084
75140
|
priv.model = null;
|
|
@@ -75290,6 +75346,23 @@ function ac_wait_for_the_load(gobj, event, kw, src) {
|
|
|
75290
75346
|
return -1;
|
|
75291
75347
|
}
|
|
75292
75348
|
/***************************************************************
|
|
75349
|
+
* A confirmation answered where no treedb is open: ST_EMPTY (a
|
|
75350
|
+
* reload landed on zero treedbs while it was up) or ST_IDLE (no
|
|
75351
|
+
* model). A confirmation is a shell modal, not this view's dialog,
|
|
75352
|
+
* so the load that lands does not close it, and its Yes arrives
|
|
75353
|
+
* anyway. Undeclared, it answered "Event NOT DEFINED" (fifth
|
|
75354
|
+
* independent review).
|
|
75355
|
+
*
|
|
75356
|
+
* Refused with the stamp's own words: whatever it was decided on
|
|
75357
|
+
* is not on screen any more.
|
|
75358
|
+
***************************************************************/
|
|
75359
|
+
function ac_confirmed_on_nothing(gobj, event, kw, src) {
|
|
75360
|
+
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75361
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} refused, no treedb is open`);
|
|
75362
|
+
yui_shell_show_error(yui_shell_of(gobj), "the schemas were read again: open the dialog again", { t: i18next.t });
|
|
75363
|
+
return -1;
|
|
75364
|
+
}
|
|
75365
|
+
/***************************************************************
|
|
75293
75366
|
* {drafts: {treedb_name: [topic names]}} -- the host says which
|
|
75294
75367
|
* topics hold a draft in __system__ that is not saved (C_TREEDB's
|
|
75295
75368
|
* saved-schema, `draft_changed`). The mark of a write lived in this
|
|
@@ -75314,20 +75387,23 @@ function ac_drafts(gobj, event, kw, src) {
|
|
|
75314
75387
|
* Moving about.
|
|
75315
75388
|
***************************************************************/
|
|
75316
75389
|
function ac_select_treedb(gobj, event, kw, src) {
|
|
75317
|
-
|
|
75390
|
+
go(gobj, kw.treedb, "", false, true);
|
|
75391
|
+
return reload_after_move(gobj);
|
|
75318
75392
|
}
|
|
75319
75393
|
function ac_select_topic(gobj, event, kw, src) {
|
|
75320
|
-
|
|
75394
|
+
go(gobj, gobj.priv.treedb_id, kw.topic, false, true);
|
|
75395
|
+
return reload_after_move(gobj);
|
|
75321
75396
|
}
|
|
75322
75397
|
function ac_back(gobj, event, kw, src) {
|
|
75323
75398
|
let priv = gobj.priv;
|
|
75324
|
-
if (priv.diagram)
|
|
75325
|
-
|
|
75326
|
-
return
|
|
75399
|
+
if (priv.diagram || priv.topic_name) go(gobj, priv.treedb_id, "", false, true);
|
|
75400
|
+
else go(gobj, "", "", false, true);
|
|
75401
|
+
return reload_after_move(gobj);
|
|
75327
75402
|
}
|
|
75328
75403
|
function ac_toggle_diagram(gobj, event, kw, src) {
|
|
75329
75404
|
let priv = gobj.priv;
|
|
75330
|
-
|
|
75405
|
+
go(gobj, priv.treedb_id, priv.topic_name, !priv.diagram, true);
|
|
75406
|
+
return reload_after_move(gobj);
|
|
75331
75407
|
}
|
|
75332
75408
|
/***************************************************************
|
|
75333
75409
|
* A topic clicked in the drawing. The diagram is a CHILD here
|
|
@@ -75337,9 +75413,11 @@ function ac_toggle_diagram(gobj, event, kw, src) {
|
|
|
75337
75413
|
function ac_node_click(gobj, event, kw, src) {
|
|
75338
75414
|
let topic = kw && kw.topic;
|
|
75339
75415
|
if (!topic) return 0;
|
|
75340
|
-
|
|
75416
|
+
go(gobj, gobj.priv.treedb_id, topic, false, true);
|
|
75417
|
+
return reload_after_move(gobj);
|
|
75341
75418
|
}
|
|
75342
75419
|
function ac_show_orphans(gobj, event, kw, src) {
|
|
75420
|
+
if (reload_first(gobj, event)) return -1;
|
|
75343
75421
|
open_orphans(gobj);
|
|
75344
75422
|
return 0;
|
|
75345
75423
|
}
|
|
@@ -75367,6 +75445,7 @@ function confirm_then(gobj, message, detail, kw) {
|
|
|
75367
75445
|
function ac_add_column(gobj, event, kw, src) {
|
|
75368
75446
|
let topic = current_topic(gobj);
|
|
75369
75447
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75448
|
+
if (reload_first(gobj, event)) return -1;
|
|
75370
75449
|
if (!topic) {
|
|
75371
75450
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no topic open`);
|
|
75372
75451
|
return -1;
|
|
@@ -75379,6 +75458,7 @@ function ac_edit_column(gobj, event, kw, src) {
|
|
|
75379
75458
|
let topic = current_topic(gobj);
|
|
75380
75459
|
let col = topic ? find_col(priv.model, priv.treedb_id, topic.name, kw.col) : null;
|
|
75381
75460
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75461
|
+
if (reload_first(gobj, event)) return -1;
|
|
75382
75462
|
if (!col) {
|
|
75383
75463
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no column: ${kw.col}`);
|
|
75384
75464
|
return -1;
|
|
@@ -75396,6 +75476,7 @@ function ac_duplicate_column(gobj, event, kw, src) {
|
|
|
75396
75476
|
let topic = current_topic(gobj);
|
|
75397
75477
|
let col = topic ? find_col(priv.model, priv.treedb_id, topic.name, kw.col) : null;
|
|
75398
75478
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75479
|
+
if (reload_first(gobj, event)) return -1;
|
|
75399
75480
|
if (!col) {
|
|
75400
75481
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no column: ${kw.col}`);
|
|
75401
75482
|
return -1;
|
|
@@ -75414,6 +75495,7 @@ function ac_save_column(gobj, event, kw, src) {
|
|
|
75414
75495
|
let topic = find_topic(priv.model, priv.treedb_id, kw.topic);
|
|
75415
75496
|
let col = kw.creating ? null : find_col(priv.model, priv.treedb_id, kw.topic, kw.col);
|
|
75416
75497
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75498
|
+
if (reload_first(gobj, event)) return -1;
|
|
75417
75499
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75418
75500
|
if (!topic || !kw.creating && !col) {
|
|
75419
75501
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no column: ${kw.topic}.${kw.col}`);
|
|
@@ -75440,6 +75522,7 @@ function ac_delete_column(gobj, event, kw, src) {
|
|
|
75440
75522
|
let topic = current_topic(gobj);
|
|
75441
75523
|
let col = topic ? find_col(priv.model, priv.treedb_id, topic.name, kw.col) : null;
|
|
75442
75524
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75525
|
+
if (reload_first(gobj, event)) return -1;
|
|
75443
75526
|
if (!col) {
|
|
75444
75527
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no column: ${kw.col}`);
|
|
75445
75528
|
return -1;
|
|
@@ -75459,6 +75542,7 @@ function ac_delete_column(gobj, event, kw, src) {
|
|
|
75459
75542
|
function ac_move_column(gobj, event, kw, src) {
|
|
75460
75543
|
let topic = current_topic(gobj);
|
|
75461
75544
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75545
|
+
if (reload_first(gobj, event)) return -1;
|
|
75462
75546
|
if (!topic) {
|
|
75463
75547
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no topic open`);
|
|
75464
75548
|
return -1;
|
|
@@ -75494,6 +75578,7 @@ function ac_undo_order(gobj, event, kw, src) {
|
|
|
75494
75578
|
let priv = gobj.priv;
|
|
75495
75579
|
let topic = current_topic(gobj);
|
|
75496
75580
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75581
|
+
if (reload_first(gobj, event)) return -1;
|
|
75497
75582
|
if (!topic) {
|
|
75498
75583
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no topic open`);
|
|
75499
75584
|
return -1;
|
|
@@ -75512,6 +75597,7 @@ function ac_undo_order(gobj, event, kw, src) {
|
|
|
75512
75597
|
function ac_add_topic(gobj, event, kw, src) {
|
|
75513
75598
|
let treedb = current_treedb(gobj);
|
|
75514
75599
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75600
|
+
if (reload_first(gobj, event)) return -1;
|
|
75515
75601
|
if (!treedb) {
|
|
75516
75602
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no treedb open`);
|
|
75517
75603
|
return -1;
|
|
@@ -75524,6 +75610,7 @@ function ac_edit_topic(gobj, event, kw, src) {
|
|
|
75524
75610
|
let treedb = current_treedb(gobj);
|
|
75525
75611
|
let topic = treedb ? find_topic(priv.model, priv.treedb_id, kw.topic) : null;
|
|
75526
75612
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75613
|
+
if (reload_first(gobj, event)) return -1;
|
|
75527
75614
|
if (!topic) {
|
|
75528
75615
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no topic: ${kw.topic}`);
|
|
75529
75616
|
return -1;
|
|
@@ -75536,6 +75623,7 @@ function ac_save_topic(gobj, event, kw, src) {
|
|
|
75536
75623
|
let treedb = current_treedb(gobj);
|
|
75537
75624
|
let topic = kw.creating ? null : find_topic(priv.model, priv.treedb_id, kw.topic);
|
|
75538
75625
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75626
|
+
if (reload_first(gobj, event)) return -1;
|
|
75539
75627
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75540
75628
|
if (!treedb || !kw.creating && !topic) {
|
|
75541
75629
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no topic: ${kw.topic}`);
|
|
@@ -75564,6 +75652,7 @@ function ac_delete_topic(gobj, event, kw, src) {
|
|
|
75564
75652
|
let priv = gobj.priv;
|
|
75565
75653
|
let topic = find_topic(priv.model, priv.treedb_id, kw.topic);
|
|
75566
75654
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75655
|
+
if (reload_first(gobj, event)) return -1;
|
|
75567
75656
|
if (!topic) {
|
|
75568
75657
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no topic: ${kw.topic}`);
|
|
75569
75658
|
return -1;
|
|
@@ -75579,6 +75668,7 @@ function ac_delete_topic(gobj, event, kw, src) {
|
|
|
75579
75668
|
***************************************************************/
|
|
75580
75669
|
function ac_delete_orphan(gobj, event, kw, src) {
|
|
75581
75670
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75671
|
+
if (reload_first(gobj, event)) return -1;
|
|
75582
75672
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75583
75673
|
if ((0, _yuneta_gobj_js.empty_string)(kw.id)) {
|
|
75584
75674
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names nothing`);
|
|
@@ -75597,6 +75687,7 @@ function ac_delete_orphan(gobj, event, kw, src) {
|
|
|
75597
75687
|
function ac_validate(gobj, event, kw, src) {
|
|
75598
75688
|
let priv = gobj.priv;
|
|
75599
75689
|
let treedb = current_treedb(gobj);
|
|
75690
|
+
if (reload_first(gobj, event)) return -1;
|
|
75600
75691
|
if (!treedb) {
|
|
75601
75692
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no treedb open`);
|
|
75602
75693
|
return -1;
|
|
@@ -75611,6 +75702,7 @@ function ac_validate(gobj, event, kw, src) {
|
|
|
75611
75702
|
}
|
|
75612
75703
|
function ac_export(gobj, event, kw, src) {
|
|
75613
75704
|
let treedb = current_treedb(gobj);
|
|
75705
|
+
if (reload_first(gobj, event)) return -1;
|
|
75614
75706
|
if (!treedb) {
|
|
75615
75707
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no treedb open`);
|
|
75616
75708
|
return -1;
|
|
@@ -75621,6 +75713,7 @@ function ac_export(gobj, event, kw, src) {
|
|
|
75621
75713
|
function ac_import(gobj, event, kw, src) {
|
|
75622
75714
|
let treedb = current_treedb(gobj);
|
|
75623
75715
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75716
|
+
if (reload_first(gobj, event)) return -1;
|
|
75624
75717
|
if (!treedb) {
|
|
75625
75718
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no treedb open`);
|
|
75626
75719
|
return -1;
|
|
@@ -75636,6 +75729,7 @@ function ac_preview_import(gobj, event, kw, src) {
|
|
|
75636
75729
|
let priv = gobj.priv;
|
|
75637
75730
|
let treedb = current_treedb(gobj);
|
|
75638
75731
|
let incoming = null;
|
|
75732
|
+
if (reload_first(gobj, event)) return -1;
|
|
75639
75733
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75640
75734
|
if (!treedb) {
|
|
75641
75735
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no treedb open`);
|
|
@@ -75664,6 +75758,7 @@ function ac_preview_import(gobj, event, kw, src) {
|
|
|
75664
75758
|
function ac_apply_import(gobj, event, kw, src) {
|
|
75665
75759
|
let plan = gobj.priv.import_plan;
|
|
75666
75760
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75761
|
+
if (reload_first(gobj, event)) return -1;
|
|
75667
75762
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75668
75763
|
if (!plan || plan.writes.length === 0) {
|
|
75669
75764
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no plan to run`);
|
|
@@ -75682,7 +75777,8 @@ function run_import(gobj) {
|
|
|
75682
75777
|
let priv = gobj.priv;
|
|
75683
75778
|
let plan = priv.import_plan;
|
|
75684
75779
|
if (!plan) {
|
|
75685
|
-
(0, _yuneta_gobj_js.
|
|
75780
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the import plan is gone`);
|
|
75781
|
+
yui_shell_show_error(yui_shell_of(gobj), "the import plan is gone: preview it again", { t: i18next.t });
|
|
75686
75782
|
return -1;
|
|
75687
75783
|
}
|
|
75688
75784
|
close_dialog(gobj);
|
|
@@ -75707,6 +75803,7 @@ function run_import(gobj) {
|
|
|
75707
75803
|
function ac_confirmed(gobj, event, kw, src) {
|
|
75708
75804
|
let priv = gobj.priv;
|
|
75709
75805
|
if (refuse_if_readonly(gobj, event)) return -1;
|
|
75806
|
+
if (reload_first(gobj, event)) return -1;
|
|
75710
75807
|
if (built_on_a_replaced_model(gobj, event, kw)) return -1;
|
|
75711
75808
|
if (kw.what === "import") return run_import(gobj);
|
|
75712
75809
|
if (kw.what === "topic") {
|
|
@@ -75841,7 +75938,11 @@ function create_gclass$1(gclass_name) {
|
|
|
75841
75938
|
]
|
|
75842
75939
|
];
|
|
75843
75940
|
const states = [
|
|
75844
|
-
["ST_IDLE", COMMON.
|
|
75941
|
+
["ST_IDLE", COMMON.concat([[
|
|
75942
|
+
"EV_CONFIRMED",
|
|
75943
|
+
ac_confirmed_on_nothing,
|
|
75944
|
+
null
|
|
75945
|
+
]])],
|
|
75845
75946
|
["ST_LOADING", COMMON.concat([
|
|
75846
75947
|
[
|
|
75847
75948
|
"EV_SAVE_COLUMN",
|
|
@@ -75874,7 +75975,11 @@ function create_gclass$1(gclass_name) {
|
|
|
75874
75975
|
null
|
|
75875
75976
|
]
|
|
75876
75977
|
])],
|
|
75877
|
-
["ST_EMPTY", COMMON.
|
|
75978
|
+
["ST_EMPTY", COMMON.concat([[
|
|
75979
|
+
"EV_CONFIRMED",
|
|
75980
|
+
ac_confirmed_on_nothing,
|
|
75981
|
+
null
|
|
75982
|
+
]])],
|
|
75878
75983
|
["ST_TREEDBS", COMMON.concat([
|
|
75879
75984
|
[
|
|
75880
75985
|
"EV_SELECT_TREEDB",
|