From 8597dd812aefc8b1442fa27b588bfb5c1633cf1b Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 13:46:05 +0530 Subject: [PATCH 01/11] added a checking for the 'signalReadyForRendering' --- edge-apps/tfl-bus-status/static/js/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 0c8402d0..8ede3cfe 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -227,8 +227,12 @@ async function fetchBusData () { busArrival.innerHTML = error document.querySelector('.bus-list').classList.add('hidden') } - // Send signal to load the screen once content is ready. - screenly.signalReadyForRendering() + + // Send signal to load the screen once content is ready, if the function exists. + if (typeof screenly !== 'undefined' && typeof screenly.signalReadyForRendering === 'function') { + screenly.signalReadyForRendering() + } + } /* From 2f2543e17147e9bba4223017701c632892391fa4 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 13:56:45 +0530 Subject: [PATCH 02/11] fix js lint --- edge-apps/tfl-bus-status/static/js/script.js | 1 - 1 file changed, 1 deletion(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 8ede3cfe..2b86f7ae 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -232,7 +232,6 @@ async function fetchBusData () { if (typeof screenly !== 'undefined' && typeof screenly.signalReadyForRendering === 'function') { screenly.signalReadyForRendering() } - } /* From 87157c651d0ed61834710c62399c1456ffc14f77 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 20:15:07 +0530 Subject: [PATCH 03/11] adding sentry dsn as setting --- edge-apps/tfl-bus-status/screenly.yml | 16 ++++++++++++++++ edge-apps/tfl-bus-status/static/js/script.js | 1 + 2 files changed, 17 insertions(+) diff --git a/edge-apps/tfl-bus-status/screenly.yml b/edge-apps/tfl-bus-status/screenly.yml index cc902f6a..0a890658 100644 --- a/edge-apps/tfl-bus-status/screenly.yml +++ b/edge-apps/tfl-bus-status/screenly.yml @@ -24,3 +24,19 @@ settings: help_text: | You can find your bus stop here: https://playground.srly.io/edge-apps/helpers/tfl/bus-stop-lookup/ +<<<<<<< HEAD +======= + sentry_dsn: + type: secret + title: Sentry Client Key + optional: true + is_global: true + help_text: Sentry Client Key from Sentry SDK. + screenly_render_notification: + type: string + default_value: "1" + title: Requires ready for rendering + optional: true + help_text: | + Leave as is. +>>>>>>> 2154fe3 (adding sentry dsn as setting) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 2b86f7ae..0ca881da 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -3,6 +3,7 @@ const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API const stopId = screenly.settings.stop_id const apiKey = screenly.settings.tfl_api_token +const sentryDsn = screenly.settings.sentry_dsn async function getCachedData (url, cacheKey) { const cachedData = JSON.parse(localStorage.getItem(cacheKey)) From 9a32501c0cdeeb6e5683a50942d84ba7afd4bc5b Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 20:18:12 +0530 Subject: [PATCH 04/11] Resolve git conflict From 9a7b89d89a1bbd934f674d33a494f70b69b9f0f7 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 20:21:09 +0530 Subject: [PATCH 05/11] adding sentry dsn as setting --- edge-apps/tfl-bus-status/screenly.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/edge-apps/tfl-bus-status/screenly.yml b/edge-apps/tfl-bus-status/screenly.yml index 0a890658..39e67a9b 100644 --- a/edge-apps/tfl-bus-status/screenly.yml +++ b/edge-apps/tfl-bus-status/screenly.yml @@ -24,8 +24,6 @@ settings: help_text: | You can find your bus stop here: https://playground.srly.io/edge-apps/helpers/tfl/bus-stop-lookup/ -<<<<<<< HEAD -======= sentry_dsn: type: secret title: Sentry Client Key @@ -39,4 +37,3 @@ settings: optional: true help_text: | Leave as is. ->>>>>>> 2154fe3 (adding sentry dsn as setting) From d1d7c40d867328541e3c3409c50f9d923e88aeaf Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 10 Sep 2024 20:49:27 +0530 Subject: [PATCH 06/11] fix git conflict with reset to head one --- edge-apps/tfl-bus-status/static/js/script.js | 1 - 1 file changed, 1 deletion(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 0ca881da..2b86f7ae 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -3,7 +3,6 @@ const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API const stopId = screenly.settings.stop_id const apiKey = screenly.settings.tfl_api_token -const sentryDsn = screenly.settings.sentry_dsn async function getCachedData (url, cacheKey) { const cachedData = JSON.parse(localStorage.getItem(cacheKey)) From 07872dffb66553774ead1ddb970671a202057fc5 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Fri, 13 Sep 2024 12:08:37 +0530 Subject: [PATCH 07/11] fix git conflict with previous main commit --- edge-apps/tfl-bus-status/screenly.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/edge-apps/tfl-bus-status/screenly.yml b/edge-apps/tfl-bus-status/screenly.yml index 39e67a9b..6678da5a 100644 --- a/edge-apps/tfl-bus-status/screenly.yml +++ b/edge-apps/tfl-bus-status/screenly.yml @@ -29,11 +29,4 @@ settings: title: Sentry Client Key optional: true is_global: true - help_text: Sentry Client Key from Sentry SDK. - screenly_render_notification: - type: string - default_value: "1" - title: Requires ready for rendering - optional: true - help_text: | - Leave as is. + help_text: Sentry Client Key from Sentry SDK. \ No newline at end of file From bd45bce7cc1b25cd6b8312b22f1093b39b729c66 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Fri, 13 Sep 2024 12:18:46 +0530 Subject: [PATCH 08/11] remove the signalReadyForRendering checking since dsn moved to settings --- edge-apps/tfl-bus-status/static/js/script.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 2b86f7ae..2f998cf1 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -227,11 +227,7 @@ async function fetchBusData () { busArrival.innerHTML = error document.querySelector('.bus-list').classList.add('hidden') } - - // Send signal to load the screen once content is ready, if the function exists. - if (typeof screenly !== 'undefined' && typeof screenly.signalReadyForRendering === 'function') { - screenly.signalReadyForRendering() - } + screenly.signalReadyForRendering() } /* From af64a2b33f4201d6a110a85ef1808deacecddddc Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Sat, 14 Sep 2024 15:30:43 +0530 Subject: [PATCH 09/11] added sentry dsn as settings in yml and js --- edge-apps/tfl-bus-status/index.html | 2 +- edge-apps/tfl-bus-status/screenly.yml | 2 +- edge-apps/tfl-bus-status/static/js/script.js | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/edge-apps/tfl-bus-status/index.html b/edge-apps/tfl-bus-status/index.html index 5c7eccf2..be36dc35 100644 --- a/edge-apps/tfl-bus-status/index.html +++ b/edge-apps/tfl-bus-status/index.html @@ -68,7 +68,7 @@

