Skip to content

Commit

Permalink
Mapviewer resource are made unadvertized by default (#1668)
Browse files Browse the repository at this point in the history
* #1657 - Add unadvertised identifier to the resource

* Update VERSION

(cherry picked from commit 1eaecca)

* Enable group facets (#1662)

(cherry picked from commit 74030de)

* [Fixes #1665] Django upgrade to 4.2 LTS (#1664)

* Upgrade Django version

* Upgrade Django version

* Upgrade Django version

* Upgrade to django 4.2

---------

Co-authored-by: mattiagiupponi <[email protected]>
(cherry picked from commit 7a8ef7c)

* Bump to 4.4.x dev

(cherry picked from commit 16559ab)

* Mapviewer resource are made unadvertized by default

(cherry picked from commit 0b328c3)

---------

Co-authored-by: Giovanni Allegri <[email protected]>
Co-authored-by: mattiagiupponi <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2024
1 parent dca69e6 commit ae1a867
Show file tree
Hide file tree
Showing 26 changed files with 93 additions and 23 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0.dev0
4.4.0.dev0
9 changes: 5 additions & 4 deletions geonode_mapstore_client/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
import os

from django.views.generic import TemplateView
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.apps import apps, AppConfig as BaseAppConfig


def run_setup_hooks(*args, **kwargs):
from geonode.urls import urlpatterns
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls import include
from django.urls import re_path
from geonode.api.urls import router
from geonode.security.permissions import VIEW_PERMISSIONS, OWNER_PERMISSIONS
from geonode.groups.conf import settings as groups_settings
Expand Down Expand Up @@ -76,14 +77,14 @@ def run_setup_hooks(*args, **kwargs):
pass

urlpatterns += [
url(
re_path(
r"^catalogue/",
TemplateView.as_view(
template_name="geonode-mapstore-client/catalogue.html"
),
),
# required, otherwise will raise no-lookup errors to be analysed
url(r"^api/v2/", include(router.urls)),
re_path(r"^api/v2/", include(router.urls)),
]

# adding default format for metadata schema validation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { getUserName } from '@js/utils/SearchUtils';
import { useInView } from 'react-intersection-observer';
import DetailsResourcePreview from './DetailsResourcePreview';
import DetailsThumbnail from './DetailsThumbnail';
import Unadvertised from '@js/components/Unadvertised';

const CopyToClipboard = tooltip(CopyToClipboardCmp);

Expand Down Expand Up @@ -112,6 +113,7 @@ const DetailsPanelTools = ({

return (
<div className="gn-details-panel-tools">
<Unadvertised resource={resource}/>
<ResourceStatus resource={resource} />
{enableFavorite &&
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ResourceStatus from '@js/components/ResourceStatus';
import ALink from '@js/components/ALink';
import AuthorInfo from '@js/components/AuthorInfo/AuthorInfo';
import ActionButtons from '@js/components/ActionButtons';
import Unadvertised from '@js/components/Unadvertised';


const ResourceCard = forwardRef(({
Expand Down Expand Up @@ -137,6 +138,9 @@ const ResourceCard = forwardRef(({
<div>
<ResourceStatus resource={res} />
</div>
<div>
<Unadvertised resource={res}/>
</div>
</div>
<p ref={abstractRef} className={`card-text gn-card-description ${layoutCardsStyle}`}>
{res.raw_abstract ? res.raw_abstract : '...'}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2024, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import isNil from 'lodash/isNil';

import tooltip from '@mapstore/framework/components/misc/enhancers/tooltip';
import FaIcon from '@js/components/FaIcon/FaIcon';

const Icon = (props) => {
return (<div {...props} className="gn-unadvertised"><FaIcon name="eye-slash" /></div> );
};

const IconWithTooltip = tooltip(Icon);

const Unadvertised = ({resource}) => {
if (isNil(resource.advertised) || resource.advertised) {
return null;
}
return (
<IconWithTooltip
tooltipId={"gnviewer.unadvertised"}
className={'gn-unadvertised'}
/>
);
};

export default Unadvertised;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Unadvertised';
1 change: 1 addition & 0 deletions geonode_mapstore_client/client/js/epics/gnsave.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const SaveAPI = {
'name': body.title + ' ' + uuid(),
'owner': user.name,
'resource_type': ResourceTypes.VIEWER,
'advertised': false,
...body
});
}
Expand Down
4 changes: 4 additions & 0 deletions geonode_mapstore_client/client/js/plugins/ResourcesGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ function ResourcesGrid({
type: 'select',
facet: 'user'
},
{
type: 'select',
facet: "group"
},
{
type: "accordion",
style: "facet", // style can be facet or filter (checkbox)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@
button {
margin: 4px;
}
.gn-unadvertised {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
line-height: 1.5;
}
}
.inEdit{
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
.color-var(@theme-vars[primary]);
}
}
.gn-unadvertised {
.color-var(@theme-vars[warning])
}
}

// **************
Expand Down Expand Up @@ -323,3 +326,8 @@ button.btn.btn-default.gn-resource-status.gn-status-button {
}
}
}

.gn-unadvertised {
cursor: pointer;
pointer-events: auto;
}
2 changes: 1 addition & 1 deletion geonode_mapstore_client/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.contrib.postgres.fields import ArrayField
from django.dispatch import receiver
from django.db.models import signals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@
"createNewViewer": "Neuen Viewer erstellen",
"manageViewerConfiguration": "Viewer-Konfiguration verwalten",
"previewCustomViewer": "Vorschau des benutzerdefinierten Viewers",
"editMapConfiguration": "Kartenkonfiguration bearbeiten"
"editMapConfiguration": "Kartenkonfiguration bearbeiten",
"unadvertised": "Ressource wird nicht beworben. Es ist im Katalog und in den Suchergebnissen ausgeblendet"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@
"createNewViewer": "Crear nuevo visor",
"manageViewerConfiguration": "Administrar la configuración del visor",
"previewCustomViewer": "Vista previa del visor personalizado",
"editMapConfiguration": "Editar configuración del mapa"
"editMapConfiguration": "Editar configuración del mapa",
"unadvertised": "El recurso no se anuncia. Está oculto en el catálogo y en los resultados de búsqueda."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@
"createNewViewer": "Créer une nouvelle visionneuse",
"manageViewerConfiguration": "Gérer la configuration de la visionneuse",
"previewCustomViewer": "Aperçu de la visionneuse personnalisée",
"editMapConfiguration": "Modifier la configuration de la carte"
"editMapConfiguration": "Modifier la configuration de la carte",
"unadvertised": "La ressource n'est pas annoncée. Il est masqué du catalogue et des résultats de recherche"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@
"createNewViewer": "Crea un nuovo visualizzatore",
"manageViewerConfiguration": "Gestisci la configurazione del visualizzatore",
"previewCustomViewer": "Anteprima del visualizzatore personalizzato",
"editMapConfiguration": "Modifica configurazione della mappa"
"editMapConfiguration": "Modifica configurazione della mappa",
"unadvertised": "La risorsa non è pubblicizzata. E' nascosta dal catalogo e dai risultati della ricerca"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
"createNewViewer": "Create new viewer",
"manageViewerConfiguration": "Manage viewer configuration",
"previewCustomViewer": "Preview custom viewer",
"editMapConfiguration": "Edit map configuration"
"editMapConfiguration": "Edit map configuration",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
django>=3.2.0,<4.0
django>=4.2,<5.0
idna>=2.5,<2.11
requests>=2.13.0
Markdown>=3.2.2
MarkupSafe>=1.1.1
djangorestframework<=3.12.0,>=3.8.0
urllib3>=1.25.9
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ packages = find:
include_package_data = True
zip_safe = False
install_requires =
django >= 3.2.0, < 4.0
django >= 4.2, < 5.0
idna >= 2.5, < 2.11
requests >= 2.13.0
Markdown >= 2.6.11
MarkupSafe >= 1.1.1
djangorestframework <= 3.12.0, >= 3.8.0
urllib3 >= 1.25

[options.packages.find]
Expand Down

0 comments on commit ae1a867

Please sign in to comment.