Skip to content

Feature/centralized share button - #4

Draft
DarshitChanpura wants to merge 5 commits into
mainfrom
feature/centralized-share-button
Draft

Feature/centralized share button#4
DarshitChanpura wants to merge 5 commits into
mainfrom
feature/centralized-share-button

Conversation

@DarshitChanpura

Copy link
Copy Markdown
Owner

Description

[Describe what this change achieves]

Category

[Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation]

Why these changes are required?

What is the old behavior before changes and new behavior after changes?

Issues Resolved

[List any issues this PR will resolve (Is this a backport? If so, please add backport PR # and/or commits #)]

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Exposes securityDashboards.ui.ShareButton on the plugin start contract so
plugins that register protected resources under the resource-sharing
framework can embed a Share / Update Access button (with the shared
access modal) directly on their own pages, instead of navigating to the
central Resource Access Management dashboard.

- Extract ShareAccessModal, share-with types and diff/error helpers out
  of resource-sharing-panel into reusable modules (no behavior change)
- Add ResourceShareButton: self-fetches sharing record + access levels,
  handles can_share permission, MDS dataSourceId, and hides itself when
  resource sharing is disabled or the type is not registered
- Lazy-load the implementation so consumers only pay the cost on render

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…lity

Extends the centralized share button with the integration surfaces needed
by consumer plugins:

- DOM-marker SPI: plugins render a data-resource-share-button marker
  element (id/type/data-source/display attributes) anywhere in their UI
  and the centralized share button mounts into it via MutationObserver.
  No plugin dependency, imports, or manifest changes required.
- Controlled modal mode (isModalOpen/onModalClose) so triggers can live
  inside popovers/context menus that unmount on close; warns via toast
  when sharing is not possible instead of rendering a broken modal
- display='icon' compact variant for dense placements like table rows
- Request coalescing (5s TTL) so many buttons rendered at once (table
  rows) share a single types/list fetch; mutations bypass the cache
- resourceSharing.enabled core capability (provider + per-request
  switcher backed by dashboardsinfo) so any plugin can gate surrounding
  chrome (e.g. a table column) without depending on this plugin

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Extends the resourceSharing core capability with availableTypes (comma-
joined registered resource types from the /types API) so consumer plugins
can hide share affordances when their specific type is not registered,
in addition to the global enabled flag. Values are primitives because
the capabilities switcher merge only retains keys with stable types.

Note: availableTypes reflects registered types; protected_types is not
exposed by the backend to non-admin users today, so per-type buttons
still self-hide for registered-but-unprotected types.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant