@yuneta/gobj-ui 7.29.5 → 7.29.6
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 +23 -23
- package/dist/gobj-ui.cjs.js +16 -16
- package/dist/gobj-ui.es.js +16 -16
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +1 -1
- package/src/c_yui_treedb_topics.js +5 -5
- package/src/c_yui_window.js +1 -1
- package/src/lib_icons.test.js +1 -1
- package/src/named_controls.wiring.test.js +2 -2
- package/src/schema_version_bump.test.js +6 -6
- package/src/shell_dialog_names.wiring.test.js +2 -2
- package/src/treedb_fold_model.js +3 -3
- package/src/treedb_fold_model.test.js +141 -141
- package/src/treedb_layout.js +7 -7
- package/src/yui_dev.js +1 -1
- package/src/yui_dev_copy.test.js +2 -2
- package/src/yui_icons.css +3 -3
- package/src/yui_row_search.test.js +16 -16
- package/src/yui_shell_last_route.test.js +2 -2
package/README.md
CHANGED
|
@@ -1278,7 +1278,7 @@ it used to call `tabulator.setFilter` straight from the DOM handler, where the
|
|
|
1278
1278
|
A hook cell shows how many children the row has (`[5675]`). A click on it
|
|
1279
1279
|
opens the **child topic's table, filtered** to the rows whose fkey names this
|
|
1280
1280
|
row (since `7.23.162`). Above the table, a chip says which filter is on,
|
|
1281
|
-
"filtered by
|
|
1281
|
+
"filtered by models model_a", and its ✕ brings the whole topic back.
|
|
1282
1282
|
|
|
1283
1283
|
The child table already pages, searches, opens a record and exports. Until
|
|
1284
1284
|
`7.23.162` the click opened a popup that listed every child id instead:
|
|
@@ -1290,16 +1290,16 @@ click inside, and the ids did nothing.
|
|
|
1290
1290
|
|
|
1291
1291
|
```c
|
|
1292
1292
|
'devices': {
|
|
1293
|
-
'header': '
|
|
1293
|
+
'header': 'Devices',
|
|
1294
1294
|
'type': 'object',
|
|
1295
1295
|
'flag': ['hook'],
|
|
1296
1296
|
'hook': {
|
|
1297
|
-
'devices': '
|
|
1297
|
+
'devices': 'site'
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
1300
|
```
|
|
1301
1301
|
|
|
1302
|
-
A click on this hook opens `devices`, filtered to the rows whose `
|
|
1302
|
+
A click on this hook opens `devices`, filtered to the rows whose `site`
|
|
1303
1303
|
names the clicked row.
|
|
1304
1304
|
- A hook whose children live in more than one topic asks which one, in the
|
|
1305
1305
|
standardized dialog (Escape, Back and a click outside close it).
|
|
@@ -1319,8 +1319,8 @@ The table asks its host to switch, because the tabs belong to the host:
|
|
|
1319
1319
|
|
|
1320
1320
|
```
|
|
1321
1321
|
C_YUI_TREEDB_TOPIC_WITH_FORM C_YUI_TREEDB_TOPICS
|
|
1322
|
-
EV_OPEN_LINKED {topic_name: "devices", fkey: "
|
|
1323
|
-
parent_topic: "
|
|
1322
|
+
EV_OPEN_LINKED {topic_name: "devices", fkey: "site",
|
|
1323
|
+
parent_topic: "sites", parent_id: "north", hook: "devices"} ──►
|
|
1324
1324
|
select the tab of `devices`
|
|
1325
1325
|
EV_FILTER_BY_PARENT {fkey, parent_topic, parent_id, hook} ◄── to that topic's table
|
|
1326
1326
|
```
|
|
@@ -2086,7 +2086,7 @@ a level or two, with a count on every cut.
|
|
|
2086
2086
|
are the records with no drawable parent, a node's children are the records
|
|
2087
2087
|
whose fkey names it through a hook, and a node is visible when a visible
|
|
2088
2088
|
parent shows it or it is a shown root — the **union**, so a device that hangs
|
|
2089
|
-
from its
|
|
2089
|
+
from its site AND its building is drawn once, under whichever opened
|
|
2090
2090
|
first, and folding one of the two leaves it where the other shows it.
|
|
2091
2091
|
- **`expand_depth`** (default `1` since `7.23.142`, `2` before) is how much
|
|
2092
2092
|
opens on load until the reader steps: the roots alone. **`fold_page_size`** (default `24`) is how many children of
|
|
@@ -2109,14 +2109,14 @@ a level or two, with a count on every cut.
|
|
|
2109
2109
|
JSON graph's fold handles are — G6 never reads the DOM `click`, it builds its
|
|
2110
2110
|
own from the pointer pair.
|
|
2111
2111
|
- **The toolbar's fold STEPPER** (since `7.23.141`; it replaced the *expand
|
|
2112
|
-
all* / *collapse all* pair): `▸` · **`
|
|
2112
|
+
all* / *collapse all* pair): `▸` · **`sites level 2/4`** · `▾`. It walks the
|
|
2113
2113
|
**main tree** one level at a time, the way the frontend view opens one level
|
|
2114
2114
|
per press: level 1 is the main topic's roots (and the loose records the
|
|
2115
2115
|
reader asked to see), each `▾` opens the next level through every topic that
|
|
2116
2116
|
is not hidden, each `▸` folds the deepest one. The readout says what the two
|
|
2117
2117
|
buttons act on — the main topic's swatch and name (data, never translated;
|
|
2118
2118
|
gone on a phone, the numbers stay) and `level N/M` — the WORD as well as the
|
|
2119
|
-
numbers, because the legend chip under it says `
|
|
2119
|
+
numbers, because the legend chip under it says `sites 2/4` too and there it
|
|
2120
2120
|
means records on screen — and a button is disabled at either end. **A level is a floor, not a picture**: stepping down
|
|
2121
2121
|
opens only what is folded above the new level and keeps the pages and pills
|
|
2122
2122
|
already open; stepping up folds from the new level down and touches nothing
|
|
@@ -2158,9 +2158,9 @@ One consumer key came with it: `show more`, the chip's tooltip.
|
|
|
2158
2158
|
### Layouts: what G6 offers, and the two made for a treedb
|
|
2159
2159
|
|
|
2160
2160
|
What a treedb graph IS, once folded: a **forest read top to bottom**. A main
|
|
2161
|
-
topic is a tree (
|
|
2161
|
+
topic is a tree (sites: country, region, campus), the other topics hang
|
|
2162
2162
|
from its nodes through hooks, a record may hang from two parents (a device
|
|
2163
|
-
from its
|
|
2163
|
+
from its site AND its building), and every visible node was reached from a
|
|
2164
2164
|
root. Tens to a few hundred cards on screen, never the store.
|
|
2165
2165
|
|
|
2166
2166
|
G6 5.1 registers these layouts, and this is how each meets that shape:
|
|
@@ -2242,8 +2242,8 @@ module defaults with every config it is given.
|
|
|
2242
2242
|
|
|
2243
2243
|
Both take the **same spanning tree**, chosen deterministically: roots are the
|
|
2244
2244
|
nodes with no incoming edge, in node order; a node belongs to the **first
|
|
2245
|
-
parent that reaches it** in a breadth-first walk (the
|
|
2246
|
-
|
|
2245
|
+
parent that reaches it** in a breadth-first walk (the site, not the
|
|
2246
|
+
building, because the site's column came first) and its other links are
|
|
2247
2247
|
drawn as edges across the tree; the children of a node are ordered by the
|
|
2248
2248
|
**hook they hang from** (the parent's port order — the schema's column order)
|
|
2249
2249
|
and then by node order (record order, the pages' order); a cycle nothing
|
|
@@ -2256,8 +2256,8 @@ node's `data.port_keys`, because a CLOSED node (below) has no ports on its
|
|
|
2256
2256
|
style and its children still sit in schema order — so the adapter needs no
|
|
2257
2257
|
model, only the G6 data.
|
|
2258
2258
|
|
|
2259
|
-
The walks are **iterative**, not recursive: a self-referent hook (a
|
|
2260
|
-
inside a
|
|
2259
|
+
The walks are **iterative**, not recursive: a self-referent hook (a site
|
|
2260
|
+
inside a site inside a site) is as deep as the store says, and the stack is
|
|
2261
2261
|
not. A 20000-node chain is a test.
|
|
2262
2262
|
|
|
2263
2263
|
### The three views of a record: card, pill, figure
|
|
@@ -2507,11 +2507,11 @@ them:
|
|
|
2507
2507
|
|---|---|
|
|
2508
2508
|
| the chip body | **show / hide** the topic. A hidden topic leaves the MODEL, not just the drawing: no card, no pill counts it, no edge reaches it, and whatever hung from it alone has no parent any more. The name is struck through and the count is the total. |
|
|
2509
2509
|
| `★` / `☆` | the **main topic**: the trunk the tree hangs from, always a **hierarchical** topic (hooked to itself); the hollow star appears only on the other hierarchical topics, and only when there are two or more (`7.23.142`). Filled on the main one (a mark, not a button — the main topic cannot be hidden, because hiding the trunk turns everything into roots, which is the pile); hollow on the others, where it moves the star. |
|
|
2510
|
-
| `+N` | the topic's **loose records**: the ones that should hang from the main tree and do not (a device with no
|
|
2510
|
+
| `+N` | the topic's **loose records**: the ones that should hang from the main tree and do not (a device with no site). Counted here, shown only on request. |
|
|
2511
2511
|
| `⌖` | **highlight** the topic — the focus, with `reveal: "all"`. |
|
|
2512
2512
|
|
|
2513
2513
|
**Only a HIERARCHICAL topic can be the main one** (since `7.23.142`): a topic
|
|
2514
|
-
hooked to ITSELF —
|
|
2514
|
+
hooked to ITSELF — sites inside sites, groups inside groups, roles inside
|
|
2515
2515
|
roles (`fold_is_hierarchical()`). A topic that only reaches OTHER topics is a
|
|
2516
2516
|
list with children, and the old rule (*the topic whose hooks reach the most
|
|
2517
2517
|
others*) drew the agent's treedb from `yunos` instead of `realms`. In order:
|
|
@@ -2524,8 +2524,8 @@ others*) drew the agent's treedb from `yunos` instead of `realms`. In order:
|
|
|
2524
2524
|
3. the hierarchical topic that reaches the most other topics, schema order
|
|
2525
2525
|
breaking a tie.
|
|
2526
2526
|
|
|
2527
|
-
In
|
|
2528
|
-
|
|
2527
|
+
In the treedbs of the SDK there is exactly one hierarchical topic each
|
|
2528
|
+
(`roles` in the authorization treedb, `realms` in the agent's), so the mark
|
|
2529
2529
|
only has something to decide once a schema grows a second one. A treedb with
|
|
2530
2530
|
no topic hooked to itself has no trunk, and every topic is a tree of its own.
|
|
2531
2531
|
|
|
@@ -2541,9 +2541,9 @@ What the main topic governs, in `treedb_fold_model.js`:
|
|
|
2541
2541
|
- a topic the schema does not tie to the main one is its own tree, with its
|
|
2542
2542
|
own roots, as before.
|
|
2543
2543
|
|
|
2544
|
-
So *
|
|
2545
|
-
`
|
|
2546
|
-
`users` and `
|
|
2544
|
+
So *sites with their users and nothing else* is hiding `devices`,
|
|
2545
|
+
`buildings` and `models`; *sites with their devices* is hiding
|
|
2546
|
+
`users` and `buildings`. Each combination is a user preference **per
|
|
2547
2547
|
treedb**: `hidden_topics`, `main_topic` and `loose_topics` are `SDF_PERSIST`
|
|
2548
2548
|
attrs of `C_YUI_TREEDB_GRAPH`, saved under the view's name, and both hosts
|
|
2549
2549
|
name the view after the treedb.
|
|
@@ -3489,7 +3489,7 @@ gclass of a **backend** yuno the host passes the answer of `view-gclass` as
|
|
|
3489
3489
|
description describes the CLASS and cannot carry it, so the host supplies it —
|
|
3490
3490
|
the gobj tree passes `node_data.state` — and the machine lights that column.
|
|
3491
3491
|
Omitted, nothing is lit. `opts.instance_name` names that instance beside its
|
|
3492
|
-
state in the head (`
|
|
3492
|
+
state in the head (`tranger_events: ST_IDLE`): a gclass has several, and a
|
|
3493
3493
|
state with no name said whose it was to nobody.
|
|
3494
3494
|
|
|
3495
3495
|
`opts.traces` (`{info, pending}`) says the host can SET this gclass' traces for
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -5262,7 +5262,7 @@ function ensure_window_style() {
|
|
|
5262
5262
|
* starts with '<', otherwise a yi-* class name.
|
|
5263
5263
|
*
|
|
5264
5264
|
* The two halves are separate text nodes on purpose. Titles here are
|
|
5265
|
-
* nearly always "<what> · <kind>" — `
|
|
5265
|
+
* nearly always "<what> · <kind>" — `raw_events · keys` — and
|
|
5266
5266
|
* composing that into one string is what makes a title untranslatable:
|
|
5267
5267
|
* `${topic} · ${t("keys")}` is not an i18n key, so i18next answers it
|
|
5268
5268
|
* with itself and it stays in the language it was built in for the
|
|
@@ -59725,10 +59725,10 @@ function ac_set_landing_view(gobj, event, kw, src) {
|
|
|
59725
59725
|
* Back from a topic to WHERE THE READER WAS.
|
|
59726
59726
|
*
|
|
59727
59727
|
* Browser Back and this button must land on the same place, or the
|
|
59728
|
-
* reader cannot tell which one to trust
|
|
59729
|
-
*
|
|
59730
|
-
*
|
|
59731
|
-
*
|
|
59728
|
+
* reader cannot tell which one to trust. The button went to the
|
|
59729
|
+
* landing whatever came before it, so "linked records" from `models`
|
|
59730
|
+
* opened `devices`, and the arrow then showed the cards instead of
|
|
59731
|
+
* `models`, where Back went.
|
|
59732
59732
|
*
|
|
59733
59733
|
* So it asks the shell for the route before this one
|
|
59734
59734
|
* (yui_shell_previous_route): the previous topic, the landing, or the
|
|
@@ -65557,7 +65557,7 @@ function node_label(desc, record) {
|
|
|
65557
65557
|
*
|
|
65558
65558
|
* - A node is visible when SOME visible parent shows it, or it is
|
|
65559
65559
|
* a shown root. A record with two parents (a device hangs from
|
|
65560
|
-
* its
|
|
65560
|
+
* its site AND its building) is drawn ONCE, under whichever
|
|
65561
65561
|
* opened first, and folding one of the two leaves it where the
|
|
65562
65562
|
* other one shows it. The union, never the intersection.
|
|
65563
65563
|
*
|
|
@@ -65772,8 +65772,8 @@ function count_levels(model) {
|
|
|
65772
65772
|
model.levels = deepest;
|
|
65773
65773
|
}
|
|
65774
65774
|
/************************************************************
|
|
65775
|
-
* A HIERARCHICAL topic: one hooked to ITSELF --
|
|
65776
|
-
*
|
|
65775
|
+
* A HIERARCHICAL topic: one hooked to ITSELF -- sites inside
|
|
65776
|
+
* sites, groups inside groups, roles inside roles. It is the
|
|
65777
65777
|
* only kind of topic a tree can hang from: a topic that only
|
|
65778
65778
|
* reaches OTHER topics is a list with children, and making it
|
|
65779
65779
|
* the trunk drew the agent's treedb from `yunos` instead of
|
|
@@ -66117,11 +66117,11 @@ function fold_reveal(model, state, node_key) {
|
|
|
66117
66117
|
* Two layouts made for a treedb, and nothing else.
|
|
66118
66118
|
*
|
|
66119
66119
|
* What a treedb graph IS, once it is folded (treedb_fold_model.js):
|
|
66120
|
-
* a forest read top to bottom. A main topic is a tree (
|
|
66121
|
-
* country, region,
|
|
66122
|
-
*
|
|
66123
|
-
*
|
|
66124
|
-
*
|
|
66120
|
+
* a forest read top to bottom. A main topic is a tree (sites:
|
|
66121
|
+
* country, region, campus), the other topics hang from its nodes
|
|
66122
|
+
* through hooks (buildings, devices, users), a record may hang
|
|
66123
|
+
* from two parents (a device from its site AND its building), and
|
|
66124
|
+
* every visible node was reached from a root.
|
|
66125
66125
|
* Tens to a few hundred cards on screen, never the whole store.
|
|
66126
66126
|
*
|
|
66127
66127
|
* G6's own layouts either do not know that or pay for not knowing:
|
|
@@ -66143,8 +66143,8 @@ function fold_reveal(model, state, node_key) {
|
|
|
66143
66143
|
*
|
|
66144
66144
|
* - roots are the nodes with no incoming edge, in node order;
|
|
66145
66145
|
* - a node belongs to the FIRST parent that reaches it in a
|
|
66146
|
-
* breadth-first walk from the roots -- the
|
|
66147
|
-
*
|
|
66146
|
+
* breadth-first walk from the roots -- the site, not the
|
|
66147
|
+
* building, because the site's column came first -- and the
|
|
66148
66148
|
* other links are drawn as edges across the tree;
|
|
66149
66149
|
* - the children of a node are ordered by the HOOK they hang from
|
|
66150
66150
|
* (the parent's port order, which is the schema's column order)
|
|
@@ -72023,7 +72023,7 @@ function geometry_has_position(g) {
|
|
|
72023
72023
|
* `manual` means "leave every node where it was put", and where none
|
|
72024
72024
|
* was put it means a cascade: get_default_ne_xy() walks x and y
|
|
72025
72025
|
* together, so a treedb opened for the first time was a diagonal pile
|
|
72026
|
-
* of cards —
|
|
72026
|
+
* of cards — a hundred of them on a large one — and the only way out was to
|
|
72027
72027
|
* know to pick a layout by hand. It is the right default only once
|
|
72028
72028
|
* there ARE saved positions to leave alone.
|
|
72029
72029
|
*
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -5257,7 +5257,7 @@ function ensure_window_style() {
|
|
|
5257
5257
|
* starts with '<', otherwise a yi-* class name.
|
|
5258
5258
|
*
|
|
5259
5259
|
* The two halves are separate text nodes on purpose. Titles here are
|
|
5260
|
-
* nearly always "<what> · <kind>" — `
|
|
5260
|
+
* nearly always "<what> · <kind>" — `raw_events · keys` — and
|
|
5261
5261
|
* composing that into one string is what makes a title untranslatable:
|
|
5262
5262
|
* `${topic} · ${t("keys")}` is not an i18n key, so i18next answers it
|
|
5263
5263
|
* with itself and it stays in the language it was built in for the
|
|
@@ -59720,10 +59720,10 @@ function ac_set_landing_view(gobj, event, kw, src) {
|
|
|
59720
59720
|
* Back from a topic to WHERE THE READER WAS.
|
|
59721
59721
|
*
|
|
59722
59722
|
* Browser Back and this button must land on the same place, or the
|
|
59723
|
-
* reader cannot tell which one to trust
|
|
59724
|
-
*
|
|
59725
|
-
*
|
|
59726
|
-
*
|
|
59723
|
+
* reader cannot tell which one to trust. The button went to the
|
|
59724
|
+
* landing whatever came before it, so "linked records" from `models`
|
|
59725
|
+
* opened `devices`, and the arrow then showed the cards instead of
|
|
59726
|
+
* `models`, where Back went.
|
|
59727
59727
|
*
|
|
59728
59728
|
* So it asks the shell for the route before this one
|
|
59729
59729
|
* (yui_shell_previous_route): the previous topic, the landing, or the
|
|
@@ -65552,7 +65552,7 @@ function node_label(desc, record) {
|
|
|
65552
65552
|
*
|
|
65553
65553
|
* - A node is visible when SOME visible parent shows it, or it is
|
|
65554
65554
|
* a shown root. A record with two parents (a device hangs from
|
|
65555
|
-
* its
|
|
65555
|
+
* its site AND its building) is drawn ONCE, under whichever
|
|
65556
65556
|
* opened first, and folding one of the two leaves it where the
|
|
65557
65557
|
* other one shows it. The union, never the intersection.
|
|
65558
65558
|
*
|
|
@@ -65767,8 +65767,8 @@ function count_levels(model) {
|
|
|
65767
65767
|
model.levels = deepest;
|
|
65768
65768
|
}
|
|
65769
65769
|
/************************************************************
|
|
65770
|
-
* A HIERARCHICAL topic: one hooked to ITSELF --
|
|
65771
|
-
*
|
|
65770
|
+
* A HIERARCHICAL topic: one hooked to ITSELF -- sites inside
|
|
65771
|
+
* sites, groups inside groups, roles inside roles. It is the
|
|
65772
65772
|
* only kind of topic a tree can hang from: a topic that only
|
|
65773
65773
|
* reaches OTHER topics is a list with children, and making it
|
|
65774
65774
|
* the trunk drew the agent's treedb from `yunos` instead of
|
|
@@ -66112,11 +66112,11 @@ function fold_reveal(model, state, node_key) {
|
|
|
66112
66112
|
* Two layouts made for a treedb, and nothing else.
|
|
66113
66113
|
*
|
|
66114
66114
|
* What a treedb graph IS, once it is folded (treedb_fold_model.js):
|
|
66115
|
-
* a forest read top to bottom. A main topic is a tree (
|
|
66116
|
-
* country, region,
|
|
66117
|
-
*
|
|
66118
|
-
*
|
|
66119
|
-
*
|
|
66115
|
+
* a forest read top to bottom. A main topic is a tree (sites:
|
|
66116
|
+
* country, region, campus), the other topics hang from its nodes
|
|
66117
|
+
* through hooks (buildings, devices, users), a record may hang
|
|
66118
|
+
* from two parents (a device from its site AND its building), and
|
|
66119
|
+
* every visible node was reached from a root.
|
|
66120
66120
|
* Tens to a few hundred cards on screen, never the whole store.
|
|
66121
66121
|
*
|
|
66122
66122
|
* G6's own layouts either do not know that or pay for not knowing:
|
|
@@ -66138,8 +66138,8 @@ function fold_reveal(model, state, node_key) {
|
|
|
66138
66138
|
*
|
|
66139
66139
|
* - roots are the nodes with no incoming edge, in node order;
|
|
66140
66140
|
* - a node belongs to the FIRST parent that reaches it in a
|
|
66141
|
-
* breadth-first walk from the roots -- the
|
|
66142
|
-
*
|
|
66141
|
+
* breadth-first walk from the roots -- the site, not the
|
|
66142
|
+
* building, because the site's column came first -- and the
|
|
66143
66143
|
* other links are drawn as edges across the tree;
|
|
66144
66144
|
* - the children of a node are ordered by the HOOK they hang from
|
|
66145
66145
|
* (the parent's port order, which is the schema's column order)
|
|
@@ -72018,7 +72018,7 @@ function geometry_has_position(g) {
|
|
|
72018
72018
|
* `manual` means "leave every node where it was put", and where none
|
|
72019
72019
|
* was put it means a cascade: get_default_ne_xy() walks x and y
|
|
72020
72020
|
* together, so a treedb opened for the first time was a diagonal pile
|
|
72021
|
-
* of cards —
|
|
72021
|
+
* of cards — a hundred of them on a large one — and the only way out was to
|
|
72022
72022
|
* know to pick a layout by hand. It is the right default only once
|
|
72023
72023
|
* there ARE saved positions to leave alone.
|
|
72024
72024
|
*
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -7997,7 +7997,7 @@ function geometry_has_position(g)
|
|
|
7997
7997
|
* `manual` means "leave every node where it was put", and where none
|
|
7998
7998
|
* was put it means a cascade: get_default_ne_xy() walks x and y
|
|
7999
7999
|
* together, so a treedb opened for the first time was a diagonal pile
|
|
8000
|
-
* of cards —
|
|
8000
|
+
* of cards — a hundred of them on a large one — and the only way out was to
|
|
8001
8001
|
* know to pick a layout by hand. It is the right default only once
|
|
8002
8002
|
* there ARE saved positions to leave alone.
|
|
8003
8003
|
*
|
|
@@ -636,7 +636,7 @@ function add_tab(gobj, gobj2, id, text, icon)
|
|
|
636
636
|
* initial text is the raw key (the topic_name). Tabs are built
|
|
637
637
|
* lazily when topic descriptions arrive from the backend —
|
|
638
638
|
* AFTER the host's one-time refresh_language($container,t) —
|
|
639
|
-
* so without this they stay as raw keys ("
|
|
639
|
+
* so without this they stay as raw keys ("groups", …).
|
|
640
640
|
* `t` is the i18next translator already imported here.
|
|
641
641
|
*/
|
|
642
642
|
refresh_language($a, t);
|
|
@@ -2844,10 +2844,10 @@ function ac_set_landing_view(gobj, event, kw, src)
|
|
|
2844
2844
|
* Back from a topic to WHERE THE READER WAS.
|
|
2845
2845
|
*
|
|
2846
2846
|
* Browser Back and this button must land on the same place, or the
|
|
2847
|
-
* reader cannot tell which one to trust
|
|
2848
|
-
*
|
|
2849
|
-
*
|
|
2850
|
-
*
|
|
2847
|
+
* reader cannot tell which one to trust. The button went to the
|
|
2848
|
+
* landing whatever came before it, so "linked records" from `models`
|
|
2849
|
+
* opened `devices`, and the arrow then showed the cards instead of
|
|
2850
|
+
* `models`, where Back went.
|
|
2851
2851
|
*
|
|
2852
2852
|
* So it asks the shell for the route before this one
|
|
2853
2853
|
* (yui_shell_previous_route): the previous topic, the landing, or the
|
package/src/c_yui_window.js
CHANGED
|
@@ -475,7 +475,7 @@ function ensure_window_style()
|
|
|
475
475
|
* starts with '<', otherwise a yi-* class name.
|
|
476
476
|
*
|
|
477
477
|
* The two halves are separate text nodes on purpose. Titles here are
|
|
478
|
-
* nearly always "<what> · <kind>" — `
|
|
478
|
+
* nearly always "<what> · <kind>" — `raw_events · keys` — and
|
|
479
479
|
* composing that into one string is what makes a title untranslatable:
|
|
480
480
|
* `${topic} · ${t("keys")}` is not an i18n key, so i18next answers it
|
|
481
481
|
* with itself and it stays in the language it was built in for the
|
package/src/lib_icons.test.js
CHANGED
|
@@ -152,7 +152,7 @@ test("a user icon lives in its own namespace", () => {
|
|
|
152
152
|
expect(USER_ICON_PREFIX).toBe("yi-u-");
|
|
153
153
|
expect(yui_user_icon_class("transformer")).toBe("yi-u-transformer");
|
|
154
154
|
expect(yui_icons_is_svg_field(ICONS_TOPIC, "svg")).toBe(true);
|
|
155
|
-
expect(yui_icons_is_svg_field("
|
|
155
|
+
expect(yui_icons_is_svg_field("models", "svg")).toBe(false);
|
|
156
156
|
expect(yui_icons_is_svg_field(ICONS_TOPIC, "id")).toBe(false);
|
|
157
157
|
});
|
|
158
158
|
|
|
@@ -698,14 +698,14 @@ describe("a chip of the dock", () => {
|
|
|
698
698
|
gobj_start(dock);
|
|
699
699
|
const w = gobj_create_service(`nwin${seq}`, "C_YUI_WINDOW", {
|
|
700
700
|
header: "x", body: ["div", {}, "x"],
|
|
701
|
-
title: "keys", title_prefix: "
|
|
701
|
+
title: "keys", title_prefix: "raw_events", manager: dock
|
|
702
702
|
}, yuno);
|
|
703
703
|
gobj_start(w);
|
|
704
704
|
|
|
705
705
|
const $toggle = chip(dock).querySelector(".DOCK_CHIP_TOGGLE");
|
|
706
706
|
const names = ($toggle.getAttribute("aria-labelledby") || "").split(" ")
|
|
707
707
|
.map((id) => $toggle.querySelector(`#${id}`).textContent);
|
|
708
|
-
expect(names).toEqual(["
|
|
708
|
+
expect(names).toEqual(["raw_events", "keys"]);
|
|
709
709
|
});
|
|
710
710
|
|
|
711
711
|
test("its toggle minimises and brings back, through the FSM; its ✕ closes", () => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import {describe, it, expect} from "vitest";
|
|
16
16
|
import {topic_is_draft} from "./c_yui_schema_editor.js";
|
|
17
17
|
|
|
18
|
-
const TOPIC = {id: "
|
|
18
|
+
const TOPIC = {id: "groups", topic_version: 5};
|
|
19
19
|
|
|
20
20
|
describe("topic_is_draft", () => {
|
|
21
21
|
it("says nothing about a topic this session never wrote", () => {
|
|
@@ -23,18 +23,18 @@ describe("topic_is_draft", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("a written topic is a draft, whatever its version says", () => {
|
|
26
|
-
expect(topic_is_draft({written: {
|
|
27
|
-
expect(topic_is_draft({written: {
|
|
28
|
-
{id: "
|
|
26
|
+
expect(topic_is_draft({written: {groups: true}}, TOPIC)).toBe(true);
|
|
27
|
+
expect(topic_is_draft({written: {groups: true}},
|
|
28
|
+
{id: "groups", topic_version: 6})).toBe(true);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it("a topic the host names is a draft too (EV_DRAFTS)", () => {
|
|
32
|
-
expect(topic_is_draft({written: {}, host_ids: {
|
|
32
|
+
expect(topic_is_draft({written: {}, host_ids: {groups: true}}, TOPIC)).toBe(true);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("answers false rather than throwing on a missing half", () => {
|
|
36
36
|
expect(topic_is_draft(null, TOPIC)).toBe(false);
|
|
37
|
-
expect(topic_is_draft({written: {
|
|
37
|
+
expect(topic_is_draft({written: {groups: true}}, null)).toBe(false);
|
|
38
38
|
expect(topic_is_draft({}, TOPIC)).toBe(false);
|
|
39
39
|
});
|
|
40
40
|
});
|
|
@@ -72,12 +72,12 @@ describe("a modal of the shell is named", () => {
|
|
|
72
72
|
test("by the two halves of its title, the kind half carrying its key", () => {
|
|
73
73
|
const $box = document.createElement("div");
|
|
74
74
|
const handle = yui_shell_show_modal(shell, $box,
|
|
75
|
-
{dialog: true, title: "keys", title_prefix: "
|
|
75
|
+
{dialog: true, title: "keys", title_prefix: "raw_events", logical_class: "NAMED_SHEET"});
|
|
76
76
|
const $modal = document.querySelector(".NAMED_SHEET");
|
|
77
77
|
|
|
78
78
|
const [$prefix, $kind] = named_by($modal, "aria-labelledby");
|
|
79
79
|
expect($prefix.classList.contains("MODAL_TITLE_PREFIX")).toBe(true);
|
|
80
|
-
expect($prefix.textContent).toBe("
|
|
80
|
+
expect($prefix.textContent).toBe("raw_events");
|
|
81
81
|
expect($kind.classList.contains("MODAL_TITLE_KIND")).toBe(true);
|
|
82
82
|
expect($kind.dataset.i18n || $kind.getAttribute("i18n")).toBe("keys");
|
|
83
83
|
expect(named_by($modal, "aria-labelledby").length).toBe(2);
|
package/src/treedb_fold_model.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* - A node is visible when SOME visible parent shows it, or it is
|
|
30
30
|
* a shown root. A record with two parents (a device hangs from
|
|
31
|
-
* its
|
|
31
|
+
* its site AND its building) is drawn ONCE, under whichever
|
|
32
32
|
* opened first, and folding one of the two leaves it where the
|
|
33
33
|
* other one shows it. The union, never the intersection.
|
|
34
34
|
*
|
|
@@ -361,8 +361,8 @@ function count_levels(model)
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
/************************************************************
|
|
364
|
-
* A HIERARCHICAL topic: one hooked to ITSELF --
|
|
365
|
-
*
|
|
364
|
+
* A HIERARCHICAL topic: one hooked to ITSELF -- sites inside
|
|
365
|
+
* sites, groups inside groups, roles inside roles. It is the
|
|
366
366
|
* only kind of topic a tree can hang from: a topic that only
|
|
367
367
|
* reaches OTHER topics is a list with children, and making it
|
|
368
368
|
* the trunk drew the agent's treedb from `yunos` instead of
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The fold arithmetic of the treedb graph, pinned.
|
|
5
5
|
*
|
|
6
|
-
* A small
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* A small sites / buildings / devices inventory: sites (a
|
|
7
|
+
* self-referent tree), devices hanging from a site AND a building,
|
|
8
|
+
* buildings hanging from a site, and a topic with hooks and no
|
|
9
|
+
* fkeys (extended) whose children must be roots.
|
|
10
10
|
***********************************************************************/
|
|
11
11
|
import { describe, test, expect } from "vitest";
|
|
12
12
|
import {
|
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
fold_is_hierarchical,
|
|
35
35
|
} from "./treedb_fold_model.js";
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
topic_name: "
|
|
37
|
+
const sites_desc = {
|
|
38
|
+
topic_name: "sites",
|
|
39
39
|
node_treedb_type: "entity",
|
|
40
40
|
cols: [
|
|
41
41
|
{id: "id", flag: []},
|
|
42
|
-
{id: "
|
|
43
|
-
{id: "
|
|
44
|
-
{id: "devices", flag: ["hook"], hook: {devices: "
|
|
45
|
-
{id: "
|
|
42
|
+
{id: "site", flag: ["fkey"], fkey: {sites: "sites"}},
|
|
43
|
+
{id: "sites", flag: ["hook"], hook: {sites: "site"}},
|
|
44
|
+
{id: "devices", flag: ["hook"], hook: {devices: "site"}},
|
|
45
|
+
{id: "buildings", flag: ["hook"], hook: {buildings: "site"}},
|
|
46
46
|
],
|
|
47
47
|
};
|
|
48
48
|
const devices_desc = {
|
|
@@ -50,29 +50,29 @@ const devices_desc = {
|
|
|
50
50
|
node_treedb_type: "child",
|
|
51
51
|
cols: [
|
|
52
52
|
{id: "id", flag: []},
|
|
53
|
-
{id: "
|
|
54
|
-
{id: "
|
|
53
|
+
{id: "site", flag: ["fkey"], fkey: {sites: "devices"}},
|
|
54
|
+
{id: "building", flag: ["fkey"], fkey: {buildings: "devices"}},
|
|
55
55
|
{id: "photo", flag: ["fkey", "file"], fkey: {__assets__: "photos"}},
|
|
56
56
|
],
|
|
57
57
|
};
|
|
58
|
-
const
|
|
59
|
-
topic_name: "
|
|
58
|
+
const buildings_desc = {
|
|
59
|
+
topic_name: "buildings",
|
|
60
60
|
node_treedb_type: "entity",
|
|
61
61
|
cols: [
|
|
62
62
|
{id: "id", flag: []},
|
|
63
|
-
{id: "
|
|
64
|
-
{id: "devices", flag: ["hook"], hook: {devices: "
|
|
63
|
+
{id: "site", flag: ["fkey"], fkey: {sites: "buildings"}},
|
|
64
|
+
{id: "devices", flag: ["hook"], hook: {devices: "building"}},
|
|
65
65
|
],
|
|
66
66
|
};
|
|
67
|
-
/*
|
|
68
|
-
const
|
|
69
|
-
cols:
|
|
70
|
-
{id: "
|
|
71
|
-
{id: "parent", flag: ["fkey"], fkey: {
|
|
67
|
+
/* buildings inside buildings: a second HIERARCHICAL topic */
|
|
68
|
+
const buildings_self = Object.assign({}, buildings_desc, {
|
|
69
|
+
cols: buildings_desc.cols.concat([
|
|
70
|
+
{id: "buildings", flag: ["hook"], hook: {buildings: "parent"}},
|
|
71
|
+
{id: "parent", flag: ["fkey"], fkey: {buildings: "buildings"}},
|
|
72
72
|
]),
|
|
73
73
|
});
|
|
74
74
|
const groups_desc = {
|
|
75
|
-
topic_name: "
|
|
75
|
+
topic_name: "groups",
|
|
76
76
|
node_treedb_type: "extended",
|
|
77
77
|
cols: [
|
|
78
78
|
{id: "id", flag: []},
|
|
@@ -82,34 +82,34 @@ const groups_desc = {
|
|
|
82
82
|
|
|
83
83
|
const descs = {
|
|
84
84
|
__graphs__: {topic_name: "__graphs__", cols: []},
|
|
85
|
-
|
|
85
|
+
sites: sites_desc,
|
|
86
86
|
devices: devices_desc,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
buildings: buildings_desc,
|
|
88
|
+
groups: groups_desc,
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
/* region > (north, south); north > site1; site1 has 30 devices and one
|
|
92
|
-
*
|
|
92
|
+
* building b1 that also reaches devices d0..d9. */
|
|
93
93
|
function make_records(n_devices)
|
|
94
94
|
{
|
|
95
95
|
let devices = [];
|
|
96
96
|
for(let i = 0; i < n_devices; i++) {
|
|
97
|
-
let rec = {id: `d${i}`,
|
|
97
|
+
let rec = {id: `d${i}`, site: "sites^site1^devices", photo: "x^y^photos"};
|
|
98
98
|
if(i < 10) {
|
|
99
|
-
rec.
|
|
99
|
+
rec.building = ["buildings^b1^devices"];
|
|
100
100
|
}
|
|
101
101
|
devices.push(rec);
|
|
102
102
|
}
|
|
103
103
|
return {
|
|
104
|
-
|
|
105
|
-
{id: "region",
|
|
106
|
-
{id: "north",
|
|
107
|
-
{id: "south",
|
|
108
|
-
{id: "site1",
|
|
104
|
+
sites: [
|
|
105
|
+
{id: "region", site: ""},
|
|
106
|
+
{id: "north", site: "sites^region^sites"},
|
|
107
|
+
{id: "south", site: "sites^region^sites"},
|
|
108
|
+
{id: "site1", site: "sites^north^sites"},
|
|
109
109
|
],
|
|
110
110
|
devices: devices,
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
buildings: [{id: "b1", site: "sites^site1^buildings"}],
|
|
112
|
+
groups: [{id: "g1"}],
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -119,16 +119,16 @@ describe("the model", () => {
|
|
|
119
119
|
test("every record is a node, system topics are skipped", () => {
|
|
120
120
|
let m = fold_build_model(descs, make_records(3));
|
|
121
121
|
expect(m.nodes.size).toBe(4 + 3 + 1 + 1);
|
|
122
|
-
expect(m.topics).toEqual(["
|
|
122
|
+
expect(m.topics).toEqual(["sites", "devices", "buildings", "groups"]);
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
test("children hang from the hook the fkey names, in record order", () => {
|
|
126
126
|
let m = fold_build_model(descs, make_records(3));
|
|
127
|
-
expect(m.groups.get(fold_group_key(K("
|
|
128
|
-
.toEqual([K("
|
|
129
|
-
expect(m.groups.get(fold_group_key(K("
|
|
127
|
+
expect(m.groups.get(fold_group_key(K("sites", "region"), "sites")))
|
|
128
|
+
.toEqual([K("sites", "north"), K("sites", "south")]);
|
|
129
|
+
expect(m.groups.get(fold_group_key(K("sites", "site1"), "devices")))
|
|
130
130
|
.toEqual([K("devices", "d0"), K("devices", "d1"), K("devices", "d2")]);
|
|
131
|
-
expect(m.groups.get(fold_group_key(K("
|
|
131
|
+
expect(m.groups.get(fold_group_key(K("buildings", "b1"), "devices")))
|
|
132
132
|
.toEqual([K("devices", "d0"), K("devices", "d1"), K("devices", "d2")]);
|
|
133
133
|
});
|
|
134
134
|
|
|
@@ -136,88 +136,88 @@ describe("the model", () => {
|
|
|
136
136
|
let m = fold_build_model(descs, make_records(3));
|
|
137
137
|
let d0 = m.nodes.get(K("devices", "d0"));
|
|
138
138
|
expect(d0.parents.map((p) => p.node_key).sort())
|
|
139
|
-
.toEqual([K("
|
|
139
|
+
.toEqual([K("buildings", "b1"), K("sites", "site1")]);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
142
|
test("roots: no drawable parent -- and a fkey into a topic nobody fetched is not a parent", () => {
|
|
143
143
|
let m = fold_build_model(descs, make_records(3));
|
|
144
|
-
expect(m.groups.get(fold_root_group_key("
|
|
144
|
+
expect(m.groups.get(fold_root_group_key("sites"))).toEqual([K("sites", "region")]);
|
|
145
145
|
expect(m.groups.get(fold_root_group_key("devices"))).toBeUndefined();
|
|
146
146
|
/* `photo` names __assets__, which has no desc: ignored */
|
|
147
147
|
expect(m.nodes.get(K("devices", "d0")).parents.length).toBe(2);
|
|
148
|
-
expect(m.groups.get(fold_root_group_key("
|
|
148
|
+
expect(m.groups.get(fold_root_group_key("groups"))).toEqual([K("groups", "g1")]);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
test("a child of an `extended` parent only has no parent: the engine draws no edge to one", () => {
|
|
152
152
|
let recs = make_records(1);
|
|
153
|
-
recs.devices[0] = {id: "d0", group: "
|
|
153
|
+
recs.devices[0] = {id: "d0", group: "groups^g1^members"};
|
|
154
154
|
let m = fold_build_model(descs, recs);
|
|
155
|
-
expect(m.nodes.get(K("
|
|
156
|
-
/* devices hang from
|
|
155
|
+
expect(m.nodes.get(K("groups", "g1")).hooks).toEqual({});
|
|
156
|
+
/* devices hang from sites (the main topic), so a device with
|
|
157
157
|
* no parent is LOOSE, not a root -- see the "main topic" block */
|
|
158
158
|
expect(m.loose.devices).toEqual([K("devices", "d0")]);
|
|
159
159
|
expect(m.groups.get(fold_root_group_key("devices"))).toBeUndefined();
|
|
160
160
|
/* and with no main topic it is a plain root */
|
|
161
|
-
let m2 = fold_build_model({
|
|
162
|
-
expect(m2.main_topic).toBe("
|
|
163
|
-
let m3 = fold_build_model({devices: devices_desc,
|
|
161
|
+
let m2 = fold_build_model({sites: sites_desc, devices: devices_desc, groups: groups_desc}, recs, {main_topic: ""});
|
|
162
|
+
expect(m2.main_topic).toBe("sites"); /* "" means "deduce", and sites reaches devices */
|
|
163
|
+
let m3 = fold_build_model({devices: devices_desc, groups: groups_desc}, recs);
|
|
164
164
|
expect(m3.main_topic).toBe("");
|
|
165
165
|
expect(m3.groups.get(fold_root_group_key("devices"))).toEqual([K("devices", "d0")]);
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
test("a cycle with no way in gets one root, not a row of them", () => {
|
|
169
169
|
let recs = {
|
|
170
|
-
|
|
171
|
-
{id: "a",
|
|
172
|
-
{id: "b",
|
|
173
|
-
{id: "c",
|
|
170
|
+
sites: [
|
|
171
|
+
{id: "a", site: "sites^c^sites"},
|
|
172
|
+
{id: "b", site: "sites^a^sites"},
|
|
173
|
+
{id: "c", site: "sites^b^sites"},
|
|
174
174
|
],
|
|
175
175
|
};
|
|
176
|
-
let m = fold_build_model({
|
|
177
|
-
expect(m.groups.get(fold_root_group_key("
|
|
176
|
+
let m = fold_build_model({sites: sites_desc}, recs);
|
|
177
|
+
expect(m.groups.get(fold_root_group_key("sites"))).toEqual([K("sites", "a")]);
|
|
178
178
|
let st = fold_new_state(24);
|
|
179
179
|
fold_expand_all(m, st);
|
|
180
180
|
expect(fold_visible_set(m, st).size).toBe(3);
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
test("group keys split back", () => {
|
|
184
|
-
expect(fold_split_group_key("
|
|
185
|
-
.toEqual({node_key: "
|
|
184
|
+
expect(fold_split_group_key("sites^site1|devices"))
|
|
185
|
+
.toEqual({node_key: "sites^site1", hook: "devices"});
|
|
186
186
|
expect(fold_split_group_key("|devices")).toEqual({node_key: "", hook: "devices"});
|
|
187
187
|
expect(fold_split_group_key("nope")).toBeNull();
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
describe("main topic, hidden topics, loose records", () => {
|
|
192
|
-
test("the main topic is the one whose hooks reach the most others;
|
|
193
|
-
expect(fold_main_topic(descs)).toBe("
|
|
192
|
+
test("the main topic is the one whose hooks reach the most others; sites, not groups", () => {
|
|
193
|
+
expect(fold_main_topic(descs)).toBe("sites");
|
|
194
194
|
let m = fold_build_model(descs, make_records(3));
|
|
195
|
-
expect(m.main_topic).toBe("
|
|
196
|
-
expect([...m.linked].sort()).toEqual(["
|
|
197
|
-
expect(m.linked.has("
|
|
195
|
+
expect(m.main_topic).toBe("sites");
|
|
196
|
+
expect([...m.linked].sort()).toEqual(["buildings", "devices", "sites"]);
|
|
197
|
+
expect(m.linked.has("groups")).toBe(false);
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
test("only a topic hooked to ITSELF can be the main one", () => {
|
|
201
|
-
expect(fold_is_hierarchical(descs, "
|
|
202
|
-
expect(fold_is_hierarchical(descs, "
|
|
203
|
-
expect(fold_is_hierarchical(descs, "
|
|
201
|
+
expect(fold_is_hierarchical(descs, "sites")).toBe(true);
|
|
202
|
+
expect(fold_is_hierarchical(descs, "buildings")).toBe(false);
|
|
203
|
+
expect(fold_is_hierarchical(descs, "groups")).toBe(false);
|
|
204
204
|
/* c reaches x and nothing reaches itself: no trunk at all */
|
|
205
205
|
let c = {topic_name: "c", cols: [{id: "id", flag: []},
|
|
206
206
|
{id: "xs", flag: ["hook"], hook: {x: "c"}}]};
|
|
207
207
|
let x = {topic_name: "x", cols: [{id: "id", flag: []}, {id: "c", flag: ["fkey"]}]};
|
|
208
208
|
expect(fold_main_topic({c: c, x: x})).toBe("");
|
|
209
|
-
/* a tree of
|
|
210
|
-
expect(fold_main_topic({
|
|
209
|
+
/* a tree of sites alone, reaching no other topic, is still a trunk */
|
|
210
|
+
expect(fold_main_topic({sites: sites_desc})).toBe("sites");
|
|
211
211
|
});
|
|
212
212
|
|
|
213
213
|
test("the schema's mark wins over the deduction, among hierarchical topics", () => {
|
|
214
|
-
let d = Object.assign({}, descs, {
|
|
215
|
-
expect(fold_main_topic(d)).toBe("
|
|
216
|
-
let marked = Object.assign({}, d, {
|
|
217
|
-
expect(fold_main_topic(marked)).toBe("
|
|
214
|
+
let d = Object.assign({}, descs, {buildings: buildings_self});
|
|
215
|
+
expect(fold_main_topic(d)).toBe("sites"); /* sites reaches more */
|
|
216
|
+
let marked = Object.assign({}, d, {buildings: Object.assign({}, buildings_self, {main_topic: true})});
|
|
217
|
+
expect(fold_main_topic(marked)).toBe("buildings");
|
|
218
218
|
/* a mark on a topic that is not hierarchical is not a trunk */
|
|
219
219
|
let wrong = Object.assign({}, descs, {devices: Object.assign({}, devices_desc, {main_topic: true})});
|
|
220
|
-
expect(fold_main_topic(wrong)).toBe("
|
|
220
|
+
expect(fold_main_topic(wrong)).toBe("sites");
|
|
221
221
|
});
|
|
222
222
|
|
|
223
223
|
test("a self-referent hook breaks a tie", () => {
|
|
@@ -233,18 +233,18 @@ describe("main topic, hidden topics, loose records", () => {
|
|
|
233
233
|
});
|
|
234
234
|
|
|
235
235
|
test("the reader's pick wins -- if it is a hierarchical topic", () => {
|
|
236
|
-
let d = Object.assign({}, descs, {
|
|
237
|
-
let m = fold_build_model(d, make_records(3), {main_topic: "
|
|
238
|
-
expect(m.main_topic).toBe("
|
|
239
|
-
expect([...m.linked].sort()).toEqual(["
|
|
240
|
-
/*
|
|
241
|
-
expect(m.groups.get(fold_root_group_key("
|
|
236
|
+
let d = Object.assign({}, descs, {buildings: buildings_self});
|
|
237
|
+
let m = fold_build_model(d, make_records(3), {main_topic: "buildings"});
|
|
238
|
+
expect(m.main_topic).toBe("buildings");
|
|
239
|
+
expect([...m.linked].sort()).toEqual(["buildings", "devices"]);
|
|
240
|
+
/* sites is not linked to buildings, so its roots are roots */
|
|
241
|
+
expect(m.groups.get(fold_root_group_key("sites"))).toEqual([K("sites", "region")]);
|
|
242
242
|
/* a pick the rule refuses is ignored, and the trunk is deduced */
|
|
243
|
-
let m2 = fold_build_model(descs, make_records(3), {main_topic: "
|
|
244
|
-
expect(m2.main_topic).toBe("
|
|
243
|
+
let m2 = fold_build_model(descs, make_records(3), {main_topic: "buildings"});
|
|
244
|
+
expect(m2.main_topic).toBe("sites");
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
test("a device with no
|
|
247
|
+
test("a device with no site is LOOSE: counted, not a root, unless asked for", () => {
|
|
248
248
|
let recs = make_records(3);
|
|
249
249
|
recs.devices.push({id: "d_loose"});
|
|
250
250
|
let m = fold_build_model(descs, recs);
|
|
@@ -256,55 +256,55 @@ describe("main topic, hidden topics, loose records", () => {
|
|
|
256
256
|
expect(m2.loose.devices).toEqual([K("devices", "d_loose")]);
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
test("a device hanging from a loose
|
|
259
|
+
test("a device hanging from a loose building only is loose too, and follows it", () => {
|
|
260
260
|
let recs = make_records(0);
|
|
261
|
-
recs.
|
|
262
|
-
recs.devices.push({id: "d_under",
|
|
261
|
+
recs.buildings.push({id: "b_loose"});
|
|
262
|
+
recs.devices.push({id: "d_under", building: ["buildings^b_loose^devices"]});
|
|
263
263
|
let m = fold_build_model(descs, recs);
|
|
264
|
-
expect(m.loose.
|
|
264
|
+
expect(m.loose.buildings).toEqual([K("buildings", "b_loose")]);
|
|
265
265
|
expect(m.loose.devices).toEqual([K("devices", "d_under")]);
|
|
266
266
|
let st = fold_new_state(24);
|
|
267
267
|
fold_expand_all(m, st);
|
|
268
268
|
expect(fold_visible_set(m, st).has(K("devices", "d_under"))).toBe(false);
|
|
269
|
-
let m2 = fold_build_model(descs, recs, {loose_topics: ["
|
|
269
|
+
let m2 = fold_build_model(descs, recs, {loose_topics: ["buildings"]});
|
|
270
270
|
fold_expand_all(m2, st);
|
|
271
271
|
expect(fold_visible_set(m2, st).has(K("devices", "d_under"))).toBe(true);
|
|
272
272
|
});
|
|
273
273
|
|
|
274
274
|
test("a hidden topic leaves the model whole: no node, no pill, no edge", () => {
|
|
275
275
|
let m = fold_build_model(descs, make_records(30), {hidden_topics: ["devices"]});
|
|
276
|
-
expect(m.topics).toEqual(["
|
|
276
|
+
expect(m.topics).toEqual(["sites", "buildings", "groups"]);
|
|
277
277
|
expect(m.totals.devices).toBe(30);
|
|
278
|
-
expect(m.nodes.get(K("
|
|
279
|
-
expect(fold_pills_of(m, fold_new_state(24), K("
|
|
280
|
-
.toEqual(["
|
|
278
|
+
expect(m.nodes.get(K("sites", "site1")).hooks.devices).toBeUndefined();
|
|
279
|
+
expect(fold_pills_of(m, fold_new_state(24), K("sites", "site1")).map((p) => p.hook))
|
|
280
|
+
.toEqual(["buildings"]);
|
|
281
281
|
expect(m.hidden.has("devices")).toBe(true);
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
test("hiding a topic in the middle: what hung from it alone becomes loose", () => {
|
|
285
|
-
let m = fold_build_model(descs, make_records(12), {hidden_topics: ["
|
|
286
|
-
/* d0..d9 hang from site1 AND
|
|
285
|
+
let m = fold_build_model(descs, make_records(12), {hidden_topics: ["buildings"]});
|
|
286
|
+
/* d0..d9 hang from site1 AND b1: still under site1 */
|
|
287
287
|
expect(m.nodes.get(K("devices", "d0")).parents.length).toBe(1);
|
|
288
288
|
expect(m.loose.devices).toEqual([]);
|
|
289
|
-
/*
|
|
290
|
-
* whatever has no parent left is a root --
|
|
289
|
+
/* sites hidden = the main topic gone: nothing governs, and
|
|
290
|
+
* whatever has no parent left is a root -- b1, with d0 and d1
|
|
291
291
|
* still hanging from it */
|
|
292
|
-
let m2 = fold_build_model(descs, make_records(2), {hidden_topics: ["
|
|
292
|
+
let m2 = fold_build_model(descs, make_records(2), {hidden_topics: ["sites"]});
|
|
293
293
|
expect(m2.main_topic).toBe("");
|
|
294
|
-
expect(m2.groups.get(fold_root_group_key("
|
|
294
|
+
expect(m2.groups.get(fold_root_group_key("buildings"))).toEqual([K("buildings", "b1")]);
|
|
295
295
|
expect(m2.groups.get(fold_root_group_key("devices"))).toBeUndefined();
|
|
296
|
-
let m3 = fold_build_model(descs, {devices: [{id: "d9"}]}, {hidden_topics: ["
|
|
296
|
+
let m3 = fold_build_model(descs, {devices: [{id: "d9"}]}, {hidden_topics: ["sites"]});
|
|
297
297
|
expect(m3.groups.get(fold_root_group_key("devices"))).toEqual([K("devices", "d9")]);
|
|
298
298
|
});
|
|
299
299
|
|
|
300
300
|
test("a topic shown again opens on its roots' first page: nobody folds the roots", () => {
|
|
301
301
|
let recs = make_records(3);
|
|
302
302
|
let st = fold_new_state(24);
|
|
303
|
-
let m = fold_build_model(descs, recs, {hidden_topics: ["
|
|
303
|
+
let m = fold_build_model(descs, recs, {hidden_topics: ["groups"]});
|
|
304
304
|
fold_expand_to_depth(m, st, 2);
|
|
305
|
-
expect(fold_visible_set(m, st).has(K("
|
|
305
|
+
expect(fold_visible_set(m, st).has(K("groups", "g1"))).toBe(false);
|
|
306
306
|
let m2 = fold_build_model(descs, recs);
|
|
307
|
-
expect(fold_visible_set(m2, st).has(K("
|
|
307
|
+
expect(fold_visible_set(m2, st).has(K("groups", "g1"))).toBe(true);
|
|
308
308
|
expect(fold_pending_groups(m2, st, fold_visible_set(m2, st))).toEqual([]);
|
|
309
309
|
});
|
|
310
310
|
|
|
@@ -313,7 +313,7 @@ describe("main topic, hidden topics, loose records", () => {
|
|
|
313
313
|
let st = fold_new_state(24);
|
|
314
314
|
let m = fold_build_model(descs, recs);
|
|
315
315
|
fold_expand_to_depth(m, st, 4);
|
|
316
|
-
let g = fold_group_key(K("
|
|
316
|
+
let g = fold_group_key(K("sites", "site1"), "devices");
|
|
317
317
|
expect(fold_group_shown(m, st, g)).toBe(24);
|
|
318
318
|
let m_hidden = fold_build_model(descs, recs, {hidden_topics: ["devices"]});
|
|
319
319
|
expect(fold_group_shown(m_hidden, st, g)).toBe(0); /* no group: nothing shown */
|
|
@@ -328,7 +328,7 @@ describe("depth", () => {
|
|
|
328
328
|
let st = fold_new_state(24);
|
|
329
329
|
fold_expand_to_depth(m, st, 1);
|
|
330
330
|
expect([...fold_visible_set(m, st)].sort())
|
|
331
|
-
.toEqual([K("
|
|
331
|
+
.toEqual([K("groups", "g1"), K("sites", "region")]);
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
test("depth 2 opens the roots' hooks on their first page", () => {
|
|
@@ -336,9 +336,9 @@ describe("depth", () => {
|
|
|
336
336
|
let st = fold_new_state(24);
|
|
337
337
|
fold_expand_to_depth(m, st, 2);
|
|
338
338
|
let v = fold_visible_set(m, st);
|
|
339
|
-
expect(v.has(K("
|
|
340
|
-
expect(v.has(K("
|
|
341
|
-
expect(v.has(K("
|
|
339
|
+
expect(v.has(K("sites", "north"))).toBe(true);
|
|
340
|
+
expect(v.has(K("sites", "south"))).toBe(true);
|
|
341
|
+
expect(v.has(K("sites", "site1"))).toBe(false);
|
|
342
342
|
expect(v.has(K("devices", "d0"))).toBe(false);
|
|
343
343
|
});
|
|
344
344
|
|
|
@@ -350,7 +350,7 @@ describe("depth", () => {
|
|
|
350
350
|
expect(v.has(K("devices", "d0"))).toBe(true);
|
|
351
351
|
expect(v.has(K("devices", "d23"))).toBe(true);
|
|
352
352
|
expect(v.has(K("devices", "d24"))).toBe(false);
|
|
353
|
-
expect(v.has(K("
|
|
353
|
+
expect(v.has(K("buildings", "b1"))).toBe(true);
|
|
354
354
|
});
|
|
355
355
|
|
|
356
356
|
test("expand all shows everything, collapse all the roots' first page", () => {
|
|
@@ -366,18 +366,18 @@ describe("depth", () => {
|
|
|
366
366
|
describe("levels of the main tree (the toolbar's stepper)", () => {
|
|
367
367
|
test("levels count from the main topic's roots, down every hook", () => {
|
|
368
368
|
let m = fold_build_model(descs, make_records(30));
|
|
369
|
-
/* region 1, north/south 2, site1 3, its devices and
|
|
369
|
+
/* region 1, north/south 2, site1 3, its devices and b1 4 */
|
|
370
370
|
expect(m.levels).toBe(4);
|
|
371
|
-
expect(m.level_of.get(K("
|
|
372
|
-
expect(m.level_of.get(K("
|
|
373
|
-
/* d0 hangs from site1 (3) and
|
|
371
|
+
expect(m.level_of.get(K("sites", "region"))).toBe(1);
|
|
372
|
+
expect(m.level_of.get(K("sites", "site1"))).toBe(3);
|
|
373
|
+
/* d0 hangs from site1 (3) and b1 (4): the shallowest wins */
|
|
374
374
|
expect(m.level_of.get(K("devices", "d0"))).toBe(4);
|
|
375
|
-
/*
|
|
376
|
-
expect(m.level_of.has(K("
|
|
375
|
+
/* groups is not tied to sites: a tree of its own, no level */
|
|
376
|
+
expect(m.level_of.has(K("groups", "g1"))).toBe(false);
|
|
377
377
|
});
|
|
378
378
|
|
|
379
379
|
test("a hidden topic takes its levels with it", () => {
|
|
380
|
-
let m = fold_build_model(descs, make_records(30), {hidden_topics: ["devices", "
|
|
380
|
+
let m = fold_build_model(descs, make_records(30), {hidden_topics: ["devices", "buildings"]});
|
|
381
381
|
expect(m.levels).toBe(3);
|
|
382
382
|
let m0 = fold_build_model({}, {});
|
|
383
383
|
expect(m0.levels).toBe(0);
|
|
@@ -397,44 +397,44 @@ describe("levels of the main tree (the toolbar's stepper)", () => {
|
|
|
397
397
|
let st = fold_new_state(24);
|
|
398
398
|
fold_expand_to_level(m, st, 1);
|
|
399
399
|
expect([...fold_visible_set(m, st)].sort())
|
|
400
|
-
.toEqual([K("
|
|
400
|
+
.toEqual([K("groups", "g1"), K("sites", "region")]);
|
|
401
401
|
fold_open_levels(m, st, 2);
|
|
402
402
|
let v = fold_visible_set(m, st);
|
|
403
|
-
expect(v.has(K("
|
|
404
|
-
expect(v.has(K("
|
|
403
|
+
expect(v.has(K("sites", "north"))).toBe(true);
|
|
404
|
+
expect(v.has(K("sites", "site1"))).toBe(false);
|
|
405
405
|
fold_open_levels(m, st, 3);
|
|
406
|
-
expect(fold_visible_set(m, st).has(K("
|
|
406
|
+
expect(fold_visible_set(m, st).has(K("sites", "site1"))).toBe(true);
|
|
407
407
|
expect(fold_visible_set(m, st).has(K("devices", "d0"))).toBe(false);
|
|
408
408
|
fold_open_levels(m, st, 4);
|
|
409
409
|
v = fold_visible_set(m, st);
|
|
410
410
|
expect(v.has(K("devices", "d23"))).toBe(true);
|
|
411
411
|
expect(v.has(K("devices", "d24"))).toBe(false); /* one page */
|
|
412
|
-
expect(v.has(K("
|
|
412
|
+
expect(v.has(K("buildings", "b1"))).toBe(true);
|
|
413
413
|
});
|
|
414
414
|
|
|
415
415
|
test("opening keeps the pages already shown; closing folds only from its level down", () => {
|
|
416
416
|
let m = fold_build_model(descs, make_records(30));
|
|
417
417
|
let st = fold_new_state(24);
|
|
418
418
|
fold_expand_to_level(m, st, 4);
|
|
419
|
-
let g = fold_group_key(K("
|
|
419
|
+
let g = fold_group_key(K("sites", "site1"), "devices");
|
|
420
420
|
fold_show_more(m, st, g); /* 30 */
|
|
421
421
|
fold_open_levels(m, st, 4);
|
|
422
422
|
expect(fold_group_shown(m, st, g)).toBe(30);
|
|
423
423
|
fold_close_levels(m, st, 3);
|
|
424
424
|
let v = fold_visible_set(m, st);
|
|
425
|
-
expect(v.has(K("
|
|
425
|
+
expect(v.has(K("sites", "site1"))).toBe(true); /* level 3 stays */
|
|
426
426
|
expect(v.has(K("devices", "d0"))).toBe(false); /* its hooks folded */
|
|
427
|
-
expect(v.has(K("
|
|
428
|
-
expect(fold_is_open(st, fold_group_key(K("
|
|
427
|
+
expect(v.has(K("buildings", "b1"))).toBe(false);
|
|
428
|
+
expect(fold_is_open(st, fold_group_key(K("sites", "north"), "sites"))).toBe(true);
|
|
429
429
|
});
|
|
430
430
|
|
|
431
431
|
test("closing does not reopen what the reader folded above the level", () => {
|
|
432
432
|
let m = fold_build_model(descs, make_records(3));
|
|
433
433
|
let st = fold_new_state(24);
|
|
434
434
|
fold_expand_to_level(m, st, 4);
|
|
435
|
-
fold_toggle(m, st, fold_group_key(K("
|
|
435
|
+
fold_toggle(m, st, fold_group_key(K("sites", "region"), "sites")); /* fold region */
|
|
436
436
|
fold_close_levels(m, st, 3);
|
|
437
|
-
expect(fold_is_open(st, fold_group_key(K("
|
|
437
|
+
expect(fold_is_open(st, fold_group_key(K("sites", "region"), "sites"))).toBe(false);
|
|
438
438
|
});
|
|
439
439
|
});
|
|
440
440
|
|
|
@@ -443,7 +443,7 @@ describe("toggle and pages", () => {
|
|
|
443
443
|
let m = fold_build_model(descs, make_records(30));
|
|
444
444
|
let st = fold_new_state(24);
|
|
445
445
|
fold_expand_to_depth(m, st, 3);
|
|
446
|
-
let g = fold_group_key(K("
|
|
446
|
+
let g = fold_group_key(K("sites", "site1"), "devices");
|
|
447
447
|
expect(fold_toggle(m, st, g)).toBe(true);
|
|
448
448
|
expect(fold_visible_set(m, st).has(K("devices", "d5"))).toBe(true);
|
|
449
449
|
expect(fold_toggle(m, st, g)).toBe(false);
|
|
@@ -453,7 +453,7 @@ describe("toggle and pages", () => {
|
|
|
453
453
|
test("show more adds a page and stops at the total", () => {
|
|
454
454
|
let m = fold_build_model(descs, make_records(30));
|
|
455
455
|
let st = fold_new_state(24);
|
|
456
|
-
let g = fold_group_key(K("
|
|
456
|
+
let g = fold_group_key(K("sites", "site1"), "devices");
|
|
457
457
|
expect(fold_show_more(m, st, g)).toBe(24);
|
|
458
458
|
expect(fold_show_more(m, st, g)).toBe(30);
|
|
459
459
|
expect(fold_show_more(m, st, g)).toBe(30);
|
|
@@ -463,11 +463,11 @@ describe("toggle and pages", () => {
|
|
|
463
463
|
let m = fold_build_model(descs, make_records(30));
|
|
464
464
|
let st = fold_new_state(24);
|
|
465
465
|
fold_expand_to_depth(m, st, 4);
|
|
466
|
-
fold_toggle(m, st, fold_group_key(K("
|
|
466
|
+
fold_toggle(m, st, fold_group_key(K("sites", "region"), "sites")); /* close */
|
|
467
467
|
let v = fold_visible_set(m, st);
|
|
468
468
|
expect(v.has(K("devices", "d0"))).toBe(false);
|
|
469
469
|
expect(v.size).toBe(2);
|
|
470
|
-
fold_toggle(m, st, fold_group_key(K("
|
|
470
|
+
fold_toggle(m, st, fold_group_key(K("sites", "region"), "sites")); /* reopen */
|
|
471
471
|
expect(fold_visible_set(m, st).has(K("devices", "d0"))).toBe(true);
|
|
472
472
|
});
|
|
473
473
|
|
|
@@ -475,12 +475,12 @@ describe("toggle and pages", () => {
|
|
|
475
475
|
let m = fold_build_model(descs, make_records(30));
|
|
476
476
|
let st = fold_new_state(24);
|
|
477
477
|
fold_expand_to_depth(m, st, 4);
|
|
478
|
-
let
|
|
479
|
-
let
|
|
480
|
-
fold_toggle(m, st,
|
|
481
|
-
fold_toggle(m, st,
|
|
478
|
+
let g_site = fold_group_key(K("sites", "site1"), "devices");
|
|
479
|
+
let g_bldg = fold_group_key(K("buildings", "b1"), "devices");
|
|
480
|
+
fold_toggle(m, st, g_bldg); /* b1's devices open too */
|
|
481
|
+
fold_toggle(m, st, g_site); /* site1's devices folded */
|
|
482
482
|
let v = fold_visible_set(m, st);
|
|
483
|
-
expect(v.has(K("devices", "d3"))).toBe(true); /* via
|
|
483
|
+
expect(v.has(K("devices", "d3"))).toBe(true); /* via b1 */
|
|
484
484
|
expect(v.has(K("devices", "d15"))).toBe(false); /* only via site1 */
|
|
485
485
|
});
|
|
486
486
|
|
|
@@ -492,8 +492,8 @@ describe("toggle and pages", () => {
|
|
|
492
492
|
let pending = fold_pending_groups(m, st, v);
|
|
493
493
|
expect(pending.length).toBe(1);
|
|
494
494
|
expect(pending[0]).toMatchObject({
|
|
495
|
-
group_key: fold_group_key(K("
|
|
496
|
-
node_key: K("
|
|
495
|
+
group_key: fold_group_key(K("sites", "site1"), "devices"),
|
|
496
|
+
node_key: K("sites", "site1"), hook: "devices",
|
|
497
497
|
shown: 24, total: 30, rest: 6,
|
|
498
498
|
});
|
|
499
499
|
});
|
|
@@ -502,11 +502,11 @@ describe("toggle and pages", () => {
|
|
|
502
502
|
let m = fold_build_model(descs, make_records(30));
|
|
503
503
|
let st = fold_new_state(24);
|
|
504
504
|
fold_expand_to_depth(m, st, 4);
|
|
505
|
-
let pills = fold_pills_of(m, st, K("
|
|
506
|
-
expect(pills.map((p) => p.hook)).toEqual(["devices", "
|
|
505
|
+
let pills = fold_pills_of(m, st, K("sites", "site1"));
|
|
506
|
+
expect(pills.map((p) => p.hook)).toEqual(["devices", "buildings"]);
|
|
507
507
|
expect(pills[0]).toMatchObject({total: 30, shown: 24, open: true, child_topic: "devices"});
|
|
508
|
-
expect(pills[1]).toMatchObject({total: 1, shown: 1, open: true, child_topic: "
|
|
509
|
-
expect(fold_pills_of(m, st, K("
|
|
508
|
+
expect(pills[1]).toMatchObject({total: 1, shown: 1, open: true, child_topic: "buildings"});
|
|
509
|
+
expect(fold_pills_of(m, st, K("sites", "south"))).toEqual([]);
|
|
510
510
|
});
|
|
511
511
|
});
|
|
512
512
|
|
|
@@ -521,14 +521,14 @@ describe("reveal", () => {
|
|
|
521
521
|
/* d40 is the 41st: two pages, not three, and not all */
|
|
522
522
|
expect(v.has(K("devices", "d47"))).toBe(true);
|
|
523
523
|
expect(v.has(K("devices", "d48"))).toBe(false);
|
|
524
|
-
expect(v.has(K("
|
|
524
|
+
expect(v.has(K("sites", "south"))).toBe(true); /* region|sites opened whole page */
|
|
525
525
|
});
|
|
526
526
|
|
|
527
527
|
test("does not close what was open", () => {
|
|
528
528
|
let m = fold_build_model(descs, make_records(60));
|
|
529
529
|
let st = fold_new_state(24);
|
|
530
530
|
fold_expand_to_depth(m, st, 4);
|
|
531
|
-
fold_show_more(m, st, fold_group_key(K("
|
|
531
|
+
fold_show_more(m, st, fold_group_key(K("sites", "site1"), "devices")); /* 48 */
|
|
532
532
|
fold_reveal(m, st, K("devices", "d3"));
|
|
533
533
|
expect(fold_visible_set(m, st).has(K("devices", "d47"))).toBe(true);
|
|
534
534
|
});
|
package/src/treedb_layout.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Two layouts made for a treedb, and nothing else.
|
|
5
5
|
*
|
|
6
6
|
* What a treedb graph IS, once it is folded (treedb_fold_model.js):
|
|
7
|
-
* a forest read top to bottom. A main topic is a tree (
|
|
8
|
-
* country, region,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* a forest read top to bottom. A main topic is a tree (sites:
|
|
8
|
+
* country, region, campus), the other topics hang from its nodes
|
|
9
|
+
* through hooks (buildings, devices, users), a record may hang
|
|
10
|
+
* from two parents (a device from its site AND its building), and
|
|
11
|
+
* every visible node was reached from a root.
|
|
12
12
|
* Tens to a few hundred cards on screen, never the whole store.
|
|
13
13
|
*
|
|
14
14
|
* G6's own layouts either do not know that or pay for not knowing:
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*
|
|
31
31
|
* - roots are the nodes with no incoming edge, in node order;
|
|
32
32
|
* - a node belongs to the FIRST parent that reaches it in a
|
|
33
|
-
* breadth-first walk from the roots -- the
|
|
34
|
-
*
|
|
33
|
+
* breadth-first walk from the roots -- the site, not the
|
|
34
|
+
* building, because the site's column came first -- and the
|
|
35
35
|
* other links are drawn as edges across the tree;
|
|
36
36
|
* - the children of a node are ordered by the HOOK they hang from
|
|
37
37
|
* (the parent's port order, which is the schema's column order)
|
package/src/yui_dev.js
CHANGED
|
@@ -1455,7 +1455,7 @@ function refresh_dev_chrome()
|
|
|
1455
1455
|
}
|
|
1456
1456
|
|
|
1457
1457
|
/* The payload of a FOLDED entry as text, the way it is on screen: one line
|
|
1458
|
-
* per row, a closed branch as its one-line summary (`data {
|
|
1458
|
+
* per row, a closed branch as its one-line summary (`data {sites: […], …}`)
|
|
1459
1459
|
* and only an OPENED branch with its content, four characters further in.
|
|
1460
1460
|
*
|
|
1461
1461
|
* Read from the painted DOM and not from the payload, because whether a
|
package/src/yui_dev_copy.test.js
CHANGED
|
@@ -39,12 +39,12 @@ describe("entry_shown_lines", () => {
|
|
|
39
39
|
const $e = painted({
|
|
40
40
|
result: 0,
|
|
41
41
|
comment: "db_history^7301: 500 nodes",
|
|
42
|
-
data: {
|
|
42
|
+
data: {sites: [1, 2, 3], buildings: [4], devices: [5, 6]},
|
|
43
43
|
});
|
|
44
44
|
expect(entry_shown_lines($e)).toEqual([
|
|
45
45
|
" • result: 0",
|
|
46
46
|
" • comment: db_history^7301: 500 nodes",
|
|
47
|
-
" ▸ data {
|
|
47
|
+
" ▸ data {sites:[…],buildings:[…],devices:[…]}",
|
|
48
48
|
]);
|
|
49
49
|
});
|
|
50
50
|
|
package/src/yui_icons.css
CHANGED
|
@@ -631,8 +631,8 @@
|
|
|
631
631
|
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M176 24c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c-35.3 0-64 28.7-64 64l-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0c0 35.3 28.7 64 64 64l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c35.3 0 64-28.7 64-64l40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0c0-35.3-28.7-64-64-64l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40zM160 128l192 0c17.7 0 32 14.3 32 32l0 192c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-192c0-17.7 14.3-32 32-32zm16 48l0 160 160 0 0-160-160 0z'/%3E%3C/svg%3E");
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
-
/* A
|
|
635
|
-
* 7.3.1). */
|
|
634
|
+
/* A server: a machine that serves others, a rack unit (FontAwesome
|
|
635
|
+
* Free 7.3.1). */
|
|
636
636
|
.yi-server::before {
|
|
637
637
|
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M64 32C28.7 32 0 60.7 0 96l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 32zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0zM64 288c-35.3 0-64 28.7-64 64l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 288zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z'/%3E%3C/svg%3E");
|
|
638
638
|
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M64 32C28.7 32 0 60.7 0 96l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 32zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0zM64 288c-35.3 0-64 28.7-64 64l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 288zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z'/%3E%3C/svg%3E");
|
|
@@ -764,7 +764,7 @@
|
|
|
764
764
|
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z'/%3E%3C/svg%3E");
|
|
765
765
|
}
|
|
766
766
|
|
|
767
|
-
/* A hierarchy of groups to file things in -- zones,
|
|
767
|
+
/* A hierarchy of groups to file things in -- zones, sites: the tree of
|
|
768
768
|
* folders of Windows Explorer, VS Code or Drive. The sitemap is the site
|
|
769
769
|
* map (FontAwesome Free 7.3.1). */
|
|
770
770
|
.yi-folder-tree::before {
|
|
@@ -4,23 +4,23 @@ import {row_matches, is_fkey_ref, is_hook_size} from "./yui_row_search.js";
|
|
|
4
4
|
|
|
5
5
|
describe("row_matches", () => {
|
|
6
6
|
const row = {
|
|
7
|
-
id: "
|
|
7
|
+
id: "D00000042",
|
|
8
8
|
name: "",
|
|
9
|
-
|
|
9
|
+
site: [
|
|
10
10
|
{
|
|
11
|
-
id: "
|
|
12
|
-
topic_name: "
|
|
11
|
+
id: "north.campus-a.room-13",
|
|
12
|
+
topic_name: "sites",
|
|
13
13
|
hook_name: "devices"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
|
-
|
|
16
|
+
capacity: 400,
|
|
17
17
|
enabled: true,
|
|
18
18
|
_operation: "hidden",
|
|
19
19
|
__md_treedb__: {topic_name: "devices"}
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
it("finds a plain field", () => {
|
|
23
|
-
expect(row_matches(row, "
|
|
23
|
+
expect(row_matches(row, "d00000042")).toBe(true);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it("finds a number", () => {
|
|
@@ -28,13 +28,13 @@ describe("row_matches", () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it("finds a value INSIDE an fkey, which is the whole point", () => {
|
|
31
|
-
expect(row_matches(row, "
|
|
31
|
+
expect(row_matches(row, "room-13")).toBe(true);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it("does NOT match the structural halves of an fkey", () => {
|
|
35
35
|
/* `topic_name`/`hook_name` are the same two words on every row:
|
|
36
36
|
* matching them turns the term into a wildcard. */
|
|
37
|
-
expect(row_matches(row, "
|
|
37
|
+
expect(row_matches(row, "sites")).toBe(false);
|
|
38
38
|
expect(row_matches(row, "hook")).toBe(false);
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -56,14 +56,14 @@ describe("row_matches, on a table loaded with hook_size", () => {
|
|
|
56
56
|
/* What a topic table gets since 7.23.163: the hook is the COUNT
|
|
57
57
|
* of its children, not their ids. */
|
|
58
58
|
const row = {
|
|
59
|
-
id: "
|
|
60
|
-
name: "
|
|
59
|
+
id: "sites-north",
|
|
60
|
+
name: "North",
|
|
61
61
|
devices: [{size: 400}],
|
|
62
|
-
__md_treedb__: {topic_name: "
|
|
62
|
+
__md_treedb__: {topic_name: "sites"}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
it("does NOT match the count of a hook", () => {
|
|
66
|
-
/* It did, and "400" then answered every
|
|
66
|
+
/* It did, and "400" then answered every site holding 400
|
|
67
67
|
* devices together with the ones that really say 400. */
|
|
68
68
|
expect(row_matches(row, "400")).toBe(false);
|
|
69
69
|
expect(row_matches(row, "40")).toBe(false);
|
|
@@ -71,19 +71,19 @@ describe("row_matches, on a table loaded with hook_size", () => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it("still matches the rest of the row", () => {
|
|
74
|
-
expect(row_matches(row, "
|
|
74
|
+
expect(row_matches(row, "north")).toBe(true);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it("still walks a hook that DID come with its children", () => {
|
|
78
78
|
/* A node event carries whole hooks whatever the table asked
|
|
79
79
|
* for, so both shapes reach this row. */
|
|
80
80
|
const loaded = {
|
|
81
|
-
id: "
|
|
81
|
+
id: "sites-north",
|
|
82
82
|
devices: [
|
|
83
|
-
{id: "
|
|
83
|
+
{id: "D00000042", topic_name: "devices", hook_name: "sites"}
|
|
84
84
|
]
|
|
85
85
|
};
|
|
86
|
-
expect(row_matches(loaded, "
|
|
86
|
+
expect(row_matches(loaded, "d00000042")).toBe(true);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -70,8 +70,8 @@ describe("yui_shell_last_route_under", () => {
|
|
|
70
70
|
|
|
71
71
|
describe("yui_shell_previous_route", () => {
|
|
72
72
|
it("answers the route before the current one, as browser Back does", () => {
|
|
73
|
-
const s = shell(["/topics", "/topics/
|
|
74
|
-
expect(yui_shell_previous_route(s)).toBe("/topics/
|
|
73
|
+
const s = shell(["/topics", "/topics/models", "/topics/devices"]);
|
|
74
|
+
expect(yui_shell_previous_route(s)).toBe("/topics/models");
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it("goes back to the previous record, not past it", () => {
|