diff --git a/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx b/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx index 2968b82528..8d13277606 100644 --- a/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx +++ b/geonode_mapstore_client/client/js/components/DetailsPanel/DetailsPanel.jsx @@ -173,34 +173,52 @@ function DetailsPanel({ const detailUrl = resource?.pk && formatDetailUrl(resource); const documentDownloadUrl = (resource?.href && resource?.href.includes('download')) ? resource?.href : undefined; const attributeSet = resource?.attribute_set; + + const validateDataType = (data) => { + + let dataType; + switch (true) { + case data === 'None': + case data?.length === 0: + dataType = undefined; + break; + default: + dataType = data; + } + + + return dataType; + }; + + const infoField = [ { "label": "Title", - "value": resource?.title + "value": validateDataType(resource?.title) }, { "label": "Abstract", - "value": resource?.raw_abstract + "value": validateDataType(resource?.raw_abstract) }, { "label": "Owner", - "value": {(resource?.owner?.first_name !== "" && resource?.owner?.last_name !== "" ) ? (resource?.owner?.first_name + " " + resource?.owner?.last_name) : resource?.owner?.username} + "value": validateDataType(resource?.owner?.username) && {(resource?.owner?.first_name !== "" && resource?.owner?.last_name !== "" ) ? (resource?.owner?.first_name + " " + resource?.owner?.last_name) : resource?.owner?.username} }, { "label": "Created", - "value": moment(resource?.created).format('MMMM Do YYYY') + "value": validateDataType(resource?.created) && moment(resource?.created).format('MMMM Do YYYY') }, { "label": "Published", - "value": moment(resource?.date).format('MMMM Do YYYY') + "value": validateDataType(resource?.date) && moment(resource?.date).format('MMMM Do YYYY') }, { "label": "Last Modified", - "value": moment(resource?.last_updated).format('MMMM Do YYYY') + "value": validateDataType(resource?.last_updated) && moment(resource?.last_updated).format('MMMM Do YYYY') }, { "label": "Resource Type", - "value": { + "value": validateDataType(resource?.keywords) && resource?.keywords?.map((map) => { return ( { + "value": validateDataType(resource?.regions) && resource?.regions?.map((map) => { return (