Skip to content

Commit f4e4d11

Browse files
committed
chore(signage): add some logging for debugging
1 parent 22c2416 commit f4e4d11

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

apps/signage/src/app/bootstrap.component.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
firstTruthyValueFrom,
77
i18n,
88
Identity,
9+
log,
910
OrganisationService,
1011
} from '@placeos/common';
1112
import { PlaceSystem, querySystems } from '@placeos/ts-client';
@@ -196,15 +197,18 @@ export class BootstrapComponent extends AsyncHandler implements OnInit {
196197
'route.query',
197198
this._route.queryParamMap.subscribe((params) => {
198199
if (params.has('clear') && params.get('clear') === 'true') {
200+
log('BOOTSTRAP', 'Bootstrapped data clear');
199201
localStorage.removeItem(STORE_DISPLAY_KEY);
200202
localStorage.removeItem(STORE_BUILDING_KEY);
201203
}
202204
if (params.has('building')) {
203205
this.setBuilding(params.get('building'));
206+
log('BOOTSTRAP', 'Bootstrapped data for building set');
204207
}
205208
if (params.has('display')) {
206209
this.active_display = params.get('display');
207-
this.bootstrapKiosk();
210+
log('BOOTSTRAP', 'Bootstrapped data for display set');
211+
this.bootstrapPanel();
208212
}
209213
}),
210214
);
@@ -220,7 +224,7 @@ export class BootstrapComponent extends AsyncHandler implements OnInit {
220224
/**
221225
* Store bootstrapped values and navigate to the main page
222226
*/
223-
public async bootstrapKiosk() {
227+
public async bootstrapPanel() {
224228
this.loading.set(i18n('APP.SIGNAGE.BOOTSTRAP_LOADING'));
225229
const bld = await firstTruthyValueFrom(this.active_building);
226230
if (!bld?.id || !this.active_display || !localStorage) {
@@ -229,6 +233,10 @@ export class BootstrapComponent extends AsyncHandler implements OnInit {
229233
}
230234
localStorage.setItem(STORE_BUILDING_KEY, bld.id);
231235
localStorage.setItem(STORE_DISPLAY_KEY, this.active_display);
236+
log(
237+
'BOOTSTRAP',
238+
`Bootstrapped panel to building "${bld.id}" and display ${this.active_display}`,
239+
);
232240
this._router.navigate(['/signage', this.active_display]);
233241
this.loading.set('');
234242
}
@@ -242,6 +250,10 @@ export class BootstrapComponent extends AsyncHandler implements OnInit {
242250
const display_id = localStorage?.getItem(STORE_DISPLAY_KEY);
243251

244252
if (bld_id && display_id) {
253+
log(
254+
'BOOTSTRAP',
255+
`Application already bootstrapped to building "${bld_id}" and display ${display_id}`,
256+
);
245257
this._router.navigate(['/signage', display_id]);
246258
}
247259
VirtualKeyboardComponent.enabled =

apps/signage/src/app/signage.component.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CommonModule } from '@angular/common';
22
import { Component, inject, OnInit, signal } from '@angular/core';
33
import { ActivatedRoute, Router } from '@angular/router';
4-
import { AsyncHandler, SettingsService } from '@placeos/common';
4+
import { AsyncHandler, log, SettingsService } from '@placeos/common';
55
import { time } from './media-helpers';
66
import { MediaPlayerComponent } from './media-player.component';
77
import { MediaEvent, SignageService } from './signage.service';
@@ -58,13 +58,23 @@ export class SignagePanelComponent extends AsyncHandler implements OnInit {
5858
public ngOnInit() {
5959
this.timeout(
6060
'not-bootstrapped',
61-
() => this._router.navigate(['/bootstrap']),
61+
() => {
62+
log(
63+
'SIGNAGE',
64+
'Panel not bootstrapped after 3 seconds. Redirecting...',
65+
);
66+
this._router.navigate(['/bootstrap']);
67+
},
6268
3000,
6369
);
6470
this.subscription(
6571
'route.params',
6672
this._route.paramMap.subscribe((params) => {
6773
if (params.has('system_id')) {
74+
log(
75+
'SIGNAGE',
76+
`Display set to "${params.get('system_id')}"`,
77+
);
6878
this._signage.setDisplay(params.get('system_id'));
6979
this.clearTimeout('not-bootstrapped');
7080
}

0 commit comments

Comments
 (0)