Skip to content

Commit

Permalink
Add loading spinner beside the "# resources found" (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
luorlandini authored Nov 23, 2021
1 parent b16eec8 commit 4fbe941
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Message from '@mapstore/framework/components/I18N/Message';
import FaIcon from '@js/components/FaIcon';
import useLocalStorage from '@js/hooks/useLocalStorage';
import Menu from '@js/components/Menu';
import Spinner from '@js/components/Spinner';

const FiltersMenu = forwardRef(({
formatHref,
Expand All @@ -26,7 +27,8 @@ const FiltersMenu = forwardRef(({
onClear,
totalResources,
totalFilters,
filtersActive
filtersActive,
loading
}, ref) => {

const selectedSort = orderOptions.find(({ value }) => order === value);
Expand Down Expand Up @@ -63,7 +65,7 @@ const FiltersMenu = forwardRef(({
</span>

}

{loading && <Spinner spinnerName="circle" style={{"float": "right", "paddingLeft": "0.7em"}}noFadeIn/> }
</Badge>
</div>
<Menu
Expand Down
14 changes: 10 additions & 4 deletions geonode_mapstore_client/client/js/routes/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function Detail({
width,
resource,
totalResources,
siteName
siteName,
loading
}) {

const {
Expand Down Expand Up @@ -156,7 +157,10 @@ function Detail({
totalResources={totalResources}
totalFilters={queryFilters.length}
filtersActive={!!(queryFilters.length > 0)}
loading={loading}

/>

</ConnectedCardGrid>
</div>
{!!resource &&
Expand Down Expand Up @@ -208,15 +212,17 @@ const ConnectedDetail = connect(
state => state?.controls?.gnFiltersPanel?.enabled || null,
getParsedGeoNodeConfiguration,
getTotalResources,
state => state?.gnsettings?.siteName || "Geonode"
], (params, user, resource, isFiltersPanelEnabled, config, totalResources, siteName) => ({
state => state?.gnsettings?.siteName || "Geonode",
state => state?.gnsearch?.loading || false
], (params, user, resource, isFiltersPanelEnabled, config, totalResources, siteName, loading) => ({
params,
user,
resource,
isFiltersPanelEnabled,
config,
totalResources,
siteName
siteName,
loading
})),
{
onSearch: searchResources,
Expand Down
12 changes: 8 additions & 4 deletions geonode_mapstore_client/client/js/routes/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function Home({
user,
width,
totalResources,
fetchFeaturedResources = () => {}
fetchFeaturedResources = () => {},
loading
}) {

const cataloguePage = '/catalogue/';
Expand Down Expand Up @@ -141,6 +142,7 @@ function Home({
totalResources={totalResources}
totalFilters={queryFilters.length}
filtersActive={!!(queryFilters.length > 0)}
loading={loading}
/>
</ConnectedCardGrid>
</div>
Expand Down Expand Up @@ -174,12 +176,14 @@ const ConnectedHome = connect(
state => state?.gnsearch?.params || DEFAULT_PARAMS,
userSelector,
getParsedGeoNodeConfiguration,
getTotalResources
], (params, user, config, totalResources) => ({
getTotalResources,
state => state?.gnsearch?.loading || false
], (params, user, config, totalResources, loading) => ({
params,
user,
config,
totalResources
totalResources,
loading
})),
{
onSearch: searchResources,
Expand Down
13 changes: 8 additions & 5 deletions geonode_mapstore_client/client/js/routes/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ function Search({
width,
totalResources,
resource,
siteName
siteName,
loading
}) {

const {
filterMenuItemsAllowed,
cardOptionsItemsAllowed,
Expand Down Expand Up @@ -217,6 +217,7 @@ function Search({
totalResources={totalResources}
totalFilters={queryFilters.length}
filtersActive={!!(queryFilters.length > 0)}
loading={loading}
/>
</ConnectedCardGrid>
</div>
Expand Down Expand Up @@ -258,15 +259,17 @@ const ConnectedSearch = connect(
state => state?.controls?.gnFiltersPanel?.enabled || null,
getParsedGeoNodeConfiguration,
getTotalResources,
state => state?.gnsettings?.siteName || "Geonode"
], (params, user, resource, isFiltersPanelEnabled, config, totalResources, siteName) => ({
state => state?.gnsettings?.siteName || "Geonode",
state => state?.gnsearch.loading || false
], (params, user, resource, isFiltersPanelEnabled, config, totalResources, siteName, loading) => ({
params,
user,
resource,
isFiltersPanelEnabled,
config,
totalResources,
siteName
siteName,
loading
})),
{
onSearch: searchResources,
Expand Down

0 comments on commit 4fbe941

Please sign in to comment.