@necrolab/dashboard 0.4.219 → 0.4.221
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/package.json +2 -2
- package/src/libs/Filter.js +56 -30
- package/src/views/Accounts.vue +1 -2
- package/src/views/Console.vue +3 -4
- package/src/views/FilterBuilder.vue +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necrolab/dashboard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.221",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx workbox-cli generateSW workbox-config.js && vite build",
|
|
6
6
|
"dev": "vite",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@faker-js/faker": "^7.6.0",
|
|
16
16
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
17
|
-
"@necrolab/tm-renderer": "^0.1.
|
|
17
|
+
"@necrolab/tm-renderer": "^0.1.4",
|
|
18
18
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
19
19
|
"@vueuse/core": "^10.7.2",
|
|
20
20
|
"autoprefixer": "^10.4.17",
|
package/src/libs/Filter.js
CHANGED
|
@@ -10,6 +10,18 @@ const colors = {
|
|
|
10
10
|
|
|
11
11
|
const BASE_CSS = `path[generaladmission]:hover {fill: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}`;
|
|
12
12
|
|
|
13
|
+
const getAttributeValue = (element, attributeName) => {
|
|
14
|
+
try {
|
|
15
|
+
return element.attributes[attributeName]?.nodeValue?.trim() || "";
|
|
16
|
+
} catch {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getTextContent = (element) => {
|
|
22
|
+
return element.innerHTML?.trim() || "";
|
|
23
|
+
};
|
|
24
|
+
|
|
13
25
|
const isWheelchair = (p) => {
|
|
14
26
|
if (p.row === "W" || p.sectionName === "W") return false;
|
|
15
27
|
return [("W", "ADA")].some((part) => p.row !== "W" && (p.row?.includes(part) || p.sectionName?.includes(part)));
|
|
@@ -88,22 +100,29 @@ const cleanupFilter = (f) => {
|
|
|
88
100
|
|
|
89
101
|
return ret;
|
|
90
102
|
};
|
|
103
|
+
|
|
91
104
|
const getSectionNameMapping = () => {
|
|
92
105
|
const sectionRealName = {};
|
|
106
|
+
|
|
93
107
|
[...document.querySelectorAll("path")].forEach((t) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
const sec = getAttributeValue(t, "section");
|
|
109
|
+
const secName = getAttributeValue(t, "sectionname");
|
|
110
|
+
if (sec && secName) {
|
|
97
111
|
sectionRealName[sec] = secName;
|
|
98
|
-
} catch {
|
|
99
|
-
/* empty */
|
|
100
112
|
}
|
|
101
113
|
});
|
|
102
114
|
|
|
103
115
|
[...document.querySelectorAll("tspan")].forEach((t) => {
|
|
104
|
-
const sec = t
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
const sec = getAttributeValue(t, "section");
|
|
117
|
+
const content = getTextContent(t);
|
|
118
|
+
|
|
119
|
+
if (sec && content) {
|
|
120
|
+
if (!sectionRealName[sec]) {
|
|
121
|
+
sectionRealName[sec] = content;
|
|
122
|
+
} else if (!sectionRealName[sec].includes(content)) {
|
|
123
|
+
sectionRealName[sec] += " " + content;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
107
126
|
});
|
|
108
127
|
|
|
109
128
|
log("getSectionNameMapping:", sectionRealName);
|
|
@@ -112,20 +131,21 @@ const getSectionNameMapping = () => {
|
|
|
112
131
|
|
|
113
132
|
const getReverseSectionNameMapping = () => {
|
|
114
133
|
const reverseSectionName = {};
|
|
134
|
+
|
|
115
135
|
[...document.querySelectorAll("path")].forEach((t) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
136
|
+
const sec = getAttributeValue(t, "section");
|
|
137
|
+
const secName = getAttributeValue(t, "sectionname");
|
|
138
|
+
|
|
139
|
+
if (sec && secName) {
|
|
119
140
|
if (!reverseSectionName[secName]) {
|
|
120
141
|
reverseSectionName[secName] = [];
|
|
121
142
|
}
|
|
122
143
|
if (!reverseSectionName[secName].includes(sec)) {
|
|
123
144
|
reverseSectionName[secName].push(sec);
|
|
124
145
|
}
|
|
125
|
-
} catch {
|
|
126
|
-
/* empty */
|
|
127
146
|
}
|
|
128
147
|
});
|
|
148
|
+
|
|
129
149
|
log("getReverseSectionNameMapping", reverseSectionName);
|
|
130
150
|
return reverseSectionName;
|
|
131
151
|
};
|
|
@@ -192,10 +212,11 @@ export default class FilterBuilder {
|
|
|
192
212
|
const row = this.rows[i];
|
|
193
213
|
row.onclick = () => {
|
|
194
214
|
const parsed = {
|
|
195
|
-
section: row
|
|
196
|
-
row: row
|
|
197
|
-
id: row
|
|
215
|
+
section: getAttributeValue(row, "section"),
|
|
216
|
+
row: getAttributeValue(row, "row"),
|
|
217
|
+
id: getAttributeValue(row, "id")
|
|
198
218
|
};
|
|
219
|
+
|
|
199
220
|
log(`Adding filter ${parsed.section}`);
|
|
200
221
|
const matchingFilter = this.filters.find(
|
|
201
222
|
(f) =>
|
|
@@ -203,6 +224,7 @@ export default class FilterBuilder {
|
|
|
203
224
|
f.section === parsed.section &&
|
|
204
225
|
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
205
226
|
);
|
|
227
|
+
|
|
206
228
|
if (matchingFilter) {
|
|
207
229
|
log(`Filter for ${parsed.section}/${parsed.row} already exists (${matchingFilter.id})`);
|
|
208
230
|
if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
|
|
@@ -219,21 +241,24 @@ export default class FilterBuilder {
|
|
|
219
241
|
|
|
220
242
|
row.onmouseover = () => {
|
|
221
243
|
const parsed = {
|
|
222
|
-
section: row
|
|
223
|
-
row: row
|
|
224
|
-
id: row
|
|
244
|
+
section: getAttributeValue(row, "section"),
|
|
245
|
+
row: getAttributeValue(row, "row"),
|
|
246
|
+
id: getAttributeValue(row, "id")
|
|
225
247
|
};
|
|
248
|
+
|
|
226
249
|
const matchingFilter = this.filters.find(
|
|
227
250
|
(f) =>
|
|
228
251
|
this.isForCurrentEvent(f) &&
|
|
229
252
|
f.section === parsed.section &&
|
|
230
253
|
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
231
254
|
);
|
|
255
|
+
|
|
232
256
|
if (!matchingFilter) return;
|
|
233
257
|
if (Array.isArray(matchingFilter.rows))
|
|
234
258
|
matchingFilter.rows.forEach((row) => this.highlight({ section: parsed.section, row: row }));
|
|
235
259
|
else this.highlight({ section: matchingFilter.section });
|
|
236
260
|
};
|
|
261
|
+
|
|
237
262
|
row.onmouseout = () => {
|
|
238
263
|
if (!this.isDragging) this.clearHighlight();
|
|
239
264
|
};
|
|
@@ -332,8 +357,7 @@ export default class FilterBuilder {
|
|
|
332
357
|
if (!this.isForCurrentEvent(filter)) return;
|
|
333
358
|
|
|
334
359
|
const tryFindRealName = Object.entries(gaSectionNameMapping).find(
|
|
335
|
-
|
|
336
|
-
([_, v]) => v === filter.section && v.includes(" ")
|
|
360
|
+
([, v]) => v === filter.section && v.includes(" ")
|
|
337
361
|
)?.[0];
|
|
338
362
|
|
|
339
363
|
if (tryFindRealName) {
|
|
@@ -395,7 +419,7 @@ export default class FilterBuilder {
|
|
|
395
419
|
|
|
396
420
|
for (let i = 0; i < labels.length; i++) {
|
|
397
421
|
const label = labels[i];
|
|
398
|
-
const section = label
|
|
422
|
+
const section = getAttributeValue(label, "section");
|
|
399
423
|
|
|
400
424
|
label.onclick = () => {
|
|
401
425
|
// filter exists already for section - return
|
|
@@ -415,17 +439,20 @@ export default class FilterBuilder {
|
|
|
415
439
|
|
|
416
440
|
if (isWheelchair({ section: gaSectionNameMapping[section] || section })) return;
|
|
417
441
|
|
|
418
|
-
const isGA = document.querySelectorAll(`path[sectionname="${section
|
|
442
|
+
const isGA = document.querySelectorAll(`path[sectionname="${section}"][row]`).length === 0;
|
|
419
443
|
|
|
420
444
|
try {
|
|
421
445
|
if (isGA) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
446
|
+
const realSectionName = gaSectionNameMapping[section];
|
|
447
|
+
if (realSectionName) {
|
|
448
|
+
this.addFilter({
|
|
449
|
+
section: realSectionName,
|
|
450
|
+
event: this.currentEventId
|
|
451
|
+
});
|
|
452
|
+
}
|
|
426
453
|
} else {
|
|
427
454
|
const reverseMapping = getReverseSectionNameMapping();
|
|
428
|
-
const sections = reverseMapping[section
|
|
455
|
+
const sections = reverseMapping[section] || [section];
|
|
429
456
|
log("labelHandler: non-ga", sections, section);
|
|
430
457
|
sections.forEach((s) => {
|
|
431
458
|
this.addFilter({
|
|
@@ -452,7 +479,7 @@ export default class FilterBuilder {
|
|
|
452
479
|
|
|
453
480
|
for (let i = 0; i < GASections.length; i++) {
|
|
454
481
|
const path = GASections[i];
|
|
455
|
-
const section = path
|
|
482
|
+
const section = getAttributeValue(path, "name");
|
|
456
483
|
const sectionName = gaSectionNameMapping[section];
|
|
457
484
|
|
|
458
485
|
path.onclick = () => {
|
|
@@ -466,7 +493,6 @@ export default class FilterBuilder {
|
|
|
466
493
|
return;
|
|
467
494
|
}
|
|
468
495
|
log(`GAHandler: adding filter for ${section} (realname: ${sectionName})`, section, sectionName);
|
|
469
|
-
|
|
470
496
|
this.addFilter({
|
|
471
497
|
section: sectionName,
|
|
472
498
|
event: this.currentEventId
|
package/src/views/Accounts.vue
CHANGED
|
@@ -138,9 +138,8 @@ const filterAccounts = () => {
|
|
|
138
138
|
if (show === "Enabled") accs = accs.filter((p) => p.enabled);
|
|
139
139
|
if (show === "Disabled") accs = accs.filter((p) => !p.enabled);
|
|
140
140
|
ui.logger.Info(`Filtered accounts for ${ui.currentModule}`);
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
accs = accs.filter((acc) => acc.module === ui.currentModule);
|
|
143
|
-
console.log(accs);
|
|
144
143
|
|
|
145
144
|
if (tag !== "Any") accs = accs.filter((p) => p.tags.includes(ui.search.accounts.tag));
|
|
146
145
|
if (!query) return (ui.search.accounts.results = accs);
|
package/src/views/Console.vue
CHANGED
|
@@ -147,7 +147,7 @@ const scrollTo = (dir) => {
|
|
|
147
147
|
if (dir === "up") $autoscroll.value.el.scrollTop = 0;
|
|
148
148
|
else $autoscroll.value.el.scrollTop = parseInt($autoscroll.value.el.children[1].style.height);
|
|
149
149
|
} catch (e) {
|
|
150
|
-
console.log("Error scrolling", e);
|
|
150
|
+
if (DEBUG) console.log("Error scrolling", e);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
|
|
@@ -171,7 +171,6 @@ const handleWebsocketMessages = (msg) => {
|
|
|
171
171
|
addAnsiToOutput(l);
|
|
172
172
|
});
|
|
173
173
|
} else if (msg.type === "console") {
|
|
174
|
-
console.log(msg);
|
|
175
174
|
makeTaskLogMapping([msg]);
|
|
176
175
|
if (data.includes("Cleared logs")) logLines.value = [];
|
|
177
176
|
addAnsiToOutput(msg);
|
|
@@ -181,7 +180,7 @@ const handleWebsocketMessages = (msg) => {
|
|
|
181
180
|
const makeTaskLogMapping = (lines) => {
|
|
182
181
|
lines.forEach((l) => {
|
|
183
182
|
if (!l.metadata) {
|
|
184
|
-
console.log("Error getting metadata", l);
|
|
183
|
+
if (DEBUG) console.log("Error getting metadata", l);
|
|
185
184
|
return;
|
|
186
185
|
}
|
|
187
186
|
const region = l.metadata.siteId?.split("_")?.[1];
|
|
@@ -209,7 +208,7 @@ onMounted(() => {
|
|
|
209
208
|
|
|
210
209
|
socket.onmessage = (event) => {
|
|
211
210
|
const msg = JSON.parse(event.data);
|
|
212
|
-
console.log("Received message", msg);
|
|
211
|
+
if (DEBUG) console.log("Received message", msg);
|
|
213
212
|
msg.forEach((e) => {
|
|
214
213
|
handleWebsocketMessages(e);
|
|
215
214
|
});
|
|
@@ -329,6 +329,8 @@ if (!DEBUG)
|
|
|
329
329
|
RendererFactory.then((r) => {
|
|
330
330
|
rendererFactory = new r.default();
|
|
331
331
|
rendererFactory.init();
|
|
332
|
+
}).catch((error) => {
|
|
333
|
+
console.error("Failed to initialize renderer:", error);
|
|
332
334
|
});
|
|
333
335
|
|
|
334
336
|
const updateShownVenue = async () => {
|