CEC-2970: Multiple Superset Dashboards (#229)

Co-authored-by: Alexander Andrews <aandrews@fiskerinc.com>
This commit is contained in:
Alexander Andrews
2022-11-02 14:37:08 -04:00
committed by GitHub
parent 843fddd0b7
commit 2d298368c5
9 changed files with 4406 additions and 501 deletions

View File

@@ -4,10 +4,12 @@ import { useStatusContext } from "../Contexts/StatusContext";
import { useUserContext } from "../Contexts/UserContext";
import './index.css'
import { embedDashboard } from "@superset-ui/embedded-sdk";
import { useHistory } from "react-router-dom";
const Dashboard = () => {
const { setTitle, setSitePath } = useStatusContext();
const history = useHistory()
const {
token: {
@@ -16,17 +18,19 @@ const Dashboard = () => {
} = useUserContext();
useEffect(() => {
const urlsplit = window.location.href.split("/")
const id = urlsplit[urlsplit.length - 1]
setTitle("Datascope");
setSitePath([]);
embedDashboard({
id: api.SupersetDashboardID(), // given by the Superset embedding UI
id: id, // given by the Superset embedding UI
supersetDomain: api.SupersetDashboardURL(),
mountPoint: document.getElementById("my-superset-container"), // any html element that can contain an iframe
fetchGuestToken: () => api.getGuestToken(token),
dashboardUiConfig: { hideTab: true, hideTitle: true }, // dashboard UI config: hideTitle, hideTab, hideChartControls (optional)
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [history.location]);
return (
<div style={{