使用共用 QuickSight 檢視
建立新的共用檢視後,請使用嵌入式 SDK 讓其他使用者也可使用共用檢視。下方範例為 Amazon QuickSight 中的嵌入式儀表板設定可使用的共用檢視。
- With an appended URL
-
在
/views/{viewId}下,將sharedViewId附加至嵌入式 URL,並將此 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; };
建立共用檢視
一鍵式嵌入