gabotorresruiz opened a new pull request, #43624:
URL: https://github.com/apache/superset/pull/43624
### SUMMARY
Adds a new UI extension slot, `dashboard.slice.header.menu`, that lets a
deployment inject custom items into a chart's more-options ("…") menu on a
dashboard.
The slot is a function that receives the chart context (`sliceId`,
`sliceName`, `dashboardId`) and returns an array of `MenuItem`.
Returned items are prepended to the top of the menu, above the built-in
entries, followed by a divider.
An empty array injects nothing, so no dangling divider is added.
This mirrors the existing `dashboard.slice.header` component slot, but
returns menu data instead of a rendered component, since the host owns the menu
structure.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable.
This adds an extension point with no built-in UI of its own; the visible
result depends on what a deployment registers against the slot.
### TESTING INSTRUCTIONS
Register the slot and confirm the item renders at the top of a chart's "…"
menu on a dashboard:
```ts
import { getExtensionsRegistry } from '@superset-ui/core';
getExtensionsRegistry().set('dashboard.slice.header.menu', ({ sliceName })
=> [
{ key: 'demo', label: `Ask about ${sliceName}`, onClick: () => {} },
]);
```
Run the unit tests:
```bash
cd superset-frontend
npm run test --
src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx
```
The suite covers two behaviors: registered items render at the top of the
menu, and an empty array injects nothing.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]