From 0734bfdbe3935d4357231af99f81c871662dbde7 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 24 Feb 2022 16:56:06 +0100 Subject: [PATCH 1/5] fix(ui) - assist offline and refresh button --- frontend/app/components/Session/LivePlayer.js | 6 ++--- .../Session_/Player/Controls/Controls.js | 2 +- .../app/components/Session_/Player/Player.js | 2 +- .../app/components/Session_/PlayerBlock.js | 2 +- .../components/Session_/PlayerBlockHeader.js | 7 +++--- .../LiveSessionList/LiveSessionList.tsx | 5 +++-- .../LiveSessionReloadButton.tsx | 19 ++++++++++++++++ .../shared/LiveSessionReloadButton/index.ts | 1 + .../shared/ReloadButton/ReloadButton.tsx | 22 +++++++++++++++++++ .../components/shared/ReloadButton/index.ts | 1 + 10 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx create mode 100644 frontend/app/components/shared/LiveSessionReloadButton/index.ts create mode 100644 frontend/app/components/shared/ReloadButton/ReloadButton.tsx create mode 100644 frontend/app/components/shared/ReloadButton/index.ts diff --git a/frontend/app/components/Session/LivePlayer.js b/frontend/app/components/Session/LivePlayer.js index ef4bda5ae..3d408866a 100644 --- a/frontend/app/components/Session/LivePlayer.js +++ b/frontend/app/components/Session/LivePlayer.js @@ -60,14 +60,14 @@ 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'); + // 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, + // hasSessionsPath: hasSessioPath && !isAssist, isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee', hasErrors: !!state.getIn([ 'sessions', 'errors' ]), } diff --git a/frontend/app/components/Session_/Player/Controls/Controls.js b/frontend/app/components/Session_/Player/Controls/Controls.js index 464165e69..22fd3b0cf 100644 --- a/frontend/app/components/Session_/Player/Controls/Controls.js +++ b/frontend/app/components/Session_/Player/Controls/Controls.js @@ -106,7 +106,7 @@ function getStorageName(type) { bottomBlock: state.getIn([ 'components', 'player', 'bottomBlock' ]), showStorage: props.showStorage || !state.getIn(['components', 'player', 'hiddenHints', 'storage']), showStack: props.showStack || !state.getIn(['components', 'player', 'hiddenHints', 'stack']), - closedLive: !!state.getIn([ 'sessions', 'errors' ]), + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !state.getIn([ 'sessions', 'current', 'live' ]), } }, { fullscreenOn, diff --git a/frontend/app/components/Session_/Player/Player.js b/frontend/app/components/Session_/Player/Player.js index a3a6e3b1a..8e9c38d2c 100644 --- a/frontend/app/components/Session_/Player/Player.js +++ b/frontend/app/components/Session_/Player/Player.js @@ -16,7 +16,7 @@ import EventsToggleButton from '../../Session/EventsToggleButton'; @connect(state => ({ fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), nextId: state.getIn([ 'sessions', 'nextId' ]), - closedLive: !!state.getIn([ 'sessions', 'errors' ]), + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !state.getIn([ 'sessions', 'current', 'live' ]), }), { hideTargetDefiner, fullscreenOff, diff --git a/frontend/app/components/Session_/PlayerBlock.js b/frontend/app/components/Session_/PlayerBlock.js index dec170e57..02ee08c75 100644 --- a/frontend/app/components/Session_/PlayerBlock.js +++ b/frontend/app/components/Session_/PlayerBlock.js @@ -33,7 +33,7 @@ import styles from './playerBlock.css'; @connect(state => ({ fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), bottomBlock: state.getIn([ 'components', 'player', 'bottomBlock' ]), - closedLive: !!state.getIn([ 'sessions', 'errors' ]), + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !state.getIn([ 'sessions', 'current', 'live' ]), })) export default class PlayerBlock extends React.PureComponent { componentDidUpdate(prevProps) { diff --git a/frontend/app/components/Session_/PlayerBlockHeader.js b/frontend/app/components/Session_/PlayerBlockHeader.js index e0883cc59..b6295ed70 100644 --- a/frontend/app/components/Session_/PlayerBlockHeader.js +++ b/frontend/app/components/Session_/PlayerBlockHeader.js @@ -29,10 +29,11 @@ const ASSIST_ROUTE = assistRoute(); loading: state.cssLoading || state.messagesLoading, })) @connect((state, props) => { - const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live'; + const isAssist = window.location.pathname.includes('/assist/'); const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'); + const session = state.getIn([ 'sessions', 'current' ]); return { - session: state.getIn([ 'sessions', 'current' ]), + session, sessionPath: state.getIn([ 'sessions', 'sessionPath' ]), loading: state.getIn([ 'sessions', 'toggleFavoriteRequest', 'loading' ]), disabled: state.getIn([ 'components', 'targetDefiner', 'inspectorMode' ]) || props.loading, @@ -43,7 +44,7 @@ const ASSIST_ROUTE = assistRoute(); siteId: state.getIn([ 'user', 'siteId' ]), hasSessionsPath: hasSessioPath && !isAssist, metaList: state.getIn(['customFields', 'list']).map(i => i.key), - closedLive: !!state.getIn([ 'sessions', 'errors' ]), + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !session.live, } }, { toggleFavorite, fetchListIntegration, setSessionPath diff --git a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx index d6325ea00..8ffd256bd 100644 --- a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx +++ b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx @@ -13,6 +13,7 @@ import DropdownPlain from 'Shared/DropdownPlain'; import SortOrderButton from 'Shared/SortOrderButton'; import { TimezoneDropdown } from 'UI'; import { capitalize } from 'App/utils'; +import LiveSessionReloadButton from 'Shared/LiveSessionReloadButton'; const AUTOREFRESH_INTERVAL = .5 * 60 * 1000 const PER_PAGE = 20; @@ -107,8 +108,6 @@ function LiveSessionList(props: Props) { }, AUTOREFRESH_INTERVAL); } - console.log('srt', sort) - return (
@@ -117,6 +116,8 @@ function LiveSessionList(props: Props) { Live Sessions {sessions.size} + +
diff --git a/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx b/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx new file mode 100644 index 000000000..a6541c884 --- /dev/null +++ b/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx @@ -0,0 +1,19 @@ +import React from 'react' +import ReloadButton from '../ReloadButton' +import { connect } from 'react-redux' +import { fetchLiveList } from 'Duck/sessions' + +interface Props { + loading: boolean + fetchLiveList: typeof fetchLiveList +} +function LiveSessionReloadButton(props: Props) { + const { loading } = props + return ( + + ) +} + +export default connect(state => ({ + loading: state.getIn([ 'sessions', 'fetchLiveListRequest', 'loading' ]), +}), { fetchLiveList })(LiveSessionReloadButton) diff --git a/frontend/app/components/shared/LiveSessionReloadButton/index.ts b/frontend/app/components/shared/LiveSessionReloadButton/index.ts new file mode 100644 index 000000000..59b517a52 --- /dev/null +++ b/frontend/app/components/shared/LiveSessionReloadButton/index.ts @@ -0,0 +1 @@ +export { default } from './LiveSessionReloadButton'; \ No newline at end of file diff --git a/frontend/app/components/shared/ReloadButton/ReloadButton.tsx b/frontend/app/components/shared/ReloadButton/ReloadButton.tsx new file mode 100644 index 000000000..8ae36a8f1 --- /dev/null +++ b/frontend/app/components/shared/ReloadButton/ReloadButton.tsx @@ -0,0 +1,22 @@ +import React from 'react' +import { CircularLoader, Icon } from 'UI' +import cn from 'classnames' + +interface Props { + loading?: boolean + onClick: () => void + iconSize?: number + iconName?: string + className?: string +} +export default function ReloadButton(props: Props) { + const { loading, onClick, iconSize = "14", iconName = "sync-alt", className = '' } = props + return ( +
+ { loading ? : } +
+ ) +} diff --git a/frontend/app/components/shared/ReloadButton/index.ts b/frontend/app/components/shared/ReloadButton/index.ts new file mode 100644 index 000000000..cc431c632 --- /dev/null +++ b/frontend/app/components/shared/ReloadButton/index.ts @@ -0,0 +1 @@ +export { default } from './ReloadButton'; \ No newline at end of file From 37db48ceecce830df0977e7d19b0c73da2b527cc Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Thu, 24 Feb 2022 17:54:08 +0100 Subject: [PATCH 2/5] feat(api): fixed get sessions list if no-metadata is available feat(DB): v1.5.2 changes --- api/chalicelib/core/sessions.py | 8 ++++---- ee/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql | 8 ++++++++ ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql | 2 +- scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql | 8 ++++++++ scripts/helm/db/init_dbs/postgresql/init_schema.sql | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 ee/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql create mode 100644 scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql diff --git a/api/chalicelib/core/sessions.py b/api/chalicelib/core/sessions.py index c095ce344..d180cccc7 100644 --- a/api/chalicelib/core/sessions.py +++ b/api/chalicelib/core/sessions.py @@ -197,8 +197,8 @@ def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, f MIN(full_sessions.start_ts) AS first_session_ts, ROW_NUMBER() OVER (ORDER BY count(full_sessions) DESC) AS rn FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY start_ts DESC) AS rn - FROM (SELECT DISTINCT ON(s.session_id) {SESSION_PROJECTION_COLS}, - {",".join([f'metadata_{m["index"]}' for m in meta_keys])} + FROM (SELECT DISTINCT ON(s.session_id) {SESSION_PROJECTION_COLS} + {"," if len(meta_keys)>0 else ""}{",".join([f'metadata_{m["index"]}' for m in meta_keys])} {query_part} ORDER BY s.session_id desc) AS filtred_sessions ORDER BY favorite DESC, issue_score DESC, {sort} {data.order}) AS full_sessions @@ -209,8 +209,8 @@ def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, f meta_keys = metadata.get(project_id=project_id) main_query = cur.mogrify(f"""SELECT COUNT(full_sessions) AS count, COALESCE(JSONB_AGG(full_sessions) FILTER (WHERE rn <= 200), '[]'::JSONB) AS sessions FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY favorite DESC, issue_score DESC, session_id desc, start_ts desc) AS rn - FROM (SELECT DISTINCT ON(s.session_id) {SESSION_PROJECTION_COLS}, - {",".join([f'metadata_{m["index"]}' for m in meta_keys])} + FROM (SELECT DISTINCT ON(s.session_id) {SESSION_PROJECTION_COLS} + {"," if len(meta_keys)>0 else ""}{",".join([f'metadata_{m["index"]}' for m in meta_keys])} {query_part} ORDER BY s.session_id desc) AS filtred_sessions ORDER BY favorite DESC, issue_score DESC, {sort} {data.order}) AS full_sessions;""", diff --git a/ee/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql b/ee/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql new file mode 100644 index 000000000..8ec804b02 --- /dev/null +++ b/ee/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql @@ -0,0 +1,8 @@ +BEGIN; +CREATE OR REPLACE FUNCTION openreplay_version() + RETURNS text AS +$$ +SELECT 'v1.5.2-ee' +$$ LANGUAGE sql IMMUTABLE; + +COMMIT; \ No newline at end of file diff --git a/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql index a6ceddf35..b64376d10 100644 --- a/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql @@ -7,7 +7,7 @@ CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE OR REPLACE FUNCTION openreplay_version() RETURNS text AS $$ -SELECT 'v1.5.1-ee' +SELECT 'v1.5.2-ee' $$ LANGUAGE sql IMMUTABLE; diff --git a/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql b/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql new file mode 100644 index 000000000..f4e26f93a --- /dev/null +++ b/scripts/helm/db/init_dbs/postgresql/1.5.2/1.5.2.sql @@ -0,0 +1,8 @@ +BEGIN; +CREATE OR REPLACE FUNCTION openreplay_version() + RETURNS text AS +$$ +SELECT 'v1.5.2' +$$ LANGUAGE sql IMMUTABLE; + +COMMIT; \ No newline at end of file diff --git a/scripts/helm/db/init_dbs/postgresql/init_schema.sql b/scripts/helm/db/init_dbs/postgresql/init_schema.sql index 3d05795e9..e053063c2 100644 --- a/scripts/helm/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/helm/db/init_dbs/postgresql/init_schema.sql @@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS events; CREATE OR REPLACE FUNCTION openreplay_version() RETURNS text AS $$ -SELECT 'v1.5.1' +SELECT 'v1.5.2' $$ LANGUAGE sql IMMUTABLE; -- --- accounts.sql --- From 09430d08680bda3b10d8cf2982a9317f573a8925 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 24 Feb 2022 18:34:15 +0100 Subject: [PATCH 3/5] fix(ui) - assist offline --- frontend/app/components/Session_/Player/Player.js | 13 ++++++++----- frontend/app/components/Session_/PlayerBlock.js | 4 +--- .../app/components/Session_/PlayerBlockHeader.js | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/app/components/Session_/Player/Player.js b/frontend/app/components/Session_/Player/Player.js index 8e9c38d2c..0f0b51786 100644 --- a/frontend/app/components/Session_/Player/Player.js +++ b/frontend/app/components/Session_/Player/Player.js @@ -13,11 +13,14 @@ import EventsToggleButton from '../../Session/EventsToggleButton'; @connectPlayer(state => ({ live: state.live, })) -@connect(state => ({ - fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), - nextId: state.getIn([ 'sessions', 'nextId' ]), - closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !state.getIn([ 'sessions', 'current', 'live' ]), -}), { +@connect(state => { + const isAssist = window.location.pathname.includes('/assist/'); + return { + fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), + nextId: state.getIn([ 'sessions', 'nextId' ]), + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || (isAssist && !state.getIn([ 'sessions', 'current', 'live' ])), + } +}, { hideTargetDefiner, fullscreenOff, }) diff --git a/frontend/app/components/Session_/PlayerBlock.js b/frontend/app/components/Session_/PlayerBlock.js index 02ee08c75..ab95c11fd 100644 --- a/frontend/app/components/Session_/PlayerBlock.js +++ b/frontend/app/components/Session_/PlayerBlock.js @@ -33,7 +33,6 @@ import styles from './playerBlock.css'; @connect(state => ({ fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]), bottomBlock: state.getIn([ 'components', 'player', 'bottomBlock' ]), - closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !state.getIn([ 'sessions', 'current', 'live' ]), })) export default class PlayerBlock extends React.PureComponent { componentDidUpdate(prevProps) { @@ -44,14 +43,13 @@ export default class PlayerBlock extends React.PureComponent { } render() { - const { fullscreen, bottomBlock, closedLive } = this.props; + const { fullscreen, bottomBlock } = this.props; return (
{ !fullscreen && !!bottomBlock &&
diff --git a/frontend/app/components/Session_/PlayerBlockHeader.js b/frontend/app/components/Session_/PlayerBlockHeader.js index b6295ed70..1a0735f5f 100644 --- a/frontend/app/components/Session_/PlayerBlockHeader.js +++ b/frontend/app/components/Session_/PlayerBlockHeader.js @@ -44,7 +44,7 @@ const ASSIST_ROUTE = assistRoute(); siteId: state.getIn([ 'user', 'siteId' ]), hasSessionsPath: hasSessioPath && !isAssist, metaList: state.getIn(['customFields', 'list']).map(i => i.key), - closedLive: !!state.getIn([ 'sessions', 'errors' ]) || !session.live, + closedLive: !!state.getIn([ 'sessions', 'errors' ]) || (isAssist && !session.live), } }, { toggleFavorite, fetchListIntegration, setSessionPath From db2b430733dbf45ad336e3f10d7860d483b99b09 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 24 Feb 2022 18:45:50 +0100 Subject: [PATCH 4/5] fix(ui) - assist disable remote on disconnect --- .../components/AssistActions/AssistActions.tsx | 12 ------------ .../MessageDistributor/managers/AssistManager.ts | 3 ++- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx index 2d7a7baf1..58eadd472 100644 --- a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx +++ b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx @@ -91,12 +91,6 @@ function AssistActions({ toggleChatWindow, userId, calling, peerConnectionStatus onClick={ requestReleaseRemoteControl } role="button" > - {/* - { 'Remote Control' } */}
@@ -112,12 +106,6 @@ function AssistActions({ toggleChatWindow, userId, calling, peerConnectionStatus onClick={ onCall ? callObject?.end : confirmCall} role="button" > - {/* - { onCall ? 'End Call' : 'Call' } */}
} diff --git a/frontend/app/player/MessageDistributor/managers/AssistManager.ts b/frontend/app/player/MessageDistributor/managers/AssistManager.ts index 51895b327..908add195 100644 --- a/frontend/app/player/MessageDistributor/managers/AssistManager.ts +++ b/frontend/app/player/MessageDistributor/managers/AssistManager.ts @@ -171,7 +171,8 @@ export default class AssistManager { this.setStatus(ConnectionStatus.Disconnected) }, 12000) - if (getState().remoteControl === RemoteControlStatus.Requesting) { + if (getState().remoteControl === RemoteControlStatus.Requesting || + getState().remoteControl === RemoteControlStatus.Enabled) { this.toggleRemoteControl(false) } From b19042878014cbfac6ea361d0cd9c936beddbda7 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 24 Feb 2022 18:51:18 +0100 Subject: [PATCH 5/5] fix(ui) - button cursor pointer --- .../shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx b/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx index a6541c884..ab47fc054 100644 --- a/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx +++ b/frontend/app/components/shared/LiveSessionReloadButton/LiveSessionReloadButton.tsx @@ -10,7 +10,7 @@ interface Props { function LiveSessionReloadButton(props: Props) { const { loading } = props return ( - + ) }