Skip to content

Introducing broken map context state #11140#11429

Merged
allyoucanmap merged 6 commits intogeosolutions-it:masterfrom
rowheat02:contextpermission
Oct 13, 2025
Merged

Introducing broken map context state #11140#11429
allyoucanmap merged 6 commits intogeosolutions-it:masterfrom
rowheat02:contextpermission

Conversation

@rowheat02
Copy link
Copy Markdown
Contributor

Description

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Enhancement

fixes #11140

What is the current behavior?

#11140
When a user attempts to open a context map without the context permission to the user, they can open the map on the viewer route /viewer/id, which is incorrect.

What is the new behavior?

  • On the homepage, the warning tooltip will be shown for the context map without context permission (yellow border line). The user can not open this map
    image

  • If the user tries to access this type of map, it already shows the context permission message.
    image

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

@rowheat02 rowheat02 added this to the 2025.02.00 milestone Sep 4, 2025
@rowheat02 rowheat02 self-assigned this Sep 4, 2025
@tdipisa tdipisa requested a review from allyoucanmap September 4, 2025 08:36
@tdipisa tdipisa assigned allyoucanmap and unassigned rowheat02 Sep 4, 2025
Comment on lines +90 to +93
style={contextMapWithoutContextPermission ? {
border: '2px solid #f0ad4e',
borderRadius: '4px'
} : undefined}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid inline hardcoded style and we should think on a different way to represent this not sure yet on the usage of a yellow border for a broken link

Comment on lines +78 to +81
const CardWrapper = contextMapWithoutContextPermission ? tooltip(FlexBox) : FlexBox;
const tooltipProps = contextMapWithoutContextPermission ? {
tooltipId: "resourcesCatalog.warningForContextMapWithoutContextPermssion"
} : {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contextMapWithoutContextPermission prop and the warningForContextMapWithoutContextPermssion message are too specific for the GeoStore backend we should avoid this kind of naming and keep things generic

...props
}) => {
const showViewerLink = !!(!readOnly && viewerUrl);
const CardWrapper = contextMapWithoutContextPermission ? tooltip(FlexBox) : FlexBox;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not define a component inside the render function of another component. This should be declared outside

Comment on lines 416 to 417
contextMapWithoutContextPermission
} = getResourceInfo(resource);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the previous comment we should use status object instead of info

export const getGeostoreResourceStatus = (resource = {}, context = {}) => {
return {
items: [
...(resource.advertised === false ? [{
type: 'icon',
tooltipId: 'resourcesCatalog.unadvertised',
glyph: 'eye-close'
}] : []),
...(context?.name ? [{
type: 'icon',
glyph: 'context',
tooltipId: 'resourcesCatalog.mapUsesContext',
tooltipParams: {
contextName: context.name
}
}] : [])
]
};
};

If we want we could use the already available items that are icon visible on the grid card but we could also expose new property e.g.:

{
  cardClassNames: ['ms-broken-resource-card'], // based on condition
  cardTooltipId: 'resourcesCatalog.warningForContextMapWithoutContextPermssion' // based on condition
  items: [...]
}

if we include something cardClassNames and cardTooltipId we can avoid to have hardcoded inline style and too specific name for props inside the generic component.

@tdipisa
Copy link
Copy Markdown
Member

tdipisa commented Oct 9, 2025

@rowheat02 there are failing eslint checks. Can you please fix?

@rowheat02
Copy link
Copy Markdown
Contributor Author

  • Now error is handled using getResourceState.
  • Error message is generalized: Required dependency (e.g: parent context) is not accessible
  • Css is not inline , moved to .less
  • cardClassNames and cardTooltipId are taken from resource status and passed to the CardWrapper
  • The style same yellow border. This style can be changed if you think another style is better for this case.

@rowheat02 rowheat02 requested a review from allyoucanmap October 9, 2025 10:49
@allyoucanmap allyoucanmap merged commit 6a42dac into geosolutions-it:master Oct 13, 2025
5 checks passed
@allyoucanmap
Copy link
Copy Markdown
Contributor

@ElenaGallo please test this enhancement on dev, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introducing broken map context state

4 participants