@yuneta/gobj-ui 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gobj-ui.cjs.js +96 -155
- package/dist/gobj-ui.es.js +97 -156
- package/package.json +2 -2
- package/src/c_yui_map.js +13 -2
- package/src/yui_dev.js +88 -168
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -49,7 +49,7 @@ let _antv_g6 = require("@antv/g6");
|
|
|
49
49
|
*
|
|
50
50
|
* Development Tools
|
|
51
51
|
*
|
|
52
|
-
* Copyright (c) 2024, ArtGins.
|
|
52
|
+
* Copyright (c) 2024-2026, ArtGins.
|
|
53
53
|
* All Rights Reserved.
|
|
54
54
|
***********************************************************************/
|
|
55
55
|
/************************************************************
|
|
@@ -139,79 +139,107 @@ function info_traffic(title, msg, direction, size) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
/************************************************************
|
|
142
|
-
*
|
|
142
|
+
* A button turns trace bits of the runtime on or off through the
|
|
143
|
+
* yuno's trace commands (the C kernel's, same names), and the yuno
|
|
144
|
+
* persists them (`trace_levels`). What is on is READ from the runtime.
|
|
143
145
|
************************************************************/
|
|
144
|
-
function
|
|
145
|
-
let
|
|
146
|
-
|
|
147
|
-
if (v) {
|
|
148
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_inter_event", false);
|
|
149
|
-
v = 0;
|
|
150
|
-
} else {
|
|
151
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_inter_event", true);
|
|
152
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_ievent_callback", info_traffic);
|
|
153
|
-
v = 1;
|
|
154
|
-
}
|
|
155
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("trace_traffic", v);
|
|
146
|
+
function yuno_trace_command(command, kw) {
|
|
147
|
+
let r = (0, _yuneta_gobj_js.gobj_command)((0, _yuneta_gobj_js.gobj_yuno)(), command, kw, (0, _yuneta_gobj_js.gobj_yuno)());
|
|
148
|
+
if (!r || r.result < 0) (0, _yuneta_gobj_js.log_error)(`yui_dev: ${command} ${JSON.stringify(kw)}: ${r ? r.comment : "no answer"}`);
|
|
156
149
|
info_user();
|
|
157
150
|
}
|
|
151
|
+
function global_bit(bit) {
|
|
152
|
+
return (0, _yuneta_gobj_js.gobj_global_trace_level)() & bit ? 1 : 0;
|
|
153
|
+
}
|
|
154
|
+
function trace_states() {
|
|
155
|
+
let automata = 0;
|
|
156
|
+
if (global_bit(_yuneta_gobj_js.trace_level_t.TRACE_MACHINE)) automata = global_bit(_yuneta_gobj_js.trace_level_t.TRACE_EV_KW) ? 2 : 1;
|
|
157
|
+
return {
|
|
158
|
+
automata,
|
|
159
|
+
creation: global_bit(_yuneta_gobj_js.trace_level_t.TRACE_CREATE_DELETE),
|
|
160
|
+
start_stop: global_bit(_yuneta_gobj_js.trace_level_t.TRACE_START_STOP),
|
|
161
|
+
subscriptions: global_bit(_yuneta_gobj_js.trace_level_t.TRACE_SUBSCRIPTIONS),
|
|
162
|
+
i18n: Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_i18n", 0, false)) ? 1 : 0,
|
|
163
|
+
traffic: (0, _yuneta_gobj_js.gobj_get_gclass_trace_level2)("C_IEVENT_CLI").includes("ievents") ? 1 : 0
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function trace_counters() {
|
|
167
|
+
let st = trace_states();
|
|
168
|
+
return [
|
|
169
|
+
`Automata: ${st.automata}`,
|
|
170
|
+
`Creation: ${st.creation}`,
|
|
171
|
+
`Start/Stop: ${st.start_stop}`,
|
|
172
|
+
`Subscriptions: ${st.subscriptions}`,
|
|
173
|
+
`I18n: ${st.i18n}`,
|
|
174
|
+
`Traffic: ${st.traffic}`
|
|
175
|
+
];
|
|
176
|
+
}
|
|
158
177
|
/************************************************************
|
|
159
|
-
*
|
|
178
|
+
* Traffic is C_IEVENT_CLI's own level `ievents`.
|
|
179
|
+
************************************************************/
|
|
180
|
+
function trace_traffic() {
|
|
181
|
+
yuno_trace_command("set-gclass-trace", {
|
|
182
|
+
gclass_name: "C_IEVENT_CLI",
|
|
183
|
+
level: "ievents",
|
|
184
|
+
set: trace_states().traffic ? 0 : 1
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/************************************************************
|
|
188
|
+
* 0 → 1 (machine) → 2 (machine + kw of each event) → 0
|
|
160
189
|
************************************************************/
|
|
161
190
|
function trace_automata() {
|
|
162
|
-
let v = (
|
|
163
|
-
v
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
(
|
|
168
|
-
|
|
169
|
-
|
|
191
|
+
let v = trace_states().automata;
|
|
192
|
+
if (v === 0) yuno_trace_command("set-global-trace", {
|
|
193
|
+
level: "machine",
|
|
194
|
+
set: 1
|
|
195
|
+
});
|
|
196
|
+
else if (v === 1) yuno_trace_command("set-global-trace", {
|
|
197
|
+
level: "ev_kw",
|
|
198
|
+
set: 1
|
|
199
|
+
});
|
|
200
|
+
else {
|
|
201
|
+
yuno_trace_command("set-global-trace", {
|
|
202
|
+
level: "ev_kw",
|
|
203
|
+
set: 0
|
|
204
|
+
});
|
|
205
|
+
yuno_trace_command("set-global-trace", {
|
|
206
|
+
level: "machine",
|
|
207
|
+
set: 0
|
|
208
|
+
});
|
|
209
|
+
}
|
|
170
210
|
}
|
|
171
211
|
/************************************************************
|
|
172
212
|
*
|
|
173
213
|
************************************************************/
|
|
174
214
|
function trace_creation() {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_creation", v);
|
|
180
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("trace_creation", v);
|
|
181
|
-
info_user();
|
|
215
|
+
yuno_trace_command("set-global-trace", {
|
|
216
|
+
level: "create_delete",
|
|
217
|
+
set: trace_states().creation ? 0 : 1
|
|
218
|
+
});
|
|
182
219
|
}
|
|
183
220
|
/************************************************************
|
|
184
221
|
*
|
|
185
222
|
************************************************************/
|
|
186
223
|
function trace_start_stop() {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_start_stop", v);
|
|
192
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("trace_start_stop", v);
|
|
193
|
-
info_user();
|
|
224
|
+
yuno_trace_command("set-global-trace", {
|
|
225
|
+
level: "start_stop",
|
|
226
|
+
set: trace_states().start_stop ? 0 : 1
|
|
227
|
+
});
|
|
194
228
|
}
|
|
195
229
|
/************************************************************
|
|
196
230
|
*
|
|
197
231
|
************************************************************/
|
|
198
232
|
function trace_subscriptions() {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_subscriptions", v);
|
|
204
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("trace_subscriptions", v);
|
|
205
|
-
info_user();
|
|
233
|
+
yuno_trace_command("set-global-trace", {
|
|
234
|
+
level: "subscriptions",
|
|
235
|
+
set: trace_states().subscriptions ? 0 : 1
|
|
236
|
+
});
|
|
206
237
|
}
|
|
207
238
|
/************************************************************
|
|
208
|
-
*
|
|
239
|
+
* No trace of the runtime: i18next's own debug switch.
|
|
209
240
|
************************************************************/
|
|
210
241
|
function trace_i18n() {
|
|
211
|
-
let v = (0
|
|
212
|
-
v = Number(v);
|
|
213
|
-
if (v === 0) v = 1;
|
|
214
|
-
else v = 0;
|
|
242
|
+
let v = trace_states().i18n ? 0 : 1;
|
|
215
243
|
i18next.default.options.debug = v ? true : false;
|
|
216
244
|
(0, _yuneta_gobj_js.kw_set_local_storage_value)("trace_i18n", v);
|
|
217
245
|
info_user();
|
|
@@ -219,37 +247,11 @@ function trace_i18n() {
|
|
|
219
247
|
/************************************************************
|
|
220
248
|
*
|
|
221
249
|
************************************************************/
|
|
222
|
-
function set_no_poll() {
|
|
223
|
-
let v = (0, _yuneta_gobj_js.kw_get_local_storage_value)("no_poll");
|
|
224
|
-
v = Number(v);
|
|
225
|
-
if (v) v = 0;
|
|
226
|
-
else v = 1;
|
|
227
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "no_poll", v);
|
|
228
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("no_poll", v);
|
|
229
|
-
info_user();
|
|
230
|
-
}
|
|
231
|
-
/************************************************************
|
|
232
|
-
*
|
|
233
|
-
************************************************************/
|
|
234
250
|
function info_user() {
|
|
235
251
|
let $info = document.getElementById("developer-window-info");
|
|
236
|
-
|
|
237
|
-
let trace = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_automata", 0, false));
|
|
238
|
-
let creation = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_creation", 0, false));
|
|
239
|
-
let start_stop = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_start_stop", 0, false));
|
|
240
|
-
let subscriptions = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_subscriptions", 0, false));
|
|
241
|
-
let i18n = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_i18n", 0, false));
|
|
242
|
-
let no_poll = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("no_poll", 0, false));
|
|
252
|
+
if (!$info) return;
|
|
243
253
|
$info.replaceChildren();
|
|
244
|
-
|
|
245
|
-
`Automata: ${trace}`,
|
|
246
|
-
`Creation: ${creation}`,
|
|
247
|
-
`Start/Stop: ${start_stop}`,
|
|
248
|
-
`Subscriptions: ${subscriptions}`,
|
|
249
|
-
`I18n: ${i18n}`,
|
|
250
|
-
`Traffic: ${traffic}`,
|
|
251
|
-
`No poll: ${no_poll}`
|
|
252
|
-
].forEach((text) => {
|
|
254
|
+
trace_counters().forEach((text) => {
|
|
253
255
|
const div = document.createElement("div");
|
|
254
256
|
div.textContent = text;
|
|
255
257
|
$info.appendChild(div);
|
|
@@ -265,31 +267,13 @@ function dev_window_was_open() {
|
|
|
265
267
|
return Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("open_developer_window", 0, false)) ? true : false;
|
|
266
268
|
}
|
|
267
269
|
/************************************************************
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* Single source of truth for "localStorage flag → effect";
|
|
272
|
-
* setup_dev() and build_dev_panel() reuse it instead of each
|
|
273
|
-
* re-applying a partial subset.
|
|
270
|
+
* Wire the traffic sink and i18n debug. Call it once at app
|
|
271
|
+
* startup. The trace levels themselves are persisted and
|
|
272
|
+
* restored by the yuno (see gobj-js C_YUNO).
|
|
274
273
|
************************************************************/
|
|
275
274
|
function apply_dev_traces() {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
let creation = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_creation", 0, false));
|
|
279
|
-
let start_stop = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_start_stop", 0, false));
|
|
280
|
-
let subscriptions = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_subscriptions", 0, false));
|
|
281
|
-
let i18n = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_i18n", 0, false));
|
|
282
|
-
let no_poll = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("no_poll", 0, false));
|
|
283
|
-
if (traffic) {
|
|
284
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_inter_event", true);
|
|
285
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_ievent_callback", info_traffic);
|
|
286
|
-
} else (0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_inter_event", false);
|
|
287
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "tracing", trace);
|
|
288
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_creation", creation);
|
|
289
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_start_stop", start_stop);
|
|
290
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_subscriptions", subscriptions);
|
|
291
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "no_poll", no_poll);
|
|
292
|
-
i18next.default.options.debug = i18n ? true : false;
|
|
275
|
+
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_ievent_callback", info_traffic);
|
|
276
|
+
i18next.default.options.debug = trace_states().i18n ? true : false;
|
|
293
277
|
}
|
|
294
278
|
/************************************************************
|
|
295
279
|
* Open the developer panel inside a non-modal C_YUI_WINDOW
|
|
@@ -304,13 +288,6 @@ function apply_dev_traces() {
|
|
|
304
288
|
* unchanged (when '#top-layer' exists it is still used).
|
|
305
289
|
************************************************************/
|
|
306
290
|
function setup_dev(self, show) {
|
|
307
|
-
let traffic = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_traffic", 0, false));
|
|
308
|
-
let trace = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_automata", 0, false));
|
|
309
|
-
let creation = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_creation", 0, false));
|
|
310
|
-
let start_stop = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_start_stop", 0, false));
|
|
311
|
-
let subscriptions = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_subscriptions", 0, false));
|
|
312
|
-
let i18n = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_i18n", 0, false));
|
|
313
|
-
let no_poll = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("no_poll", 0, false));
|
|
314
291
|
if (show) {
|
|
315
292
|
const $dev_toolbar = (0, _yuneta_gobj_js.createElement2)([
|
|
316
293
|
"div",
|
|
@@ -370,15 +347,6 @@ function setup_dev(self, show) {
|
|
|
370
347
|
trace_traffic();
|
|
371
348
|
} }
|
|
372
349
|
],
|
|
373
|
-
[
|
|
374
|
-
"button",
|
|
375
|
-
{ class: "button" },
|
|
376
|
-
"No Poll",
|
|
377
|
-
{ click: (evt) => {
|
|
378
|
-
evt.stopPropagation();
|
|
379
|
-
set_no_poll();
|
|
380
|
-
} }
|
|
381
|
-
],
|
|
382
350
|
[
|
|
383
351
|
"button",
|
|
384
352
|
{ class: "button" },
|
|
@@ -390,14 +358,7 @@ function setup_dev(self, show) {
|
|
|
390
358
|
]
|
|
391
359
|
]
|
|
392
360
|
]);
|
|
393
|
-
let estados =
|
|
394
|
-
<div>Automata: ${trace}</div>
|
|
395
|
-
<div>Creation: ${creation}</div>
|
|
396
|
-
<div>Start/Stop: ${start_stop}</div>
|
|
397
|
-
<div>Subscriptions: ${subscriptions}</div>
|
|
398
|
-
<div>I18n: ${i18n}</div>
|
|
399
|
-
<div>Traffic: ${traffic}</div>
|
|
400
|
-
<div>No poll: ${no_poll}</div>`;
|
|
361
|
+
let estados = trace_counters().map((txt) => `<div>${txt}</div>`).join("");
|
|
401
362
|
(0, _yuneta_gobj_js.gobj_create_service)("Developer-Window", "C_YUI_WINDOW", {
|
|
402
363
|
$parent: document.getElementById("top-layer") || null,
|
|
403
364
|
subscriber: null,
|
|
@@ -424,20 +385,13 @@ function setup_dev(self, show) {
|
|
|
424
385
|
* Returns { $el, dispose }:
|
|
425
386
|
* - $el: the panel element (header tabs + traffic logger
|
|
426
387
|
* body + footer counters).
|
|
427
|
-
* - dispose:
|
|
428
|
-
* the
|
|
388
|
+
* - dispose: call it from the modal's on_close (kept for the
|
|
389
|
+
* contract; the traces outlive the panel).
|
|
429
390
|
*
|
|
430
391
|
* Backwards compatible: setup_dev() (old shell, C_YUI_WINDOW) is
|
|
431
392
|
* untouched; the trace_* helpers and info_traffic are shared.
|
|
432
393
|
************************************************************/
|
|
433
394
|
function build_dev_panel() {
|
|
434
|
-
let traffic = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_traffic", 0, false));
|
|
435
|
-
let trace = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_automata", 0, false));
|
|
436
|
-
let creation = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_creation", 0, false));
|
|
437
|
-
let start_stop = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_start_stop", 0, false));
|
|
438
|
-
let subscriptions = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_subscriptions", 0, false));
|
|
439
|
-
let i18n = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("trace_i18n", 0, false));
|
|
440
|
-
let no_poll = Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("no_poll", 0, false));
|
|
441
395
|
let mk_btn = (label, fn) => [
|
|
442
396
|
"button",
|
|
443
397
|
{ class: "button is-small" },
|
|
@@ -447,15 +401,7 @@ function build_dev_panel() {
|
|
|
447
401
|
fn();
|
|
448
402
|
} }
|
|
449
403
|
];
|
|
450
|
-
let counters = [
|
|
451
|
-
`Automata: ${trace}`,
|
|
452
|
-
`Creation: ${creation}`,
|
|
453
|
-
`Start/Stop: ${start_stop}`,
|
|
454
|
-
`Subscriptions: ${subscriptions}`,
|
|
455
|
-
`I18n: ${i18n}`,
|
|
456
|
-
`Traffic: ${traffic}`,
|
|
457
|
-
`No poll: ${no_poll}`
|
|
458
|
-
].map((txt) => [
|
|
404
|
+
let counters = trace_counters().map((txt) => [
|
|
459
405
|
"div",
|
|
460
406
|
{ style: "padding:0 8px;" },
|
|
461
407
|
txt
|
|
@@ -484,7 +430,6 @@ function build_dev_panel() {
|
|
|
484
430
|
mk_btn("Subscriptions", trace_subscriptions),
|
|
485
431
|
mk_btn("I18n", trace_i18n),
|
|
486
432
|
mk_btn("Traffic", trace_traffic),
|
|
487
|
-
mk_btn("No Poll", set_no_poll),
|
|
488
433
|
mk_btn("Clear Traffic", () => {
|
|
489
434
|
let l = document.getElementById("developer-traffic-logger");
|
|
490
435
|
if (l) l.innerHTML = "";
|
|
@@ -515,9 +460,7 @@ function build_dev_panel() {
|
|
|
515
460
|
]
|
|
516
461
|
]);
|
|
517
462
|
apply_dev_traces();
|
|
518
|
-
let dispose = function() {
|
|
519
|
-
(0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_inter_event", false);
|
|
520
|
-
};
|
|
463
|
+
let dispose = function() {};
|
|
521
464
|
return {
|
|
522
465
|
$el,
|
|
523
466
|
dispose
|
|
@@ -5560,7 +5503,7 @@ function decod_coordinates(gobj, coordinates) {
|
|
|
5560
5503
|
*
|
|
5561
5504
|
************************************************************/
|
|
5562
5505
|
function get_coordinates(gobj, device) {
|
|
5563
|
-
let coordinates = decod_coordinates(gobj, device.settings
|
|
5506
|
+
let coordinates = decod_coordinates(gobj, device.settings?.coordinates);
|
|
5564
5507
|
if (coordinates.lng === 0 && coordinates.lat === 0) coordinates = decod_coordinates(gobj, device.coordinates);
|
|
5565
5508
|
if (coordinates.lng === 0 && coordinates.lat === 0) {
|
|
5566
5509
|
coordinates.lng = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "default_longitude");
|
|
@@ -5609,7 +5552,7 @@ function devices2geojson(gobj, devices) {
|
|
|
5609
5552
|
id: device.id,
|
|
5610
5553
|
name: device.name,
|
|
5611
5554
|
image: device.image,
|
|
5612
|
-
connected: device.connected,
|
|
5555
|
+
connected: !!device.connected,
|
|
5613
5556
|
gobj_service_name: device.gobj_service_name
|
|
5614
5557
|
}
|
|
5615
5558
|
};
|
|
@@ -6199,8 +6142,8 @@ function ac_load_data$2(gobj, event, kw, src) {
|
|
|
6199
6142
|
******************************************************/
|
|
6200
6143
|
function ac_add_serie(gobj, event, kw, src) {
|
|
6201
6144
|
let uplot$4 = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
|
|
6202
|
-
let idx;
|
|
6203
|
-
for (
|
|
6145
|
+
let idx = 0;
|
|
6146
|
+
for (; idx < uplot$4.series.length; idx++) {
|
|
6204
6147
|
let serie = uplot$4.series[idx];
|
|
6205
6148
|
if (serie.id && serie.id === kw.id) {
|
|
6206
6149
|
(0, _yuneta_gobj_js.log_error)("Serie '" + kw.id + "' already exists");
|
|
@@ -13265,8 +13208,6 @@ var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS
|
|
|
13265
13208
|
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
13266
13209
|
})))(), 1)).default;
|
|
13267
13210
|
var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
|
|
13268
|
-
Math.PI / 180;
|
|
13269
|
-
180 / Math.PI;
|
|
13270
13211
|
//#endregion
|
|
13271
13212
|
//#region node_modules/gl-matrix/esm/mat3.js
|
|
13272
13213
|
/**
|
|
@@ -30541,12 +30482,12 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
30541
30482
|
},
|
|
30542
30483
|
trys: [],
|
|
30543
30484
|
ops: []
|
|
30544
|
-
}, f, y, t, g
|
|
30545
|
-
return g = {
|
|
30485
|
+
}, f, y, t, g = {
|
|
30546
30486
|
next: verb(0),
|
|
30547
30487
|
"throw": verb(1),
|
|
30548
30488
|
"return": verb(2)
|
|
30549
|
-
}
|
|
30489
|
+
};
|
|
30490
|
+
return typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
30550
30491
|
return this;
|
|
30551
30492
|
}), g;
|
|
30552
30493
|
function verb(n) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, duplicate_objects, empty_string, escapeHtml, event_flag_t, gclass_create, gclass_flag_t, getPositionRelativeToBody, gobj_command, gobj_create_service, gobj_current_state, gobj_default_service, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_has_attr, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_short_name, gobj_start, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_pure_number, is_string, json_deep_copy, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_get_ids, kwid_new_dict, list2options, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, sprintf, str_in_list, template_get_field_desc, trace_json, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
|
|
1
|
+
import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, duplicate_objects, empty_string, escapeHtml, event_flag_t, gclass_create, gclass_flag_t, getPositionRelativeToBody, gobj_command, gobj_create_service, gobj_current_state, gobj_default_service, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_has_attr, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_short_name, gobj_start, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_pure_number, is_string, json_deep_copy, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_get_ids, kwid_new_dict, list2options, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, sprintf, str_in_list, template_get_field_desc, trace_json, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
|
|
2
2
|
import i18next, { t } from "i18next";
|
|
3
3
|
import { JSONEditor } from "vanilla-jsoneditor";
|
|
4
4
|
import TomSelect from "tom-select";
|
|
@@ -44,7 +44,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
44
44
|
*
|
|
45
45
|
* Development Tools
|
|
46
46
|
*
|
|
47
|
-
* Copyright (c) 2024, ArtGins.
|
|
47
|
+
* Copyright (c) 2024-2026, ArtGins.
|
|
48
48
|
* All Rights Reserved.
|
|
49
49
|
***********************************************************************/
|
|
50
50
|
/************************************************************
|
|
@@ -134,79 +134,107 @@ function info_traffic(title, msg, direction, size) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
/************************************************************
|
|
137
|
-
*
|
|
137
|
+
* A button turns trace bits of the runtime on or off through the
|
|
138
|
+
* yuno's trace commands (the C kernel's, same names), and the yuno
|
|
139
|
+
* persists them (`trace_levels`). What is on is READ from the runtime.
|
|
138
140
|
************************************************************/
|
|
139
|
-
function
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
if (v) {
|
|
143
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
144
|
-
v = 0;
|
|
145
|
-
} else {
|
|
146
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
147
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
148
|
-
v = 1;
|
|
149
|
-
}
|
|
150
|
-
kw_set_local_storage_value("trace_traffic", v);
|
|
141
|
+
function yuno_trace_command(command, kw) {
|
|
142
|
+
let r = gobj_command(gobj_yuno(), command, kw, gobj_yuno());
|
|
143
|
+
if (!r || r.result < 0) log_error(`yui_dev: ${command} ${JSON.stringify(kw)}: ${r ? r.comment : "no answer"}`);
|
|
151
144
|
info_user();
|
|
152
145
|
}
|
|
146
|
+
function global_bit(bit) {
|
|
147
|
+
return gobj_global_trace_level() & bit ? 1 : 0;
|
|
148
|
+
}
|
|
149
|
+
function trace_states() {
|
|
150
|
+
let automata = 0;
|
|
151
|
+
if (global_bit(trace_level_t.TRACE_MACHINE)) automata = global_bit(trace_level_t.TRACE_EV_KW) ? 2 : 1;
|
|
152
|
+
return {
|
|
153
|
+
automata,
|
|
154
|
+
creation: global_bit(trace_level_t.TRACE_CREATE_DELETE),
|
|
155
|
+
start_stop: global_bit(trace_level_t.TRACE_START_STOP),
|
|
156
|
+
subscriptions: global_bit(trace_level_t.TRACE_SUBSCRIPTIONS),
|
|
157
|
+
i18n: Number(kw_get_local_storage_value("trace_i18n", 0, false)) ? 1 : 0,
|
|
158
|
+
traffic: gobj_get_gclass_trace_level2("C_IEVENT_CLI").includes("ievents") ? 1 : 0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function trace_counters() {
|
|
162
|
+
let st = trace_states();
|
|
163
|
+
return [
|
|
164
|
+
`Automata: ${st.automata}`,
|
|
165
|
+
`Creation: ${st.creation}`,
|
|
166
|
+
`Start/Stop: ${st.start_stop}`,
|
|
167
|
+
`Subscriptions: ${st.subscriptions}`,
|
|
168
|
+
`I18n: ${st.i18n}`,
|
|
169
|
+
`Traffic: ${st.traffic}`
|
|
170
|
+
];
|
|
171
|
+
}
|
|
153
172
|
/************************************************************
|
|
154
|
-
*
|
|
173
|
+
* Traffic is C_IEVENT_CLI's own level `ievents`.
|
|
174
|
+
************************************************************/
|
|
175
|
+
function trace_traffic() {
|
|
176
|
+
yuno_trace_command("set-gclass-trace", {
|
|
177
|
+
gclass_name: "C_IEVENT_CLI",
|
|
178
|
+
level: "ievents",
|
|
179
|
+
set: trace_states().traffic ? 0 : 1
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/************************************************************
|
|
183
|
+
* 0 → 1 (machine) → 2 (machine + kw of each event) → 0
|
|
155
184
|
************************************************************/
|
|
156
185
|
function trace_automata() {
|
|
157
|
-
let v =
|
|
158
|
-
v
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
186
|
+
let v = trace_states().automata;
|
|
187
|
+
if (v === 0) yuno_trace_command("set-global-trace", {
|
|
188
|
+
level: "machine",
|
|
189
|
+
set: 1
|
|
190
|
+
});
|
|
191
|
+
else if (v === 1) yuno_trace_command("set-global-trace", {
|
|
192
|
+
level: "ev_kw",
|
|
193
|
+
set: 1
|
|
194
|
+
});
|
|
195
|
+
else {
|
|
196
|
+
yuno_trace_command("set-global-trace", {
|
|
197
|
+
level: "ev_kw",
|
|
198
|
+
set: 0
|
|
199
|
+
});
|
|
200
|
+
yuno_trace_command("set-global-trace", {
|
|
201
|
+
level: "machine",
|
|
202
|
+
set: 0
|
|
203
|
+
});
|
|
204
|
+
}
|
|
165
205
|
}
|
|
166
206
|
/************************************************************
|
|
167
207
|
*
|
|
168
208
|
************************************************************/
|
|
169
209
|
function trace_creation() {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", v);
|
|
175
|
-
kw_set_local_storage_value("trace_creation", v);
|
|
176
|
-
info_user();
|
|
210
|
+
yuno_trace_command("set-global-trace", {
|
|
211
|
+
level: "create_delete",
|
|
212
|
+
set: trace_states().creation ? 0 : 1
|
|
213
|
+
});
|
|
177
214
|
}
|
|
178
215
|
/************************************************************
|
|
179
216
|
*
|
|
180
217
|
************************************************************/
|
|
181
218
|
function trace_start_stop() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", v);
|
|
187
|
-
kw_set_local_storage_value("trace_start_stop", v);
|
|
188
|
-
info_user();
|
|
219
|
+
yuno_trace_command("set-global-trace", {
|
|
220
|
+
level: "start_stop",
|
|
221
|
+
set: trace_states().start_stop ? 0 : 1
|
|
222
|
+
});
|
|
189
223
|
}
|
|
190
224
|
/************************************************************
|
|
191
225
|
*
|
|
192
226
|
************************************************************/
|
|
193
227
|
function trace_subscriptions() {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", v);
|
|
199
|
-
kw_set_local_storage_value("trace_subscriptions", v);
|
|
200
|
-
info_user();
|
|
228
|
+
yuno_trace_command("set-global-trace", {
|
|
229
|
+
level: "subscriptions",
|
|
230
|
+
set: trace_states().subscriptions ? 0 : 1
|
|
231
|
+
});
|
|
201
232
|
}
|
|
202
233
|
/************************************************************
|
|
203
|
-
*
|
|
234
|
+
* No trace of the runtime: i18next's own debug switch.
|
|
204
235
|
************************************************************/
|
|
205
236
|
function trace_i18n() {
|
|
206
|
-
let v =
|
|
207
|
-
v = Number(v);
|
|
208
|
-
if (v === 0) v = 1;
|
|
209
|
-
else v = 0;
|
|
237
|
+
let v = trace_states().i18n ? 0 : 1;
|
|
210
238
|
i18next.options.debug = v ? true : false;
|
|
211
239
|
kw_set_local_storage_value("trace_i18n", v);
|
|
212
240
|
info_user();
|
|
@@ -214,37 +242,11 @@ function trace_i18n() {
|
|
|
214
242
|
/************************************************************
|
|
215
243
|
*
|
|
216
244
|
************************************************************/
|
|
217
|
-
function set_no_poll() {
|
|
218
|
-
let v = kw_get_local_storage_value("no_poll");
|
|
219
|
-
v = Number(v);
|
|
220
|
-
if (v) v = 0;
|
|
221
|
-
else v = 1;
|
|
222
|
-
gobj_write_attr(gobj_yuno(), "no_poll", v);
|
|
223
|
-
kw_set_local_storage_value("no_poll", v);
|
|
224
|
-
info_user();
|
|
225
|
-
}
|
|
226
|
-
/************************************************************
|
|
227
|
-
*
|
|
228
|
-
************************************************************/
|
|
229
245
|
function info_user() {
|
|
230
246
|
let $info = document.getElementById("developer-window-info");
|
|
231
|
-
|
|
232
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
233
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
234
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
235
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
236
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
237
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
247
|
+
if (!$info) return;
|
|
238
248
|
$info.replaceChildren();
|
|
239
|
-
|
|
240
|
-
`Automata: ${trace}`,
|
|
241
|
-
`Creation: ${creation}`,
|
|
242
|
-
`Start/Stop: ${start_stop}`,
|
|
243
|
-
`Subscriptions: ${subscriptions}`,
|
|
244
|
-
`I18n: ${i18n}`,
|
|
245
|
-
`Traffic: ${traffic}`,
|
|
246
|
-
`No poll: ${no_poll}`
|
|
247
|
-
].forEach((text) => {
|
|
249
|
+
trace_counters().forEach((text) => {
|
|
248
250
|
const div = document.createElement("div");
|
|
249
251
|
div.textContent = text;
|
|
250
252
|
$info.appendChild(div);
|
|
@@ -260,31 +262,13 @@ function dev_window_was_open() {
|
|
|
260
262
|
return Number(kw_get_local_storage_value("open_developer_window", 0, false)) ? true : false;
|
|
261
263
|
}
|
|
262
264
|
/************************************************************
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* Single source of truth for "localStorage flag → effect";
|
|
267
|
-
* setup_dev() and build_dev_panel() reuse it instead of each
|
|
268
|
-
* re-applying a partial subset.
|
|
265
|
+
* Wire the traffic sink and i18n debug. Call it once at app
|
|
266
|
+
* startup. The trace levels themselves are persisted and
|
|
267
|
+
* restored by the yuno (see gobj-js C_YUNO).
|
|
269
268
|
************************************************************/
|
|
270
269
|
function apply_dev_traces() {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
274
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
275
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
276
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
277
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
278
|
-
if (traffic) {
|
|
279
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
280
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
281
|
-
} else gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
282
|
-
gobj_write_attr(gobj_yuno(), "tracing", trace);
|
|
283
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", creation);
|
|
284
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", start_stop);
|
|
285
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", subscriptions);
|
|
286
|
-
gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
|
|
287
|
-
i18next.options.debug = i18n ? true : false;
|
|
270
|
+
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
271
|
+
i18next.options.debug = trace_states().i18n ? true : false;
|
|
288
272
|
}
|
|
289
273
|
/************************************************************
|
|
290
274
|
* Open the developer panel inside a non-modal C_YUI_WINDOW
|
|
@@ -299,13 +283,6 @@ function apply_dev_traces() {
|
|
|
299
283
|
* unchanged (when '#top-layer' exists it is still used).
|
|
300
284
|
************************************************************/
|
|
301
285
|
function setup_dev(self, show) {
|
|
302
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
303
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
304
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
305
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
306
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
307
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
308
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
309
286
|
if (show) {
|
|
310
287
|
const $dev_toolbar = createElement2([
|
|
311
288
|
"div",
|
|
@@ -365,15 +342,6 @@ function setup_dev(self, show) {
|
|
|
365
342
|
trace_traffic();
|
|
366
343
|
} }
|
|
367
344
|
],
|
|
368
|
-
[
|
|
369
|
-
"button",
|
|
370
|
-
{ class: "button" },
|
|
371
|
-
"No Poll",
|
|
372
|
-
{ click: (evt) => {
|
|
373
|
-
evt.stopPropagation();
|
|
374
|
-
set_no_poll();
|
|
375
|
-
} }
|
|
376
|
-
],
|
|
377
345
|
[
|
|
378
346
|
"button",
|
|
379
347
|
{ class: "button" },
|
|
@@ -385,14 +353,7 @@ function setup_dev(self, show) {
|
|
|
385
353
|
]
|
|
386
354
|
]
|
|
387
355
|
]);
|
|
388
|
-
let estados =
|
|
389
|
-
<div>Automata: ${trace}</div>
|
|
390
|
-
<div>Creation: ${creation}</div>
|
|
391
|
-
<div>Start/Stop: ${start_stop}</div>
|
|
392
|
-
<div>Subscriptions: ${subscriptions}</div>
|
|
393
|
-
<div>I18n: ${i18n}</div>
|
|
394
|
-
<div>Traffic: ${traffic}</div>
|
|
395
|
-
<div>No poll: ${no_poll}</div>`;
|
|
356
|
+
let estados = trace_counters().map((txt) => `<div>${txt}</div>`).join("");
|
|
396
357
|
gobj_create_service("Developer-Window", "C_YUI_WINDOW", {
|
|
397
358
|
$parent: document.getElementById("top-layer") || null,
|
|
398
359
|
subscriber: null,
|
|
@@ -419,20 +380,13 @@ function setup_dev(self, show) {
|
|
|
419
380
|
* Returns { $el, dispose }:
|
|
420
381
|
* - $el: the panel element (header tabs + traffic logger
|
|
421
382
|
* body + footer counters).
|
|
422
|
-
* - dispose:
|
|
423
|
-
* the
|
|
383
|
+
* - dispose: call it from the modal's on_close (kept for the
|
|
384
|
+
* contract; the traces outlive the panel).
|
|
424
385
|
*
|
|
425
386
|
* Backwards compatible: setup_dev() (old shell, C_YUI_WINDOW) is
|
|
426
387
|
* untouched; the trace_* helpers and info_traffic are shared.
|
|
427
388
|
************************************************************/
|
|
428
389
|
function build_dev_panel() {
|
|
429
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
430
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
431
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
432
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
433
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
434
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
435
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
436
390
|
let mk_btn = (label, fn) => [
|
|
437
391
|
"button",
|
|
438
392
|
{ class: "button is-small" },
|
|
@@ -442,15 +396,7 @@ function build_dev_panel() {
|
|
|
442
396
|
fn();
|
|
443
397
|
} }
|
|
444
398
|
];
|
|
445
|
-
let counters = [
|
|
446
|
-
`Automata: ${trace}`,
|
|
447
|
-
`Creation: ${creation}`,
|
|
448
|
-
`Start/Stop: ${start_stop}`,
|
|
449
|
-
`Subscriptions: ${subscriptions}`,
|
|
450
|
-
`I18n: ${i18n}`,
|
|
451
|
-
`Traffic: ${traffic}`,
|
|
452
|
-
`No poll: ${no_poll}`
|
|
453
|
-
].map((txt) => [
|
|
399
|
+
let counters = trace_counters().map((txt) => [
|
|
454
400
|
"div",
|
|
455
401
|
{ style: "padding:0 8px;" },
|
|
456
402
|
txt
|
|
@@ -479,7 +425,6 @@ function build_dev_panel() {
|
|
|
479
425
|
mk_btn("Subscriptions", trace_subscriptions),
|
|
480
426
|
mk_btn("I18n", trace_i18n),
|
|
481
427
|
mk_btn("Traffic", trace_traffic),
|
|
482
|
-
mk_btn("No Poll", set_no_poll),
|
|
483
428
|
mk_btn("Clear Traffic", () => {
|
|
484
429
|
let l = document.getElementById("developer-traffic-logger");
|
|
485
430
|
if (l) l.innerHTML = "";
|
|
@@ -510,9 +455,7 @@ function build_dev_panel() {
|
|
|
510
455
|
]
|
|
511
456
|
]);
|
|
512
457
|
apply_dev_traces();
|
|
513
|
-
let dispose = function() {
|
|
514
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
515
|
-
};
|
|
458
|
+
let dispose = function() {};
|
|
516
459
|
return {
|
|
517
460
|
$el,
|
|
518
461
|
dispose
|
|
@@ -5555,7 +5498,7 @@ function decod_coordinates(gobj, coordinates) {
|
|
|
5555
5498
|
*
|
|
5556
5499
|
************************************************************/
|
|
5557
5500
|
function get_coordinates(gobj, device) {
|
|
5558
|
-
let coordinates = decod_coordinates(gobj, device.settings
|
|
5501
|
+
let coordinates = decod_coordinates(gobj, device.settings?.coordinates);
|
|
5559
5502
|
if (coordinates.lng === 0 && coordinates.lat === 0) coordinates = decod_coordinates(gobj, device.coordinates);
|
|
5560
5503
|
if (coordinates.lng === 0 && coordinates.lat === 0) {
|
|
5561
5504
|
coordinates.lng = gobj_read_attr(gobj, "default_longitude");
|
|
@@ -5604,7 +5547,7 @@ function devices2geojson(gobj, devices) {
|
|
|
5604
5547
|
id: device.id,
|
|
5605
5548
|
name: device.name,
|
|
5606
5549
|
image: device.image,
|
|
5607
|
-
connected: device.connected,
|
|
5550
|
+
connected: !!device.connected,
|
|
5608
5551
|
gobj_service_name: device.gobj_service_name
|
|
5609
5552
|
}
|
|
5610
5553
|
};
|
|
@@ -6194,8 +6137,8 @@ function ac_load_data$2(gobj, event, kw, src) {
|
|
|
6194
6137
|
******************************************************/
|
|
6195
6138
|
function ac_add_serie(gobj, event, kw, src) {
|
|
6196
6139
|
let uplot = gobj_read_attr(gobj, "uplot");
|
|
6197
|
-
let idx;
|
|
6198
|
-
for (
|
|
6140
|
+
let idx = 0;
|
|
6141
|
+
for (; idx < uplot.series.length; idx++) {
|
|
6199
6142
|
let serie = uplot.series[idx];
|
|
6200
6143
|
if (serie.id && serie.id === kw.id) {
|
|
6201
6144
|
log_error("Serie '" + kw.id + "' already exists");
|
|
@@ -13252,8 +13195,6 @@ var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS
|
|
|
13252
13195
|
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
13253
13196
|
})))(), 1)).default;
|
|
13254
13197
|
var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
|
|
13255
|
-
Math.PI / 180;
|
|
13256
|
-
180 / Math.PI;
|
|
13257
13198
|
//#endregion
|
|
13258
13199
|
//#region node_modules/gl-matrix/esm/mat3.js
|
|
13259
13200
|
/**
|
|
@@ -30528,12 +30469,12 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
30528
30469
|
},
|
|
30529
30470
|
trys: [],
|
|
30530
30471
|
ops: []
|
|
30531
|
-
}, f, y, t, g
|
|
30532
|
-
return g = {
|
|
30472
|
+
}, f, y, t, g = {
|
|
30533
30473
|
next: verb(0),
|
|
30534
30474
|
"throw": verb(1),
|
|
30535
30475
|
"return": verb(2)
|
|
30536
|
-
}
|
|
30476
|
+
};
|
|
30477
|
+
return typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
30537
30478
|
return this;
|
|
30538
30479
|
}), g;
|
|
30539
30480
|
function verb(n) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"vite": "^8.0.10"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@yuneta/gobj-js": "^7.
|
|
35
|
+
"@yuneta/gobj-js": "^7.22.0",
|
|
36
36
|
"@antv/g6": "^5.1.0",
|
|
37
37
|
"bulma": "^1.0.4",
|
|
38
38
|
"i18next": "^26.0.7",
|
package/src/c_yui_map.js
CHANGED
|
@@ -305,7 +305,7 @@ function get_coordinates(gobj, device)
|
|
|
305
305
|
* Coordinates can be set in device.settings or in device
|
|
306
306
|
* If devices.settings are null then get it from device
|
|
307
307
|
*/
|
|
308
|
-
let coordinates = decod_coordinates(gobj, device.settings
|
|
308
|
+
let coordinates = decod_coordinates(gobj, device.settings?.coordinates);
|
|
309
309
|
if(coordinates.lng === 0 && coordinates.lat === 0) {
|
|
310
310
|
coordinates = decod_coordinates(gobj, device.coordinates);
|
|
311
311
|
}
|
|
@@ -381,7 +381,18 @@ function devices2geojson(gobj, devices)
|
|
|
381
381
|
id: device.id,
|
|
382
382
|
name: device.name,
|
|
383
383
|
image: device.image,
|
|
384
|
-
|
|
384
|
+
/*
|
|
385
|
+
* A REAL boolean. Four style expressions test this with
|
|
386
|
+
* ['case', ...], and maplibre asserts a STRICT boolean
|
|
387
|
+
* there, so null, absent, or the 1/0 a backend may send all
|
|
388
|
+
* fail the assertion. The consequences are not cosmetic:
|
|
389
|
+
* the point paints with the property default instead of
|
|
390
|
+
* green/red, and the cluster accumulator turns NULL, which
|
|
391
|
+
* the cluster colour compares against point_count -- never
|
|
392
|
+
* equal, so the whole cluster stays red as if something were
|
|
393
|
+
* disconnected.
|
|
394
|
+
*/
|
|
395
|
+
connected: !!device.connected,
|
|
385
396
|
gobj_service_name: device.gobj_service_name,
|
|
386
397
|
}
|
|
387
398
|
};
|
package/src/yui_dev.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Development Tools
|
|
5
5
|
*
|
|
6
|
-
* Copyright (c) 2024, ArtGins.
|
|
6
|
+
* Copyright (c) 2024-2026, ArtGins.
|
|
7
7
|
* All Rights Reserved.
|
|
8
8
|
***********************************************************************/
|
|
9
9
|
import {
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
gobj_write_attr,
|
|
17
17
|
gobj_create_service,
|
|
18
18
|
trace_json,
|
|
19
|
+
gobj_command,
|
|
20
|
+
gobj_global_trace_level,
|
|
21
|
+
gobj_get_gclass_trace_level2,
|
|
22
|
+
trace_level_t,
|
|
19
23
|
} from "@yuneta/gobj-js";
|
|
20
24
|
|
|
21
25
|
import i18next from 'i18next';
|
|
@@ -132,41 +136,76 @@ function info_traffic(title, msg, direction, size)
|
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
/************************************************************
|
|
135
|
-
*
|
|
139
|
+
* A button turns trace bits of the runtime on or off through the
|
|
140
|
+
* yuno's trace commands (the C kernel's, same names), and the yuno
|
|
141
|
+
* persists them (`trace_levels`). What is on is READ from the runtime.
|
|
136
142
|
************************************************************/
|
|
137
|
-
function
|
|
143
|
+
function yuno_trace_command(command, kw)
|
|
138
144
|
{
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
143
|
-
v = 0;
|
|
144
|
-
} else {
|
|
145
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
146
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
147
|
-
v = 1;
|
|
145
|
+
let r = gobj_command(gobj_yuno(), command, kw, gobj_yuno());
|
|
146
|
+
if(!r || r.result < 0) {
|
|
147
|
+
log_error(`yui_dev: ${command} ${JSON.stringify(kw)}: ${r ? r.comment : "no answer"}`);
|
|
148
148
|
}
|
|
149
|
-
kw_set_local_storage_value("trace_traffic", v);
|
|
150
149
|
info_user();
|
|
151
150
|
}
|
|
152
151
|
|
|
152
|
+
function global_bit(bit)
|
|
153
|
+
{
|
|
154
|
+
return (gobj_global_trace_level() & bit) ? 1 : 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function trace_states()
|
|
158
|
+
{
|
|
159
|
+
let automata = 0;
|
|
160
|
+
if(global_bit(trace_level_t.TRACE_MACHINE)) {
|
|
161
|
+
automata = global_bit(trace_level_t.TRACE_EV_KW) ? 2 : 1;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
automata: automata,
|
|
165
|
+
creation: global_bit(trace_level_t.TRACE_CREATE_DELETE),
|
|
166
|
+
start_stop: global_bit(trace_level_t.TRACE_START_STOP),
|
|
167
|
+
subscriptions: global_bit(trace_level_t.TRACE_SUBSCRIPTIONS),
|
|
168
|
+
i18n: Number(kw_get_local_storage_value("trace_i18n", 0, false)) ? 1 : 0,
|
|
169
|
+
traffic: gobj_get_gclass_trace_level2("C_IEVENT_CLI").includes("ievents") ? 1 : 0,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function trace_counters()
|
|
174
|
+
{
|
|
175
|
+
let st = trace_states();
|
|
176
|
+
return [
|
|
177
|
+
`Automata: ${st.automata}`,
|
|
178
|
+
`Creation: ${st.creation}`,
|
|
179
|
+
`Start/Stop: ${st.start_stop}`,
|
|
180
|
+
`Subscriptions: ${st.subscriptions}`,
|
|
181
|
+
`I18n: ${st.i18n}`,
|
|
182
|
+
`Traffic: ${st.traffic}`,
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
|
|
153
186
|
/************************************************************
|
|
154
|
-
*
|
|
187
|
+
* Traffic is C_IEVENT_CLI's own level `ievents`.
|
|
188
|
+
************************************************************/
|
|
189
|
+
function trace_traffic()
|
|
190
|
+
{
|
|
191
|
+
yuno_trace_command("set-gclass-trace",
|
|
192
|
+
{gclass_name: "C_IEVENT_CLI", level: "ievents", set: trace_states().traffic ? 0 : 1});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/************************************************************
|
|
196
|
+
* 0 → 1 (machine) → 2 (machine + kw of each event) → 0
|
|
155
197
|
************************************************************/
|
|
156
198
|
function trace_automata()
|
|
157
199
|
{
|
|
158
|
-
let v =
|
|
159
|
-
v
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
v = 2;
|
|
200
|
+
let v = trace_states().automata;
|
|
201
|
+
if(v === 0) {
|
|
202
|
+
yuno_trace_command("set-global-trace", {level: "machine", set: 1});
|
|
203
|
+
} else if(v === 1) {
|
|
204
|
+
yuno_trace_command("set-global-trace", {level: "ev_kw", set: 1});
|
|
164
205
|
} else {
|
|
165
|
-
|
|
206
|
+
yuno_trace_command("set-global-trace", {level: "ev_kw", set: 0});
|
|
207
|
+
yuno_trace_command("set-global-trace", {level: "machine", set: 0});
|
|
166
208
|
}
|
|
167
|
-
gobj_write_attr(gobj_yuno(), "tracing", v);
|
|
168
|
-
kw_set_local_storage_value("trace_automata", v);
|
|
169
|
-
info_user();
|
|
170
209
|
}
|
|
171
210
|
|
|
172
211
|
/************************************************************
|
|
@@ -174,16 +213,8 @@ function trace_automata()
|
|
|
174
213
|
************************************************************/
|
|
175
214
|
function trace_creation()
|
|
176
215
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if(v===0) {
|
|
180
|
-
v = 1;
|
|
181
|
-
} else {
|
|
182
|
-
v = 0;
|
|
183
|
-
}
|
|
184
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", v);
|
|
185
|
-
kw_set_local_storage_value("trace_creation", v);
|
|
186
|
-
info_user();
|
|
216
|
+
yuno_trace_command("set-global-trace",
|
|
217
|
+
{level: "create_delete", set: trace_states().creation ? 0 : 1});
|
|
187
218
|
}
|
|
188
219
|
|
|
189
220
|
/************************************************************
|
|
@@ -191,16 +222,8 @@ function trace_creation()
|
|
|
191
222
|
************************************************************/
|
|
192
223
|
function trace_start_stop()
|
|
193
224
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if(v===0) {
|
|
197
|
-
v = 1;
|
|
198
|
-
} else {
|
|
199
|
-
v = 0;
|
|
200
|
-
}
|
|
201
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", v);
|
|
202
|
-
kw_set_local_storage_value("trace_start_stop", v);
|
|
203
|
-
info_user();
|
|
225
|
+
yuno_trace_command("set-global-trace",
|
|
226
|
+
{level: "start_stop", set: trace_states().start_stop ? 0 : 1});
|
|
204
227
|
}
|
|
205
228
|
|
|
206
229
|
/************************************************************
|
|
@@ -208,80 +231,34 @@ function trace_start_stop()
|
|
|
208
231
|
************************************************************/
|
|
209
232
|
function trace_subscriptions()
|
|
210
233
|
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if(v===0) {
|
|
214
|
-
v = 1;
|
|
215
|
-
} else {
|
|
216
|
-
v = 0;
|
|
217
|
-
}
|
|
218
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", v);
|
|
219
|
-
kw_set_local_storage_value("trace_subscriptions", v);
|
|
220
|
-
info_user();
|
|
234
|
+
yuno_trace_command("set-global-trace",
|
|
235
|
+
{level: "subscriptions", set: trace_states().subscriptions ? 0 : 1});
|
|
221
236
|
}
|
|
222
237
|
|
|
223
238
|
/************************************************************
|
|
224
|
-
*
|
|
239
|
+
* No trace of the runtime: i18next's own debug switch.
|
|
225
240
|
************************************************************/
|
|
226
241
|
function trace_i18n()
|
|
227
242
|
{
|
|
228
|
-
let v =
|
|
229
|
-
v = Number(v);
|
|
230
|
-
if(v===0) {
|
|
231
|
-
v = 1;
|
|
232
|
-
} else {
|
|
233
|
-
v = 0;
|
|
234
|
-
}
|
|
243
|
+
let v = trace_states().i18n ? 0 : 1;
|
|
235
244
|
i18next.options.debug = v?true:false;
|
|
236
245
|
kw_set_local_storage_value("trace_i18n", v);
|
|
237
246
|
info_user();
|
|
238
247
|
}
|
|
239
248
|
|
|
240
|
-
/************************************************************
|
|
241
|
-
*
|
|
242
|
-
************************************************************/
|
|
243
|
-
function set_no_poll()
|
|
244
|
-
{
|
|
245
|
-
let v = kw_get_local_storage_value("no_poll");
|
|
246
|
-
v = Number(v);
|
|
247
|
-
if(v) {
|
|
248
|
-
v = 0;
|
|
249
|
-
} else {
|
|
250
|
-
v = 1;
|
|
251
|
-
}
|
|
252
|
-
gobj_write_attr(gobj_yuno(), "no_poll", v);
|
|
253
|
-
kw_set_local_storage_value("no_poll", v);
|
|
254
|
-
info_user();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
249
|
/************************************************************
|
|
258
250
|
*
|
|
259
251
|
************************************************************/
|
|
260
252
|
function info_user()
|
|
261
253
|
{
|
|
262
254
|
let $info = document.getElementById("developer-window-info");
|
|
255
|
+
if(!$info) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
263
258
|
|
|
264
|
-
|
|
265
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
266
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
267
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
268
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
269
|
-
|
|
270
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
271
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
272
|
-
|
|
273
|
-
// Code repeated
|
|
274
|
-
// Build with DOM instead of innerHTML to prevent any XSS via localStorage values
|
|
259
|
+
// Build with DOM instead of innerHTML
|
|
275
260
|
$info.replaceChildren();
|
|
276
|
-
|
|
277
|
-
`Automata: ${trace}`,
|
|
278
|
-
`Creation: ${creation}`,
|
|
279
|
-
`Start/Stop: ${start_stop}`,
|
|
280
|
-
`Subscriptions: ${subscriptions}`,
|
|
281
|
-
`I18n: ${i18n}`,
|
|
282
|
-
`Traffic: ${traffic}`,
|
|
283
|
-
`No poll: ${no_poll}`,
|
|
284
|
-
].forEach(text => {
|
|
261
|
+
trace_counters().forEach(text => {
|
|
285
262
|
const div = document.createElement('div');
|
|
286
263
|
div.textContent = text;
|
|
287
264
|
$info.appendChild(div);
|
|
@@ -301,35 +278,16 @@ function dev_window_was_open()
|
|
|
301
278
|
}
|
|
302
279
|
|
|
303
280
|
/************************************************************
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* Single source of truth for "localStorage flag → effect";
|
|
308
|
-
* setup_dev() and build_dev_panel() reuse it instead of each
|
|
309
|
-
* re-applying a partial subset.
|
|
281
|
+
* Wire the traffic sink and i18n debug. Call it once at app
|
|
282
|
+
* startup. The trace levels themselves are persisted and
|
|
283
|
+
* restored by the yuno (see gobj-js C_YUNO).
|
|
310
284
|
************************************************************/
|
|
311
285
|
function apply_dev_traces()
|
|
312
286
|
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
318
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
319
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
320
|
-
|
|
321
|
-
if(traffic) {
|
|
322
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
323
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
324
|
-
} else {
|
|
325
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
326
|
-
}
|
|
327
|
-
gobj_write_attr(gobj_yuno(), "tracing", trace);
|
|
328
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", creation);
|
|
329
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", start_stop);
|
|
330
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", subscriptions);
|
|
331
|
-
gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
|
|
332
|
-
i18next.options.debug = i18n ? true : false;
|
|
287
|
+
/* The trace LEVELS are the yuno's, restored by its mt_create from
|
|
288
|
+
* what the user persisted. Here only where the traffic goes. */
|
|
289
|
+
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
290
|
+
i18next.options.debug = trace_states().i18n ? true : false;
|
|
333
291
|
}
|
|
334
292
|
|
|
335
293
|
/************************************************************
|
|
@@ -346,14 +304,6 @@ function apply_dev_traces()
|
|
|
346
304
|
************************************************************/
|
|
347
305
|
function setup_dev(self, show)
|
|
348
306
|
{
|
|
349
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
350
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
351
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
352
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
353
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
354
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
355
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
356
|
-
|
|
357
307
|
if(show) {
|
|
358
308
|
const $dev_toolbar = createElement2(
|
|
359
309
|
['div', {class: 'buttons'}, [
|
|
@@ -405,14 +355,6 @@ function setup_dev(self, show)
|
|
|
405
355
|
trace_traffic();
|
|
406
356
|
}
|
|
407
357
|
}],
|
|
408
|
-
['button', {
|
|
409
|
-
class: 'button',
|
|
410
|
-
}, 'No Poll', {
|
|
411
|
-
click: (evt) => {
|
|
412
|
-
evt.stopPropagation();
|
|
413
|
-
set_no_poll();
|
|
414
|
-
}
|
|
415
|
-
}],
|
|
416
358
|
['button', {
|
|
417
359
|
class: 'button',
|
|
418
360
|
}, 'Clear Traffic', {
|
|
@@ -436,15 +378,7 @@ function setup_dev(self, show)
|
|
|
436
378
|
// gobj_save_persistent_attrs();
|
|
437
379
|
// }
|
|
438
380
|
|
|
439
|
-
|
|
440
|
-
let estados = `
|
|
441
|
-
<div>Automata: ${trace}</div>
|
|
442
|
-
<div>Creation: ${creation}</div>
|
|
443
|
-
<div>Start/Stop: ${start_stop}</div>
|
|
444
|
-
<div>Subscriptions: ${subscriptions}</div>
|
|
445
|
-
<div>I18n: ${i18n}</div>
|
|
446
|
-
<div>Traffic: ${traffic}</div>
|
|
447
|
-
<div>No poll: ${no_poll}</div>`;
|
|
381
|
+
let estados = trace_counters().map(txt => `<div>${txt}</div>`).join("");
|
|
448
382
|
|
|
449
383
|
gobj_create_service(
|
|
450
384
|
"Developer-Window",
|
|
@@ -482,22 +416,14 @@ function setup_dev(self, show)
|
|
|
482
416
|
* Returns { $el, dispose }:
|
|
483
417
|
* - $el: the panel element (header tabs + traffic logger
|
|
484
418
|
* body + footer counters).
|
|
485
|
-
* - dispose:
|
|
486
|
-
* the
|
|
419
|
+
* - dispose: call it from the modal's on_close (kept for the
|
|
420
|
+
* contract; the traces outlive the panel).
|
|
487
421
|
*
|
|
488
422
|
* Backwards compatible: setup_dev() (old shell, C_YUI_WINDOW) is
|
|
489
423
|
* untouched; the trace_* helpers and info_traffic are shared.
|
|
490
424
|
************************************************************/
|
|
491
425
|
function build_dev_panel()
|
|
492
426
|
{
|
|
493
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
494
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
495
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
496
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
497
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
498
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
499
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
500
|
-
|
|
501
427
|
let mk_btn = (label, fn) => ['button', {
|
|
502
428
|
class: 'button is-small',
|
|
503
429
|
}, label, {
|
|
@@ -507,11 +433,7 @@ function build_dev_panel()
|
|
|
507
433
|
}
|
|
508
434
|
}];
|
|
509
435
|
|
|
510
|
-
let counters = [
|
|
511
|
-
`Automata: ${trace}`, `Creation: ${creation}`,
|
|
512
|
-
`Start/Stop: ${start_stop}`, `Subscriptions: ${subscriptions}`,
|
|
513
|
-
`I18n: ${i18n}`, `Traffic: ${traffic}`, `No poll: ${no_poll}`,
|
|
514
|
-
].map(txt => ['div', {style: 'padding:0 8px;'}, txt]);
|
|
436
|
+
let counters = trace_counters().map(txt => ['div', {style: 'padding:0 8px;'}, txt]);
|
|
515
437
|
|
|
516
438
|
// The shell modal drops content into a transparent, unsized
|
|
517
439
|
// Bulma .modal-content; the panel must be its own opaque,
|
|
@@ -546,7 +468,6 @@ function build_dev_panel()
|
|
|
546
468
|
mk_btn('Subscriptions', trace_subscriptions),
|
|
547
469
|
mk_btn('I18n', trace_i18n),
|
|
548
470
|
mk_btn('Traffic', trace_traffic),
|
|
549
|
-
mk_btn('No Poll', set_no_poll),
|
|
550
471
|
mk_btn('Clear Traffic', () => {
|
|
551
472
|
let l = document.getElementById("developer-traffic-logger");
|
|
552
473
|
if(l) {
|
|
@@ -572,9 +493,8 @@ function build_dev_panel()
|
|
|
572
493
|
|
|
573
494
|
apply_dev_traces();
|
|
574
495
|
|
|
496
|
+
/* Nothing to undo: the trace levels are the yuno's, persisted. */
|
|
575
497
|
let dispose = function() {
|
|
576
|
-
// Stop feeding traffic into a detached DOM.
|
|
577
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
578
498
|
};
|
|
579
499
|
|
|
580
500
|
return {$el: $el, dispose: dispose};
|