Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide shorten url button #5539

Closed

Conversation

MaciejMierzwa
Copy link

Description

This solution hides the "shorten URL" switch from user that who doesn't have permission to perform the action.
image

Issues Resolved

(opensearch-project/security-dashboards-plugin#891)

Testing the changes

Manual testing was performed according to scenario from task: #8914

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Maciej Mierzwa <dev.maciej.mierzwa@gmail.com>
@@ -393,7 +403,8 @@ export class UrlPanelContent extends Component<Props, State> {
private renderShortUrlSwitch = () => {
if (
this.state.exportUrlAs === ExportUrlAsType.EXPORT_URL_AS_SAVED_OBJECT ||
!this.props.allowShortUrl
!this.props.allowShortUrl ||
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible that a dashboards-plugin can assign this value? IMO it would be better for a plugin to supply this value of whether to render or not render the component instead of relying on catching an exception.

@MaciejMierzwa
Copy link
Author

Hi @joshuarrrr was assigning @ashwin-pc a missclick?

@joshuarrrr
Copy link
Member

Hi @joshuarrrr was assigning @ashwin-pc a missclick?

No - PRs are assigned to maintainers for review

@ashwin-pc
Copy link
Member

This Pr should no longer be necessary after a recent change to use the capabilities provider correctly.

Here is where the capabilities provider is used to show or hide the button: https://github.com/opensearch-project/opensearch-dashboards/blob/04bdb2b10d0b70f465dc15835bdc5fc9f342900c/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.tsx#L192

Here is the docs that outline how it all woks is here: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/docs/capabilities/read_only_mode.md

Its a pretty new addition so its not in any release yet and should come out in 2.12.

Feel free to reopen if this is not what you were trying to achieve here :)

@ashwin-pc ashwin-pc closed this Nov 29, 2023
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.

4 participants