Fix public display not showing queue stats and ticket data.
Deploy Ladill Queue / deploy (push) Successful in 43s
Deploy Ladill Queue / deploy (push) Successful in 43s
Server-render initial payload, poll with same-origin relative URLs, fall back to branch queues when none assigned, and improve contrast so stats remain visible if custom CSS is missing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -94,24 +94,38 @@ export function registerKioskFlow(Alpine) {
|
||||
}));
|
||||
|
||||
Alpine.data('displayBoard', (config = {}) => ({
|
||||
payload: null,
|
||||
payload: config.initial ?? null,
|
||||
announcedIds: {},
|
||||
isAnnouncing: false,
|
||||
speechReady: false,
|
||||
voices: [],
|
||||
clock: '',
|
||||
dateLabel: '',
|
||||
pollError: null,
|
||||
dataUrl: typeof config === 'string' ? config : config.dataUrl,
|
||||
playedUrlTemplate: config.playedUrl ?? null,
|
||||
pollMs: config.pollMs ?? 1200,
|
||||
csrf: config.csrf ?? document.querySelector('meta[name="csrf-token"]')?.content ?? '',
|
||||
|
||||
formatCount(value) {
|
||||
return value === null || value === undefined ? '—' : String(value);
|
||||
},
|
||||
|
||||
formatWait(minutes) {
|
||||
return minutes === null || minutes === undefined ? '—' : String(minutes);
|
||||
},
|
||||
|
||||
async poll() {
|
||||
try {
|
||||
const res = await fetch(this.dataUrl, { headers: { Accept: 'application/json' } });
|
||||
if (! res.ok) {
|
||||
throw new Error(`Display poll failed (${res.status})`);
|
||||
}
|
||||
this.payload = await res.json();
|
||||
this.pollError = null;
|
||||
this.maybeAnnounce(this.payload?.announcements ?? []);
|
||||
} catch (e) {
|
||||
this.pollError = e.message || 'Could not refresh display data';
|
||||
console.error('Display poll failed', e);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user