Skip to content

Commit

Permalink
feat: show embed error + always show sources
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Jan 16, 2024
1 parent 94cc865 commit 35f5465
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/components/Blocks/EmbedEEAMap/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const Edit = (props) => {
enable_queries,
show_legend = true,
show_note = true,
show_sources = true,
show_more_info = true,
show_share = true,
dataprotection = { enabled: true },
Expand Down Expand Up @@ -66,7 +65,7 @@ const Edit = (props) => {

useEffect(() => {
const mapVisId = flattenToAppURL(map_visualization_data['@id'] || '');
if (vis_url && vis_url !== mapVisId) {
if (!map_visualization_data?.error && vis_url && vis_url !== mapVisId) {
getContent(vis_url, null, id);
}
if (!vis_url) {
Expand Down Expand Up @@ -118,7 +117,7 @@ const Edit = (props) => {
...data,
show_legend,
show_note,
show_sources,
show_sources: true,
show_more_info,
show_share,
dataprotection,
Expand Down
1 change: 0 additions & 1 deletion src/components/Blocks/EmbedEEAMap/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const Schema = (props) => {
'show_legend',
'show_viewer',
'show_note',
'show_sources',
'show_more_info',
'show_share',
],
Expand Down
9 changes: 7 additions & 2 deletions src/components/Blocks/EmbedEEAMap/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const View = (props) => {
enable_queries,
show_legend = true,
show_note = true,
show_sources = true,
show_more_info = true,
show_share = true,
dataprotection = { enabled: true },
Expand All @@ -40,6 +39,12 @@ const View = (props) => {
? `${map_visualization_data.layers.map_layers[0].map_layer.map_service_url}?f=jsapi`
: '';

if (map_visualization_data?.error) {
return (
<p dangerouslySetInnerHTML={{ __html: map_visualization_data.error }} />
);
}

return (
<PrivacyProtection
className="embed-map-visualization"
Expand All @@ -54,7 +59,7 @@ const View = (props) => {
...data,
show_legend,
show_note,
show_sources,
show_sources: true,
show_more_info,
show_share,
dataprotection,
Expand Down

0 comments on commit 35f5465

Please sign in to comment.