+ - \ No newline at end of file diff --git a/edge-apps/tfl-bus-status/screenly.yml b/edge-apps/tfl-bus-status/screenly.yml index 6678da5a..0346fb7f 100644 --- a/edge-apps/tfl-bus-status/screenly.yml +++ b/edge-apps/tfl-bus-status/screenly.yml @@ -29,4 +29,4 @@ settings: title: Sentry Client Key optional: true is_global: true - help_text: Sentry Client Key from Sentry SDK. \ No newline at end of file + help_text: Sentry Client Key from Sentry SDK for error capturing. \ No newline at end of file diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 2f998cf1..52158f04 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -3,6 +3,15 @@ const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API const stopId = screenly.settings.stop_id const apiKey = screenly.settings.tfl_api_token +const sentryDsn = screenly.settings.sentry_dsn + +if (sentryDsn) { + Sentry.init({ + dsn: sentryDsn + }); +} else { + console.warn('Sentry DSN is not defined. Sentry will not be initialized.'); +} async function getCachedData (url, cacheKey) { const cachedData = JSON.parse(localStorage.getItem(cacheKey)) From 9b5adec07cc39ef0606ac8015b53203b09464a27 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Sat, 14 Sep 2024 15:38:39 +0530 Subject: [PATCH 10/11] fix lint and added sentry as global for lint --- edge-apps/tfl-bus-status/static/js/script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 52158f04..0ffcdc7e 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -1,16 +1,17 @@ -/* global screenly */ +/* global screenly, Sentry */ const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API const stopId = screenly.settings.stop_id const apiKey = screenly.settings.tfl_api_token const sentryDsn = screenly.settings.sentry_dsn +//Initiate Sentry. if (sentryDsn) { - Sentry.init({ - dsn: sentryDsn - }); + Sentry.init({ + dsn: sentryDsn + }) } else { - console.warn('Sentry DSN is not defined. Sentry will not be initialized.'); + console.warn('Sentry DSN is not defined. Sentry will not be initialized.') } async function getCachedData (url, cacheKey) { From 63486ef6519ed9ec208d1e625529aaef2eae3817 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Sat, 14 Sep 2024 16:11:24 +0530 Subject: [PATCH 11/11] fix lint --- edge-apps/tfl-bus-status/static/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edge-apps/tfl-bus-status/static/js/script.js b/edge-apps/tfl-bus-status/static/js/script.js index 0ffcdc7e..6c013871 100644 --- a/edge-apps/tfl-bus-status/static/js/script.js +++ b/edge-apps/tfl-bus-status/static/js/script.js @@ -3,9 +3,9 @@ const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API const stopId = screenly.settings.stop_id const apiKey = screenly.settings.tfl_api_token -const sentryDsn = screenly.settings.sentry_dsn +const sentryDsn = screenly.settings.sentry_dsn -//Initiate Sentry. +// Initiate Sentry. if (sentryDsn) { Sentry.init({ dsn: sentryDsn