From fd9a1a511e300458fc7e03670223a59cef3f78bb Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:17:16 -0300 Subject: [PATCH 1/4] fix: admin listeners navigating = true => false --- front/admin/src/routes/(online)/(app)/listeners/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte index 70ad2b69..b5031714 100644 --- a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte +++ b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte @@ -101,7 +101,7 @@ }))}` } - let navigating = true; + let navigating = false; const toggle_deployment = (item: Item) => { const target = deployment_toggle_link(item); From f26da8a0997d0d4f96362b9848b6985dea3d17e6 Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:19:11 -0300 Subject: [PATCH 2/4] fix: searchParams change on afterNavigate --- front/admin/src/routes/(online)/(app)/listeners/+page.svelte | 3 +++ 1 file changed, 3 insertions(+) diff --git a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte index b5031714..e3a6a42a 100644 --- a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte +++ b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte @@ -157,6 +157,9 @@ afterNavigate(() => { token++; last_update = Date.now(); + if(String(new URLSearchParams(location.search)) !== String(searchParams)) { + searchParams = new URLSearchParams(location.search); + } }) beforeNavigate(() => { From b1dd8696679f263bd4473a602af99438c3f7fde1 Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:20:24 -0300 Subject: [PATCH 3/4] fix: searchParams change on afterNavigate --- .../admin/src/routes/(online)/(app)/listeners/+page.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte index e3a6a42a..4214de86 100644 --- a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte +++ b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte @@ -107,13 +107,18 @@ const target = deployment_toggle_link(item); history.replaceState(history.state, "", target); navigating = true; + token++; + last_update = Date.now(); searchParams = new URLSearchParams(location.search) + sleep(5).then(() => navigating = false) } const toggle_station = (item: Item) => { const target = station_toggle_link(item); history.replaceState(history.state, "", target); navigating = true; + token++; + last_update = Date.now(); searchParams = new URLSearchParams(location.search) sleep(5).then(() => navigating = false) } @@ -122,6 +127,8 @@ const target = referer_toggle_link(ref); history.replaceState(history.state, "", target); navigating = true; + token++; + last_update = Date.now(); searchParams = new URLSearchParams(location.search) sleep(5).then(() => navigating = false) } From f4bc1a2ef3263b11db4b8bc641feb27a41198010 Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:23:01 -0300 Subject: [PATCH 4/4] feat: admin listeners add minutes to large durations --- front/admin/src/routes/(online)/(app)/listeners/+page.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte index 4214de86..5a97ee92 100644 --- a/front/admin/src/routes/(online)/(app)/listeners/+page.svelte +++ b/front/admin/src/routes/(online)/(app)/listeners/+page.svelte @@ -141,8 +141,9 @@ const ms = item.duration_ms != null ? item.duration_ms : (+$now - +new Date(item.created_at)); if(ms >= DAY) { const d = Math.floor(ms / DAY); - const h = Math.round((ms % DAY) / HOUR); - return `${d}d ${h}h`; + const h = Math.floor((ms % DAY) / HOUR); + const m = Math.round((ms % HOUR) / MIN); + return `${d}d ${h}h ${m}m`; } else if (ms >= HOUR) { const h = Math.floor(ms / HOUR); const m = Math.round((ms % HOUR) / MIN);