Add embedded docs config details to extensions registry (#21052)
diff --git a/superset-frontend/packages/superset-ui-core/src/ui-overrides/ExtensionsRegistry.ts b/superset-frontend/packages/superset-ui-core/src/ui-overrides/ExtensionsRegistry.ts
index dc71c80..bf050a2 100644
--- a/superset-frontend/packages/superset-ui-core/src/ui-overrides/ExtensionsRegistry.ts
+++ b/superset-frontend/packages/superset-ui-core/src/ui-overrides/ExtensionsRegistry.ts
@@ -35,7 +35,12 @@
* When defining a new option here, take care to keep any parameters to functions (or components) minimal.
* Any removal or alteration to a parameter will be considered a breaking change.
*/
+type ConfigDetailsProps = {
+ embeddedId: string;
+};
+
export type Extensions = Partial<{
+ 'embedded.documentation.configuration_details': React.ComponentType<ConfigDetailsProps>;
'embedded.documentation.description': ReturningDisplayable;
'embedded.documentation.url': string;
'dashboard.nav.right': React.ComponentType;
diff --git a/superset-frontend/src/dashboard/components/DashboardEmbedControls.tsx b/superset-frontend/src/dashboard/components/DashboardEmbedControls.tsx
index dfe3f49..6d28b7f 100644
--- a/superset-frontend/src/dashboard/components/DashboardEmbedControls.tsx
+++ b/superset-frontend/src/dashboard/components/DashboardEmbedControls.tsx
@@ -148,6 +148,9 @@
return <Loading />;
}
+ const DocsConfigDetails = extensionsRegistry.get(
+ 'embedded.documentation.configuration_details',
+ );
const docsDescription = extensionsRegistry.get(
'embedded.documentation.description',
);
@@ -157,21 +160,25 @@
return (
<>
- <p>
- {embedded ? (
- <>
+ {embedded ? (
+ DocsConfigDetails ? (
+ <DocsConfigDetails embeddedId={embedded.uuid} />
+ ) : (
+ <p>
{t(
'This dashboard is ready to embed. In your application, pass the following id to the SDK:',
)}
<br />
<code>{embedded.uuid}</code>
- </>
- ) : (
- t(
+ </p>
+ )
+ ) : (
+ <p>
+ {t(
'Configure this dashboard to embed it into an external web application.',
- )
- )}
- </p>
+ )}
+ </p>
+ )}
<p>
{t('For further instructions, consult the')}{' '}
<a href={docsUrl} target="_blank" rel="noreferrer">