From fee5cba478ee34cd005cf767ff3997d64859f336 Mon Sep 17 00:00:00 2001 From: Suren Date: Mon, 22 Jan 2024 14:34:47 +0530 Subject: [PATCH] #1657 - Add unadvertised identifier to the resource --- .../components/DetailsPanel/DetailsPanel.jsx | 2 ++ .../components/ResourceCard/ResourceCard.jsx | 4 +++ .../components/Unadvertised/Unadvertised.jsx | 33 +++++++++++++++++++ .../js/components/Unadvertised/index.js | 1 + .../themes/geonode/less/_details-panel.less | 5 +++ .../themes/geonode/less/_resource-card.less | 8 +++++ .../mapstore/gn-translations/data.de-DE.json | 3 +- .../mapstore/gn-translations/data.en-US.json | 3 +- .../mapstore/gn-translations/data.es-ES.json | 3 +- .../mapstore/gn-translations/data.fi-FI.json | 3 +- .../mapstore/gn-translations/data.fr-FR.json | 3 +- .../mapstore/gn-translations/data.hr-HR.json | 3 +- .../mapstore/gn-translations/data.it-IT.json | 3 +- .../mapstore/gn-translations/data.nl-NL.json | 3 +- .../mapstore/gn-translations/data.pt-PT.json | 3 +- .../mapstore/gn-translations/data.sk-SK.json | 3 +- .../mapstore/gn-translations/data.sv-SE.json | 3 +- .../mapstore/gn-translations/data.vi-VN.json | 3 +- .../mapstore/gn-translations/data.zh-ZH.json | 3 +- 19 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 geonode_mapstore_client/client/js/components/Unadvertised/Unadvertised.jsx create mode 100644 geonode_mapstore_client/client/js/components/Unadvertised/index.js diff --git a/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx b/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx index 638bb453d2..f595920229 100644 --- a/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx +++ b/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx @@ -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); @@ -112,6 +113,7 @@ const DetailsPanelTools = ({ return (
+ {enableFavorite &&
+
+ +

{res.raw_abstract ? res.raw_abstract : '...'} diff --git a/geonode_mapstore_client/client/js/components/Unadvertised/Unadvertised.jsx b/geonode_mapstore_client/client/js/components/Unadvertised/Unadvertised.jsx new file mode 100644 index 0000000000..42e40c7240 --- /dev/null +++ b/geonode_mapstore_client/client/js/components/Unadvertised/Unadvertised.jsx @@ -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 (

); +}; + +const IconWithTooltip = tooltip(Icon); + +const Unadvertised = ({resource}) => { + if (isNil(resource.advertised) || resource.advertised) { + return null; + } + return ( + + ); +}; + +export default Unadvertised; diff --git a/geonode_mapstore_client/client/js/components/Unadvertised/index.js b/geonode_mapstore_client/client/js/components/Unadvertised/index.js new file mode 100644 index 0000000000..59d6f463af --- /dev/null +++ b/geonode_mapstore_client/client/js/components/Unadvertised/index.js @@ -0,0 +1 @@ +export { default } from './Unadvertised'; diff --git a/geonode_mapstore_client/client/themes/geonode/less/_details-panel.less b/geonode_mapstore_client/client/themes/geonode/less/_details-panel.less index cbdafb97ce..9643c63710 100644 --- a/geonode_mapstore_client/client/themes/geonode/less/_details-panel.less +++ b/geonode_mapstore_client/client/themes/geonode/less/_details-panel.less @@ -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; diff --git a/geonode_mapstore_client/client/themes/geonode/less/_resource-card.less b/geonode_mapstore_client/client/themes/geonode/less/_resource-card.less index 3c2440e640..f4fb42f9a1 100644 --- a/geonode_mapstore_client/client/themes/geonode/less/_resource-card.less +++ b/geonode_mapstore_client/client/themes/geonode/less/_resource-card.less @@ -46,6 +46,9 @@ .color-var(@theme-vars[primary]); } } + .gn-unadvertised { + .color-var(@theme-vars[warning]) + } } // ************** @@ -323,3 +326,8 @@ button.btn.btn-default.gn-resource-status.gn-status-button { } } } + +.gn-unadvertised { + cursor: pointer; + pointer-events: auto; +} \ No newline at end of file diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json index f1ba50e093..43d86375b7 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json index cc89882e54..4ba5e027ac 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json index 83186845b1..7c5082ea1d 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json @@ -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." } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json index 58e447f92a..fe9f1b51b2 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json index a9d21750ea..f6d664c987 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json index cc3ca8944e..0ba402ee56 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json index fd3794843e..4f8cfb1460 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json index 919eeff54e..5873f52048 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json index 21dffc859f..995a5a3695 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json index e44a8e84e2..fcfd50e257 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json index ac65882fa7..b6564d12a3 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json index f50d42b836..c4dbae692d 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json @@ -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" } } } diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json index 4b1e776fe3..77c6724647 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json @@ -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" } } }