使用共享的 QuickSight 视图
创建新的共享视图后,请使用 Embedding SDK 使其他用户可以使用共享视图。以下示例将为 Amazon QuickSight 中的嵌入式控制面板设置可用的共享视图。
- With an appended URL
-
将
sharedViewId
附加到嵌入式 URL(位于/views/{viewId}
下),并将此 URL 公开给您的用户。用户可以使用此 URL 导航到该共享视图。const response = await dashboardFrame.createSharedView(); const newEmbedUrl = await generateNewEmbedUrl(); const formattedUrl = new URL(newEmbedUrl); formattedUrl.pathname = formattedUrl.pathname.concat('/views/' + response.message.sharedViewId); const baseUrl = formattedUrl.href; alert("Click to view this QuickSight shared view", baseUrl);
- With the contentOptions SDK
-
将
viewId
传递给contentOptions
以打开具有给定viewId
的体验。const contentOptions = { toolbarOptions: { ... }, viewId: sharedViewId, }; const embeddedDashboard = await embeddingContext.embedDashboard( {container: containerRef.current}, contentOptions );
- With the InitialPath property
-
const shareView = async() => { const returnValue = await consoleFrame.createSharedView(); const {dashboardId, sharedViewId} = returnValue.message; const newEmbedUrl = await generateNewEmbedUrl(`/dashboards/${dashboardId}/views/${sharedViewId}`); setShareUrl(newEmbedUrl); }; const generateNewEmbedUrl = async (initialPath) => { const generateUrlPayload = { experienceConfiguration: { QuickSightConsole: { InitialPath: initialPath, FeatureConfigurations: { "SharedView": { "Enabled": true }, }, }, } const result: GenerateEmbedUrlResult = await generateEmbedUrlForRegisteredUser(generateUrlPayload); return result.url; };
创建共享视图
一键式嵌入