From 67e6abadc427c3a3bc7254c5b14b862c7b6808f7 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 12:58:13 +0100 Subject: [PATCH 01/13] fix(ui) - errors reading --- frontend/app/api_client.js | 6 ++---- frontend/app/api_middleware.js | 5 +++-- .../components/Client/CustomFields/CustomFieldForm.js | 11 ----------- .../components/Client/CustomFields/CustomFields.js | 10 ++++++---- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/frontend/app/api_client.js b/frontend/app/api_client.js index a9e092486..c9a041cc9 100644 --- a/frontend/app/api_client.js +++ b/frontend/app/api_client.js @@ -95,13 +95,11 @@ export default class APIClient { edp = `${ edp }/${ this.siteId }` } return fetch(edp + path, this.init) - .then(response => { + .then((response) => { if (response.ok) { return response } else { - throw new Error( - `! ${this.init.method} error on ${path}; ${response.status}` - ) + return Promise.reject({ message: `! ${this.init.method} error on ${path}; ${response.status}`, response }); } }) } diff --git a/frontend/app/api_middleware.js b/frontend/app/api_middleware.js index f98ad344b..9ef371f01 100644 --- a/frontend/app/api_middleware.js +++ b/frontend/app/api_middleware.js @@ -33,9 +33,10 @@ export default () => (next) => (action) => { next({ type: UPDATE_JWT, data: jwt }); } }) - .catch((e) => { + .catch(async (e) => { + const data = await e.response.json(); logger.error('Error during API request. ', e); - return next({ type: FAILURE, errors: parseError(e) }); + return next({ type: FAILURE, errors: parseError(data.errors) }); }); }; diff --git a/frontend/app/components/Client/CustomFields/CustomFieldForm.js b/frontend/app/components/Client/CustomFields/CustomFieldForm.js index 22108deee..15d24be3d 100644 --- a/frontend/app/components/Client/CustomFields/CustomFieldForm.js +++ b/frontend/app/components/Client/CustomFields/CustomFieldForm.js @@ -39,17 +39,6 @@ class CustomFieldForm extends React.PureComponent { placeholder="Field Name" /> - - {/* TODO: errors state is not updating properly */} - {/* {errors && ( -
- {errors.map((error, i) => ( - - {error.message} - - ))} -
- )} */}
diff --git a/frontend/app/components/Client/CustomFields/CustomFields.js b/frontend/app/components/Client/CustomFields/CustomFields.js index 30844dec2..d5843425a 100644 --- a/frontend/app/components/Client/CustomFields/CustomFields.js +++ b/frontend/app/components/Client/CustomFields/CustomFields.js @@ -11,6 +11,7 @@ import ListItem from './ListItem'; import { confirm } from 'UI'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { useModal } from 'App/components/Modal'; +import { toast } from 'react-toastify'; function CustomFields(props) { const [currentSite, setCurrentSite] = React.useState(props.sites.get(0)); @@ -25,10 +26,11 @@ function CustomFields(props) { }, []); const save = (field) => { - props.save(currentSite.id, field).then(() => { - const { errors } = props; - if (!errors || errors.size === 0) { + props.save(currentSite.id, field).then((response) => { + if (!response || !response.errors || response.errors.size === 0) { hideModal(); + } else { + toast.error(response.errors[0]); } }); }; @@ -73,7 +75,7 @@ function CustomFields(props) {
- +
From 0b583b91df2ee63014a177d526e31e26edbf6b55 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Mon, 30 Jan 2023 13:00:20 +0100 Subject: [PATCH 02/13] feat(chalice): fixed autocomplete --- api/chalicelib/core/autocomplete.py | 20 ++++++++++---------- ee/api/chalicelib/core/autocomplete_exp.py | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/api/chalicelib/core/autocomplete.py b/api/chalicelib/core/autocomplete.py index 06741cbe5..56ad29b54 100644 --- a/api/chalicelib/core/autocomplete.py +++ b/api/chalicelib/core/autocomplete.py @@ -8,16 +8,16 @@ TABLE = "public.autocomplete" def __get_autocomplete_table(value, project_id): - autocomplete_events = [schemas.FilterType.rev_id, - schemas.EventType.click, - schemas.FilterType.user_device, - schemas.FilterType.user_id, - schemas.FilterType.user_browser, - schemas.FilterType.user_os, - schemas.EventType.custom, - schemas.FilterType.user_country, - schemas.EventType.location, - schemas.EventType.input] + autocomplete_events = [schemas.FilterType.rev_id.value.upper(), + schemas.EventType.click.value.upper(), + schemas.FilterType.user_device.value.upper(), + schemas.FilterType.user_id.value.upper(), + schemas.FilterType.user_browser.value.upper(), + schemas.FilterType.user_os.value.upper(), + schemas.EventType.custom.value.upper(), + schemas.FilterType.user_country.value.upper(), + schemas.EventType.location.value.upper(), + schemas.EventType.input.value.upper()] autocomplete_events.sort() sub_queries = [] c_list = [] diff --git a/ee/api/chalicelib/core/autocomplete_exp.py b/ee/api/chalicelib/core/autocomplete_exp.py index 2e1a3f002..ea70af00e 100644 --- a/ee/api/chalicelib/core/autocomplete_exp.py +++ b/ee/api/chalicelib/core/autocomplete_exp.py @@ -8,16 +8,16 @@ TABLE = "experimental.autocomplete" def __get_autocomplete_table(value, project_id): - autocomplete_events = [schemas.FilterType.rev_id, - schemas.EventType.click, - schemas.FilterType.user_device, - schemas.FilterType.user_id, - schemas.FilterType.user_browser, - schemas.FilterType.user_os, - schemas.EventType.custom, - schemas.FilterType.user_country, - schemas.EventType.location, - schemas.EventType.input] + autocomplete_events = [schemas.FilterType.rev_id.value.upper(), + schemas.EventType.click.value.upper(), + schemas.FilterType.user_device.value.upper(), + schemas.FilterType.user_id.value.upper(), + schemas.FilterType.user_browser.value.upper(), + schemas.FilterType.user_os.value.upper(), + schemas.EventType.custom.value.upper(), + schemas.FilterType.user_country.value.upper(), + schemas.EventType.location.value.upper(), + schemas.EventType.input.value.upper()] autocomplete_events.sort() sub_queries = [] c_list = [] From 25522f63ca65862283da2188542255f3e0616599 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 12:16:18 +0100 Subject: [PATCH 03/13] fix(ui) - listing visibility negative values --- .../shared/SessionSettings/components/ListingVisibility.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/shared/SessionSettings/components/ListingVisibility.tsx b/frontend/app/components/shared/SessionSettings/components/ListingVisibility.tsx index c18629490..8bea8b004 100644 --- a/frontend/app/components/shared/SessionSettings/components/ListingVisibility.tsx +++ b/frontend/app/components/shared/SessionSettings/components/ListingVisibility.tsx @@ -49,9 +49,11 @@ function ListingVisibility() { value={durationSettings.count} type="number" name="count" + min={0} placeholder="E.g 10" onChange={({ target: { value } }: any) => { - changeSettings({ count: value }) + console.log('value', value) + changeSettings({ count: value > 0 ? value : '' }) }} /> From ab81546a996d213250b9faad70eff0c6e3b97ffd Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 30 Jan 2023 12:27:11 +0100 Subject: [PATCH 04/13] fix(ui): change spelling for sharing --- frontend/app/components/Session/WebPlayer.tsx | 1 - .../Session_/Player/Controls/components/CreateNote.tsx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index a7865621f..e2f97cd52 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -72,7 +72,6 @@ function WebPlayer(props: any) { WebPlayerInst.jump(parseInt(jumpToTime)); } if (freeze) { - console.log(freeze) WebPlayerInst.freeze() } diff --git a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx index e2e50d2e4..51f74bf44 100644 --- a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx +++ b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx @@ -258,7 +258,7 @@ function CreateNote({
setTeams(!useTeams)}> - Send to teams? + Send to MSTeams?
{useTeams && ( From 6ac1e0c5bdbafbdbe156a7d0abcaa3ee3bc06c06 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 30 Jan 2023 12:36:15 +0100 Subject: [PATCH 05/13] fix(ui): remove depecated code(screen sharing, long tasks) --- .../Assist/ScreenSharing/ScreenSharing.tsx | 45 ------- .../components/Assist/ScreenSharing/index.js | 1 - .../LongTasks/LongTasks.DEPRECATED.js | 122 ------------------ .../components/Session_/LongTasks/index.js | 1 - frontend/app/duck/components/player.js | 1 - 5 files changed, 170 deletions(-) delete mode 100644 frontend/app/components/Assist/ScreenSharing/ScreenSharing.tsx delete mode 100644 frontend/app/components/Assist/ScreenSharing/index.js delete mode 100644 frontend/app/components/Session_/LongTasks/LongTasks.DEPRECATED.js delete mode 100644 frontend/app/components/Session_/LongTasks/index.js diff --git a/frontend/app/components/Assist/ScreenSharing/ScreenSharing.tsx b/frontend/app/components/Assist/ScreenSharing/ScreenSharing.tsx deleted file mode 100644 index 35d67f91b..000000000 --- a/frontend/app/components/Assist/ScreenSharing/ScreenSharing.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React from 'react' -import { Button } from 'UI' - -function ScreenSharing() { - const videoRef = React.createRef() - - function handleSuccess(stream) { - // startButton.disabled = true; - //videoRef.current?.srcObject = stream; - // @ts-ignore - window.stream = stream; // make variable available to browser console - - stream.getVideoTracks()[0].addEventListener('ended', () => { - console.log('The user has ended sharing the screen'); - }); - } - - function handleError(error) { - console.log(`getDisplayMedia error: ${error.name}`, error); - } - - const startScreenSharing = () => { - // @ts-ignore - navigator.mediaDevices.getDisplayMedia({video: true}) - .then(handleSuccess, handleError); - } - - const stopScreenSharing = () => { - // @ts-ignore - window.stream.stop() - console.log('Stop screen sharing') - } - - return ( -
- -
- - -
-
- ) -} - -export default ScreenSharing diff --git a/frontend/app/components/Assist/ScreenSharing/index.js b/frontend/app/components/Assist/ScreenSharing/index.js deleted file mode 100644 index f2bc82ab6..000000000 --- a/frontend/app/components/Assist/ScreenSharing/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './ScreenSharing' \ No newline at end of file diff --git a/frontend/app/components/Session_/LongTasks/LongTasks.DEPRECATED.js b/frontend/app/components/Session_/LongTasks/LongTasks.DEPRECATED.js deleted file mode 100644 index 2fa80fd01..000000000 --- a/frontend/app/components/Session_/LongTasks/LongTasks.DEPRECATED.js +++ /dev/null @@ -1,122 +0,0 @@ -import React from 'react'; -import { NoContent, Input, QuestionMarkHint } from 'UI' -import { getRE } from 'App/utils'; -import { connectPlayer, jump } from 'Player'; -import BottomBlock from '../BottomBlock'; -import TimeTable from '../TimeTable'; - - -const CONTEXTS = [ "unknown", "self", "same-origin-ancestor", "same-origin-descendant", "same-origin", "cross-origin-ancestor", "cross-origin-descendant", "cross-origin-unreachable", "multiple-contexts" ]; -const CONTAINER_TYPES = [ "window", "iframe", "embed", "object" ]; - -function renderContext({ context }) { - return CONTEXTS[ context ]; -} - -function renderDuration({ duration }) { - return `${ duration }ms`; -} - -function renderContainerType({ containerType }) { - return CONTAINER_TYPES[ containerType ] -} - -@connectPlayer(state => ({ - list: state.longtasksList, - time: state.time, -})) -export default class GraphQL extends React.PureComponent { - state = { - filter: "", - } - onFilterChange = ({ target: { value } }) => this.setState({ filter: value }) - - jump = ({ time }) => { - jump(time); - } - - render() { - const { list, time} = this.props; - const { filter, current } = this.state; - const filterRE = getRE(filter, 'i'); - const filtered = list - .filter(({ containerType, context, containerName = "", containerId = "", containerSrc="" }) => - filterRE.test(containerName) || - filterRE.test(containerId) || - filterRE.test(containerSrc) || - filterRE.test(CONTEXTS[ context ]) || - filterRE.test(CONTAINER_TYPES[ containerType ])); - const lastIndex = filtered.filter(item => item.time <= time).length - 1; - return ( - - - Long Tasks -
- - - Learn more - about Long Tasks API - - } - // className="mr-4" - /> -
-
- - - - {[ - { - label: "Context", - render: renderContext, - width: 140, - }, { - label: "Container Type", - width: 110, - render: renderContainerType, - }, - // { - // label: "ID", - // width: 70, - // dataKey: "containerId" - // }, { - // label: "Name", - // width: 70, - // dataKey: "containerName" - // }, { - // label: "SRC", - // width: 70, - // dataKey: "containerSrc" - // }, - { - label: "Duration", - width: 100, - render: renderDuration, - } - ]} - - - -
- ); - } -} diff --git a/frontend/app/components/Session_/LongTasks/index.js b/frontend/app/components/Session_/LongTasks/index.js deleted file mode 100644 index ace8262a0..000000000 --- a/frontend/app/components/Session_/LongTasks/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './LongTasks.DEPRECATED'; diff --git a/frontend/app/duck/components/player.js b/frontend/app/duck/components/player.js index 550f6e4df..e3b39bf52 100644 --- a/frontend/app/duck/components/player.js +++ b/frontend/app/duck/components/player.js @@ -10,7 +10,6 @@ export const PERFORMANCE = 6; export const GRAPHQL = 7; export const FETCH = 8; export const EXCEPTIONS = 9; -export const LONGTASKS = 10; export const INSPECTOR = 11; export const OVERVIEW = 12; From fd88a728d98bcce4c6112162351e4d79cbd75a55 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 12:58:13 +0100 Subject: [PATCH 06/13] fix(ui) - errors reading --- frontend/app/api_client.js | 6 ++---- frontend/app/api_middleware.js | 5 +++-- .../components/Client/CustomFields/CustomFieldForm.js | 11 ----------- .../components/Client/CustomFields/CustomFields.js | 10 ++++++---- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/frontend/app/api_client.js b/frontend/app/api_client.js index a9e092486..c9a041cc9 100644 --- a/frontend/app/api_client.js +++ b/frontend/app/api_client.js @@ -95,13 +95,11 @@ export default class APIClient { edp = `${ edp }/${ this.siteId }` } return fetch(edp + path, this.init) - .then(response => { + .then((response) => { if (response.ok) { return response } else { - throw new Error( - `! ${this.init.method} error on ${path}; ${response.status}` - ) + return Promise.reject({ message: `! ${this.init.method} error on ${path}; ${response.status}`, response }); } }) } diff --git a/frontend/app/api_middleware.js b/frontend/app/api_middleware.js index f98ad344b..9ef371f01 100644 --- a/frontend/app/api_middleware.js +++ b/frontend/app/api_middleware.js @@ -33,9 +33,10 @@ export default () => (next) => (action) => { next({ type: UPDATE_JWT, data: jwt }); } }) - .catch((e) => { + .catch(async (e) => { + const data = await e.response.json(); logger.error('Error during API request. ', e); - return next({ type: FAILURE, errors: parseError(e) }); + return next({ type: FAILURE, errors: parseError(data.errors) }); }); }; diff --git a/frontend/app/components/Client/CustomFields/CustomFieldForm.js b/frontend/app/components/Client/CustomFields/CustomFieldForm.js index 22108deee..15d24be3d 100644 --- a/frontend/app/components/Client/CustomFields/CustomFieldForm.js +++ b/frontend/app/components/Client/CustomFields/CustomFieldForm.js @@ -39,17 +39,6 @@ class CustomFieldForm extends React.PureComponent { placeholder="Field Name" /> - - {/* TODO: errors state is not updating properly */} - {/* {errors && ( -
- {errors.map((error, i) => ( - - {error.message} - - ))} -
- )} */}
diff --git a/frontend/app/components/Client/CustomFields/CustomFields.js b/frontend/app/components/Client/CustomFields/CustomFields.js index 30844dec2..d5843425a 100644 --- a/frontend/app/components/Client/CustomFields/CustomFields.js +++ b/frontend/app/components/Client/CustomFields/CustomFields.js @@ -11,6 +11,7 @@ import ListItem from './ListItem'; import { confirm } from 'UI'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { useModal } from 'App/components/Modal'; +import { toast } from 'react-toastify'; function CustomFields(props) { const [currentSite, setCurrentSite] = React.useState(props.sites.get(0)); @@ -25,10 +26,11 @@ function CustomFields(props) { }, []); const save = (field) => { - props.save(currentSite.id, field).then(() => { - const { errors } = props; - if (!errors || errors.size === 0) { + props.save(currentSite.id, field).then((response) => { + if (!response || !response.errors || response.errors.size === 0) { hideModal(); + } else { + toast.error(response.errors[0]); } }); }; @@ -73,7 +75,7 @@ function CustomFields(props) {
- +
From ee47121d615164f059c9a8c32566e6aa8da298d3 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Mon, 30 Jan 2023 13:10:11 +0100 Subject: [PATCH 07/13] feat(chalice): fixed autocomplete --- api/chalicelib/core/autocomplete.py | 39 ++++++++++++---------- ee/api/chalicelib/core/autocomplete_exp.py | 37 ++++++++++---------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/api/chalicelib/core/autocomplete.py b/api/chalicelib/core/autocomplete.py index 56ad29b54..00eff7d61 100644 --- a/api/chalicelib/core/autocomplete.py +++ b/api/chalicelib/core/autocomplete.py @@ -8,16 +8,16 @@ TABLE = "public.autocomplete" def __get_autocomplete_table(value, project_id): - autocomplete_events = [schemas.FilterType.rev_id.value.upper(), - schemas.EventType.click.value.upper(), - schemas.FilterType.user_device.value.upper(), - schemas.FilterType.user_id.value.upper(), - schemas.FilterType.user_browser.value.upper(), - schemas.FilterType.user_os.value.upper(), - schemas.EventType.custom.value.upper(), - schemas.FilterType.user_country.value.upper(), - schemas.EventType.location.value.upper(), - schemas.EventType.input.value.upper()] + autocomplete_events = [schemas.FilterType.rev_id, + schemas.EventType.click, + schemas.FilterType.user_device, + schemas.FilterType.user_id, + schemas.FilterType.user_browser, + schemas.FilterType.user_os, + schemas.EventType.custom, + schemas.FilterType.user_country, + schemas.EventType.location, + schemas.EventType.input] autocomplete_events.sort() sub_queries = [] c_list = [] @@ -25,24 +25,24 @@ def __get_autocomplete_table(value, project_id): if e == schemas.FilterType.user_country: c_list = countries.get_country_code_autocomplete(value) if len(c_list) > 0: - sub_queries.append(f"""(SELECT DISTINCT ON(value) type, value + sub_queries.append(f"""(SELECT DISTINCT ON(value) '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value IN %(c_list)s)""") continue - sub_queries.append(f"""(SELECT type, value + sub_queries.append(f"""(SELECT '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value ILIKE %(svalue)s ORDER BY value LIMIT 5)""") if len(value) > 2: - sub_queries.append(f"""(SELECT type, value + sub_queries.append(f"""(SELECT '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value ILIKE %(value)s ORDER BY value LIMIT 5)""") @@ -62,8 +62,11 @@ def __get_autocomplete_table(value, project_id): print(value) print("--------------------") raise err - results = helper.list_to_camel_case(cur.fetchall()) - return results + results = cur.fetchall() + for r in results: + r["type"] = r.pop("_type") + results = helper.list_to_camel_case(results) + return results def __generic_query(typename, value_length=None): diff --git a/ee/api/chalicelib/core/autocomplete_exp.py b/ee/api/chalicelib/core/autocomplete_exp.py index ea70af00e..03ca85957 100644 --- a/ee/api/chalicelib/core/autocomplete_exp.py +++ b/ee/api/chalicelib/core/autocomplete_exp.py @@ -8,16 +8,16 @@ TABLE = "experimental.autocomplete" def __get_autocomplete_table(value, project_id): - autocomplete_events = [schemas.FilterType.rev_id.value.upper(), - schemas.EventType.click.value.upper(), - schemas.FilterType.user_device.value.upper(), - schemas.FilterType.user_id.value.upper(), - schemas.FilterType.user_browser.value.upper(), - schemas.FilterType.user_os.value.upper(), - schemas.EventType.custom.value.upper(), - schemas.FilterType.user_country.value.upper(), - schemas.EventType.location.value.upper(), - schemas.EventType.input.value.upper()] + autocomplete_events = [schemas.FilterType.rev_id, + schemas.EventType.click, + schemas.FilterType.user_device, + schemas.FilterType.user_id, + schemas.FilterType.user_browser, + schemas.FilterType.user_os, + schemas.EventType.custom, + schemas.FilterType.user_country, + schemas.EventType.location, + schemas.EventType.input] autocomplete_events.sort() sub_queries = [] c_list = [] @@ -25,24 +25,24 @@ def __get_autocomplete_table(value, project_id): if e == schemas.FilterType.user_country: c_list = countries.get_country_code_autocomplete(value) if len(c_list) > 0: - sub_queries.append(f"""(SELECT DISTINCT ON(value) type, value + sub_queries.append(f"""(SELECT DISTINCT ON(value) '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value IN %(c_list)s)""") continue - sub_queries.append(f"""(SELECT type, value + sub_queries.append(f"""(SELECT '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value ILIKE %(svalue)s ORDER BY value LIMIT 5)""") if len(value) > 2: - sub_queries.append(f"""(SELECT type, value + sub_queries.append(f"""(SELECT '{e.value}' AS _type, value FROM {TABLE} WHERE project_id = %(project_id)s - AND type= '{e}' + AND type= '{e.value.upper()}' AND value ILIKE %(value)s ORDER BY value LIMIT 5)""") @@ -64,7 +64,10 @@ def __get_autocomplete_table(value, project_id): print(value) print("--------------------") raise err - return results + for r in results: + r["type"] = r.pop("_type") + results = helper.list_to_camel_case(results) + return results def __generic_query(typename, value_length=None): From 92be78f509259c812438e608b7f171469d14ca65 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 14:10:55 +0100 Subject: [PATCH 08/13] fix(ui) - password reset error check --- .../Client/ProfileSettings/ChangePassword.js | 21 ++++++++++--------- frontend/app/duck/user.js | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/frontend/app/components/Client/ProfileSettings/ChangePassword.js b/frontend/app/components/Client/ProfileSettings/ChangePassword.js index d0222abf0..2640ab612 100644 --- a/frontend/app/components/Client/ProfileSettings/ChangePassword.js +++ b/frontend/app/components/Client/ProfileSettings/ChangePassword.js @@ -3,6 +3,7 @@ import { connect } from 'react-redux'; import { Button, Message, Form, Input } from 'UI'; import styles from './profileSettings.module.css'; import { updatePassword } from 'Duck/user'; +import { toast } from 'react-toastify'; const ERROR_DOESNT_MATCH = "Passwords doesn't match"; const MIN_LENGTH = 8; @@ -48,12 +49,15 @@ export default class ChangePassword extends React.PureComponent { oldPassword, newPassword, }) - .then(() => { - if (this.props.passwordErrors.size === 0) { - this.setState({ - ...defaultState, - success: true, - }); + .then((e) => { + const success = !e || !e.errors || e.errors.length === 0; + this.setState({ + ...defaultState, + success: success, + show: !success + }); + if (success) { + toast.success(`Successfully changed password`); } }); }; @@ -98,7 +102,7 @@ export default class ChangePassword extends React.PureComponent { -
+
@@ -107,9 +111,6 @@ export default class ChangePassword extends React.PureComponent { Cancel
- ) : (
this.setState({ show: true })}> diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index ce0f66fec..d938c8c09 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -59,7 +59,7 @@ const reducer = (state = initialState, action = {}) => { case RESET_PASSWORD.SUCCESS: case UPDATE_PASSWORD.SUCCESS: case LOGIN.SUCCESS: - state.set('account', Account({...action.data.user })).set('loginRequest', { loading: false, errors: [] }) + state.set('account', Account({...action.data.user })).set('loginRequest', { loading: false, errors: [] }).set('passwordErrors', List()) case SIGNUP.SUCCESS: state.set('account', Account(action.data.user)).set('onboarding', true); case REQUEST_RESET_PASSWORD.SUCCESS: From 64cc9ea72d8742fa0be576fa8d9846fc3e8e5df7 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 30 Jan 2023 14:27:38 +0100 Subject: [PATCH 09/13] fix(ui): fix webhook duplicating --- frontend/app/mstore/settingsStore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/app/mstore/settingsStore.ts b/frontend/app/mstore/settingsStore.ts index d9dfb0dd3..7dd584fd3 100644 --- a/frontend/app/mstore/settingsStore.ts +++ b/frontend/app/mstore/settingsStore.ts @@ -71,11 +71,16 @@ export default class SettingsStore { return webhookService.saveWebhook(inst) .then(data => { this.webhookInst = new Webhook(data) - this.webhooks = [...this.webhooks, this.webhookInst] + if (inst.webhookId === undefined) this.setWebhooks([...this.webhooks, this.webhookInst]) + else this.setWebhooks([...this.webhooks.filter(hook => hook.webhookId !== data.webhookId), this.webhookInst]) this.hooksLoading = false }) } + setWebhooks = (webhooks: Webhook[]) => { + this.webhooks = webhooks + } + removeWebhook = (hookId: string) => { this.hooksLoading = true return webhookService.removeWebhook(hookId) From 8338f1e6594090f9206adaee95e69681bf5eb0b7 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 14:34:25 +0100 Subject: [PATCH 10/13] fix(ui) - removed unnecessary calls --- .../Client/Integrations/Integrations.tsx | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/frontend/app/components/Client/Integrations/Integrations.tsx b/frontend/app/components/Client/Integrations/Integrations.tsx index d1f53f56d..f1851f919 100644 --- a/frontend/app/components/Client/Integrations/Integrations.tsx +++ b/frontend/app/components/Client/Integrations/Integrations.tsx @@ -64,7 +64,7 @@ function Integrations(props: Props) { }, []); const onClick = (integration: any, width: number) => { - if (integration.slug) { + if (integration.slug && integration.slug !== 'slack' && integration.slug !== 'msteams') { props.fetch(integration.slug, props.siteId); } @@ -241,30 +241,15 @@ const integrations = [ description: "Reproduce issues as if they happened in your own browser. Plugins help capture your application's store, HTTP requeets, GraphQL queries, and more.", integrations: [ - { title: 'Redux', slug: 'redux', icon: 'integrations/redux', component: }, - { title: 'VueX', slug: 'vuex', icon: 'integrations/vuejs', component: }, - { title: 'Pinia', slug: 'pinia', icon: 'integrations/pinia', component: }, - { - title: 'GraphQL', - slug: 'graphql', - icon: 'integrations/graphql', - component: , - }, - { title: 'NgRx', slug: 'ngrx', icon: 'integrations/ngrx', component: }, - { title: 'MobX', slug: 'mobx', icon: 'integrations/mobx', component: }, - { - title: 'Profiler', - slug: 'profiler', - icon: 'integrations/openreplay', - component: , - }, - { - title: 'Assist', - slug: 'assist', - icon: 'integrations/openreplay', - component: , - }, - { title: 'Zustand', slug: 'zustand', icon: '', header: '🐻', component: }, + { title: 'Redux', icon: 'integrations/redux', component: }, + { title: 'VueX', icon: 'integrations/vuejs', component: }, + { title: 'Pinia', icon: 'integrations/pinia', component: }, + { title: 'GraphQL', icon: 'integrations/graphql', component: }, + { title: 'NgRx', icon: 'integrations/ngrx', component: }, + { title: 'MobX', icon: 'integrations/mobx', component: }, + { title: 'Profiler', icon: 'integrations/openreplay', component: }, + { title: 'Assist', icon: 'integrations/openreplay', component: }, + { title: 'Zustand', icon: '', header: '🐻', component: }, ], }, ]; From 03e28df698fbc55a2525c590afe6dc478fc6b4bc Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Jan 2023 14:48:58 +0100 Subject: [PATCH 11/13] fix(ui) - session share --- .../app/components/shared/SharePopup/SharePopup.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/app/components/shared/SharePopup/SharePopup.js b/frontend/app/components/shared/SharePopup/SharePopup.js index 1df16cf6d..8e09f819c 100644 --- a/frontend/app/components/shared/SharePopup/SharePopup.js +++ b/frontend/app/components/shared/SharePopup/SharePopup.js @@ -91,15 +91,13 @@ export default class SharePopup extends React.PureComponent { const { trigger, channels, msTeamsChannels, showCopyLink = false } = this.props; const { comment, channelId, teamsChannel, loading } = this.state; - // const slackOptions = channels - // .map(({ webhookId, name }) => ({ value: webhookId, label: name })) - // .toJS(); + const slackOptions = channels + .map(({ webhookId, name }) => ({ value: webhookId, label: name })) + .toJS(); - // const msTeamsOptions = msTeamsChannels - // .map(({ webhookId, name }) => ({ value: webhookId, label: name })) - // .toJS(); - - const slackOptions = [], msTeamsOptions = []; + const msTeamsOptions = msTeamsChannels + .map(({ webhookId, name }) => ({ value: webhookId, label: name })) + .toJS(); return ( Date: Mon, 30 Jan 2023 15:03:30 +0100 Subject: [PATCH 12/13] change(ui) - notes removed an extra call to members --- .../Player/ReplayPlayer/EventsBlock/EventGroupWrapper.js | 1 - .../Session/Player/ReplayPlayer/EventsBlock/NoteEvent.tsx | 3 +-- frontend/app/components/Session/WebPlayer.tsx | 6 ------ .../components/Session_/EventsBlock/EventGroupWrapper.js | 1 - frontend/app/components/Session_/EventsBlock/NoteEvent.tsx | 3 +-- .../Session_/Player/Controls/components/ReadNote.tsx | 2 +- .../shared/SessionListContainer/SessionListContainer.tsx | 3 --- .../SessionListContainer/components/Notes/NoteItem.tsx | 3 +-- .../SessionListContainer/components/Notes/NoteList.tsx | 5 +---- frontend/app/services/NotesService.ts | 1 + 10 files changed, 6 insertions(+), 22 deletions(-) diff --git a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/EventGroupWrapper.js b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/EventGroupWrapper.js index 1ec053462..924be9f2c 100644 --- a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/EventGroupWrapper.js +++ b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/EventGroupWrapper.js @@ -88,7 +88,6 @@ class EventGroupWrapper extends React.Component { )} {isNote ? ( m.id === event.userId)?.email || event.userId} note={event} filterOutNote={filterOutNote} onEdit={this.props.setEditNoteTooltip} diff --git a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/NoteEvent.tsx b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/NoteEvent.tsx index 676b1f901..a09869ba5 100644 --- a/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/NoteEvent.tsx +++ b/frontend/app/components/Session/Player/ReplayPlayer/EventsBlock/NoteEvent.tsx @@ -14,7 +14,6 @@ import { TeamBadge } from 'Shared/SessionListContainer/components/Notes'; interface Props { note: Note; noEdit: boolean; - userEmail: string; filterOutNote: (id: number) => void; onEdit: (noteTooltipObj: Record) => void; } @@ -86,7 +85,7 @@ function NoteEvent(props: Props) { whiteSpace: 'nowrap', }} > - {props.userEmail}, {props.userEmail} + {props.note.userName}
{formatTimeOrDate(props.note.createdAt as unknown as number, timezone)} diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index e2f97cd52..0a9e3c48c 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -51,8 +51,6 @@ function WebPlayer(props: any) { ); setContextValue({ player: WebPlayerInst, store: PlayerStore }); - props.fetchMembers(); - if (!isClickmap) { notesStore.fetchSessionNotes(session.sessionId).then((r) => { const note = props.query.get('note'); @@ -123,10 +121,6 @@ function WebPlayer(props: any) { {showNoteModal ? ( ) => m.id === noteItem?.userId)?.email - || '' - } note={noteItem} onClose={onNoteClose} notFound={!noteItem} diff --git a/frontend/app/components/Session_/EventsBlock/EventGroupWrapper.js b/frontend/app/components/Session_/EventsBlock/EventGroupWrapper.js index 1ec053462..924be9f2c 100644 --- a/frontend/app/components/Session_/EventsBlock/EventGroupWrapper.js +++ b/frontend/app/components/Session_/EventsBlock/EventGroupWrapper.js @@ -88,7 +88,6 @@ class EventGroupWrapper extends React.Component { )} {isNote ? ( m.id === event.userId)?.email || event.userId} note={event} filterOutNote={filterOutNote} onEdit={this.props.setEditNoteTooltip} diff --git a/frontend/app/components/Session_/EventsBlock/NoteEvent.tsx b/frontend/app/components/Session_/EventsBlock/NoteEvent.tsx index 676b1f901..a09869ba5 100644 --- a/frontend/app/components/Session_/EventsBlock/NoteEvent.tsx +++ b/frontend/app/components/Session_/EventsBlock/NoteEvent.tsx @@ -14,7 +14,6 @@ import { TeamBadge } from 'Shared/SessionListContainer/components/Notes'; interface Props { note: Note; noEdit: boolean; - userEmail: string; filterOutNote: (id: number) => void; onEdit: (noteTooltipObj: Record) => void; } @@ -86,7 +85,7 @@ function NoteEvent(props: Props) { whiteSpace: 'nowrap', }} > - {props.userEmail}, {props.userEmail} + {props.note.userName}
{formatTimeOrDate(props.note.createdAt as unknown as number, timezone)} diff --git a/frontend/app/components/Session_/Player/Controls/components/ReadNote.tsx b/frontend/app/components/Session_/Player/Controls/components/ReadNote.tsx index 988412b2d..550c8f99f 100644 --- a/frontend/app/components/Session_/Player/Controls/components/ReadNote.tsx +++ b/frontend/app/components/Session_/Player/Controls/components/ReadNote.tsx @@ -58,7 +58,7 @@ function ReadNote(props: Props) {
-
{props.userEmail}
+
{props.note.userName}
{formatTimeOrDate(props.note.createdAt as unknown as number, timezone)}
diff --git a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx index 6a863e69b..67b1e12e7 100644 --- a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx +++ b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx @@ -15,9 +15,6 @@ function SessionListContainer({ fetchMembers: () => void; members: object[]; }) { - React.useEffect(() => { - fetchMembers(); - }, []); return (
diff --git a/frontend/app/components/shared/SessionListContainer/components/Notes/NoteItem.tsx b/frontend/app/components/shared/SessionListContainer/components/Notes/NoteItem.tsx index 1ece07d7f..05113f523 100644 --- a/frontend/app/components/shared/SessionListContainer/components/Notes/NoteItem.tsx +++ b/frontend/app/components/shared/SessionListContainer/components/Notes/NoteItem.tsx @@ -13,7 +13,6 @@ import TeamBadge from './TeamBadge'; interface Props { note: Note; - userEmail: string; } function NoteItem(props: Props) { @@ -69,7 +68,7 @@ function NoteItem(props: Props) { ) : null}
By - {props.userEmail},{' '} + {props.note.userName},{' '} {formatTimeOrDate(props.note.createdAt as unknown as number, timezone)}
{!props.note.isPublic ? null : } diff --git a/frontend/app/components/shared/SessionListContainer/components/Notes/NoteList.tsx b/frontend/app/components/shared/SessionListContainer/components/Notes/NoteList.tsx index 0a66cd0eb..3c48d2af0 100644 --- a/frontend/app/components/shared/SessionListContainer/components/Notes/NoteList.tsx +++ b/frontend/app/components/shared/SessionListContainer/components/Notes/NoteList.tsx @@ -35,10 +35,7 @@ function NotesList({ members }: { members: Array> }) {
{sliceListPerPage(list, notesStore.page - 1, notesStore.pageSize).map((note) => ( - m.id === note.userId)?.email || note.userId} - /> + ))}
diff --git a/frontend/app/services/NotesService.ts b/frontend/app/services/NotesService.ts index cdecb7c3f..d66316129 100644 --- a/frontend/app/services/NotesService.ts +++ b/frontend/app/services/NotesService.ts @@ -32,6 +32,7 @@ export interface Note { tag: iTag timestamp: number userId: number + userName: string } export interface NotesFilter { From aae5f366c2fbd292e5a01e5761cca402b60ee33a Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 30 Jan 2023 15:12:34 +0100 Subject: [PATCH 13/13] fix(ui): fix bug report steps radius --- .../components/Session_/BugReport/components/Steps.tsx | 8 +++++++- .../BugReport/components/StepsComponents/StepRadius.tsx | 5 +++-- frontend/app/components/Session_/BugReport/utils.ts | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/app/components/Session_/BugReport/components/Steps.tsx b/frontend/app/components/Session_/BugReport/components/Steps.tsx index 8307eea47..2f1517d24 100644 --- a/frontend/app/components/Session_/BugReport/components/Steps.tsx +++ b/frontend/app/components/Session_/BugReport/components/Steps.tsx @@ -46,6 +46,12 @@ function Steps({ xrayProps, notes, members }: Props) { bugReportStore.resetSteps(); }; + React.useEffect(() => { + if (bugReportStore.sessionEventSteps.length < RADIUS && bugReportStore.sessionEventSteps.length > 0) { + setRadius(bugReportStore.sessionEventSteps.length); + } + }, [bugReportStore.sessionEventSteps]) + return (
Steps to reproduce @@ -63,7 +69,7 @@ function Steps({ xrayProps, notes, members }: Props) { STEPS
{timePointer > 0 ? ( - + ) : null}
diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/StepRadius.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/StepRadius.tsx index 543d2c803..afa8b15c7 100644 --- a/frontend/app/components/Session_/BugReport/components/StepsComponents/StepRadius.tsx +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/StepRadius.tsx @@ -4,9 +4,10 @@ import { Tooltip } from 'UI' interface Props { pickRadius: number; setRadius: (v: number) => void; + stepsNum: number; } -function StepRadius({ pickRadius, setRadius }: Props) { +function StepRadius({ pickRadius, setRadius, stepsNum }: Props) { return (
@@ -18,7 +19,7 @@ function StepRadius({ pickRadius, setRadius }: Props) {
setRadius(pickRadius + 1)} + onClick={() => pickRadius < Math.floor(stepsNum/2) ? setRadius(pickRadius + 1) : null} > +1
diff --git a/frontend/app/components/Session_/BugReport/utils.ts b/frontend/app/components/Session_/BugReport/utils.ts index a97e275d7..053ece364 100644 --- a/frontend/app/components/Session_/BugReport/utils.ts +++ b/frontend/app/components/Session_/BugReport/utils.ts @@ -62,7 +62,7 @@ export function getClosestEventStep(time: number, arr: Step[]) { export const selectEventSteps = (steps: Step[], targetTime: number, radius: number) => { const { targetStep, index } = getClosestEventStep(targetTime, steps) - const stepsBeforeEvent = steps.slice(index - radius, index) + const stepsBeforeEvent = steps.slice(Math.max(index - radius, 0), index) const stepsAfterEvent = steps.slice(index + 1, index + 1 + radius) return [...stepsBeforeEvent, targetStep, ...stepsAfterEvent]