EnxDev commented on code in PR #45275:
URL: https://github.com/apache/superset/pull/45275#discussion_r4276224199
##########
superset-frontend/src/components/Chart/ChartRenderer.tsx:
##########
@@ -239,6 +242,17 @@ function ChartRendererComponent({
[source, suppressContextMenu],
);
+ // Tells plugins where they render, e.g. to allow editing only in Explore.
+ // Standalone Explore serves embedded charts and report screenshots.
+ const appSection = useMemo(() => {
+ if (source === ChartSource.Dashboard) {
+ return AppSection.Dashboard;
Review Comment:
Embedded dashboards (the SDK / guest token path) render through here with
`source=Dashboard`, so they get `AppSection.Dashboard` and `Embedded` only ever
shows up for standalone Explore.
If the point is letting a plugin lock itself down when embedded, there's
`isEmbedded()` in `src/dashboard/util/isEmbedded.ts` that could feed this
branch. Otherwise I'd tighten the PR description, since "embedded charts" reads
like it covers the SDK.
##########
superset-frontend/src/components/Chart/ChartRenderer.tsx:
##########
@@ -239,6 +242,17 @@ function ChartRendererComponent({
[source, suppressContextMenu],
);
+ // Tells plugins where they render, e.g. to allow editing only in Explore.
+ // Standalone Explore serves embedded charts and report screenshots.
+ const appSection = useMemo(() => {
+ if (source === ChartSource.Dashboard) {
+ return AppSection.Dashboard;
+ }
+ return getUrlParam(URL_PARAMS.standalone)
+ ? AppSection.Embedded
+ : AppSection.Explore;
Review Comment:
`standalone=2` is `ExploreStandaloneMode.HideNavShowControls`, which keeps
the editor, but the truthy check sends it to `Embedded`. A plugin that only
allows editing in Explore would turn it off there.
Something like this (plus the `ExploreStandaloneMode` import from
`src/explore/constants`), and a `?standalone=2` case next to the existing test:
```suggestion
const standalone = getUrlParam(URL_PARAMS.standalone);
return standalone &&
standalone !== ExploreStandaloneMode.HideNavShowControls
? AppSection.Embedded
: AppSection.Explore;
```
--
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]