From c7172b813983e0a110ced6e015acee61d1fbe5cf Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Wed, 1 Feb 2023 16:23:22 +0100 Subject: [PATCH 1/4] feat(chalice): fixed funnel-card-issue's sessions --- api/chalicelib/core/custom_metrics.py | 7 ++++--- ee/api/chalicelib/core/custom_metrics.py | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/api/chalicelib/core/custom_metrics.py b/api/chalicelib/core/custom_metrics.py index 5f7e831ad..5b34cc687 100644 --- a/api/chalicelib/core/custom_metrics.py +++ b/api/chalicelib/core/custom_metrics.py @@ -160,7 +160,7 @@ def __merge_metric_with_data(metric: schemas.CreateCardSchema, def make_chart(project_id, user_id, metric_id, data: schemas.CardChartSchema, metric: schemas.CreateCardSchema = None): if metric is None: - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None metric: schemas.CreateCardSchema = __merge_metric_with_data(metric=metric, data=data) @@ -292,7 +292,7 @@ def create(project_id, user_id, data: schemas.CreateCardSchema, dashboard=False) def update(metric_id, user_id, project_id, data: schemas.UpdateCardSchema): - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None series_ids = [r["seriesId"] for r in metric["series"]] @@ -538,9 +538,10 @@ def get_funnel_sessions_by_issue(user_id, project_id, metric_id, issue_id, data: schemas.CardSessionsSchema # , range_value=None, start_date=None, end_date=None ): - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None + metric: schemas.CreateCardSchema = schemas.CreateCardSchema(**metric) metric: schemas.CreateCardSchema = __merge_metric_with_data(metric=metric, data=data) if metric is None: return None diff --git a/ee/api/chalicelib/core/custom_metrics.py b/ee/api/chalicelib/core/custom_metrics.py index bd652ba01..46fa491e3 100644 --- a/ee/api/chalicelib/core/custom_metrics.py +++ b/ee/api/chalicelib/core/custom_metrics.py @@ -189,7 +189,7 @@ def __merge_metric_with_data(metric: schemas_ee.CreateCardSchema, def make_chart(project_id, user_id, metric_id, data: schemas.CardChartSchema, metric: schemas_ee.CreateCardSchema = None): if metric is None: - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None metric: schemas_ee.CreateCardSchema = __merge_metric_with_data(metric=metric, data=data) @@ -198,8 +198,8 @@ def make_chart(project_id, user_id, metric_id, data: schemas.CardChartSchema, def get_sessions(project_id, user_id, metric_id, data: schemas.CardSessionsSchema): - raw_metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False, - include_data=True) + # raw_metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False, include_data=True) + raw_metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if raw_metric is None: return None metric: schemas_ee.CreateCardSchema = schemas_ee.CreateCardSchema(**raw_metric) @@ -285,6 +285,7 @@ def create(project_id, user_id, data: schemas_ee.CreateCardSchema, dashboard=Fal session_data = __get_click_map_chart(project_id=project_id, user_id=user_id, data=data, include_mobs=False) if session_data is not None: + # for EE only keys = sessions_mobs. \ __get_mob_keys(project_id=project_id, session_id=session_data["sessionId"]) keys += sessions_mobs. \ @@ -332,7 +333,7 @@ def create(project_id, user_id, data: schemas_ee.CreateCardSchema, dashboard=Fal def update(metric_id, user_id, project_id, data: schemas_ee.UpdateCardSchema): - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None series_ids = [r["seriesId"] for r in metric["series"]] @@ -489,6 +490,7 @@ def delete(project_id, metric_id, user_id): RETURNING data;""", {"metric_id": metric_id, "project_id": project_id, "user_id": user_id}) ) + # for EE only row = cur.fetchone() if row: if row["data"] and not sessions_favorite.favorite_session_exists(session_id=row["data"]["sessionId"]): @@ -592,9 +594,10 @@ def get_funnel_sessions_by_issue(user_id, project_id, metric_id, issue_id, data: schemas.CardSessionsSchema # , range_value=None, start_date=None, end_date=None ): - metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) + metric: dict = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False) if metric is None: return None + metric: schemas_ee.CreateCardSchema = schemas.CreateCardSchema(**metric) metric: schemas_ee.CreateCardSchema = __merge_metric_with_data(metric=metric, data=data) if metric is None: return None From 4d2b53a9233ef368ee7e309829e51d41f9d056d0 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Wed, 1 Feb 2023 15:25:20 +0100 Subject: [PATCH 2/4] fix(ui) - funnel issues and other updates --- .../FunnelIssueDetails/FunnelIssueDetails.tsx | 2 +- .../Funnels/FunnelIssueModal/FunnelIssueModal.tsx | 12 +++++------- .../Funnels/FunnelIssuesList/FunnelIssuesList.tsx | 2 +- .../shared/Filters/FilterList/FilterList.tsx | 7 ++++--- frontend/app/mstore/metricStore.ts | 5 +++++ frontend/app/mstore/types/filter.ts | 1 + frontend/app/mstore/types/widget.ts | 5 +++++ 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/frontend/app/components/Dashboard/components/Funnels/FunnelIssueDetails/FunnelIssueDetails.tsx b/frontend/app/components/Dashboard/components/Funnels/FunnelIssueDetails/FunnelIssueDetails.tsx index 25ef7a0a0..16bd8abd0 100644 --- a/frontend/app/components/Dashboard/components/Funnels/FunnelIssueDetails/FunnelIssueDetails.tsx +++ b/frontend/app/components/Dashboard/components/Funnels/FunnelIssueDetails/FunnelIssueDetails.tsx @@ -27,7 +27,7 @@ function FunnelIssueDetails(props: Props) { filters: item.filter.filters.filter((filter: any, index: any) => { const stage = widget.data.funnel.stages[index]; return stage &&stage.isActive - }) + }).map((f: any) => f.toJson()) } } }) : [], }; diff --git a/frontend/app/components/Dashboard/components/Funnels/FunnelIssueModal/FunnelIssueModal.tsx b/frontend/app/components/Dashboard/components/Funnels/FunnelIssueModal/FunnelIssueModal.tsx index f1fa3469d..d5b6de307 100644 --- a/frontend/app/components/Dashboard/components/Funnels/FunnelIssueModal/FunnelIssueModal.tsx +++ b/frontend/app/components/Dashboard/components/Funnels/FunnelIssueModal/FunnelIssueModal.tsx @@ -7,13 +7,11 @@ interface Props { function FunnelIssueModal(props: Props) { const { issueId } = props; return ( -
-
- -
+
+
); } diff --git a/frontend/app/components/Dashboard/components/Funnels/FunnelIssuesList/FunnelIssuesList.tsx b/frontend/app/components/Dashboard/components/Funnels/FunnelIssuesList/FunnelIssuesList.tsx index 3894f4671..a59202043 100644 --- a/frontend/app/components/Dashboard/components/Funnels/FunnelIssuesList/FunnelIssuesList.tsx +++ b/frontend/app/components/Dashboard/components/Funnels/FunnelIssuesList/FunnelIssuesList.tsx @@ -29,7 +29,7 @@ function FunnelIssuesList(props: RouteComponentProps) { useEffect(() => { if (!issueId) return; - showModal(, { right: true, onClose: () => { + showModal(, { right: true, width: 1000, onClose: () => { if (props.history.location.pathname.includes("/metric")) { props.history.replace({search: ""}); } diff --git a/frontend/app/components/shared/Filters/FilterList/FilterList.tsx b/frontend/app/components/shared/Filters/FilterList/FilterList.tsx index 521a70eeb..6a115b502 100644 --- a/frontend/app/components/shared/Filters/FilterList/FilterList.tsx +++ b/frontend/app/components/shared/Filters/FilterList/FilterList.tsx @@ -18,6 +18,7 @@ interface Props { function FilterList(props: Props) { const { observeChanges = () => {}, filter, hideEventsOrder = false, saveRequestPayloads, supportsEmpty = true, excludeFilterKeys = [] } = props; const filters = List(filter.filters); + const eventsOrderSupport = filter.eventsOrderSupport; const hasEvents = filters.filter((i: any) => i.isEvent).size > 0; const hasFilters = filters.filter((i: any) => !i.isEvent).size > 0; let rowIndex = 0; @@ -55,9 +56,9 @@ function FilterList(props: Props) { onSelect={props.onChangeEventsOrder} value={{ value: filter.eventsOrder }} list={[ - { name: 'THEN', value: 'then' }, - { name: 'AND', value: 'and' }, - { name: 'OR', value: 'or' }, + { name: 'THEN', value: 'then', disabled: !eventsOrderSupport.includes('then') }, + { name: 'AND', value: 'and', disabled: !eventsOrderSupport.includes('and')}, + { name: 'OR', value: 'or', disabled: !eventsOrderSupport.includes('or')}, ]} />
diff --git a/frontend/app/mstore/metricStore.ts b/frontend/app/mstore/metricStore.ts index 63e8500bf..3ff0dbe97 100644 --- a/frontend/app/mstore/metricStore.ts +++ b/frontend/app/mstore/metricStore.ts @@ -103,6 +103,9 @@ export default class MetricStore { // handle metricType change if (obj.hasOwnProperty('metricType') && type !== this.instance.metricType) { + this.instance.series.forEach((s: any, i: number) => { + this.instance.series[i].filter.eventsOrderSupport = ['then', 'or', 'and'] + }) this.changeType(type); } @@ -141,6 +144,8 @@ export default class MetricStore { if (value === FUNNEL) { obj['metricOf'] = 'sessionCount'; + obj.series[0].filter.eventsOrder = 'then' + obj.series[0].filter.eventsOrderSupport = ['then'] } if (value === INSIGHTS) { diff --git a/frontend/app/mstore/types/filter.ts b/frontend/app/mstore/types/filter.ts index 549a0ad29..9b2874e9f 100644 --- a/frontend/app/mstore/types/filter.ts +++ b/frontend/app/mstore/types/filter.ts @@ -7,6 +7,7 @@ export default class Filter { name: string = '' filters: FilterItem[] = [] eventsOrder: string = 'then' + eventsOrderSupport: string[] = ['then', 'or', 'and'] startTimestamp: number = 0 endTimestamp: number = 0 diff --git a/frontend/app/mstore/types/widget.ts b/frontend/app/mstore/types/widget.ts index a39ba4ce2..5dee5d19d 100644 --- a/frontend/app/mstore/types/widget.ts +++ b/frontend/app/mstore/types/widget.ts @@ -139,6 +139,11 @@ export default class Widget { this.thumbnail = json.thumbnail; this.isPublic = json.isPublic; + if (this.metricType === FUNNEL) { + this.series[0].filter.eventsOrder = 'then'; + this.series[0].filter.eventsOrderSupport = ['then']; + } + if (period) { this.period = period; } From 635a3d2a17eb0f00bb01f5f5efa73f23349d2081 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Wed, 1 Feb 2023 15:50:03 +0100 Subject: [PATCH 3/4] fix(ui) - widget preview --- .../Dashboard/components/WidgetPreview/WidgetPreview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx index 6fb1042dc..7c534a8bb 100644 --- a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx +++ b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx @@ -95,7 +95,7 @@ function WidgetPreview(props: Props) {
- +
{ canAddToDashboard && ( From a56c64730e717b7a7cd423caddd1e1f61934b300 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Wed, 1 Feb 2023 16:22:01 +0100 Subject: [PATCH 4/4] fix(ui): fix create note modal --- .../Session_/Player/Controls/components/CreateNote.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx index 51f74bf44..663e70251 100644 --- a/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx +++ b/frontend/app/components/Session_/Player/Controls/components/CreateNote.tsx @@ -184,7 +184,7 @@ function CreateNote({ >
-

Add Note

+

{isEdit ? 'Edit Note' : 'Add Note'}

setUseTs(!useTimestamp)}> {`at ${duration}`} @@ -277,7 +277,7 @@ function CreateNote({
setPublic(!isPublic)}>