@necrolab/dashboard 0.4.214 → 0.4.216
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 +1 -1
- package/src/components/Filter/Filter.vue +1 -1
- package/src/libs/Filter.js +115 -147
- package/src/stores/logger.js +11 -3
- package/src/stores/ui.js +2 -8
- package/src/views/FilterBuilder.vue +130 -138
package/package.json
CHANGED
|
@@ -152,7 +152,7 @@ const getFilterTitle = () => {
|
|
|
152
152
|
return `${filter.value.section} (first row) ${excluded}`;
|
|
153
153
|
case filterTypes.NORMAL: {
|
|
154
154
|
const selectedRowAmount = filter.value?.rows?.length;
|
|
155
|
-
const totalRowAmount = document.querySelectorAll(`path[
|
|
155
|
+
const totalRowAmount = document.querySelectorAll(`path[section='${filter.value.section}']`)?.length;
|
|
156
156
|
isAllRows.value = selectedRowAmount === totalRowAmount || !filter.value?.rows?.length;
|
|
157
157
|
|
|
158
158
|
if (isAllRows.value) return `${filter.value.section} (full section) ${excluded}`;
|
package/src/libs/Filter.js
CHANGED
|
@@ -8,23 +8,13 @@ const colors = {
|
|
|
8
8
|
UNSELECTABLE: "#311432"
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const BASE_CSS =
|
|
12
|
-
`path[row]:hover {stroke: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}` +
|
|
13
|
-
`path[generaladmission]:hover {fill: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}`;
|
|
11
|
+
const BASE_CSS = `path[generaladmission]:hover {fill: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}`;
|
|
14
12
|
|
|
15
13
|
const isWheelchair = (p) => {
|
|
16
14
|
if (p.row === "W" || p.sectionName === "W") return false;
|
|
17
15
|
return [("W", "ADA")].some((part) => p.row !== "W" && (p.row?.includes(part) || p.sectionName?.includes(part)));
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
const getWheelChairRows = () => {
|
|
21
|
-
const rows = [...document.querySelectorAll("path[row]")];
|
|
22
|
-
return rows
|
|
23
|
-
.map((p) => {
|
|
24
|
-
return { row: p.attributes.row.nodeValue, sectionName: p.attributes.sectionname.nodeValue };
|
|
25
|
-
})
|
|
26
|
-
.filter(isWheelchair);
|
|
27
|
-
};
|
|
28
18
|
const sortAlphaNum = (a, b) => {
|
|
29
19
|
var reA = /[^a-zA-Z]/g;
|
|
30
20
|
var reN = /[^0-9]/g;
|
|
@@ -93,34 +83,23 @@ const cleanupFilter = (f) => {
|
|
|
93
83
|
return ret;
|
|
94
84
|
}
|
|
95
85
|
|
|
96
|
-
if (f.rows && document.querySelectorAll(`path[
|
|
97
|
-
delete f.rows;
|
|
86
|
+
if (f.rows && document.querySelectorAll(`path[section="${f.section}"]`)?.length === f.rows?.length) delete f.rows;
|
|
98
87
|
if (f.rows) ret.rows = f.rows.sort(sortAlphaNum);
|
|
99
88
|
|
|
100
89
|
return ret;
|
|
101
90
|
};
|
|
102
|
-
|
|
103
|
-
const getFirstRows = (rows) => {
|
|
104
|
-
const firstRows = {};
|
|
105
|
-
const parsedRows = rows.map((row) => {
|
|
106
|
-
return { sec: row.attributes.sectionname.nodeValue, row: row.attributes.row.nodeValue };
|
|
107
|
-
});
|
|
108
|
-
// log("getFirstRows: parsedRows=", parsedRows);
|
|
109
|
-
parsedRows.forEach((row) => {
|
|
110
|
-
if (!firstRows[row.sec]) firstRows[row.sec] = [];
|
|
111
|
-
firstRows[row.sec].push(row.row);
|
|
112
|
-
});
|
|
113
|
-
// log("A getFirstRows: firstRows=", firstRows);
|
|
114
|
-
Object.entries(firstRows).forEach(([sec, rows]) => {
|
|
115
|
-
log(`sort:`, sec, rows);
|
|
116
|
-
firstRows[sec] = rows.sort(sortAlphaNum);
|
|
117
|
-
});
|
|
118
|
-
// log("B getFirstRows: firstRows=", firstRows);
|
|
119
|
-
return firstRows;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
91
|
const getSectionNameMapping = () => {
|
|
123
92
|
const sectionRealName = {};
|
|
93
|
+
[...document.querySelectorAll("path")].forEach((t) => {
|
|
94
|
+
try {
|
|
95
|
+
const sec = t.attributes.section.nodeValue.trim();
|
|
96
|
+
const secName = t.attributes.sectionname.nodeValue.trim();
|
|
97
|
+
sectionRealName[sec] = secName;
|
|
98
|
+
} catch {
|
|
99
|
+
/* empty */
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
124
103
|
[...document.querySelectorAll("tspan")].forEach((t) => {
|
|
125
104
|
const sec = t.attributes.section.nodeValue.trim();
|
|
126
105
|
if (!sectionRealName[sec]) sectionRealName[sec] = t.innerHTML.trim();
|
|
@@ -131,14 +110,25 @@ const getSectionNameMapping = () => {
|
|
|
131
110
|
return sectionRealName;
|
|
132
111
|
};
|
|
133
112
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
113
|
+
const getReverseSectionNameMapping = () => {
|
|
114
|
+
const reverseSectionName = {};
|
|
115
|
+
[...document.querySelectorAll("path")].forEach((t) => {
|
|
116
|
+
try {
|
|
117
|
+
const sec = t.attributes.section.nodeValue.trim();
|
|
118
|
+
const secName = t.attributes.sectionname.nodeValue.trim();
|
|
119
|
+
if (!reverseSectionName[secName]) {
|
|
120
|
+
reverseSectionName[secName] = [];
|
|
121
|
+
}
|
|
122
|
+
if (!reverseSectionName[secName].includes(sec)) {
|
|
123
|
+
reverseSectionName[secName].push(sec);
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
/* empty */
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
log("getReverseSectionNameMapping", reverseSectionName);
|
|
130
|
+
return reverseSectionName;
|
|
131
|
+
};
|
|
142
132
|
|
|
143
133
|
export default class FilterBuilder {
|
|
144
134
|
constructor() {
|
|
@@ -157,7 +147,6 @@ export default class FilterBuilder {
|
|
|
157
147
|
CATCH_ALL_GA: 1,
|
|
158
148
|
NORMAL: 2,
|
|
159
149
|
NORMAL_FIRSTROW: 3,
|
|
160
|
-
GLOBAL_FIRSTROW: 4,
|
|
161
150
|
CATCH_ALL_FLOOR: 5
|
|
162
151
|
};
|
|
163
152
|
|
|
@@ -194,24 +183,72 @@ export default class FilterBuilder {
|
|
|
194
183
|
if (filter.buyAny) return this.filterTypes.CATCH_ALL;
|
|
195
184
|
else if (filter.floor) return this.filterTypes.CATCH_ALL_FLOOR;
|
|
196
185
|
else if (filter.generalAdmission) return this.filterTypes.CATCH_ALL_GA;
|
|
197
|
-
// else if (!!filter.section && filter.firstRow) return this.filterTypes.NORMAL_FIRSTROW;
|
|
198
|
-
// else if (!filter.section && filter.firstRow) return this.filterTypes.GLOBAL_FIRSTROW;
|
|
199
186
|
else if (filter.section) return this.filterTypes.NORMAL;
|
|
200
187
|
else return this.filterTypes.INVALID;
|
|
201
188
|
}
|
|
202
189
|
|
|
190
|
+
addRowHandlers() {
|
|
191
|
+
for (let i = 0; i < this.rows.length; i++) {
|
|
192
|
+
const row = this.rows[i];
|
|
193
|
+
row.onclick = () => {
|
|
194
|
+
const parsed = {
|
|
195
|
+
section: row.attributes.section.nodeValue,
|
|
196
|
+
row: row.attributes.row.nodeValue,
|
|
197
|
+
id: row.attributes.id.nodeValue
|
|
198
|
+
};
|
|
199
|
+
log(`Adding filter ${parsed.section}`);
|
|
200
|
+
const matchingFilter = this.filters.find(
|
|
201
|
+
(f) =>
|
|
202
|
+
this.isForCurrentEvent(f) &&
|
|
203
|
+
f.section === parsed.section &&
|
|
204
|
+
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
205
|
+
);
|
|
206
|
+
if (matchingFilter) {
|
|
207
|
+
log(`Filter for ${parsed.section}/${parsed.row} already exists (${matchingFilter.id})`);
|
|
208
|
+
if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
|
|
209
|
+
else this.setExpandedFilter(matchingFilter.id);
|
|
210
|
+
this.updateCss();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
this.addFilter({
|
|
215
|
+
section: parsed.section,
|
|
216
|
+
event: this.currentEventId
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
row.onmouseover = () => {
|
|
221
|
+
const parsed = {
|
|
222
|
+
section: row.attributes.section.nodeValue,
|
|
223
|
+
row: row.attributes.row.nodeValue,
|
|
224
|
+
id: row.attributes.id.nodeValue
|
|
225
|
+
};
|
|
226
|
+
const matchingFilter = this.filters.find(
|
|
227
|
+
(f) =>
|
|
228
|
+
this.isForCurrentEvent(f) &&
|
|
229
|
+
f.section === parsed.section &&
|
|
230
|
+
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
231
|
+
);
|
|
232
|
+
if (!matchingFilter) return;
|
|
233
|
+
if (Array.isArray(matchingFilter.rows))
|
|
234
|
+
matchingFilter.rows.forEach((row) => this.highlight({ section: parsed.section, row: row }));
|
|
235
|
+
else this.highlight({ section: matchingFilter.section });
|
|
236
|
+
};
|
|
237
|
+
row.onmouseout = () => {
|
|
238
|
+
if (!this.isDragging) this.clearHighlight();
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
203
243
|
reload(eventId) {
|
|
204
244
|
const paths = document.querySelectorAll("path");
|
|
205
245
|
this.rows = [...paths].filter((r) => r.id.startsWith("s_"));
|
|
206
246
|
|
|
207
247
|
this.addLabelHandlers();
|
|
208
|
-
this.addRowHandlers();
|
|
209
248
|
this.addGAHandlers();
|
|
249
|
+
this.addRowHandlers();
|
|
210
250
|
this.currentEventId = eventId;
|
|
211
251
|
|
|
212
|
-
const wcRows = getWheelChairRows();
|
|
213
|
-
log("wcRows:", wcRows);
|
|
214
|
-
wcRows.forEach((r) => this.makeRowUnselectable(r.sectionName, r.row));
|
|
215
252
|
this.updateCss();
|
|
216
253
|
}
|
|
217
254
|
|
|
@@ -233,6 +270,18 @@ export default class FilterBuilder {
|
|
|
233
270
|
addFilter(filter) {
|
|
234
271
|
if (!this.filters) this.filters = [];
|
|
235
272
|
|
|
273
|
+
// Check if a filter with the same properties (excluding id) already exists
|
|
274
|
+
const existingFilter = this.filters.find((f) => {
|
|
275
|
+
const n = { ...f };
|
|
276
|
+
delete n.id;
|
|
277
|
+
return JSON.stringify(n) === JSON.stringify(filter);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
if (existingFilter) {
|
|
281
|
+
console.log("Filter already exists:", existingFilter);
|
|
282
|
+
return; // Don't add the filter if it already exists
|
|
283
|
+
}
|
|
284
|
+
|
|
236
285
|
if (this.expandedFilter) {
|
|
237
286
|
const parent = this.filters.find((f) => f.event === filter.event && f.section === filter.section);
|
|
238
287
|
if (parent) return this.addFilterToParent(filter, parent);
|
|
@@ -275,23 +324,6 @@ export default class FilterBuilder {
|
|
|
275
324
|
this.updateCss();
|
|
276
325
|
}
|
|
277
326
|
|
|
278
|
-
selectFirstRow() {
|
|
279
|
-
const paths = document.querySelectorAll("path");
|
|
280
|
-
const rows = [...paths].filter((r) => r.id.startsWith("s_"));
|
|
281
|
-
const firstRows = getFirstRows(rows);
|
|
282
|
-
|
|
283
|
-
Object.entries(firstRows).forEach(([sec, rows]) => {
|
|
284
|
-
if (this.filters.some((f) => f.section === sec && f.rows.includes(rows[0]) && this.isForCurrentEvent(f))) {
|
|
285
|
-
log(`Filter for ${sec}/${rows[0]} already exists`);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (this.isUnselectable(sec, rows[0])) return;
|
|
289
|
-
this.addFilter({ event: this.currentEventId, section: sec, rows: [rows[0]] });
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
this.updateCss();
|
|
293
|
-
}
|
|
294
|
-
|
|
295
327
|
updateCss() {
|
|
296
328
|
this.cssClasses = BASE_CSS;
|
|
297
329
|
const gaSectionNameMapping = this.getSectionNameMapping();
|
|
@@ -303,6 +335,7 @@ export default class FilterBuilder {
|
|
|
303
335
|
// eslint-disable-next-line no-unused-vars
|
|
304
336
|
([_, v]) => v === filter.section && v.includes(" ")
|
|
305
337
|
)?.[0];
|
|
338
|
+
|
|
306
339
|
if (tryFindRealName) {
|
|
307
340
|
log(`Real name for ${filter.section}: ${tryFindRealName}`);
|
|
308
341
|
} else {
|
|
@@ -317,15 +350,14 @@ export default class FilterBuilder {
|
|
|
317
350
|
case this.filterTypes.NORMAL:
|
|
318
351
|
// If it has no 'rows' property
|
|
319
352
|
if (!Array.isArray(filter.rows)) {
|
|
320
|
-
const isGA = document.querySelectorAll(`path[
|
|
353
|
+
const isGA = document.querySelectorAll(`path[section='${filter.section}']`)?.length === 0;
|
|
321
354
|
|
|
322
355
|
if (isGA) this.cssClasses += `path[name="${tryFindRealName}"] {fill: ${color} !important}`;
|
|
323
|
-
else this.cssClasses += `path[
|
|
356
|
+
else this.cssClasses += `path[section="${filter.section}"] {stroke: ${color} !important}`;
|
|
324
357
|
} else {
|
|
325
358
|
this.cssClasses += filter.rows
|
|
326
359
|
.map(
|
|
327
|
-
(row) =>
|
|
328
|
-
`path[sectionname="${filter.section}"][row="${row}"] {stroke: ${color} !important}`
|
|
360
|
+
(row) => `path[section="${filter.section}"][row="${row}"] {stroke: ${color} !important}`
|
|
329
361
|
)
|
|
330
362
|
?.join("\n");
|
|
331
363
|
}
|
|
@@ -348,10 +380,10 @@ export default class FilterBuilder {
|
|
|
348
380
|
});
|
|
349
381
|
|
|
350
382
|
this.unselectable.forEach((unselectable) => {
|
|
351
|
-
const [
|
|
352
|
-
log("UpdateCSS: adding unselectable",
|
|
383
|
+
const [section, row] = unselectable.split("/");
|
|
384
|
+
log("UpdateCSS: adding unselectable", section, row);
|
|
353
385
|
const color = colors.UNSELECTABLE;
|
|
354
|
-
this.cssClasses += `path[
|
|
386
|
+
this.cssClasses += `path[section="${section}"][row="${row}"] {stroke: ${color} !important} `;
|
|
355
387
|
});
|
|
356
388
|
log(this.cssClasses);
|
|
357
389
|
}
|
|
@@ -372,11 +404,7 @@ export default class FilterBuilder {
|
|
|
372
404
|
if (f.section !== section && f.section !== gaSectionNameMapping[section]) return false;
|
|
373
405
|
return true;
|
|
374
406
|
});
|
|
375
|
-
|
|
376
|
-
// (f.section === section &&
|
|
377
|
-
// document.querySelectorAll(`path[sectionname="${section}"]`).length ===
|
|
378
|
-
// f.rows.length)) &&
|
|
379
|
-
// this.isForCurrentEvent(f)
|
|
407
|
+
|
|
380
408
|
if (matchingFilter) {
|
|
381
409
|
log(`Filter for ${section} already exists (${matchingFilter.id})`);
|
|
382
410
|
if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
|
|
@@ -396,9 +424,14 @@ export default class FilterBuilder {
|
|
|
396
424
|
event: this.currentEventId
|
|
397
425
|
});
|
|
398
426
|
} else {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
427
|
+
const reverseMapping = getReverseSectionNameMapping();
|
|
428
|
+
const sections = reverseMapping[section.trim()] || [section.trim()];
|
|
429
|
+
log("labelHandler: non-ga", sections, section);
|
|
430
|
+
sections.forEach((s) => {
|
|
431
|
+
this.addFilter({
|
|
432
|
+
section: s,
|
|
433
|
+
event: this.currentEventId
|
|
434
|
+
});
|
|
402
435
|
});
|
|
403
436
|
}
|
|
404
437
|
log("Added labelHandler filter", section);
|
|
@@ -442,62 +475,6 @@ export default class FilterBuilder {
|
|
|
442
475
|
}
|
|
443
476
|
}
|
|
444
477
|
|
|
445
|
-
addRowHandlers() {
|
|
446
|
-
for (let i = 0; i < this.rows.length; i++) {
|
|
447
|
-
const row = this.rows[i];
|
|
448
|
-
row.onclick = () => {
|
|
449
|
-
const parsed = {
|
|
450
|
-
section: row.attributes.sectionname.nodeValue,
|
|
451
|
-
row: row.attributes.row.nodeValue,
|
|
452
|
-
id: row.attributes.id.nodeValue
|
|
453
|
-
};
|
|
454
|
-
log(`Adding filter ${parsed.section}/${parsed.row}`);
|
|
455
|
-
const matchingFilter = this.filters.find(
|
|
456
|
-
(f) =>
|
|
457
|
-
this.isForCurrentEvent(f) &&
|
|
458
|
-
f.section === parsed.section &&
|
|
459
|
-
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
460
|
-
);
|
|
461
|
-
if (matchingFilter) {
|
|
462
|
-
log(`Filter for ${parsed.section}/${parsed.row} already exists (${matchingFilter.id})`);
|
|
463
|
-
if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
|
|
464
|
-
else this.setExpandedFilter(matchingFilter.id);
|
|
465
|
-
this.updateCss();
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (this.isUnselectable(parsed.section, parsed.row)) return;
|
|
470
|
-
|
|
471
|
-
this.addFilter({
|
|
472
|
-
section: parsed.section,
|
|
473
|
-
rows: [parsed.row],
|
|
474
|
-
event: this.currentEventId
|
|
475
|
-
});
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
row.onmouseover = () => {
|
|
479
|
-
const parsed = {
|
|
480
|
-
section: row.attributes.sectionname.nodeValue,
|
|
481
|
-
row: row.attributes.row.nodeValue,
|
|
482
|
-
id: row.attributes.id.nodeValue
|
|
483
|
-
};
|
|
484
|
-
const matchingFilter = this.filters.find(
|
|
485
|
-
(f) =>
|
|
486
|
-
this.isForCurrentEvent(f) &&
|
|
487
|
-
f.section === parsed.section &&
|
|
488
|
-
(f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
|
|
489
|
-
);
|
|
490
|
-
if (!matchingFilter) return;
|
|
491
|
-
if (Array.isArray(matchingFilter.rows))
|
|
492
|
-
matchingFilter.rows.forEach((row) => this.highlight({ section: parsed.section, row: row }));
|
|
493
|
-
else this.highlight({ section: matchingFilter.section });
|
|
494
|
-
};
|
|
495
|
-
row.onmouseout = () => {
|
|
496
|
-
if (!this.isDragging) this.clearHighlight();
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
478
|
deleteFilterById(id) {
|
|
502
479
|
this.filters = this.filters.filter((f) => f.id !== id);
|
|
503
480
|
// this.updateHooks = this.updateHooks.filter((i) => id !== i);
|
|
@@ -541,9 +518,9 @@ export default class FilterBuilder {
|
|
|
541
518
|
if (this.filters.find((f) => f.section === filter.name)) return;
|
|
542
519
|
newCSS += `path[name="${filter.section || filter.name}"] {fill: ${colors.HIGHLIGHT} !important}`;
|
|
543
520
|
} else if (filter.row) {
|
|
544
|
-
newCSS += `path[
|
|
521
|
+
newCSS += `path[section="${filter.section}"][row="${filter.row}"] {stroke: ${colors.HIGHLIGHT} !important}`;
|
|
545
522
|
} else {
|
|
546
|
-
newCSS += `path[
|
|
523
|
+
newCSS += `path[section="${filter.section}"] {stroke: ${colors.HIGHLIGHT} !important}`;
|
|
547
524
|
}
|
|
548
525
|
this.temporaryCSS += newCSS;
|
|
549
526
|
}
|
|
@@ -551,13 +528,4 @@ export default class FilterBuilder {
|
|
|
551
528
|
clearHighlight() {
|
|
552
529
|
this.temporaryCSS = "";
|
|
553
530
|
}
|
|
554
|
-
|
|
555
|
-
makeRowUnselectable(section, row) {
|
|
556
|
-
log("adding unselectable:", section, row);
|
|
557
|
-
this.unselectable.push(`${section}/${row}`);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
isUnselectable(section, row) {
|
|
561
|
-
return this.unselectable.includes(`${section}/${row}`);
|
|
562
|
-
}
|
|
563
531
|
}
|
package/src/stores/logger.js
CHANGED
|
@@ -18,7 +18,6 @@ const LOG_COLORS = {
|
|
|
18
18
|
yellow: "color: #ffbb33; font-weight: bold", // Yellow
|
|
19
19
|
reset: ""
|
|
20
20
|
};
|
|
21
|
-
|
|
22
21
|
class Logger {
|
|
23
22
|
constructor() {
|
|
24
23
|
this.ENABLED = true;
|
|
@@ -45,11 +44,20 @@ class Logger {
|
|
|
45
44
|
|
|
46
45
|
args.unshift(timestamp);
|
|
47
46
|
|
|
47
|
+
// Format objects for console output
|
|
48
|
+
const formattedArgs = args.map((arg) => {
|
|
49
|
+
if (typeof arg === "object" && arg !== null) {
|
|
50
|
+
console.log(arg._value ? arg._value : arg);
|
|
51
|
+
return arg;
|
|
52
|
+
}
|
|
53
|
+
return arg;
|
|
54
|
+
});
|
|
55
|
+
|
|
48
56
|
// For styled console output in browser
|
|
49
57
|
if (style) {
|
|
50
|
-
console.log(`%c${
|
|
58
|
+
console.log(`%c${formattedArgs.join(" ")}`, style);
|
|
51
59
|
} else {
|
|
52
|
-
console.log(...
|
|
60
|
+
console.log(...formattedArgs);
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
63
|
|
package/src/stores/ui.js
CHANGED
|
@@ -202,22 +202,16 @@ export const useUIStore = defineStore("ui", () => {
|
|
|
202
202
|
|
|
203
203
|
let relevantTasks = Object.values(tasks.value).filter((t) => t.siteId === currentCountry.value.siteId);
|
|
204
204
|
if (currentEvent.value) relevantTasks = relevantTasks.filter((t) => t.eventId === currentEvent.value);
|
|
205
|
-
// logger.Info("mqm tasks:", relevantTasks);
|
|
206
|
-
const tasksInQueue = relevantTasks.filter((t) => t.status.includes(" - ETA:"));
|
|
207
205
|
|
|
208
206
|
queueStats.value.total = 0;
|
|
209
|
-
queueStats.value.queued =
|
|
210
|
-
tasksInQueue.length + relevantTasks.filter((t) => t.status?.toLowerCase()?.includes("queueit")).length || 0;
|
|
207
|
+
queueStats.value.queued = relevantTasks.filter((t) => t.inQueue).length || 0;
|
|
211
208
|
queueStats.value.show = queueStats.value.total > 0;
|
|
212
209
|
const sleepingStatuses = ["sleeping in queue", "waiting for drop", "waiting for carting", "waiting for queue"];
|
|
213
210
|
queueStats.value.sleeping = relevantTasks.filter((t) =>
|
|
214
211
|
sleepingStatuses.includes(t.status.toLowerCase())
|
|
215
212
|
).length;
|
|
216
|
-
const positions =
|
|
217
|
-
.map((t) => parseInt(t.status.split(" users ahead - ETA:")[0]))
|
|
218
|
-
.filter((e) => !isNaN(e));
|
|
213
|
+
const positions = relevantTasks.map((t) => t.queuePosition).filter((e) => !isNaN(e));
|
|
219
214
|
queueStats.value.nextQueuePasses = positions.sort((a, b) => a - b);
|
|
220
|
-
// logger.Info("Refreshing queue stats", queueStats.value);
|
|
221
215
|
};
|
|
222
216
|
|
|
223
217
|
const toggleModal = (name, clearValue = false) => {
|
|
@@ -48,13 +48,6 @@
|
|
|
48
48
|
</div>
|
|
49
49
|
<div class="col-span-2 mt-10">
|
|
50
50
|
<div class="flex justify-between mb-2 items-center text-white">
|
|
51
|
-
<button
|
|
52
|
-
@click="filterBuilder.selectFirstRow"
|
|
53
|
-
class="border-2 rounded border-dark-550 px-1 h-8 w-full min-w-14 text-gray bg-dark-500 overflow-hidden smooth-hover"
|
|
54
|
-
>
|
|
55
|
-
First rows
|
|
56
|
-
</button>
|
|
57
|
-
|
|
58
51
|
<div class="rounded flex justify-between gap-2 items-center" v-if="hasLoaded">
|
|
59
52
|
<PriceSortToggle
|
|
60
53
|
:current="filterBuilder.globalFilter.priceSort"
|
|
@@ -178,135 +171,135 @@ const activeModal = computed(() => ui.activeModal);
|
|
|
178
171
|
const ui = useUIStore();
|
|
179
172
|
const hasLoaded = ref(false);
|
|
180
173
|
|
|
181
|
-
let isShiftPressed = false;
|
|
182
|
-
window.onkeyup = (e) => {
|
|
183
|
-
|
|
184
|
-
};
|
|
185
|
-
window.onkeydown = (e) => {
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const doDragSelect = () => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
174
|
+
// let isShiftPressed = false;
|
|
175
|
+
// window.onkeyup = (e) => {
|
|
176
|
+
// if (e.keyCode === 16) isShiftPressed = false;
|
|
177
|
+
// };
|
|
178
|
+
// window.onkeydown = (e) => {
|
|
179
|
+
// if (e.keyCode === 16) isShiftPressed = true;
|
|
180
|
+
// };
|
|
181
|
+
|
|
182
|
+
// const doDragSelect = () => {
|
|
183
|
+
// // https://dragselect.com/docs/API/Settings
|
|
184
|
+
// const ds = new DragSelect({
|
|
185
|
+
// selectables: [
|
|
186
|
+
// ...document.querySelectorAll("path[row]"),
|
|
187
|
+
// ...document.querySelectorAll("path[generaladmission]")
|
|
188
|
+
// ],
|
|
189
|
+
// area: document.getElementById("svg-wrapper"),
|
|
190
|
+
// selectionThreshold: 0.1,
|
|
191
|
+
// multiSelectKeys: []
|
|
192
|
+
// });
|
|
193
|
+
|
|
194
|
+
// ds.subscribe("DS:start:pre", () => {
|
|
195
|
+
// // ui.logger.Info("DS:start:pre - shift pressed:", isShiftPressed);
|
|
196
|
+
// if (!isShiftPressed) {
|
|
197
|
+
// ds.stop(false, false);
|
|
198
|
+
// ds.start();
|
|
199
|
+
// } else {
|
|
200
|
+
// panzoomInstance.pause();
|
|
201
|
+
// }
|
|
202
|
+
// });
|
|
203
|
+
|
|
204
|
+
// const parseSelected = (items) => {
|
|
205
|
+
// const parsed = items
|
|
206
|
+
// .map((e) => {
|
|
207
|
+
// return {
|
|
208
|
+
// section: e.attributes.sectionname?.nodeValue || e.attributes.name?.nodeValue,
|
|
209
|
+
// row: e.attributes.row?.nodeValue,
|
|
210
|
+
// GA: e.attributes.generaladmission?.nodeValue,
|
|
211
|
+
// name: e.attributes.name?.nodeValue
|
|
212
|
+
// };
|
|
213
|
+
// })
|
|
214
|
+
// .filter((e) => !filterBuilder.value.isUnselectable(e.section, e.row));
|
|
215
|
+
|
|
216
|
+
// const sectionMapping = {};
|
|
217
|
+
// parsed
|
|
218
|
+
// .filter((p) => !p.GA)
|
|
219
|
+
// .forEach((p) => {
|
|
220
|
+
// if (!sectionMapping[p.section]) sectionMapping[p.section] = [];
|
|
221
|
+
// sectionMapping[p.section].push(p);
|
|
222
|
+
// });
|
|
223
|
+
// parsed
|
|
224
|
+
// .filter((p) => p.GA)
|
|
225
|
+
// .forEach((p) => {
|
|
226
|
+
// sectionMapping[p.section] = {
|
|
227
|
+
// GA: true,
|
|
228
|
+
// section: p.section,
|
|
229
|
+
// name: p.name
|
|
230
|
+
// };
|
|
231
|
+
// });
|
|
232
|
+
// return sectionMapping;
|
|
233
|
+
// };
|
|
234
|
+
|
|
235
|
+
// ds.subscribe("DS:update:pre", (e) => {
|
|
236
|
+
// // ui.logger.Info("DS:update:pre - shift pressed:", isShiftPressed, e.items);
|
|
237
|
+
// filterBuilder.value.isDragging = true;
|
|
238
|
+
// if (!isShiftPressed) return;
|
|
239
|
+
// const sectionMapping = parseSelected(e.items);
|
|
240
|
+
// filterBuilder.value.clearHighlight();
|
|
241
|
+
// Object.entries(sectionMapping).forEach(([section, rows]) => {
|
|
242
|
+
// if (rows.GA) {
|
|
243
|
+
// const isSelected = filterBuilder.value.filters.find(
|
|
244
|
+
// (f) => filterBuilder.value.isForCurrentEvent(f) && f.section === section
|
|
245
|
+
// );
|
|
246
|
+
// if (isSelected) return;
|
|
247
|
+
// filterBuilder.value.highlight({ section: section }, true);
|
|
248
|
+
// } else
|
|
249
|
+
// rows.forEach((row) => {
|
|
250
|
+
// const isSelected = filterBuilder.value.filters.find(
|
|
251
|
+
// (f) =>
|
|
252
|
+
// (f.section === section && f.rows?.includes(row.row)) ||
|
|
253
|
+
// (!f.rows && f.section === section && filterBuilder.value.isForCurrentEvent(f))
|
|
254
|
+
// );
|
|
255
|
+
// if (isSelected) return;
|
|
256
|
+
|
|
257
|
+
// filterBuilder.value.highlight({ section, row: row.row });
|
|
258
|
+
// });
|
|
259
|
+
// });
|
|
260
|
+
// });
|
|
261
|
+
|
|
262
|
+
// ds.subscribe("DS:end", (e) => {
|
|
263
|
+
// filterBuilder.value.isDragging = false;
|
|
264
|
+
// panzoomInstance.resume();
|
|
265
|
+
// filterBuilder.value.clearHighlight();
|
|
266
|
+
// [...document.querySelectorAll("path")].map((f) => (f.style = ""));
|
|
267
|
+
// if (!isShiftPressed) return;
|
|
268
|
+
// const sectionMapping = parseSelected(e.items);
|
|
269
|
+
// const secNameMapping = filterBuilder.value.getSectionNameMapping();
|
|
270
|
+
|
|
271
|
+
// Object.entries(sectionMapping).forEach(([section, rows]) => {
|
|
272
|
+
// if (rows.GA) {
|
|
273
|
+
// const isSelected = filterBuilder.value.filters.find(
|
|
274
|
+
// (f) => filterBuilder.value.isForCurrentEvent(f) && f.section === secNameMapping[section]
|
|
275
|
+
// );
|
|
276
|
+
// if (isSelected) return;
|
|
277
|
+
// filterBuilder.value.addFilter({
|
|
278
|
+
// event: filterBuilder.value.currentEventId,
|
|
279
|
+
// section: secNameMapping[section]
|
|
280
|
+
// });
|
|
281
|
+
// } else {
|
|
282
|
+
// const unselectedRows = [];
|
|
283
|
+
// rows.forEach((row) => {
|
|
284
|
+
// const isSelected = filterBuilder.value.filters.find(
|
|
285
|
+
// (f) =>
|
|
286
|
+
// (f.section === section && f.rows?.includes(row.row)) ||
|
|
287
|
+
// (!f.rows && f.section === section && filterBuilder.value.isForCurrentEvent(f))
|
|
288
|
+
// );
|
|
289
|
+
// if (isSelected) return;
|
|
290
|
+
// unselectedRows.push(row.row);
|
|
291
|
+
// });
|
|
292
|
+
// if (unselectedRows.length === 0) return;
|
|
293
|
+
// filterBuilder.value.addFilter({
|
|
294
|
+
// event: filterBuilder.value.currentEventId,
|
|
295
|
+
// section,
|
|
296
|
+
// rows: unselectedRows
|
|
297
|
+
// });
|
|
298
|
+
// }
|
|
299
|
+
// });
|
|
300
|
+
// isShiftPressed = false;
|
|
301
|
+
// });
|
|
302
|
+
// };
|
|
310
303
|
|
|
311
304
|
const panzoomOptions = {
|
|
312
305
|
maxZoom: 8, // max zoom-in facor
|
|
@@ -349,7 +342,6 @@ const updateShownVenue = async () => {
|
|
|
349
342
|
return;
|
|
350
343
|
}
|
|
351
344
|
|
|
352
|
-
debugger;
|
|
353
345
|
renderer = rendererFactory.createRenderer(eventId.value, "", country);
|
|
354
346
|
filterBuilder.value.highlightedSeatColor = renderer.c.highlightedSeatColor;
|
|
355
347
|
renderer.c.logFullError = true;
|
|
@@ -384,7 +376,7 @@ const updateShownVenue = async () => {
|
|
|
384
376
|
await nextTick();
|
|
385
377
|
await loadFilter();
|
|
386
378
|
filterBuilder.value.reload(eventId.value);
|
|
387
|
-
doDragSelect();
|
|
379
|
+
// doDragSelect();
|
|
388
380
|
};
|
|
389
381
|
|
|
390
382
|
const loadFilter = async () => {
|