From 3745b297dbfd7b8d40790880141873c333b8f05d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 22 Dec 2021 20:19:54 +0100 Subject: [PATCH] Updated visits components to support the doFallbackRange flag --- src/visits/OrphanVisits.tsx | 5 +++-- src/visits/ShortUrlVisits.tsx | 5 +++-- src/visits/TagVisits.tsx | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/visits/OrphanVisits.tsx b/src/visits/OrphanVisits.tsx index e87a93fe..f30f5557 100644 --- a/src/visits/OrphanVisits.tsx +++ b/src/visits/OrphanVisits.tsx @@ -10,7 +10,7 @@ import { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; export interface OrphanVisitsProps extends CommonVisitsProps, RouteComponentProps { - getOrphanVisits: (params?: ShlinkVisitsParams, orphanVisitsType?: OrphanVisitType) => void; + getOrphanVisits: (params?: ShlinkVisitsParams, orphanVisitsType?: OrphanVisitType, doFallbackRange?: boolean) => void; orphanVisits: VisitsInfo; cancelGetOrphanVisits: () => void; } @@ -25,7 +25,8 @@ export const OrphanVisits = ({ exportVisits }: VisitsExporter) => boundToMercure selectedServer, }: OrphanVisitsProps) => { const exportCsv = (visits: NormalizedVisit[]) => exportVisits('orphan_visits.csv', visits); - const loadVisits = (params: VisitsParams) => getOrphanVisits(toApiParams(params), params.filter?.orphanVisitsType); + const loadVisits = (params: VisitsParams, doFallbackRange?: boolean) => + getOrphanVisits(toApiParams(params), params.filter?.orphanVisitsType, doFallbackRange); return ( { - getShortUrlVisits: (shortCode: string, query?: ShlinkVisitsParams) => void; + getShortUrlVisits: (shortCode: string, query?: ShlinkVisitsParams, doFallbackRange?: boolean) => void; shortUrlVisits: ShortUrlVisitsState; getShortUrlDetail: Function; shortUrlDetail: ShortUrlDetail; @@ -35,7 +35,8 @@ const ShortUrlVisits = ({ exportVisits }: VisitsExporter) => boundToMercureHub(( }: ShortUrlVisitsProps) => { const { shortCode } = params; const { domain } = parseQuery<{ domain?: string }>(search); - const loadVisits = (params: VisitsParams) => getShortUrlVisits(shortCode, { ...toApiParams(params), domain }); + const loadVisits = (params: VisitsParams, doFallbackRange?: boolean) => + getShortUrlVisits(shortCode, { ...toApiParams(params), domain }, doFallbackRange); const exportCsv = (visits: NormalizedVisit[]) => exportVisits( `short-url_${shortUrlDetail.shortUrl?.shortUrl.replace(/https?:\/\//g, '')}_visits.csv`, visits, diff --git a/src/visits/TagVisits.tsx b/src/visits/TagVisits.tsx index d7619a0a..fefbaa7e 100644 --- a/src/visits/TagVisits.tsx +++ b/src/visits/TagVisits.tsx @@ -12,7 +12,7 @@ import { CommonVisitsProps } from './types/CommonVisitsProps'; import { toApiParams } from './types/helpers'; export interface TagVisitsProps extends CommonVisitsProps, RouteComponentProps<{ tag: string }> { - getTagVisits: (tag: string, query?: ShlinkVisitsParams) => void; + getTagVisits: (tag: string, query?: ShlinkVisitsParams, doFallbackRange?: boolean) => void; tagVisits: TagVisitsState; cancelGetTagVisits: () => void; } @@ -27,7 +27,8 @@ const TagVisits = (colorGenerator: ColorGenerator, { exportVisits }: VisitsExpor selectedServer, }: TagVisitsProps) => { const { tag } = params; - const loadVisits = (params: ShlinkVisitsParams) => getTagVisits(tag, toApiParams(params)); + const loadVisits = (params: ShlinkVisitsParams, doFallbackRange?: boolean) => + getTagVisits(tag, toApiParams(params), doFallbackRange); const exportCsv = (visits: NormalizedVisit[]) => exportVisits(`tag_${tag}_visits.csv`, visits); return (