diff --git a/src/shlink-web-component/domains/DomainRow.tsx b/src/shlink-web-component/domains/DomainRow.tsx index 70bb7542..831aac8a 100644 --- a/src/shlink-web-component/domains/DomainRow.tsx +++ b/src/shlink-web-component/domains/DomainRow.tsx @@ -3,9 +3,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC } from 'react'; import { useEffect } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; -import type { ShlinkDomainRedirects } from '../../api/types'; -import type { SelectedServer } from '../../servers/data'; import type { OptionalString } from '../../utils/utils'; +import type { ShlinkDomainRedirects } from '../api-contract'; import type { Domain } from './data'; import { DomainDropdown } from './helpers/DomainDropdown'; import { DomainStatusIcon } from './helpers/DomainStatusIcon'; @@ -16,7 +15,6 @@ interface DomainRowProps { defaultRedirects?: ShlinkDomainRedirects; editDomainRedirects: (redirects: EditDomainRedirects) => Promise; checkDomainHealth: (domain: string) => void; - selectedServer: SelectedServer; } const Nr: FC<{ fallback: OptionalString }> = ({ fallback }) => ( @@ -33,7 +31,7 @@ const DefaultDomain: FC = () => ( ); export const DomainRow: FC = ( - { domain, editDomainRedirects, checkDomainHealth, defaultRedirects, selectedServer }, + { domain, editDomainRedirects, checkDomainHealth, defaultRedirects }, ) => { const { domain: authority, isDefault, redirects, status } = domain; @@ -58,7 +56,7 @@ export const DomainRow: FC = ( - + ); diff --git a/src/shlink-web-component/domains/ManageDomains.tsx b/src/shlink-web-component/domains/ManageDomains.tsx index d659b6d4..d8535666 100644 --- a/src/shlink-web-component/domains/ManageDomains.tsx +++ b/src/shlink-web-component/domains/ManageDomains.tsx @@ -1,7 +1,6 @@ import type { FC } from 'react'; import { useEffect } from 'react'; import { ShlinkApiError } from '../../api/ShlinkApiError'; -import type { SelectedServer } from '../../servers/data'; import { Message } from '../../utils/Message'; import { Result } from '../../utils/Result'; import { SearchField } from '../../utils/SearchField'; @@ -16,13 +15,12 @@ interface ManageDomainsProps { editDomainRedirects: (redirects: EditDomainRedirects) => Promise; checkDomainHealth: (domain: string) => void; domainsList: DomainsList; - selectedServer: SelectedServer; } const headers = ['', 'Domain', 'Base path redirect', 'Regular 404 redirect', 'Invalid short URL redirect', '', '']; export const ManageDomains: FC = ( - { listDomains, domainsList, filterDomains, editDomainRedirects, checkDomainHealth, selectedServer }, + { listDomains, domainsList, filterDomains, editDomainRedirects, checkDomainHealth }, ) => { const { filteredDomains: domains, defaultRedirects, loading, error, errorData } = domainsList; const resolvedDefaultRedirects = defaultRedirects ?? domains.find(({ isDefault }) => isDefault)?.redirects; @@ -59,7 +57,6 @@ export const ManageDomains: FC = ( editDomainRedirects={editDomainRedirects} checkDomainHealth={checkDomainHealth} defaultRedirects={resolvedDefaultRedirects} - selectedServer={selectedServer} /> ))} diff --git a/src/shlink-web-component/domains/data/index.ts b/src/shlink-web-component/domains/data/index.ts index a79db1f3..6cc50587 100644 --- a/src/shlink-web-component/domains/data/index.ts +++ b/src/shlink-web-component/domains/data/index.ts @@ -1,4 +1,4 @@ -import type { ShlinkDomain } from '../../../api/types'; +import type { ShlinkDomain } from '../../api-contract'; export type DomainStatus = 'validating' | 'valid' | 'invalid'; diff --git a/src/shlink-web-component/domains/helpers/DomainDropdown.tsx b/src/shlink-web-component/domains/helpers/DomainDropdown.tsx index 0e1dd50a..4bbd89f8 100644 --- a/src/shlink-web-component/domains/helpers/DomainDropdown.tsx +++ b/src/shlink-web-component/domains/helpers/DomainDropdown.tsx @@ -3,11 +3,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC } from 'react'; import { Link } from 'react-router-dom'; import { DropdownItem } from 'reactstrap'; -import type { SelectedServer } from '../../../servers/data'; -import { getServerId } from '../../../servers/data'; import { useToggle } from '../../../utils/helpers/hooks'; import { RowDropdownBtn } from '../../../utils/RowDropdownBtn'; import { useFeature } from '../../utils/features'; +import { useRoutesPrefix } from '../../utils/routesPrefix'; import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits'; import type { Domain } from '../data'; import type { EditDomainRedirects } from '../reducers/domainRedirects'; @@ -16,22 +15,21 @@ import { EditDomainRedirectsModal } from './EditDomainRedirectsModal'; interface DomainDropdownProps { domain: Domain; editDomainRedirects: (redirects: EditDomainRedirects) => Promise; - selectedServer: SelectedServer; } -export const DomainDropdown: FC = ({ domain, editDomainRedirects, selectedServer }) => { +export const DomainDropdown: FC = ({ domain, editDomainRedirects }) => { const [isModalOpen, toggleModal] = useToggle(); const { isDefault } = domain; const canBeEdited = !isDefault || useFeature('defaultDomainRedirectsEdition'); const withVisits = useFeature('domainVisits'); - const serverId = getServerId(selectedServer); + const routesPrefix = useRoutesPrefix(); return ( {withVisits && ( Visit stats diff --git a/src/shlink-web-component/domains/services/provideServices.ts b/src/shlink-web-component/domains/services/provideServices.ts index a4bb28e6..1b2a944c 100644 --- a/src/shlink-web-component/domains/services/provideServices.ts +++ b/src/shlink-web-component/domains/services/provideServices.ts @@ -13,7 +13,7 @@ export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('ManageDomains', () => ManageDomains); bottle.decorator('ManageDomains', connect( - ['domainsList', 'selectedServer'], + ['domainsList'], ['listDomains', 'filterDomains', 'editDomainRedirects', 'checkDomainHealth'], )); diff --git a/src/shlink-web-component/overview/Overview.tsx b/src/shlink-web-component/overview/Overview.tsx index 717bc872..fb411d3b 100644 --- a/src/shlink-web-component/overview/Overview.tsx +++ b/src/shlink-web-component/overview/Overview.tsx @@ -2,12 +2,8 @@ import type { FC } from 'react'; import { useEffect } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { Card, CardBody, CardHeader, Row } from 'reactstrap'; -import type { ShlinkShortUrlsListParams } from '../../api/types'; -import type { SelectedServer } from '../../servers/data'; -import { getServerId } from '../../servers/data'; -import { HighlightCard } from '../../servers/helpers/HighlightCard'; -import { VisitsHighlightCard } from '../../servers/helpers/VisitsHighlightCard'; import { prettify } from '../../utils/helpers/numbers'; +import type { ShlinkShortUrlsListParams } from '../api-contract'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; import type { CreateShortUrlProps } from '../short-urls/CreateShortUrl'; @@ -16,15 +12,17 @@ import { ITEMS_IN_OVERVIEW_PAGE } from '../short-urls/reducers/shortUrlsList'; import type { ShortUrlsTableType } from '../short-urls/ShortUrlsTable'; import type { TagsList } from '../tags/reducers/tagsList'; import { useFeature } from '../utils/features'; +import { useRoutesPrefix } from '../utils/routesPrefix'; import { useSetting } from '../utils/settings'; import type { VisitsOverview } from '../visits/reducers/visitsOverview'; +import { HighlightCard } from './helpers/HighlightCard'; +import { VisitsHighlightCard } from './helpers/VisitsHighlightCard'; interface OverviewConnectProps { shortUrlsList: ShortUrlsListState; listShortUrls: (params: ShlinkShortUrlsListParams) => void; listTags: Function; tagsList: TagsList; - selectedServer: SelectedServer; visitsOverview: VisitsOverview; loadVisitsOverview: Function; } @@ -37,14 +35,13 @@ export const Overview = ( listShortUrls, listTags, tagsList, - selectedServer, loadVisitsOverview, visitsOverview, }: OverviewConnectProps) => { const { loading, shortUrls } = shortUrlsList; const { loading: loadingTags } = tagsList; const { loading: loadingVisits, nonOrphanVisits, orphanVisits } = visitsOverview; - const serverId = getServerId(selectedServer); + const routesPrefix = useRoutesPrefix(); const linkToNonOrphanVisits = useFeature('nonOrphanVisits'); const navigate = useNavigate(); const visits = useSetting('visits'); @@ -61,7 +58,7 @@ export const Overview = (
- + {loading ? 'Loading...' : prettify(shortUrls?.pagination.totalItems ?? 0)}
- + {loadingTags ? 'Loading...' : prettify(tagsList.tags.length)}
@@ -92,7 +89,7 @@ export const Overview = ( Create a short URL
Create a short URL
- Advanced options » + Advanced options »
@@ -102,13 +99,13 @@ export const Overview = ( Recently created URLs
Recently created URLs
- See all » + See all »
navigate(`/server/${serverId}/list-short-urls/1?tags=${encodeURIComponent(tag)}`)} + onTagClick={(tag) => navigate(`${routesPrefix}/list-short-urls/1?tags=${encodeURIComponent(tag)}`)} /> diff --git a/src/servers/helpers/HighlightCard.scss b/src/shlink-web-component/overview/helpers/HighlightCard.scss similarity index 92% rename from src/servers/helpers/HighlightCard.scss rename to src/shlink-web-component/overview/helpers/HighlightCard.scss index ecfda6ed..9892de65 100644 --- a/src/servers/helpers/HighlightCard.scss +++ b/src/shlink-web-component/overview/helpers/HighlightCard.scss @@ -1,4 +1,4 @@ -@import '../../utils/base'; +@import '../../../utils/base'; .highlight-card.highlight-card { text-align: center; diff --git a/src/servers/helpers/HighlightCard.tsx b/src/shlink-web-component/overview/helpers/HighlightCard.tsx similarity index 95% rename from src/servers/helpers/HighlightCard.tsx rename to src/shlink-web-component/overview/helpers/HighlightCard.tsx index 99e35ecc..f997df48 100644 --- a/src/servers/helpers/HighlightCard.tsx +++ b/src/shlink-web-component/overview/helpers/HighlightCard.tsx @@ -3,7 +3,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC, PropsWithChildren, ReactNode } from 'react'; import { Link } from 'react-router-dom'; import { Card, CardText, CardTitle, UncontrolledTooltip } from 'reactstrap'; -import { useElementRef } from '../../utils/helpers/hooks'; +import { useElementRef } from '../../../utils/helpers/hooks'; import './HighlightCard.scss'; export type HighlightCardProps = PropsWithChildren<{ diff --git a/src/servers/helpers/VisitsHighlightCard.tsx b/src/shlink-web-component/overview/helpers/VisitsHighlightCard.tsx similarity index 83% rename from src/servers/helpers/VisitsHighlightCard.tsx rename to src/shlink-web-component/overview/helpers/VisitsHighlightCard.tsx index 393327c3..5612e498 100644 --- a/src/servers/helpers/VisitsHighlightCard.tsx +++ b/src/shlink-web-component/overview/helpers/VisitsHighlightCard.tsx @@ -1,6 +1,6 @@ import type { FC } from 'react'; -import type { PartialVisitsSummary } from '../../shlink-web-component/visits/reducers/visitsOverview'; -import { prettify } from '../../utils/helpers/numbers'; +import { prettify } from '../../../utils/helpers/numbers'; +import type { PartialVisitsSummary } from '../../visits/reducers/visitsOverview'; import type { HighlightCardProps } from './HighlightCard'; import { HighlightCard } from './HighlightCard'; diff --git a/src/shlink-web-component/overview/services/provideServices.ts b/src/shlink-web-component/overview/services/provideServices.ts index ec423cbc..1dce68ba 100644 --- a/src/shlink-web-component/overview/services/provideServices.ts +++ b/src/shlink-web-component/overview/services/provideServices.ts @@ -5,7 +5,7 @@ import { Overview } from '../Overview'; export function provideServices(bottle: Bottle, connect: ConnectDecorator) { bottle.serviceFactory('Overview', Overview, 'ShortUrlsTable', 'CreateShortUrl'); bottle.decorator('Overview', connect( - ['shortUrlsList', 'tagsList', 'selectedServer', 'mercureInfo', 'visitsOverview'], + ['shortUrlsList', 'tagsList', 'mercureInfo', 'visitsOverview'], ['listShortUrls', 'listTags', 'createNewVisits', 'loadMercureInfo', 'loadVisitsOverview'], )); } diff --git a/src/shlink-web-component/short-urls/helpers/ExportShortUrlsBtn.tsx b/src/shlink-web-component/short-urls/helpers/ExportShortUrlsBtn.tsx index ec7b4497..bb03cae1 100644 --- a/src/shlink-web-component/short-urls/helpers/ExportShortUrlsBtn.tsx +++ b/src/shlink-web-component/short-urls/helpers/ExportShortUrlsBtn.tsx @@ -1,8 +1,6 @@ import type { FC } from 'react'; import { useCallback } from 'react'; import type { ReportExporter } from '../../../common/services/ReportExporter'; -import type { SelectedServer } from '../../../servers/data'; -import { isServerWithId } from '../../../servers/data'; import { ExportBtn } from '../../../utils/ExportBtn'; import { useToggle } from '../../../utils/helpers/hooks'; import type { ShlinkApiClient } from '../../api-contract'; @@ -13,23 +11,15 @@ export interface ExportShortUrlsBtnProps { amount?: number; } -interface ExportShortUrlsBtnConnectProps extends ExportShortUrlsBtnProps { - selectedServer: SelectedServer; -} - const itemsPerPage = 20; export const ExportShortUrlsBtn = ( apiClient: ShlinkApiClient, { exportShortUrls }: ReportExporter, -): FC => ({ amount = 0, selectedServer }) => { +): FC => ({ amount = 0 }) => { const [{ tags, search, startDate, endDate, orderBy, tagsMode }] = useShortUrlsQuery(); const [loading,, startLoading, stopLoading] = useToggle(); const exportAllUrls = useCallback(async () => { - if (!isServerWithId(selectedServer)) { - return; - } - const totalPages = amount / itemsPerPage; const loadAllUrls = async (page = 1): Promise => { const { data } = await apiClient.listShortUrls( @@ -63,7 +53,7 @@ export const ExportShortUrlsBtn = ( }; })); stopLoading(); - }, [selectedServer]); + }, []); return ; }; diff --git a/src/shlink-web-component/short-urls/helpers/hooks.ts b/src/shlink-web-component/short-urls/helpers/hooks.ts index c02a8a5f..6788f221 100644 --- a/src/shlink-web-component/short-urls/helpers/hooks.ts +++ b/src/shlink-web-component/short-urls/helpers/hooks.ts @@ -1,11 +1,12 @@ import { isEmpty, pipe } from 'ramda'; import { useMemo } from 'react'; -import { useLocation, useNavigate, useParams } from 'react-router-dom'; -import type { TagsFilteringMode } from '../../../api/types'; +import { useLocation, useNavigate } from 'react-router-dom'; import { orderToString, stringToOrder } from '../../../utils/helpers/ordering'; import { parseQuery, stringifyQuery } from '../../../utils/helpers/query'; import type { BooleanString } from '../../../utils/utils'; import { parseOptionalBooleanToString } from '../../../utils/utils'; +import type { TagsFilteringMode } from '../../api-contract'; +import { useRoutesPrefix } from '../../utils/routesPrefix'; import type { ShortUrlsOrder, ShortUrlsOrderableFields } from '../data'; interface ShortUrlsQueryCommon { @@ -36,7 +37,7 @@ type ToFirstPage = (extra: Partial) => void; export const useShortUrlsQuery = (): [ShortUrlsFiltering, ToFirstPage] => { const navigate = useNavigate(); const { search } = useLocation(); - const { serverId = '' } = useParams<{ serverId: string }>(); + const routesPrefix = useRoutesPrefix(); const filtering = useMemo( pipe( @@ -70,7 +71,7 @@ export const useShortUrlsQuery = (): [ShortUrlsFiltering, ToFirstPage] => { const stringifiedQuery = stringifyQuery(query); const queryString = isEmpty(stringifiedQuery) ? '' : `?${stringifiedQuery}`; - navigate(`/server/${serverId}/list-short-urls/1${queryString}`); + navigate(`${routesPrefix}/list-short-urls/1${queryString}`); }; return [filtering, toFirstPageWithExtra]; diff --git a/src/shlink-web-component/short-urls/services/provideServices.ts b/src/shlink-web-component/short-urls/services/provideServices.ts index c3896f2a..3c79a376 100644 --- a/src/shlink-web-component/short-urls/services/provideServices.ts +++ b/src/shlink-web-component/short-urls/services/provideServices.ts @@ -55,7 +55,6 @@ export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('ShortUrlsFilteringBar', ShortUrlsFilteringBar, 'ExportShortUrlsBtn', 'TagsSelector'); bottle.serviceFactory('ExportShortUrlsBtn', ExportShortUrlsBtn, 'apiClient', 'ReportExporter'); - bottle.decorator('ExportShortUrlsBtn', connect(['selectedServer'])); // Reducers bottle.serviceFactory( diff --git a/src/shlink-web-component/tags/TagsList.tsx b/src/shlink-web-component/tags/TagsList.tsx index 418a91ed..bcb1a5d1 100644 --- a/src/shlink-web-component/tags/TagsList.tsx +++ b/src/shlink-web-component/tags/TagsList.tsx @@ -3,7 +3,6 @@ import type { FC } from 'react'; import { useEffect, useState } from 'react'; import { Row } from 'reactstrap'; import { ShlinkApiError } from '../../api/ShlinkApiError'; -import type { SelectedServer } from '../../servers/data'; import { determineOrderDir, sortList } from '../../utils/helpers/ordering'; import { Message } from '../../utils/Message'; import { OrderingDropdown } from '../../utils/OrderingDropdown'; @@ -22,11 +21,10 @@ export interface TagsListProps { filterTags: (searchTerm: string) => void; forceListTags: Function; tagsList: TagsListState; - selectedServer: SelectedServer; } export const TagsList = (TagsTable: FC) => boundToMercureHub(( - { filterTags, forceListTags, tagsList, selectedServer }: TagsListProps, + { filterTags, forceListTags, tagsList }: TagsListProps, ) => { const settings = useSettings(); const [order, setOrder] = useState(settings.tags?.defaultOrdering ?? {}); @@ -78,7 +76,6 @@ export const TagsList = (TagsTable: FC) => boundToMercureHub(( return ( diff --git a/src/shlink-web-component/tags/TagsTable.tsx b/src/shlink-web-component/tags/TagsTable.tsx index 4d613226..f223382c 100644 --- a/src/shlink-web-component/tags/TagsTable.tsx +++ b/src/shlink-web-component/tags/TagsTable.tsx @@ -19,7 +19,7 @@ export interface TagsTableProps extends TagsListChildrenProps { const TAGS_PER_PAGE = 20; // TODO Allow customizing this value in settings export const TagsTable = (TagsTableRow: FC) => ( - { sortedTags, selectedServer, orderByColumn, currentOrder }: TagsTableProps, + { sortedTags, orderByColumn, currentOrder }: TagsTableProps, ) => { const isFirstLoad = useRef(true); const { search } = useLocation(); @@ -57,7 +57,7 @@ export const TagsTable = (TagsTableRow: FC) => ( {currentPage.length === 0 && No results found} - {currentPage.map((tag) => )} + {currentPage.map((tag) => )} diff --git a/src/shlink-web-component/tags/TagsTableRow.tsx b/src/shlink-web-component/tags/TagsTableRow.tsx index cff7780a..4ce7b37e 100644 --- a/src/shlink-web-component/tags/TagsTableRow.tsx +++ b/src/shlink-web-component/tags/TagsTableRow.tsx @@ -3,28 +3,26 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC } from 'react'; import { Link } from 'react-router-dom'; import { DropdownItem } from 'reactstrap'; -import type { SelectedServer } from '../../servers/data'; -import { getServerId } from '../../servers/data'; import { useToggle } from '../../utils/helpers/hooks'; import { prettify } from '../../utils/helpers/numbers'; import { RowDropdownBtn } from '../../utils/RowDropdownBtn'; import type { ColorGenerator } from '../../utils/services/ColorGenerator'; +import { useRoutesPrefix } from '../utils/routesPrefix'; import type { SimplifiedTag, TagModalProps } from './data'; import { TagBullet } from './helpers/TagBullet'; export interface TagsTableRowProps { tag: SimplifiedTag; - selectedServer: SelectedServer; } export const TagsTableRow = ( DeleteTagConfirmModal: FC, EditTagModal: FC, colorGenerator: ColorGenerator, -) => ({ tag, selectedServer }: TagsTableRowProps) => { +) => ({ tag }: TagsTableRowProps) => { const [isDeleteModalOpen, toggleDelete] = useToggle(); const [isEditModalOpen, toggleEdit] = useToggle(); - const serverId = getServerId(selectedServer); + const routesPrefix = useRoutesPrefix(); return ( @@ -32,12 +30,12 @@ export const TagsTableRow = ( {tag.tag} - + {prettify(tag.shortUrls)} - + {prettify(tag.visits)} diff --git a/src/shlink-web-component/tags/data/TagsListChildrenProps.ts b/src/shlink-web-component/tags/data/TagsListChildrenProps.ts index 646c7d55..22d9ca8a 100644 --- a/src/shlink-web-component/tags/data/TagsListChildrenProps.ts +++ b/src/shlink-web-component/tags/data/TagsListChildrenProps.ts @@ -1,4 +1,3 @@ -import type { SelectedServer } from '../../../servers/data'; import type { Order } from '../../../utils/helpers/ordering'; import type { SimplifiedTag } from './index'; @@ -14,5 +13,4 @@ export type TagsOrder = Order; export interface TagsListChildrenProps { sortedTags: SimplifiedTag[]; - selectedServer: SelectedServer; } diff --git a/src/shlink-web-component/tags/reducers/tagsList.ts b/src/shlink-web-component/tags/reducers/tagsList.ts index 1f994712..0738ca6c 100644 --- a/src/shlink-web-component/tags/reducers/tagsList.ts +++ b/src/shlink-web-component/tags/reducers/tagsList.ts @@ -1,11 +1,9 @@ import { createAction, createSlice } from '@reduxjs/toolkit'; import { isEmpty, reject } from 'ramda'; -import { isReachableServer } from '../../../servers/data'; import { createAsyncThunk } from '../../../utils/helpers/redux'; import type { ProblemDetailsError, ShlinkApiClient, ShlinkTags } from '../../api-contract'; import { parseApiError } from '../../api-contract/utils'; import type { createShortUrl } from '../../short-urls/reducers/shortUrlCreation'; -import { isFeatureEnabledForVersion } from '../../utils/features'; import { createNewVisits } from '../../visits/reducers/visitCreation'; import type { CreateVisit } from '../../visits/types'; import type { TagStats } from '../data'; @@ -85,17 +83,13 @@ const calculateVisitsPerTag = (createdVisits: CreateVisit[]): TagIncrease[] => O export const listTags = (apiClient: ShlinkApiClient, force = true) => createAsyncThunk( `${REDUCER_PREFIX}/listTags`, async (_: void, { getState }): Promise => { - const { tagsList, selectedServer } = getState(); + const { tagsList } = getState(); if (!force && !isEmpty(tagsList.tags)) { return tagsList; } - const { tags, stats }: ShlinkTags = await ( - isReachableServer(selectedServer) && isFeatureEnabledForVersion('tagsStats', selectedServer.version) - ? apiClient.tagsStats() - : apiClient.listTags() - ); + const { tags, stats }: ShlinkTags = await apiClient.tagsStats(); const processedStats = stats.reduce((acc, { tag, ...rest }) => { acc[tag] = rest; return acc; diff --git a/src/shlink-web-component/tags/services/provideServices.ts b/src/shlink-web-component/tags/services/provideServices.ts index e9c85a0b..e6b16322 100644 --- a/src/shlink-web-component/tags/services/provideServices.ts +++ b/src/shlink-web-component/tags/services/provideServices.ts @@ -28,7 +28,7 @@ export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => { bottle.serviceFactory('TagsList', TagsList, 'TagsTable'); bottle.decorator('TagsList', connect( - ['tagsList', 'selectedServer', 'mercureInfo'], + ['tagsList', 'mercureInfo'], ['forceListTags', 'filterTags', 'createNewVisits', 'loadMercureInfo'], )); diff --git a/src/shlink-web-component/utils/features.ts b/src/shlink-web-component/utils/features.ts index 7fece6d1..83bc18ef 100644 --- a/src/shlink-web-component/utils/features.ts +++ b/src/shlink-web-component/utils/features.ts @@ -3,12 +3,15 @@ import type { SemVer } from '../../utils/helpers/version'; import { versionMatch } from '../../utils/helpers/version'; const supportedFeatures = { + // Deprecated forwardQuery: '2.9.0', nonRestCors: '2.9.0', defaultDomainRedirectsEdition: '2.10.0', nonOrphanVisits: '3.0.0', allTagsFiltering: '3.0.0', tagsStats: '3.0.0', + // End deprecated + domainVisits: '3.1.0', excludeBotsOnShortUrls: '3.4.0', filterDisabledUrls: '3.4.0', @@ -23,12 +26,15 @@ export const isFeatureEnabledForVersion = (feature: Feature, serverVersion: SemV versionMatch(serverVersion, { minVersion: supportedFeatures[feature] }); const getFeaturesForVersion = (serverVersion: SemVer): Record => ({ + // Deprecated forwardQuery: isFeatureEnabledForVersion('forwardQuery', serverVersion), nonRestCors: isFeatureEnabledForVersion('nonRestCors', serverVersion), defaultDomainRedirectsEdition: isFeatureEnabledForVersion('defaultDomainRedirectsEdition', serverVersion), nonOrphanVisits: isFeatureEnabledForVersion('nonOrphanVisits', serverVersion), allTagsFiltering: isFeatureEnabledForVersion('allTagsFiltering', serverVersion), tagsStats: isFeatureEnabledForVersion('tagsStats', serverVersion), + // End + domainVisits: isFeatureEnabledForVersion('domainVisits', serverVersion), excludeBotsOnShortUrls: isFeatureEnabledForVersion('excludeBotsOnShortUrls', serverVersion), filterDisabledUrls: isFeatureEnabledForVersion('filterDisabledUrls', serverVersion), diff --git a/test/servers/helpers/HighlightCard.test.tsx b/test/servers/helpers/HighlightCard.test.tsx index ec478de1..b70f27c5 100644 --- a/test/servers/helpers/HighlightCard.test.tsx +++ b/test/servers/helpers/HighlightCard.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import type { ReactNode } from 'react'; import { MemoryRouter } from 'react-router-dom'; -import type { HighlightCardProps } from '../../../src/servers/helpers/HighlightCard'; -import { HighlightCard } from '../../../src/servers/helpers/HighlightCard'; +import type { HighlightCardProps } from '../../../src/shlink-web-component/overview/helpers/HighlightCard'; +import { HighlightCard } from '../../../src/shlink-web-component/overview/helpers/HighlightCard'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/servers/helpers/VisitsHighlightCard.test.tsx b/test/servers/helpers/VisitsHighlightCard.test.tsx index ede67601..718da166 100644 --- a/test/servers/helpers/VisitsHighlightCard.test.tsx +++ b/test/servers/helpers/VisitsHighlightCard.test.tsx @@ -1,6 +1,6 @@ import { screen, waitFor } from '@testing-library/react'; -import type { VisitsHighlightCardProps } from '../../../src/servers/helpers/VisitsHighlightCard'; -import { VisitsHighlightCard } from '../../../src/servers/helpers/VisitsHighlightCard'; +import type { VisitsHighlightCardProps } from '../../../src/shlink-web-component/overview/helpers/VisitsHighlightCard'; +import { VisitsHighlightCard } from '../../../src/shlink-web-component/overview/helpers/VisitsHighlightCard'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => {