diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx index e0db75642..7c4c89332 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/ExampleCards.tsx @@ -53,6 +53,7 @@ export interface CardType { data?: any; height?: number; isEnterprise?: boolean; + filters?: any; } export const CARD_LIST: CardType[] = [ @@ -222,6 +223,74 @@ export const CARD_LIST: CardType[] = [ category: CARD_CATEGORIES[2].key, example: ByFetch }, + { + title: 'Sessions with 4xx/5xx Requests', + key: TIMESERIES + '_4xx_requests', + cardType: TIMESERIES, + metricOf: 'sessionCount', + category: CARD_CATEGORY.ERROR_TRACKING, + data: { + chart: generateTimeSeriesData(), + label: 'Number of Sessions', + namesMap: [ + 'Series 1' + ] + }, + filters: [ + { + "type": "fetch", + "isEvent": true, + "value": [], + "operator": "is", + "filters": [ + { + "type": "fetchStatusCode", + "isEvent": false, + "value": [ + "400" + ], + "operator": ">=", + "filters": [] + }, + ] + } + ], + example: ExampleTrend + }, + { + title: 'Sessions with Slow Network Requests', + key: TIMESERIES + '_slow_network_requests', + cardType: TIMESERIES, + metricOf: 'sessionCount', + category: CARD_CATEGORY.ERROR_TRACKING, + data: { + chart: generateTimeSeriesData(), + label: 'Number of Sessions', + namesMap: [ + 'Series 1' + ] + }, + filters: [ + { + "type": "fetch", + "isEvent": true, + "value": [], + "operator": "is", + "filters": [ + { + "type": "fetchDuration", + "isEvent": false, + "value": [ + "5000" + ], + "operator": ">=", + "filters": [] + }, + ] + } + ], + example: ExampleTrend + }, ]; function generateTimeSeriesData(): any[] { diff --git a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx index 44e3d396a..1804e029f 100644 --- a/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx +++ b/frontend/app/components/Dashboard/components/DashboardList/NewDashModal/SelectCard.tsx @@ -9,6 +9,7 @@ import CardsLibrary from 'Components/Dashboard/components/DashboardList/NewDashM import { FUNNEL } from 'App/constants/card'; import { useHistory } from 'react-router'; import { FilterKey } from 'Types/filter/filterType'; +import FilterSeries from '@/mstore/types/filterSeries'; interface SelectCardProps { onClose: (refresh?: boolean) => void; @@ -65,6 +66,17 @@ const SelectCard: React.FC = (props: SelectCardProps) => { metricOf: selectedCard.metricOf }; + if (selectedCard.filters) { + cardData.series = [ + new FilterSeries().fromJson({ + name: "Series 1", + filter: { + filters: selectedCard.filters, + } + }) + ]; + } + if (selectedCard.cardType === FUNNEL) { cardData.series = []; cardData.series.filter = [];