Skip to content

Commit

Permalink
feat(embedded): github actions lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayakrishnankarolilnlsn committed Sep 21, 2022
1 parent 94db0a6 commit 84b0b7d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions superset-frontend/src/embedded/api.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
import { store } from '../views/store';
import { bootstrapData } from '../preamble';
import { getDashboardPermalink as getDashboardPermalinkUtil } from "../utils/urlUtils";
import { getDashboardPermalink as getDashboardPermalinkUtil } from '../utils/urlUtils';

type Size = {
width: number, height: number
}
width: number;
height: number;
};

type EmbeddedSupersetApi = {
getScrollSize: () => Size;
getDashboardPermalink: ({ anchor }: { anchor: string }) => Promise<string>;
getActiveTabs: () => string[];
}
};

const getScrollSize = (): Size => ({
width: document.body.scrollWidth,
height: document.body.scrollHeight,
})
});

const getDashboardPermalink = async ({anchor}: {anchor: string}): Promise<string> => {
const getDashboardPermalink = async ({ anchor }: { anchor: string }): Promise<string> => {
const state = store?.getState();
const { dashboardId, dataMask, activeTabs } = {
dashboardId: state?.dashboardInfo?.id || bootstrapData?.embedded!.dashboard_id,
dataMask: state?.dataMask,
activeTabs: state.dashboardState?.activeTabs,
}
};

return getDashboardPermalinkUtil({
dashboardId,
dataMask,
activeTabs,
anchor,
});
}
};

const getActiveTabs = () => store?.getState()?.dashboardState?.activeTabs || [];

export const embeddedApi: EmbeddedSupersetApi = {
getScrollSize,
getDashboardPermalink,
getActiveTabs
getActiveTabs,
};

0 comments on commit 84b0b7d

Please sign in to comment.