Commit 342713f
committed
Addresses the unresolved threads on PR #104 raised across the recent
review passes. Each change is one-to-one with a finding:
- metrics.templ: in-templ fullscreen Esc handler now preventDefaults
so it doesn't fall through to the global Esc → history.back().
- metrics-layout.js patchLayout(): check `res.ok` and console.warn on
non-2xx so 401/403/413/500 saves no longer fail silently.
- metrics-layout.js applyCapabilityHiding(): switch the capability
marker from `.hidden` to a dedicated `data-cap-hidden` attribute so
fullscreen-driven `.hidden`s on neighbouring cards can't get
mis-interpreted as capability hides. applyCapabilities() in the
templ sets the new attribute; per-source templ cards carry the
initial `data-cap-hidden="true"` so the marker is correct before
the first applyCapabilities() pass runs.
- metrics-layout.js: snapshot the (x,y,w,h) of each tile we remove
from the engine into `capHiddenSnapshots` and merge those entries
into `captureLayout()`, so a tile's last-known position survives
a capability flip → re-flip cycle.
- metrics-layout.js loadSavedLayout(): pass `addRemove:false` to
`gs.load()` — without it GridStack yanks any DOM tile whose gs-id
isn't in the loaded blob, which would permanently strip the
capability-hidden DOM nodes we still need to re-attach later.
- metrics-layout.js: fix updateContainerHeight() comment to describe
what the code actually does (no margin term).
- metrics.templ: rewrite the "waits on DOMContentLoaded" script-tag
comment to match the actual `defer` execution semantics.
- api_metrics_layout.go: normalise omitted `w`/`h` (GridStack drops
them when they equal the default of 1) before the positive check,
so resizing a tile to 1×N or N×1 no longer fails validation. Plus
add column-count validation (x < 12, x+w ≤ 12) so a misbehaving
client can't persist tiles that will silently clamp on next
render. Tests cover both new behaviours plus a regression for the
omitted-w/h case.
1 parent ca4a5bd commit 342713f
4 files changed
Lines changed: 144 additions & 25 deletions
File tree
- gearbox
- internal/framework
- handler
- templates/pages
- static/js
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| |||
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
93 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
94 | 113 | | |
95 | 114 | | |
96 | 115 | | |
| |||
110 | 129 | | |
111 | 130 | | |
112 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
113 | 143 | | |
114 | 144 | | |
115 | 145 | | |
| |||
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
24 | 46 | | |
25 | 47 | | |
26 | 48 | | |
| |||
59 | 81 | | |
60 | 82 | | |
61 | 83 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 84 | | |
68 | 85 | | |
69 | 86 | | |
| |||
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
77 | 104 | | |
78 | 105 | | |
79 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| |||
1086 | 1086 | | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | | - | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1090 | 1093 | | |
1091 | 1094 | | |
| 1095 | + | |
1092 | 1096 | | |
1093 | 1097 | | |
1094 | 1098 | | |
| |||
1498 | 1502 | | |
1499 | 1503 | | |
1500 | 1504 | | |
1501 | | - | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1502 | 1510 | | |
1503 | 1511 | | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1504 | 1515 | | |
1505 | 1516 | | |
1506 | 1517 | | |
| |||
1516 | 1527 | | |
1517 | 1528 | | |
1518 | 1529 | | |
| 1530 | + | |
1519 | 1531 | | |
1520 | 1532 | | |
1521 | 1533 | | |
| |||
2833 | 2845 | | |
2834 | 2846 | | |
2835 | 2847 | | |
2836 | | - | |
2837 | | - | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
2838 | 2853 | | |
2839 | 2854 | | |
2840 | 2855 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
110 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
111 | 123 | | |
112 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
113 | 133 | | |
114 | 134 | | |
115 | 135 | | |
| |||
123 | 143 | | |
124 | 144 | | |
125 | 145 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
129 | 150 | | |
130 | 151 | | |
131 | 152 | | |
| |||
166 | 187 | | |
167 | 188 | | |
168 | 189 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
173 | 197 | | |
174 | 198 | | |
175 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
176 | 205 | | |
177 | 206 | | |
178 | 207 | | |
| 208 | + | |
179 | 209 | | |
180 | 210 | | |
181 | 211 | | |
| |||
197 | 227 | | |
198 | 228 | | |
199 | 229 | | |
200 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
201 | 237 | | |
202 | 238 | | |
203 | 239 | | |
| |||
221 | 257 | | |
222 | 258 | | |
223 | 259 | | |
224 | | - | |
| 260 | + | |
225 | 261 | | |
226 | 262 | | |
227 | 263 | | |
228 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
229 | 276 | | |
230 | 277 | | |
231 | 278 | | |
| |||
0 commit comments