diff --git a/frontend/app/api_client.js b/frontend/app/api_client.js index 5673a0aab..a9e092486 100644 --- a/frontend/app/api_client.js +++ b/frontend/app/api_client.js @@ -25,7 +25,7 @@ const siteIdRequiredPaths = [ '/heatmaps', '/custom_metrics', '/dashboards', - '/metrics', + '/cards', '/unprocessed', '/notes', // '/custom_metrics/sessions', diff --git a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/DashboardWidgetGrid.tsx b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/DashboardWidgetGrid.tsx index cef3dd332..f0d5bcd67 100644 --- a/frontend/app/components/Dashboard/components/DashboardWidgetGrid/DashboardWidgetGrid.tsx +++ b/frontend/app/components/Dashboard/components/DashboardWidgetGrid/DashboardWidgetGrid.tsx @@ -56,7 +56,7 @@ function DashboardWidgetGrid(props: Props) { >
{smallWidgets.length > 0 ? ( <> -
+
Web Vitals
@@ -82,7 +82,7 @@ function DashboardWidgetGrid(props: Props) { ) : null} {smallWidgets.length > 0 && regularWidgets.length > 0 ? ( -
+
All Metrics
diff --git a/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx b/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx index 2bade6afb..df3b09180 100644 --- a/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx +++ b/frontend/app/components/Dashboard/components/MetricListItem/MetricListItem.tsx @@ -39,19 +39,20 @@ function MetricListItem(props: Props) { const path = withSiteId(`/metrics/${metric.metricId}`, siteId); history.push(path); }; + return (
- + /> */}
{metric.name}
diff --git a/frontend/app/components/Dashboard/components/MetricTypeList/MetricTypeList.tsx b/frontend/app/components/Dashboard/components/MetricTypeList/MetricTypeList.tsx index e0d6e846b..8e64d970d 100644 --- a/frontend/app/components/Dashboard/components/MetricTypeList/MetricTypeList.tsx +++ b/frontend/app/components/Dashboard/components/MetricTypeList/MetricTypeList.tsx @@ -4,7 +4,7 @@ import MetricsLibraryModal from '../MetricsLibraryModal'; import MetricTypeItem, { MetricType } from '../MetricTypeItem/MetricTypeItem'; import { TYPES, LIBRARY } from 'App/constants/card'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { dashboardMetricCreate, withSiteId } from 'App/routes'; +import { dashboardMetricCreate, metricCreate, withSiteId } from 'App/routes'; interface Props extends RouteComponentProps { dashboardId: number; @@ -23,7 +23,11 @@ function MetricTypeList(props: Props) { // TODO redirect to card builder with metricType query param const path = withSiteId(dashboardMetricCreate(dashboardId + ''), siteId); - history.push(path); + const queryString = new URLSearchParams({ type: slug }).toString(); + history.push({ + pathname: path, + search: `?${queryString}` + }); }; return ( diff --git a/frontend/app/components/Dashboard/components/MetricViewHeader/MetricViewHeader.tsx b/frontend/app/components/Dashboard/components/MetricViewHeader/MetricViewHeader.tsx index 2c7790d73..4f33a2a8d 100644 --- a/frontend/app/components/Dashboard/components/MetricViewHeader/MetricViewHeader.tsx +++ b/frontend/app/components/Dashboard/components/MetricViewHeader/MetricViewHeader.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Icon, PageTitle, Button, Link } from 'UI'; +import { Icon, PageTitle, Button, Link, SegmentSelection } from 'UI'; import MetricsSearch from '../MetricsSearch'; import Select from 'Shared/Select'; import { useStore } from 'App/mstore'; @@ -8,6 +8,9 @@ import { useObserver } from 'mobx-react-lite'; function MetricViewHeader() { const { metricStore } = useStore(); const sort = useObserver(() => metricStore.sort); + const listView = useObserver(() => metricStore.listView); + + return (
@@ -15,9 +18,21 @@ function MetricViewHeader() {
- + {/* - + */} + metricStore.updateKey('listView', !listView) } + value={{ value: listView ? 'list' : 'grid' }} + list={ [ + { value: 'list', name: '', icon: 'graph-up-arrow' }, + { value: 'grid', name: '', icon: 'hash' }, + ]} + />