Add player control-plane and dashboard updates

This commit is contained in:
2026-08-07 22:23:46 +01:00
parent 433be06bc7
commit 0801c119ae
36 changed files with 2301 additions and 228 deletions
+52
View File
@@ -71,4 +71,56 @@ test('dashboard state counts active players from the registry heartbeat', async
player_identifier: 'player-alpha',
player_url: 'http://player.local'
});
});
test('dashboard state keeps other screens when one subscription fails', async () => {
const service = createDashboardStateService({
pool: {
async query(sql) {
if (String(sql || '').includes('COUNT(*) AS connected_count')) {
return [[{ connected_count: 0 }]];
}
if (String(sql || '').includes('SELECT s.slug, pod.device_id, pod.client_name')) {
return [[]];
}
return [[]];
}
},
common: {
async fetchAdminData() {
return {
screens: [
{ slug: 'alpha', name: 'Alpha' },
{ slug: 'beta', name: 'Beta' }
],
playlists: [],
slides: []
};
},
async fetchScreenPlayerUrls() {
return {};
},
async fetchPlayerRegistrations() {
return [];
}
},
playerSnapshotCache: new Map([
['beta', { count: 1, connections: [{ id: 'beta-conn', clientId: 'beta-conn' }] }]
]),
playerSnapshotSockets: new Map(),
ensurePlayerSnapshotSubscription(slug) {
if (slug === 'alpha') {
throw new Error('subscription failed');
}
},
formatDashboardDate(value) {
return String(value || '');
}
});
const state = await service.buildDashboardState();
assert.equal(state.screens.length, 2);
assert.equal(state.clients.length, 1);
assert.equal(state.clients[0].screen_slug, 'beta');
});