mirror of
https://github.com/apache/superset.git
synced 2026-05-24 09:15:19 +00:00
Snapshots all four versioned Docusaurus sections at v6.1.0, cut from master after the version-cutting tooling (#39837) and broken-internal- links fixes (#40102) landed. Captures fresh auto-generated content and freezes data dependencies so the historical snapshot stays correct. Versioning behavior: lastVersion stays at current for every section, so the canonical URLs (/docs/..., /admin-docs/..., /developer-docs/..., /components/...) continue to render content from master. The current version is consistently labeled "Next" with an unreleased banner, and 6.1.0 is a historical pin accessible only via its explicit version segment. Component playground: previously disabled: true in versions-config.json, now enabled and versioned. The plugin block in docusaurus.config.ts was already gated only by the disabled flag, so no other code changes were needed to bring it back online. Snapshot includes: - All MDX content for the four sections. - Auto-gen captured fresh: 74 database pages (engine spec metadata), ~1,800 API reference files (openapi.json), 59 component pages (Storybook stories). - Data imports frozen at cut time into snapshot-local _versioned_data/ dirs: versioned_docs/version-6.1.0/_versioned_data/src/data/databases.json (canonical 80-database diagnostics from master, preserved by the generator's input-hash cache) admin_docs_versioned_docs/version-6.1.0/_versioned_data/data/countries.json admin_docs_versioned_docs/version-6.1.0/_versioned_data/static/feature-flags.json developer_docs_versioned_docs/version-6.1.0/_versioned_data/static/data/components.json - Import paths in deeply-nested files rewritten so they still resolve from one directory deeper inside the snapshot. Verified via full yarn build: exit 0, no broken links surfaced by onBrokenLinks: throw. Anchor warnings present are pre-existing on master (community#superset-community-calendar) and unrelated.
132 lines
4.8 KiB
Plaintext
132 lines
4.8 KiB
Plaintext
---
|
|
title: Embedding Superset
|
|
sidebar_position: 6
|
|
---
|
|
|
|
{/*
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
*/}
|
|
|
|
|
|
# Embedding Superset
|
|
|
|
Superset dashboards can be embedded directly in host applications using the `@superset-ui/embedded-sdk` package.
|
|
|
|
:::info Prerequisites
|
|
- The `EMBEDDED_SUPERSET` feature flag must be enabled.
|
|
- The embedding domain and allowed origins must be configured by an admin.
|
|
:::
|
|
|
|
## Quick Start
|
|
|
|
Install the SDK:
|
|
|
|
```bash
|
|
npm install @superset-ui/embedded-sdk
|
|
```
|
|
|
|
Embed a dashboard:
|
|
|
|
```javascript
|
|
import { embedDashboard } from '@superset-ui/embedded-sdk';
|
|
|
|
embedDashboard({
|
|
id: 'dashboard-uuid-here', // from Dashboard → Embed
|
|
supersetDomain: 'https://superset.example.com',
|
|
mountPoint: document.getElementById('superset-container'),
|
|
fetchGuestToken: () => fetchTokenFromYourBackend(),
|
|
dashboardUiConfig: {
|
|
hideTitle: true,
|
|
filters: { expanded: false },
|
|
},
|
|
});
|
|
```
|
|
|
|
`fetchGuestToken` must return a **guest token** obtained from your server by calling Superset's `/api/v1/security/guest_token/` endpoint with a service account. Do not call this endpoint from client-side code.
|
|
|
|
---
|
|
|
|
## Callbacks
|
|
|
|
### `resolvePermalinkUrl`
|
|
|
|
When a user copies a permalink from an embedded dashboard, Superset generates a URL on its own domain. In an embedded context this URL is usually not meaningful to the host application's users — the dashboard is rendered inside the host app, not at the Superset URL.
|
|
|
|
The `resolvePermalinkUrl` callback lets the host app intercept permalink generation and return a URL on the host domain instead:
|
|
|
|
```javascript
|
|
embedDashboard({
|
|
id: 'my-dashboard-uuid',
|
|
supersetDomain: 'https://superset.example.com',
|
|
mountPoint: document.getElementById('superset-container'),
|
|
fetchGuestToken: () => fetchGuestToken(),
|
|
/**
|
|
* Called when Superset generates a permalink.
|
|
* @param {Object} args - { key: string } — the permalink key
|
|
* @returns {string | null} - your host URL, or null to use Superset's default
|
|
*/
|
|
resolvePermalinkUrl: ({ key }) => {
|
|
return `https://myapp.example.com/dashboard?permalink=${key}`;
|
|
},
|
|
});
|
|
```
|
|
|
|
If the callback returns `null` or is not provided, Superset uses its own permalink URL as a fallback.
|
|
|
|
---
|
|
|
|
## Feature Flags for Embedded Mode
|
|
|
|
### `DISABLE_EMBEDDED_SUPERSET_LOGOUT`
|
|
|
|
Hides the logout button when Superset is embedded in a host application. This is useful when the host application manages the session lifecycle and you do not want users to accidentally log out of the embedded Superset session:
|
|
|
|
```python
|
|
# superset_config.py
|
|
FEATURE_FLAGS = {
|
|
"EMBEDDED_SUPERSET": True,
|
|
"DISABLE_EMBEDDED_SUPERSET_LOGOUT": True,
|
|
}
|
|
```
|
|
|
|
When enabled, the **Logout** menu item is removed from the user avatar dropdown in the embedded view. The session can still be invalidated server-side by revoking the guest token.
|
|
|
|
### `EMBEDDED_SUPERSET`
|
|
|
|
Must be `True` to enable the embedded SDK and the guest token endpoint. Without this flag, `embedDashboard` will fail to load.
|
|
|
|
---
|
|
|
|
## URL Parameters
|
|
|
|
The following URL parameters can be passed through the `urlParams` option in `dashboardUiConfig` or appended to the embedded iframe URL:
|
|
|
|
| Parameter | Values | Effect |
|
|
|-----------|--------|--------|
|
|
| `standalone` | `0`, `1`, `2`, `3` | `0`: normal; `1`: hide nav; `2`: hide nav + title; `3`: hide nav + title + tabs |
|
|
| `show_filters` | `0`, `1` | Show or hide the native filter bar |
|
|
| `expand_filters` | `0`, `1` | Start with filter bar expanded or collapsed |
|
|
|
|
---
|
|
|
|
## Security Notes
|
|
|
|
- **Guest tokens expire** — their lifetime is controlled by the `GUEST_TOKEN_JWT_EXP_SECONDS` config (default: 5 minutes). Refresh tokens before they expire using a token refresh mechanism in your host app.
|
|
- **Row-level security** — pass `rls` rules in the guest token request to restrict which rows are visible to the embedded user.
|
|
- **Allowed domains** — restrict which host origins can embed a dashboard by setting **Allowed Domains** per-dashboard in the *Embed* settings modal. Superset checks the request's `Referer` header against this list before serving the embedded view; an empty list allows any origin, so configure this explicitly for production.
|