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 3b99bd2
Showing 1 changed file with 6 additions and 6 deletions.
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 3b99bd2

Please sign in to comment.