From c0197cdfebee4ffa152b75dd4764ecee288efbe8 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 25 Nov 2024 12:12:16 +0100 Subject: [PATCH 1/2] fix(ui): sessions list persist page, show latest sessions (#2777) --- .../SessionsTabOverview/SessionsTabOverview.tsx | 6 ++++-- .../LatestSessionsMessage.tsx | 7 ++++++- frontend/app/mstore/searchStore.ts | 14 ++++++++------ frontend/app/mstore/sessionStore.ts | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/frontend/app/components/shared/SessionsTabOverview/SessionsTabOverview.tsx b/frontend/app/components/shared/SessionsTabOverview/SessionsTabOverview.tsx index e8bbca617..58c49b61a 100644 --- a/frontend/app/components/shared/SessionsTabOverview/SessionsTabOverview.tsx +++ b/frontend/app/components/shared/SessionsTabOverview/SessionsTabOverview.tsx @@ -37,9 +37,11 @@ function SessionsTabOverview() { ) : null}
- {!isNotesRoute ? ( - + <> + + + ) : ( )} diff --git a/frontend/app/components/shared/SessionsTabOverview/components/LatestSessionsMessage/LatestSessionsMessage.tsx b/frontend/app/components/shared/SessionsTabOverview/components/LatestSessionsMessage/LatestSessionsMessage.tsx index 4215b9344..03b55e3b1 100644 --- a/frontend/app/components/shared/SessionsTabOverview/components/LatestSessionsMessage/LatestSessionsMessage.tsx +++ b/frontend/app/components/shared/SessionsTabOverview/components/LatestSessionsMessage/LatestSessionsMessage.tsx @@ -7,11 +7,16 @@ import { observer } from 'mobx-react-lite'; function LatestSessionsMessage() { const { searchStore } = useStore(); const count = searchStore.latestList.size; + + const onShowNewSessions = () => { + void searchStore.updateCurrentPage(1, true); + }; + return count > 0 ? (
searchStore.updateCurrentPage(1)} + onClick={onShowNewSessions} > Show {numberWithCommas(count)} New {count > 1 ? 'Sessions' : 'Session'}
diff --git a/frontend/app/mstore/searchStore.ts b/frontend/app/mstore/searchStore.ts index 8ce0a0c14..87dca78c2 100644 --- a/frontend/app/mstore/searchStore.ts +++ b/frontend/app/mstore/searchStore.ts @@ -162,15 +162,14 @@ class SearchStore { }); } - updateCurrentPage(page: number) { + updateCurrentPage(page: number, force = false) { this.currentPage = page; - void this.fetchSessions(); + void this.fetchSessions(force); } setActiveTab(tab: string) { runInAction(() => { this.activeTab = TAB_MAP[tab]; - this.currentPage = 1; }); } @@ -233,8 +232,9 @@ class SearchStore { filter.endTimestamp = newTimestamps.endDate; } searchService.checkLatestSessions(filter).then((response: any) => { - this.latestList = response; - this.latestRequestTime = Date.now(); + runInAction(() => { + this.latestList = List(response); + }); }); } @@ -265,7 +265,7 @@ class SearchStore { } if (filter.value && filter.value[0] && filter.value[0] !== '') { - this.fetchSessions(); + void this.fetchSessions(); } } @@ -336,6 +336,8 @@ class SearchStore { filter.filters = filter.filters.concat(tagFilter); } + this.latestRequestTime = Date.now(); + await sessionStore.fetchSessions({ ...filter, page: this.currentPage, diff --git a/frontend/app/mstore/sessionStore.ts b/frontend/app/mstore/sessionStore.ts index c01c8ae7d..2a9d12cbc 100644 --- a/frontend/app/mstore/sessionStore.ts +++ b/frontend/app/mstore/sessionStore.ts @@ -170,7 +170,7 @@ export default class SessionStore { } const nextEntryNum = keys.length > 0 - ? Math.max(...keys.map((key) => this.prefetchedMobUrls[key].entryNum || 0)) + 1 + ? Math.max(...keys.map((key) => this.prefetchedMobUrls[key]?.entryNum || 0)) + 1 : 0; this.prefetchedMobUrls[sessionId] = { data: fileData, From 954bfbf8f7ed72bebe909adb4b098171f03ba963 Mon Sep 17 00:00:00 2001 From: Mehdi Osman Date: Mon, 25 Nov 2024 06:22:33 -0500 Subject: [PATCH 2/2] Increment frontend chart version (#2778) Co-authored-by: GitHub Action --- scripts/helmcharts/openreplay/charts/frontend/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helmcharts/openreplay/charts/frontend/Chart.yaml b/scripts/helmcharts/openreplay/charts/frontend/Chart.yaml index aeb1a1d43..254200d2a 100644 --- a/scripts/helmcharts/openreplay/charts/frontend/Chart.yaml +++ b/scripts/helmcharts/openreplay/charts/frontend/Chart.yaml @@ -18,4 +18,4 @@ version: 0.1.10 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -AppVersion: "v1.21.2" +AppVersion: "v1.21.3"