From 80811f4c4961482b8cdc890a0f6e7b0570249908 Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 2 Dec 2022 16:15:33 +0100 Subject: [PATCH] change(ui): fix socket connection, player attach and autoplay for live session, and store --- .../app/components/Session/LivePlayer.tsx | 2 +- .../Session_/Multiview/Multiview.tsx | 18 +++-- .../AssistSessionsModal.tsx | 78 +++++++++++-------- .../AssistSessionsTabs/AssistSessionsTabs.tsx | 6 +- .../Controls/AssistSessionsTabs/index.tsx | 2 +- .../app/components/Session_/Player/Player.js | 5 +- .../shared/SessionItem/SessionItem.tsx | 16 ++-- .../SessionMetaList/SessionMetaList.tsx | 4 +- frontend/app/mstore/assistMultiviewStore.ts | 15 ++++ .../app/player/web/assist/AssistManager.ts | 1 + frontend/app/services/SessionService.ts | 52 +++++++------ 11 files changed, 123 insertions(+), 76 deletions(-) diff --git a/frontend/app/components/Session/LivePlayer.tsx b/frontend/app/components/Session/LivePlayer.tsx index 5a88cf89a..6a1534772 100644 --- a/frontend/app/components/Session/LivePlayer.tsx +++ b/frontend/app/components/Session/LivePlayer.tsx @@ -60,7 +60,7 @@ function LivePlayer({ makeAutoObservable(state) ); setContextValue({ player, store }); - player.play(); + return () => player.clean(); }, [session.sessionId, assistCredendials]); diff --git a/frontend/app/components/Session_/Multiview/Multiview.tsx b/frontend/app/components/Session_/Multiview/Multiview.tsx index b60c20c27..d9986a800 100644 --- a/frontend/app/components/Session_/Multiview/Multiview.tsx +++ b/frontend/app/components/Session_/Multiview/Multiview.tsx @@ -9,8 +9,9 @@ import { liveSession, assist, withSiteId } from 'App/routes'; import AssistSessionsModal from 'App/components/Session_/Player/Controls/AssistSessionsModal'; import { useModal } from 'App/components/Modal'; import LivePlayer from 'App/components/Session/LivePlayer'; +import { InactiveTab } from 'App/components/Session_/Player/Controls/AssistSessionsTabs' -function Multiview({ total, fetchSessions, siteId }: { total: number; fetchSessions: (filter: any) => void, siteId: string }) { +function Multiview({ total, fetchSessions, siteId, assistCredendials }: { total: number; fetchSessions: (filter: any) => void, siteId: string, assistCredendials: any }) { const { showModal, hideModal } = useModal(); const { assistMultiviewStore } = useStore(); @@ -58,12 +59,14 @@ function Multiview({ total, fetchSessions, siteId }: { total: number; fetchSessi className="border hover:border-active-blue-border relative group cursor-pointer" >
openLiveSession(e, session.sessionId)} className="w-full h-full"> - + {session.agentToken ? :
Loading session
}
-
+
{session.userDisplayName}
-
replaceSession(e, session.sessionId)}>Replace Session
+
replaceSession(e, session.sessionId)}> + Replace Session +
deleteSession(e, session.sessionId)}>
@@ -72,8 +75,9 @@ function Multiview({ total, fetchSessions, siteId }: { total: number; fetchSessi
))} {placeholder.map((_, i) => ( -
- Add Session +
+ + Add Session
))}
@@ -89,4 +93,4 @@ export default connect( { fetchSessions, } -)(observer(Multiview)); +)(observer(Multiview)) diff --git a/frontend/app/components/Session_/Player/Controls/AssistSessionsModal/AssistSessionsModal.tsx b/frontend/app/components/Session_/Player/Controls/AssistSessionsModal/AssistSessionsModal.tsx index ba760158a..79f8331a7 100644 --- a/frontend/app/components/Session_/Player/Controls/AssistSessionsModal/AssistSessionsModal.tsx +++ b/frontend/app/components/Session_/Player/Controls/AssistSessionsModal/AssistSessionsModal.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React from 'react'; import { Loader, Pagination, Tooltip } from 'UI'; import { connect } from 'react-redux'; import SessionItem from 'Shared/SessionItem'; @@ -9,10 +9,10 @@ import Select from 'Shared/Select'; import SortOrderButton from 'Shared/SortOrderButton'; import { KEYS } from 'Types/filter/customFilter'; import { capitalize } from 'App/utils'; -import { useStore } from 'App/mstore' -import { observer } from 'mobx-react-lite' +import { useStore } from 'App/mstore'; +import { observer } from 'mobx-react-lite'; -import cn from 'classnames' +import cn from 'classnames'; import Session from 'App/mstore/types/session'; const PER_PAGE = 10; @@ -58,23 +58,20 @@ function AssistSessionsModal(props: Props) { }; const onSessionAdd = (session: Session) => { if (props.replaceTarget) { - assistMultiviewStore.replaceSession(props.replaceTarget, session) + assistMultiviewStore.replaceSession(props.replaceTarget, session); } else { assistMultiviewStore.addSession(session); } - onAdd() - } + assistMultiviewStore.fetchAgentTokenInfo(session.sessionId).then(() => onAdd()); + }; return (
Sort By - 0} - > -
+ 0}> +