+
+
{data.total && (
<>
- Showing < span className='font-medium'>{(filter.page - 1) * pageSize + 1} to{' '}
- {(filter.page - 1) * pageSize + pageSize} of{' '}
- {data.total} issues.
+ Showing < span className="font-medium">{(filter.page - 1) * pageSize + 1} to{' '}
+ {(filter.page - 1) * pageSize + pageSize} of{' '}
+ {data.total} issues.
>
)}
@@ -132,7 +132,7 @@ function CardIssues() {
page={filter.page}
total={data.total}
onPageChange={(page: any) => filter.updateKey('page', page)}
- limit={pageSize}
+ limit={widget.limit}
debounceRequest={500}
/>
diff --git a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx
index 0fdf74d69..db9d77294 100644
--- a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx
+++ b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx
@@ -1,174 +1,168 @@
-import React, {useState} from 'react';
-import {useStore} from 'App/mstore';
-import {Icon, Loader, NoContent} from 'UI';
+import React, { useState } from 'react';
+import { useStore } from 'App/mstore';
+import { Icon, Loader, NoContent } from 'UI';
import WidgetPreview from '../WidgetPreview';
import WidgetSessions from '../WidgetSessions';
-import {useObserver} from 'mobx-react-lite';
-import {dashboardMetricDetails, metricDetails, withSiteId} from 'App/routes';
+import { useObserver } from 'mobx-react-lite';
+import { dashboardMetricDetails, metricDetails, withSiteId } from 'App/routes';
import FunnelIssues from '../Funnels/FunnelIssues/FunnelIssues';
import Breadcrumb from 'Shared/Breadcrumb';
-import {FilterKey} from 'Types/filter/filterType';
-import {Prompt, useHistory} from 'react-router';
-import AnimatedSVG, {ICONS} from 'Shared/AnimatedSVG/AnimatedSVG';
+import { FilterKey } from 'Types/filter/filterType';
+import { Prompt, useHistory } from 'react-router';
+import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG';
import {
- TIMESERIES,
- TABLE,
- HEATMAP,
- FUNNEL,
- INSIGHTS,
- USER_PATH,
- RETENTION,
+ TIMESERIES,
+ TABLE,
+ HEATMAP,
+ FUNNEL,
+ INSIGHTS,
+ USER_PATH,
+ RETENTION
} from 'App/constants/card';
import CardIssues from '../CardIssues';
import CardUserList from '../CardUserList/CardUserList';
-import WidgetViewHeader from "Components/Dashboard/components/WidgetView/WidgetViewHeader";
-import WidgetFormNew from "Components/Dashboard/components/WidgetForm/WidgetFormNew";
-import {Space} from "antd";
-import {renderClickmapThumbnail} from "Components/Dashboard/components/WidgetForm/renderMap";
-import Widget from "App/mstore/types/widget";
+import WidgetViewHeader from 'Components/Dashboard/components/WidgetView/WidgetViewHeader';
+import WidgetFormNew from 'Components/Dashboard/components/WidgetForm/WidgetFormNew';
+import { Space } from 'antd';
+import { renderClickmapThumbnail } from 'Components/Dashboard/components/WidgetForm/renderMap';
+import Widget from 'App/mstore/types/widget';
interface Props {
- history: any;
- match: any;
- siteId: any;
+ history: any;
+ match: any;
+ siteId: any;
}
function WidgetView(props: Props) {
- const {
- match: {
- params: {siteId, dashboardId, metricId},
- },
- } = props;
- // const siteId = location.pathname.split('/')[1];
- // const dashboardId = location.pathname.split('/')[3];
- const {metricStore, dashboardStore} = useStore();
- const widget = useObserver(() => metricStore.instance);
- const loading = useObserver(() => metricStore.isLoading);
- const [expanded, setExpanded] = useState(!metricId || metricId === 'create');
- const hasChanged = useObserver(() => widget.hasChanged);
- const dashboards = useObserver(() => dashboardStore.dashboards);
- const dashboard = useObserver(() => dashboards.find((d: any) => d.dashboardId == dashboardId));
- const dashboardName = dashboard ? dashboard.name : null;
- const [metricNotFound, setMetricNotFound] = useState(false);
- const history = useHistory();
- const [initialInstance, setInitialInstance] = useState();
- const isClickMap = widget.metricType === HEATMAP;
+ const {
+ match: {
+ params: { siteId, dashboardId, metricId }
+ }
+ } = props;
+ // const siteId = location.pathname.split('/')[1];
+ // const dashboardId = location.pathname.split('/')[3];
+ const { metricStore, dashboardStore } = useStore();
+ const widget = useObserver(() => metricStore.instance);
+ const loading = useObserver(() => metricStore.isLoading);
+ const [expanded, setExpanded] = useState(!metricId || metricId === 'create');
+ const hasChanged = useObserver(() => widget.hasChanged);
+ const dashboards = useObserver(() => dashboardStore.dashboards);
+ const dashboard = useObserver(() => dashboards.find((d: any) => d.dashboardId == dashboardId));
+ const dashboardName = dashboard ? dashboard.name : null;
+ const [metricNotFound, setMetricNotFound] = useState(false);
+ const history = useHistory();
+ const [initialInstance, setInitialInstance] = useState();
+ const isClickMap = widget.metricType === HEATMAP;
- React.useEffect(() => {
- if (metricId && metricId !== 'create') {
- metricStore.fetch(metricId, dashboardStore.period).catch((e) => {
- if (e.response.status === 404 || e.response.status === 422) {
- setMetricNotFound(true);
- }
- });
- } else {
- metricStore.init();
+ React.useEffect(() => {
+ if (metricId && metricId !== 'create') {
+ metricStore.fetch(metricId, dashboardStore.period).catch((e) => {
+ if (e.response.status === 404 || e.response.status === 422) {
+ setMetricNotFound(true);
}
- }, []);
+ });
+ } else {
+ metricStore.init();
+ }
+ }, []);
- // const onBackHandler = () => {
- // props.history.goBack();
- // };
- //
- // const openEdit = () => {
- // if (expanded) return;
- // setExpanded(true);
- // };
+ // const onBackHandler = () => {
+ // props.history.goBack();
+ // };
+ //
+ // const openEdit = () => {
+ // if (expanded) return;
+ // setExpanded(true);
+ // };
- const undoChanges = () => {
- const w = new Widget();
- metricStore.merge(w.fromJson(initialInstance), false);
- };
+ const undoChanges = () => {
+ const w = new Widget();
+ metricStore.merge(w.fromJson(initialInstance), false);
+ };
- const onSave = async () => {
- const wasCreating = !widget.exists();
- if (isClickMap) {
- try {
- widget.thumbnail = await renderClickmapThumbnail();
- } catch (e) {
- console.error(e);
- }
- }
- const savedMetric = await metricStore.save(widget);
- setInitialInstance(widget.toJson());
- if (wasCreating) {
- if (parseInt(dashboardId, 10) > 0) {
- history.replace(
- withSiteId(dashboardMetricDetails(dashboardId, savedMetric.metricId), siteId)
- );
- void dashboardStore.addWidgetToDashboard(
- dashboardStore.getDashboard(parseInt(dashboardId, 10))!,
- [savedMetric.metricId]
- );
- } else {
- history.replace(withSiteId(metricDetails(savedMetric.metricId), siteId));
- }
- }
- };
+ const onSave = async () => {
+ const wasCreating = !widget.exists();
+ if (isClickMap) {
+ try {
+ widget.thumbnail = await renderClickmapThumbnail();
+ } catch (e) {
+ console.error(e);
+ }
+ }
+ const savedMetric = await metricStore.save(widget);
+ setInitialInstance(widget.toJson());
+ if (wasCreating) {
+ if (parseInt(dashboardId, 10) > 0) {
+ history.replace(
+ withSiteId(dashboardMetricDetails(dashboardId, savedMetric.metricId), siteId)
+ );
+ void dashboardStore.addWidgetToDashboard(
+ dashboardStore.getDashboard(parseInt(dashboardId, 10))!,
+ [savedMetric.metricId]
+ );
+ } else {
+ history.replace(withSiteId(metricDetails(savedMetric.metricId), siteId));
+ }
+ }
+ };
- return useObserver(() => (
-
- {
- if (location.pathname.includes('/metrics/') || location.pathname.includes('/metric/')) {
- return true;
- }
- return 'You have unsaved changes. Are you sure you want to leave?';
- }}
- />
+ return useObserver(() => (
+
+ {
+ if (location.pathname.includes('/metrics/') || location.pathname.includes('/metric/')) {
+ return true;
+ }
+ return 'You have unsaved changes. Are you sure you want to leave?';
+ }}
+ />
-
-
-
-
- Metric not found!
-
- }
- >
-
-
-
-
-
-
-
-
-
- {/*
*/}
- {/* */}
- {/*
*/}
-
-
-
-
- {widget.metricOf !== FilterKey.SESSIONS && widget.metricOf !== FilterKey.ERRORS && (
- <>
- {(widget.metricType === TABLE || widget.metricType === TIMESERIES || widget.metricType === HEATMAP || widget.metricType === INSIGHTS) &&
- }
- {widget.metricType === FUNNEL && }
- >
- )}
-
- {widget.metricType === USER_PATH && }
- {widget.metricType === RETENTION && }
-
-
-
+
+
+
+
+ Metric not found!
-
- ));
+ }
+ >
+
+
+
+
+ {/**/}
+ {/* */}
+ {/*
*/}
+
+
+
+
+ {widget.metricOf !== FilterKey.SESSIONS && widget.metricOf !== FilterKey.ERRORS && (
+ <>
+ {(widget.metricType === TABLE || widget.metricType === TIMESERIES || widget.metricType === HEATMAP || widget.metricType === INSIGHTS) &&
+ }
+ {widget.metricType === FUNNEL && }
+ >
+ )}
+
+ {widget.metricType === USER_PATH && }
+ {widget.metricType === RETENTION && }
+
+
+