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() { 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 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 -
*/}
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) {