From 41b2c8277c3dc29110908a259a9814e0882346f0 Mon Sep 17 00:00:00 2001 From: ShiKhu Date: Wed, 2 Mar 2022 19:10:18 +0100 Subject: [PATCH 1/6] upd(frontend-assist): timeouts and socket pause condition --- .../app/player/MessageDistributor/managers/AssistManager.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/player/MessageDistributor/managers/AssistManager.ts b/frontend/app/player/MessageDistributor/managers/AssistManager.ts index 595cf3b3e..0b570fd87 100644 --- a/frontend/app/player/MessageDistributor/managers/AssistManager.ts +++ b/frontend/app/player/MessageDistributor/managers/AssistManager.ts @@ -100,7 +100,9 @@ export default class AssistManager { let inactiveTimeout: ReturnType | undefined if (document.hidden) { inactiveTimeout = setTimeout(() => { - if (document.hidden && getState().calling === CallingState.NoCall) { + const state = getState() + if (document.hidden && + (state.calling === CallingState.NoCall && state.remoteControl === RemoteControlStatus.Enabled)) { this.socket?.close() } }, 30000) @@ -169,7 +171,7 @@ export default class AssistManager { showDisconnectTimeout = setTimeout(() => { if (this.cleaned) { return } this.setStatus(ConnectionStatus.Disconnected) - }, 12000) + }, 30000) if (getState().remoteControl === RemoteControlStatus.Requesting || getState().remoteControl === RemoteControlStatus.Enabled) { From 4d3e4f8cb32788b53754613701a10f95273f3066 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 3 Mar 2022 15:26:41 +0100 Subject: [PATCH 2/6] fix(ui) - offline vs live header issue on refresh --- .../components/Session_/PlayerBlockHeader.js | 30 ++++++++----------- .../shared/SessionItem/SessionItem.js | 9 +----- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/frontend/app/components/Session_/PlayerBlockHeader.js b/frontend/app/components/Session_/PlayerBlockHeader.js index c29fc3085..abf94e11c 100644 --- a/frontend/app/components/Session_/PlayerBlockHeader.js +++ b/frontend/app/components/Session_/PlayerBlockHeader.js @@ -30,9 +30,9 @@ const ASSIST_ROUTE = assistRoute(); })) @connect((state, props) => { const isAssist = window.location.pathname.includes('/assist/'); - const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'); const session = state.getIn([ 'sessions', 'current' ]); return { + isAssist, session, sessionPath: state.getIn([ 'sessions', 'sessionPath' ]), loading: state.getIn([ 'sessions', 'toggleFavoriteRequest', 'loading' ]), @@ -42,7 +42,6 @@ const ASSIST_ROUTE = assistRoute(); local: state.getIn(['sessions', 'timezone']), funnelRef: state.getIn(['funnels', 'navRef']), siteId: state.getIn([ 'user', 'siteId' ]), - hasSessionsPath: hasSessioPath && !isAssist, metaList: state.getIn(['customFields', 'list']).map(i => i.key), closedLive: !!state.getIn([ 'sessions', 'errors' ]) || (isAssist && !session.live), } @@ -65,10 +64,9 @@ export default class PlayerBlockHeader extends React.PureComponent { } backHandler = () => { - const { history, siteId, sessionPath } = this.props; - const isLiveSession = sessionPath.includes("/assist"); - if (sessionPath === history.location.pathname || sessionPath.includes("/session/") || isLiveSession) { - history.push(withSiteId(isLiveSession ? ASSIST_ROUTE: SESSIONS_ROUTE, siteId)); + const { history, siteId, sessionPath, isAssist } = this.props; + if (sessionPath === history.location.pathname || sessionPath.includes("/session/") || isAssist) { + history.push(withSiteId(isAssist ? ASSIST_ROUTE: SESSIONS_ROUTE, siteId)); } else { history.push(sessionPath ? sessionPath : withSiteId(SESSIONS_ROUTE, siteId)); } @@ -100,17 +98,15 @@ export default class PlayerBlockHeader extends React.PureComponent { metadata, }, loading, - // live, disabled, jiraConfig, fullscreen, - hasSessionsPath, - sessionPath, metaList, closedLive = false, siteId, + isAssist, } = this.props; - const _live = live && !hasSessionsPath; + // const _live = isAssist; const _metaList = Object.keys(metadata).filter(i => metaList.includes(i)).map(key => { const value = metadata[key]; @@ -123,10 +119,10 @@ export default class PlayerBlockHeader extends React.PureComponent {
- { _live && } + { isAssist && }
- { live && hasSessionsPath && ( + { live && !isAssist && ( <>
@@ -137,9 +133,9 @@ export default class PlayerBlockHeader extends React.PureComponent { )} - { _live && ( + { isAssist && ( <> - +
)} @@ -161,8 +157,8 @@ export default class PlayerBlockHeader extends React.PureComponent { hideOnScroll />
- { _live && } - { !_live && ( + { isAssist && } + { !isAssist && ( <>
@@ -193,7 +189,7 @@ export default class PlayerBlockHeader extends React.PureComponent { /> )} - { !_live && jiraConfig && jiraConfig.token && } + { !isAssist && jiraConfig && jiraConfig.token && }
diff --git a/frontend/app/components/shared/SessionItem/SessionItem.js b/frontend/app/components/shared/SessionItem/SessionItem.js index ca9f649d7..51599b3c7 100644 --- a/frontend/app/components/shared/SessionItem/SessionItem.js +++ b/frontend/app/components/shared/SessionItem/SessionItem.js @@ -81,20 +81,13 @@ export default class SessionItem extends React.PureComponent {
- {/*
*/}
(!disableUser && !hasUserFilter) && onUserClick(userId, userAnonymousId)} > - {userDisplayName} +
- {/*
(!disableUser && !hasUserFilter) && onUserClick(userId, userAnonymousId)} - > - {userSessionsCount} Sessions -
*/}
From 67f436dd721499240fb22f9bb4a6698f7260cb30 Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Thu, 3 Mar 2022 14:40:23 +0100 Subject: [PATCH 3/6] chore(helm): force upgrade frontend Signed-off-by: rjshrjndrn --- scripts/helmcharts/openreplay-cli | 6 +++++- scripts/helmcharts/openreplay/files/dbops.sh | 5 +++++ scripts/helmcharts/openreplay/templates/job.yaml | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/helmcharts/openreplay-cli b/scripts/helmcharts/openreplay-cli index 1b52e2bd5..d4b36a663 100755 --- a/scripts/helmcharts/openreplay-cli +++ b/scripts/helmcharts/openreplay-cli @@ -96,7 +96,11 @@ restart() { helmInstall() { - helm upgrade --install openreplay -n app openreplay -f vars.yaml + [[ FORCE_UPGRADE_FRONTENT -eq 1 ]] && { + helm upgrade --install openreplay -n app openreplay -f vars.yaml --set forceUpgradeFrontend=true + } || { + helm upgrade --install openreplay -n app openreplay -f vars.yaml + } } upgrade() { diff --git a/scripts/helmcharts/openreplay/files/dbops.sh b/scripts/helmcharts/openreplay/files/dbops.sh index b77fd61ff..fd238471e 100644 --- a/scripts/helmcharts/openreplay/files/dbops.sh +++ b/scripts/helmcharts/openreplay/files/dbops.sh @@ -21,6 +21,11 @@ function migration() { if [[ $FORCE_MIGRATION == "true" ]]; then echo "Forcing db migration from $PREVIOUS_APP_VERSION to $CHART_APP_VERSION" + # This is a special case where we force upgrade frontend + elif [[ $UPGRADE_FRONTENT == "true" ]]; then + echo "[WARN] Skipping regular upgrdades. Forcing frontend upgrade." + /bin/bash minio.sh migrate + exit 0 elif [[ $PREVIOUS_APP_VERSION == $CHART_APP_VERSION ]]; then echo "No application version change. Not upgrading." exit 0 diff --git a/scripts/helmcharts/openreplay/templates/job.yaml b/scripts/helmcharts/openreplay/templates/job.yaml index a5a6e6241..8eedf6f62 100644 --- a/scripts/helmcharts/openreplay/templates/job.yaml +++ b/scripts/helmcharts/openreplay/templates/job.yaml @@ -80,6 +80,8 @@ spec: env: - name: FORCE_MIGRATION value: "{{ .Values.forceMigration }}" + - name: UPGRADE_FRONTENT + value: "{{ .Values.forceUpgradeFrontend }}" - name: PREVIOUS_APP_VERSION value: "{{ .Values.fromVersion }}" - name: CHART_APP_VERSION From d57959199b3cdeef6270951427540cdc57d4d05f Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 4 Mar 2022 10:53:12 +0100 Subject: [PATCH 4/6] fix(ui) - session call made twice --- frontend/app/components/Session/LivePlayer.js | 3 - frontend/app/components/Session/Session.js | 58 +++++++++---------- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/frontend/app/components/Session/LivePlayer.js b/frontend/app/components/Session/LivePlayer.js index 3d408866a..29a532f0e 100644 --- a/frontend/app/components/Session/LivePlayer.js +++ b/frontend/app/components/Session/LivePlayer.js @@ -60,14 +60,11 @@ export default withRequest({ loadingName: 'loadingCredentials', })(withPermissions(['ASSIST_LIVE'], '', true)(connect( state => { - // const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live'; - // const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'); return { session: state.getIn([ 'sessions', 'current' ]), showAssist: state.getIn([ 'sessions', 'showChatWindow' ]), jwt: state.get('jwt'), fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), - // hasSessionsPath: hasSessioPath && !isAssist, isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee', hasErrors: !!state.getIn([ 'sessions', 'errors' ]), } diff --git a/frontend/app/components/Session/Session.js b/frontend/app/components/Session/Session.js index 210a24bff..f3adb2930 100644 --- a/frontend/app/components/Session/Session.js +++ b/frontend/app/components/Session/Session.js @@ -6,8 +6,6 @@ import { fetchList as fetchSlackList } from 'Duck/integrations/slack'; import { Link, NoContent, Loader } from 'UI'; import { sessions as sessionsRoute } from 'App/routes'; import withPermissions from 'HOCs/withPermissions' - -import LivePlayer from './LivePlayer'; import WebPlayer from './WebPlayer'; import IOSPlayer from './IOSPlayer'; @@ -20,7 +18,6 @@ function Session({ session, fetchSession, fetchSlackList, - hasSessionsPath }) { usePageTitle("OpenReplay Session Player"); useEffect(() => { @@ -35,41 +32,38 @@ function Session({ return () => { if (!session.exists()) return; } - },[ sessionId, hasSessionsPath ]); + },[ sessionId ]); return ( - {'Please check your data retention plan, or try '} - {'another one'} - - } - > - - { session.isIOS - ? - : - } - - + show={ hasErrors } + title="Session not found." + subtext={ + + {'Please check your data retention plan, or try '} + {'another one'} + + } + > + + { session.isIOS + ? + : + } + + ); } export default withPermissions(['SESSION_REPLAY'], '', true)(connect((state, props) => { const { match: { params: { sessionId } } } = props; - const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live'; - const hasSessiosPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'); - return { - sessionId, - loading: state.getIn([ 'sessions', 'loading' ]), - hasErrors: !!state.getIn([ 'sessions', 'errors' ]), - session: state.getIn([ 'sessions', 'current' ]), - hasSessionsPath: hasSessiosPath && !isAssist, - }; -}, { - fetchSession, - fetchSlackList, + return { + sessionId, + loading: state.getIn([ 'sessions', 'loading' ]), + hasErrors: !!state.getIn([ 'sessions', 'errors' ]), + session: state.getIn([ 'sessions', 'current' ]), + }; + }, { + fetchSession, + fetchSlackList, })(Session)); \ No newline at end of file From a014c098f7c92dc24e1d5b03942c2c0addbcad65 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 4 Mar 2022 11:47:43 +0100 Subject: [PATCH 5/6] fix(ui) - initial data load on login --- frontend/app/Router.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/frontend/app/Router.js b/frontend/app/Router.js index 782f47e74..89fbdd343 100644 --- a/frontend/app/Router.js +++ b/frontend/app/Router.js @@ -100,24 +100,26 @@ class Router extends React.Component { constructor(props) { super(props); if (props.isLoggedIn) { - Promise.all([ - props.fetchUserInfo().then(() => { - props.fetchIntegrationVariables() - }), - props.fetchSiteList().then(() => { - setTimeout(() => { - props.fetchAnnouncements(); - props.fetchAlerts(); - props.fetchWatchdogStatus(); - }, 100); - }), - // props.fetchAnnouncements(), - ]) - // .then(() => this.onLoginLogout()); + this.fetchInitialData(); } props.fetchTenants(); } + fetchInitialData = () => { + Promise.all([ + this.props.fetchUserInfo().then(() => { + this.props.fetchIntegrationVariables() + }), + this.props.fetchSiteList().then(() => { + setTimeout(() => { + this.props.fetchAnnouncements(); + this.props.fetchAlerts(); + this.props.fetchWatchdogStatus(); + }, 100); + }), + ]) + } + componentDidMount() { const { isLoggedIn, location } = this.props; if (!isLoggedIn) { @@ -135,6 +137,10 @@ class Router extends React.Component { this.props.history.push(this.state.destinationPath); this.setState({ destinationPath: null }); } + + if (!prevProps.isLoggedIn && this.props.isLoggedIn) { + this.fetchInitialData(); + } } render() { From 7f80e52285142e2076d53071b324251b7d1ac2c8 Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Mon, 7 Mar 2022 11:11:22 +0100 Subject: [PATCH 6/6] chore(helm): enable nginx ingress annotations --- .../openreplay/charts/nginx-ingress/templates/service.yaml | 4 ++++ .../helmcharts/openreplay/charts/nginx-ingress/values.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/scripts/helmcharts/openreplay/charts/nginx-ingress/templates/service.yaml b/scripts/helmcharts/openreplay/charts/nginx-ingress/templates/service.yaml index c7bcb12be..6c978f7f6 100644 --- a/scripts/helmcharts/openreplay/charts/nginx-ingress/templates/service.yaml +++ b/scripts/helmcharts/openreplay/charts/nginx-ingress/templates/service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "nginx-ingress.fullname" . }} labels: {{- include "nginx-ingress.labels" . | nindent 4 }} + annotations: + {{- with .Values.service.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")}} diff --git a/scripts/helmcharts/openreplay/charts/nginx-ingress/values.yaml b/scripts/helmcharts/openreplay/charts/nginx-ingress/values.yaml index 43d6d3eae..6984c1938 100644 --- a/scripts/helmcharts/openreplay/charts/nginx-ingress/values.yaml +++ b/scripts/helmcharts/openreplay/charts/nginx-ingress/values.yaml @@ -37,6 +37,7 @@ securityContext: {} # runAsUser: 1000 service: + annotations: {} type: LoadBalancer ports: - port: 80