本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用共享 QuickSight 视图
创建新的共享视图后,使用 Embedd SDK ing 使共享视图可供其他用户使用。以下示例为 Amazon QuickSight 中的嵌入式控制面板设置了可使用的共享视图。
- With an appended URL
-
将添加到嵌入的下方 URL
/views/{viewId}
,然后将其显示URL给您的用户。sharedViewId
用户可以使用它来导航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
-
将 a 传递
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; };
创建共享视图
一键嵌入