Fix filter labels when filtering on clicks from ModalTable (#3247)

This commit is contained in:
hq1 2023-08-08 14:57:33 +02:00 committed by GitHub
parent e467324c5a
commit ae3a003d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import {BrowserRouter, Switch, Route, useLocation} from "react-router-dom"; import { BrowserRouter, Switch, Route, useLocation } from "react-router-dom";
import Dash from './index' import Dash from './index'
import SourcesModal from './stats/modals/sources' import SourcesModal from './stats/modals/sources'
@ -26,14 +26,14 @@ function ScrollToTop() {
return null; return null;
} }
export default function Router({site, loggedIn, currentUserRole}) { export default function Router({ site, loggedIn, currentUserRole }) {
return ( return (
<BrowserRouter> <BrowserRouter>
<Route path="/:domain"> <Route path="/:domain">
<ScrollToTop /> <ScrollToTop />
<Dash site={site} loggedIn={loggedIn} currentUserRole={currentUserRole} /> <Dash site={site} loggedIn={loggedIn} currentUserRole={currentUserRole} />
<Switch> <Switch>
<Route exact path={["/:domain/sources", "/:domain/utm_mediums", "/:domain/utm_sources", "/:domain/utm_campaigns", "/:domain/utm_contents", "/:domain/utm_terms" ]}> <Route exact path={["/:domain/sources", "/:domain/utm_mediums", "/:domain/utm_sources", "/:domain/utm_campaigns", "/:domain/utm_contents", "/:domain/utm_terms"]}>
<SourcesModal site={site} /> <SourcesModal site={site} />
</Route> </Route>
<Route exact path="/:domain/referrers/Google"> <Route exact path="/:domain/referrers/Google">
@ -52,19 +52,19 @@ export default function Router({site, loggedIn, currentUserRole}) {
<ExitPagesModal site={site} /> <ExitPagesModal site={site} />
</Route> </Route>
<Route path="/:domain/countries"> <Route path="/:domain/countries">
<ModalTable title="Top countries" site={site} endpoint={url.apiPath(site, '/countries')} filter={{country: 'code', country_name: 'name'}} keyLabel="Country" renderIcon={renderCountryIcon} /> <ModalTable title="Top countries" site={site} endpoint={url.apiPath(site, '/countries')} filter={{ country: 'code', country_labels: 'name' }} keyLabel="Country" renderIcon={renderCountryIcon} />
</Route> </Route>
<Route path="/:domain/regions"> <Route path="/:domain/regions">
<ModalTable title="Top regions" site={site} endpoint={url.apiPath(site, '/regions')} filter={{region: 'code', region_name: 'name'}} keyLabel="Region" renderIcon={renderRegionIcon} /> <ModalTable title="Top regions" site={site} endpoint={url.apiPath(site, '/regions')} filter={{ region: 'code', region_labels: 'name' }} keyLabel="Region" renderIcon={renderRegionIcon} />
</Route> </Route>
<Route path="/:domain/cities"> <Route path="/:domain/cities">
<ModalTable title="Top cities" site={site} endpoint={url.apiPath(site, '/cities')} filter={{city: 'code', city_name: 'name'}} keyLabel="City" renderIcon={renderCityIcon} /> <ModalTable title="Top cities" site={site} endpoint={url.apiPath(site, '/cities')} filter={{ city: 'code', city_labels: 'name' }} keyLabel="City" renderIcon={renderCityIcon} />
</Route> </Route>
<Route path="/:domain/custom-prop-values/:prop_key"> <Route path="/:domain/custom-prop-values/:prop_key">
<PropsModal site={site}/> <PropsModal site={site} />
</Route> </Route>
<Route path="/:domain/conversions"> <Route path="/:domain/conversions">
<ConversionsModal site={site}/> <ConversionsModal site={site} />
</Route> </Route>
<Route path={["/:domain/filter/:field"]}> <Route path={["/:domain/filter/:field"]}>
<FilterModal site={site} /> <FilterModal site={site} />