Skip to content

Commit

Permalink
Copy UUID link instead of detail_url
Browse files Browse the repository at this point in the history
The UUID link provides the user a more generic permalink (no database id
involved) which redirects to the resource, anyway.

Requires UUID resolver at the GeoNode backend.
see GeoNode/geonode#10375
  • Loading branch information
ridoo committed Mar 24, 2023
1 parent 3b0f95c commit 80c2f27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "geonode_mapstore_client/client/MapStore2"]
path = geonode_mapstore_client/client/MapStore2
url = https://github.com/Thuenen-52North-Erweiterung-GeoNode/MapStore2.git
branch = 2022.02.00
url = https://github.com/geosolutions-it/MapStore2.git
branch = 2022.01.xx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const EditThumbnail = ({ image, onEdit, thumbnailUpdating }) => (
);


function formatResourceLinkUrl(resourceUrl = '') {
if (resourceUrl.indexOf('http') === 0) {
return resourceUrl;
function formatResourceLinkUrl(resource) {
if (resource?.uuid) {
return window.location.href.replace(/#.+$/, `uuid/${resource.uuid}`);
}
return window.location.href;
}
Expand Down Expand Up @@ -564,22 +564,22 @@ function DetailsPanel({
<FaIcon name="download" />
</Button>}

{detailUrl && <CopyToClipboard
<CopyToClipboard
tooltipPosition="top"
tooltipId={
copiedResourceLink
? 'gnhome.copiedResourceUrl'
: 'gnhome.copyResourceUrl'
}
text={formatResourceLinkUrl(detailUrl)}
text={formatResourceLinkUrl(resource)}
>
<Button
variant="default"
onClick={handleCopyPermalink}>
<FaIcon name="share-alt" />
</Button>
</CopyToClipboard>
}

{detailUrl && !editThumbnail && <Button
variant="primary"
href={(resourceCanPreviewed || canView) ? detailUrl : metadataDetailUrl}
Expand Down

0 comments on commit 80c2f27

Please sign in to comment.