From 8ae6086c55623abeca3a4d80759a95983bd30658 Mon Sep 17 00:00:00 2001 From: Suren Date: Mon, 30 Oct 2023 18:46:53 +0530 Subject: [PATCH 1/2] #1603: Fix - Download button visibility with url and view only perms --- .../client/js/plugins/DownloadResource.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx b/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx index 5596fae145..14bf95bc77 100644 --- a/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx +++ b/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx @@ -46,7 +46,10 @@ const DownloadButton = ({ const downloadInfo = getDownloadUrlInfo(_resource); const isNotAjaxSafe = !Boolean(downloadInfo?.ajaxSafe); - if ((isEmpty(_resource?.download_urls) && !_resource?.perms?.includes('download_resourcebase')) || (!isButton && isNotAjaxSafe)) { + if ((isEmpty(_resource?.download_urls) && !_resource?.perms?.includes('download_resourcebase')) + || !_resource?.perms?.includes('download_resourcebase') + || (!isButton && isNotAjaxSafe) + ) { return null; } From 23fb679b9a353fb086be56ef51dfe390420a24e1 Mon Sep 17 00:00:00 2001 From: Suren Date: Thu, 9 Nov 2023 12:44:57 +0530 Subject: [PATCH 2/2] Update icon based on source type --- .../client/js/plugins/DownloadResource.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx b/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx index 14bf95bc77..10c75bc37f 100644 --- a/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx +++ b/geonode_mapstore_client/client/js/plugins/DownloadResource.jsx @@ -11,7 +11,7 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import isEmpty from 'lodash/isEmpty'; import { createPlugin } from '@mapstore/framework/utils/PluginsUtils'; -import { getDownloadUrlInfo } from '@js/utils/ResourceUtils'; +import { getDownloadUrlInfo, isDocumentExternalSource } from '@js/utils/ResourceUtils'; import Message from '@mapstore/framework/components/I18N/Message'; import Button from '@js/components/Button'; import tooltip from '@mapstore/framework/components/misc/enhancers/tooltip'; @@ -44,6 +44,7 @@ const DownloadButton = ({ const isButton = renderType !== "menuItem"; const _resource = resource ?? resourceData; const downloadInfo = getDownloadUrlInfo(_resource); + const isExternal = isDocumentExternalSource(_resource); const isNotAjaxSafe = !Boolean(downloadInfo?.ajaxSafe); if ((isEmpty(_resource?.download_urls) && !_resource?.perms?.includes('download_resourcebase')) @@ -64,7 +65,7 @@ const DownloadButton = ({ rel="noopener noreferrer" > {showIcon - ? + ? : }