Merge branch 'main' of github.com:openreplay/openreplay into dev

This commit is contained in:
Shekar Siri 2022-03-07 12:40:09 +01:00
commit 8fdeb357f1
6 changed files with 64 additions and 76 deletions

View file

@ -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() {

View file

@ -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' ]),
}

View file

@ -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 (
<NoContent
show={ hasErrors }
title="Session not found."
subtext={
<span>
{'Please check your data retention plan, or try '}
<Link to={ SESSIONS_ROUTE }>{'another one'}</Link>
</span>
}
>
<Loader className="flex-1" loading={ loading || sessionId !== session.sessionId }>
{ session.isIOS
? <IOSPlayer session={session} />
: <WebPlayer />
}
</Loader>
</NoContent>
show={ hasErrors }
title="Session not found."
subtext={
<span>
{'Please check your data retention plan, or try '}
<Link to={ SESSIONS_ROUTE }>{'another one'}</Link>
</span>
}
>
<Loader className="flex-1" loading={ loading || sessionId !== session.sessionId }>
{ session.isIOS
? <IOSPlayer session={session} />
: <WebPlayer />
}
</Loader>
</NoContent>
);
}
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));

View file

@ -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 {
<BackLink onClick={this.backHandler} label="Back" />
<div className={ stl.divider } />
{ _live && <AssistTabs userId={userId} userNumericHash={userNumericHash} />}
{ isAssist && <AssistTabs userId={userId} userNumericHash={userNumericHash} />}
<div className={cn("ml-auto flex items-center", { 'hidden' : closedLive })}>
{ live && hasSessionsPath && (
{ live && !isAssist && (
<>
<div className={stl.liveSwitchButton}>
<Link to={withSiteId(liveSessionRoute(sessionId), siteId)}>
@ -137,9 +133,9 @@ export default class PlayerBlockHeader extends React.PureComponent {
</>
)}
{ _live && (
{ isAssist && (
<>
<SessionMetaList className="" metaList={_metaList} maxLength={3} />
<SessionMetaList className="" metaList={_metaList} maxLength={2} />
<div className={ stl.divider } />
</>
)}
@ -161,8 +157,8 @@ export default class PlayerBlockHeader extends React.PureComponent {
hideOnScroll
/>
<div className={ stl.divider } />
{ _live && <AssistActions isLive userId={userId} /> }
{ !_live && (
{ isAssist && <AssistActions userId={userId} /> }
{ !isAssist && (
<>
<Autoplay />
<div className={ stl.divider } />
@ -193,7 +189,7 @@ export default class PlayerBlockHeader extends React.PureComponent {
/>
</>
)}
{ !_live && jiraConfig && jiraConfig.token && <Issues sessionId={ sessionId } /> }
{ !isAssist && jiraConfig && jiraConfig.token && <Issues sessionId={ sessionId } /> }
</div>
</div>
</div>

View file

@ -81,20 +81,13 @@ export default class SessionItem extends React.PureComponent {
<div className={ cn('flex items-center w-full')}>
<div className="flex items-center pr-2" style={{ width: "30%"}}>
<div><Avatar seed={ userNumericHash } isAssist={isAssist} /></div>
{/* <div className="flex flex-col overflow-hidden color-gray-medium ml-3"> */}
<div className="flex flex-col overflow-hidden color-gray-medium ml-3 justify-between items-center">
<div
className={cn('text-lg', {'color-teal cursor-pointer': !disableUser && hasUserId, 'color-gray-medium' : disableUser || !hasUserId})}
onClick={() => (!disableUser && !hasUserFilter) && onUserClick(userId, userAnonymousId)}
>
{userDisplayName}
<TextEllipsis text={userDisplayName} maxWidth={200} popupProps={{ inverted: true, size: 'tiny' }} />
</div>
{/* <div
className="color-gray-medium text-dotted-underline cursor-pointer"
onClick={() => (!disableUser && !hasUserFilter) && onUserClick(userId, userAnonymousId)}
>
{userSessionsCount} Sessions
</div> */}
</div>
</div>
<div style={{ width: "20%", height: "38px" }} className="px-2 flex flex-col justify-between">

View file

@ -100,7 +100,9 @@ export default class AssistManager {
let inactiveTimeout: ReturnType<typeof setTimeout> | 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) {