Skip to content

Commit

Permalink
#1657 - Add unadvertised identifier to the resource (#1658)
Browse files Browse the repository at this point in the history
* #1657 - Add unadvertised identifier to the resource

* Code refactor
  • Loading branch information
dsuren1 authored Jan 22, 2024
1 parent 0bfcb28 commit 7c3bec7
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 13 deletions.
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';
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>Sie können die Ausdehnung und Position dieser Ressource bearbeiten</b>. Shift-Klick und ziehen Sie, um eine neue Ausdehnung zu zeichnen, klicken Sie auf die Markierung und klicken und ziehen Sie dann, um ihre Position festzulegen"
"mapExtentHelpText": "<b>Sie können die Ausdehnung und Position dieser Ressource bearbeiten</b>. Shift-Klick und ziehen Sie, um eine neue Ausdehnung zu zeichnen, klicken Sie auf die Markierung und klicken und ziehen Sie dann, um ihre Position festzulegen",
"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 @@ -358,7 +358,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -357,7 +357,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>Puedes editar la extensión y posición de este recurso</b>. Shift-clic y arrastre para dibujar una nueva extensión, haga clic en el marcador y luego haga clic y arrastre para establecer su posición"
"mapExtentHelpText": "<b>Puedes editar la extensión y posición de este recurso</b>. Shift-clic y arrastre para dibujar una nueva extensión, haga clic en el marcador y luego haga clic y arrastre para establecer su posición",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -358,7 +358,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>Vous pouvez modifier l'étendue et la position de cette ressource</b>. Shift-clic et faites glisser pour dessiner une nouvelle étendue, cliquez sur le marqueur puis cliquez et faites glisser pour définir sa position"
"mapExtentHelpText": "<b>Vous pouvez modifier l'étendue et la position de cette ressource</b>. Shift-clic et faites glisser pour dessiner une nouvelle étendue, cliquez sur le marqueur puis cliquez et faites glisser pour définir sa position",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -360,7 +360,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>Puoi modificare l'estensione e la posizione di questa risorsa</b>. Shift-clic e trascina per disegnare una nuova estensione, fare clic sul marcatore, quindi fare clic e trascinare per impostarne la posizione"
"mapExtentHelpText": "<b>Puoi modificare l'estensione e la posizione di questa risorsa</b>. Shift-clic e trascina per disegnare una nuova estensione, fare clic sul marcatore, quindi fare clic e trascinare per impostarne la posizione",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -328,7 +328,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"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 @@ -327,7 +327,8 @@
"maxLon": "Max Lon",
"centerLat": "Lat",
"centerLon": "Lon",
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position"
"mapExtentHelpText": "<b>You can edit the extent and position of this resource</b>. Shift-click and drag to draw a new extent, click on the marker and then click and drag to set its position",
"unadvertised": "Resource is not advertised. It is hidden from the catalog and search results"
}
}
}

0 comments on commit 7c3bec7

Please sign in to comment.