diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTableSessions/CustomMetricTableSessions.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTableSessions/CustomMetricTableSessions.tsx index e04c5c1a3..45cbd198a 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTableSessions/CustomMetricTableSessions.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricTableSessions/CustomMetricTableSessions.tsx @@ -1,22 +1,52 @@ import React from 'react'; import SessionItem from 'Shared/SessionItem'; +import { Pagination } from 'UI'; +const PER_PAGE = 10; interface Props { data: any metric?: any isTemplate?: boolean; + isEdit?: boolean; } function CustomMetricTableSessions(props: Props) { - const { data = { sessions: [] }, metric = {}, isTemplate } = props; - console.log('data', data) + const { data = { sessions: [], total: 0 }, isEdit = false, metric = {}, isTemplate } = props; + const currentPage = 1; + return (
{data.sessions && data.sessions.map((session: any, index: any) => ( ))} + + {isEdit && ( +
+ this.props.updateCurrentPage(page)} + limit={PER_PAGE} + debounceRequest={500} + /> +
+ )} + + {!isEdit && ( + + )}
); } -export default CustomMetricTableSessions; \ No newline at end of file +export default CustomMetricTableSessions; + +const ViewMore = ({ total }: any) => total > PER_PAGE && ( +
+
+
+ All {total} sessions +
+
+
+); \ No newline at end of file diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx index f248fbc89..5275a9147 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/CustomMetricWidgetPreview/CustomMetricWidgetPreview.tsx @@ -68,7 +68,7 @@ function CustomMetricWidget(props: Props) {
{isTimeSeries && ( <> - Visualization + Visualization - { (widget.metricType === 'table' || widget.metricType === 'timeseries') && } - { widget.metricType === 'funnel' && } + { widget.metricOf !== 'SESSIONS' && widget.metricOf !== 'ERRORS' && ( + <> + { (widget.metricType === 'table' || widget.metricType === 'timeseries') && } + { widget.metricType === 'funnel' && } + + )}
)); diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index 78a0ed183..0f0331151 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -41,7 +41,7 @@ const reducer = (state = initialState, action = {}) => { case RESET_PASSWORD.SUCCESS: case UPDATE_PASSWORD.SUCCESS: case LOGIN.SUCCESS: - state.set('account', Account({...action.data.user, smtp: action.data.client.smtp })) + state.set('account', Account({...action.data.user })) case SIGNUP.SUCCESS: state.set('account', Account(action.data.user)).set('onboarding', true); case REQUEST_RESET_PASSWORD.SUCCESS: diff --git a/frontend/app/mstore/dashboardStore.ts b/frontend/app/mstore/dashboardStore.ts index 3598fdc8a..6ea803c82 100644 --- a/frontend/app/mstore/dashboardStore.ts +++ b/frontend/app/mstore/dashboardStore.ts @@ -435,7 +435,7 @@ export default class DashboardStore implements IDashboardSotre { fetchMetricChartData(metric: IWidget, data: any, isWidget: boolean = false): Promise { const period = this.period.toTimestamps() return new Promise((resolve, reject) => { - return metricService.getMetricChartData(metric, { ...period, ...data, key: metric.predefinedKey }, isWidget) + return metricService.getMetricChartData(metric, { ...period, ...data, key: metric.predefinedKey, page: 1, limit: 10 }, isWidget) .then((data: any) => { if (metric.metricType === 'predefined' && metric.viewType === 'overview') { const _data = { ...data, chart: getChartFormatter(this.period)(data.chart) }