dev - fixes and tracker version updates (#1351)

* fix(ui): fix for messages type from ws

* fix(ui): fixes for tab typings, use State instead of array to keep tabs

* fix(assist): fixed issue with sessionUpdate event

* fix(ui): fix support for old version of assist proto

* fix(assist): fixed issue with agent back compatibility

* fix(ui): fix assist backwards compat for messages

* change(ui): offline-playback text change to recordings

* change(ui): offline-playback text change to recordings

* fix(assist): added meta header only for sessions from old tracker

* fix(ui): fix assist backwards compat for messages

* tracker version

---------

Co-authored-by: nick-delirium <nikita@openreplay.com>
Co-authored-by: Alexander Zavorotynskiy <zavorotynskiy@pm.me>
This commit is contained in:
Shekar Siri 2023-06-19 19:32:00 +02:00 committed by GitHub
parent ebc14207f7
commit cc78b5087b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 52 additions and 31 deletions

View file

@ -196,10 +196,15 @@ const autocomplete = async function (req, res) {
}
const findSessionSocketId = async (io, roomId, tabId) => {
let pickFirstSession = tabId === undefined;
const connected_sockets = await io.in(roomId).fetchSockets();
for (let item of connected_sockets) {
if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) {
return item.id;
if (item.handshake.query.identity === IDENTITIES.session) {
if (pickFirstSession) {
return item.id;
} else if (item.tabId === tabId) {
return item.id;
}
}
}
return null;
@ -340,8 +345,8 @@ module.exports = {
return
}
// Back compatibility (add top layer with meta information)
if (args[0].meta === undefined) {
args[0] = {meta: {tabId: socket.tabId}, data: args[0]};
if (args[0]?.meta === undefined && socket.identity === IDENTITIES.session) {
args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]};
}
Object.assign(socket.handshake.query.sessionInfo, args[0].data, {tabId: args[0].meta.tabId});
socket.to(socket.roomId).emit(EVENTS_DEFINITION.emit.UPDATE_EVENT, args[0]);
@ -368,8 +373,8 @@ module.exports = {
return
}
// Back compatibility (add top layer with meta information)
if (args[0].meta === undefined) {
args[0] = {meta: {tabId: socket.tabId}, data: args[0]};
if (args[0]?.meta === undefined && socket.identity === IDENTITIES.session) {
args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]};
}
if (socket.identity === IDENTITIES.session) {
debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.roomId}`);
@ -377,7 +382,7 @@ module.exports = {
socket.to(socket.roomId).emit(eventName, args[0]);
} else {
debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to session of room:${socket.roomId}`);
let socketId = await findSessionSocketId(io, socket.roomId, args[0].meta.tabId);
let socketId = await findSessionSocketId(io, socket.roomId, args[0]?.meta?.tabId);
if (socketId === null) {
debug && console.log(`session not found for:${socket.roomId}`);
io.to(socket.id).emit(EVENTS_DEFINITION.emit.NO_SESSIONS);

View file

@ -247,10 +247,15 @@ const autocomplete = async function (req, res) {
}
const findSessionSocketId = async (io, roomId, tabId) => {
let pickFirstSession = tabId === undefined;
const connected_sockets = await io.in(roomId).fetchSockets();
for (let item of connected_sockets) {
if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) {
return item.id;
if (item.handshake.query.identity === IDENTITIES.session) {
if (pickFirstSession) {
return item.id;
} else if (item.tabId === tabId) {
return item.id;
}
}
}
return null;
@ -421,8 +426,8 @@ module.exports = {
return
}
// Back compatibility (add top layer with meta information)
if (args[0].meta === undefined) {
args[0] = {meta: {tabId: socket.tabId}, data: args[0]};
if (args[0].meta === undefined && socket.identity === IDENTITIES.session) {
args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]};
}
if (socket.identity === IDENTITIES.session) {
debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.roomId}`);

View file

@ -216,10 +216,15 @@ const autocomplete = async function (req, res) {
}
const findSessionSocketId = async (io, roomId, tabId) => {
let pickFirstSession = tabId === undefined;
const connected_sockets = await io.in(roomId).fetchSockets();
for (let item of connected_sockets) {
if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) {
return item.id;
if (item.handshake.query.identity === IDENTITIES.session) {
if (pickFirstSession) {
return item.id;
} else if (item.tabId === tabId) {
return item.id;
}
}
}
return null;
@ -389,8 +394,8 @@ module.exports = {
return
}
// Back compatibility (add top layer with meta information)
if (args[0].meta === undefined) {
args[0] = {meta: {tabId: socket.tabId}, data: args[0]};
if (args[0].meta === undefined && socket.identity === IDENTITIES.session) {
args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]};
}
if (socket.identity === IDENTITIES.session) {
debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.peerId}`);

View file

@ -23,4 +23,4 @@ MINIO_SECRET_KEY = ''
# APP and TRACKER VERSIONS
VERSION = 1.13.0
TRACKER_VERSION = '7.0.2'
TRACKER_VERSION = '8.0.0'

View file

