From 0b583b91df2ee63014a177d526e31e26edbf6b55 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Mon, 30 Jan 2023 13:00:20 +0100 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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) {
- +