@ -17,7 +17,7 @@ interface Props extends RouteComponentProps {
function Assist(props: Props) {
const { history, siteId, isEnterprise } = props;
const isAssist = history.location.pathname.includes('assist');
const isRecords = history.location.pathname.includes('offline-playback');
const isRecords = history.location.pathname.includes('recordings');
const redirect = (path: string) => {
history.push(withSiteId(path, siteId));
@ -37,7 +37,7 @@ function Assist(props: Props) {
<SideMenuitem
active={isRecords}
id="menu-rec"
title="Offline Playback"
title="Recordings"
iconName="record-btn"
onClick={() => redirect(recordings())}
disabled={!isEnterprise}

View file

@ -31,7 +31,7 @@ function Recordings(props: Props) {
<div style={{ maxWidth: '1300px', margin: 'auto' }} className='bg-white rounded py-4 border'>
<div className='flex items-center mb-4 justify-between px-6'>
<div className='flex items-baseline mr-3'>
<PageTitle title='Offline Playback' />
<PageTitle title='Recordings' />
</div>
<div className='ml-auto flex items-center gap-4'>
<SelectDateRange period={recordingsStore.period} onChange={onDateChange} right={true} />

View file

@ -28,8 +28,8 @@ function RecordingsList() {
<AnimatedSVG name={ICONS.NO_RECORDINGS} size={180} />
<div className="text-center mt-4">
{recordsSearch !== ''
? 'No matching results'
: 'No videos available for offline playback.'}
? 'No matching results.'
: 'No recordings available.'}
</div>
</div>
}

View file

@ -171,7 +171,8 @@ export default class AssistManager {
})
socket.on('messages', messages => {
if (messages.data !== undefined) this.assistVersion = 2
const isOldVersion = messages.meta.version === 1
this.assistVersion = isOldVersion ? 1 : 2
const data = messages.data || messages
jmr.append(data) // as RawMessage[]
@ -179,6 +180,10 @@ export default class AssistManager {
waitingForMessages = false // TODO: more explicit
this.setStatus(ConnectionStatus.Connected)
}
if (messages.meta.tabId !== this.store.get().currentTab && isOldVersion) {
reader.currentTab = messages.meta.tabId
this.store.update({ currentTab: messages.meta.tabId })
}
for (let msg = reader.readNext();msg !== null;msg = reader.readNext()) {
this.handleMessage(msg, msg._index)

View file

@ -173,7 +173,7 @@ export default class Call {
}
private emitData = (event: string, data?: any) => {
if (this.assistVersion === 1) {
if (this.getAssistVersion() === 1) {
this.socket?.emit(event, data)
} else {
this.socket?.emit(event, { meta: { tabId: this.store.get().currentTab }, data })
@ -238,7 +238,8 @@ export default class Call {
if (!this.store.get().currentTab) {
console.warn('No tab data to connect to peer')
}
const peerId = this.assistVersion === 1 ? this.peerID : `${this.peerID}-${tab || Object.keys(this.store.get().tabs)[0]}`
const peerId = this.getAssistVersion() === 1 ? this.peerID : `${this.peerID}-${tab || Object.keys(this.store.get().tabs)[0]}`
console.log(peerId, this.getAssistVersion())
void this._peerConnection(peerId);
this.emitData("_agent_name", appStore.getState().getIn([ 'user', 'account', 'name']))
}

View file

@ -29,7 +29,7 @@ export default class RemoteControl {
private screen: Screen,
private agentInfo: Object,
private onToggle: (active: boolean) => void,
private getAssistVersion: () => number,
private getAssistVersion: () => number
){
socket.on("control_granted", ({ meta, data }) => {
this.toggleRemoteControl(data === socket.id)
@ -58,7 +58,7 @@ export default class RemoteControl {
}
private emitData = (event: string, data?: any) => {
if (this.assistVersion === 1) {
if (this.getAssistVersion() === 1) {
this.socket.emit(event, data)
} else {
this.socket.emit(event, { meta: { tabId: this.store.get().currentTab }, data })

View file

@ -59,7 +59,7 @@ export default class ScreenRecording {
}
private emitData = (event: string, data?: any) => {
if (this.assistVersion === 1) {
if (this.getAssistVersion() === 1) {
this.socket.emit(event, data)
} else {
this.socket.emit(event, { meta: { tabId: this.store.get().currentTab }, data })

View file

@ -84,7 +84,7 @@ export const onboarding = (tab = routerOBTabString) => `/onboarding/${ tab }`;
export const sessions = params => queried('/sessions', params);
export const assist = params => queried('/assist', params);
export const recordings = params => queried("/offline-playback", params);
export const recordings = params => queried("/recordings", params);
export const multiviewIndex = params => queried('/multiview', params);
export const multiview = (sessionsQuery = ':sessionsquery', hash) => hashed(`/multiview/${sessionsQuery}`, hash);
export const session = (sessionId = ':sessionId', hash) => hashed(`/session/${ sessionId }`, hash);

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker-assist",
"description": "Tracker plugin for screen assistance through the WebRTC",
"version": "6.0.0-beta.11",
"version": "6.0.0",
"keywords": [
"WebRTC",
"assistance",
@ -21,7 +21,7 @@
"replace-paths": "replace-in-files cjs/* --string='@openreplay/tracker' --replacement='@openreplay/tracker/cjs' && replace-in-files cjs/* --string='/lib/' --replacement='/'",
"replace-versions": "npm run replace-pkg-version && npm run replace-req-version",
"replace-pkg-version": "replace-in-files lib/* cjs/* --string='PACKAGE_VERSION' --replacement=$npm_package_version",
"replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='3.5.14'",
"replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='8.0.0'",
"prepublishOnly": "npm run build",
"prepare": "cd ../../ && husky install tracker/.husky/",
"lint-front": "lint-staged",

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "8.0.0-beta.5",
"version": "8.0.0",
"keywords": [
"logging",
"replay"