synapse-react-client 4.0.10 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SWC.index.d.ts +1 -1
- package/dist/SWC.index.js +1 -1
- package/dist/assets/icons/CloudWarning.d.ts +5 -0
- package/dist/assets/icons/CloudWarning.d.ts.map +1 -0
- package/dist/assets/icons/CloudWarning.js +47 -0
- package/dist/assets/icons/CloudWarning.js.map +1 -0
- package/dist/components/AdaptiveTwoColumnLayout/AdaptiveTwoColumnLayout.d.ts +44 -0
- package/dist/components/AdaptiveTwoColumnLayout/AdaptiveTwoColumnLayout.d.ts.map +1 -0
- package/dist/components/AdaptiveTwoColumnLayout/AdaptiveTwoColumnLayout.js +46 -0
- package/dist/components/AdaptiveTwoColumnLayout/AdaptiveTwoColumnLayout.js.map +1 -0
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.d.ts.map +1 -1
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js +143 -140
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteColumn.js +66 -55
- package/dist/components/DataGrid/columns/AutocompleteColumn.js.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.js +1 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.js.map +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.d.ts +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.js +27 -24
- package/dist/components/DataGrid/utils/applyModelChange.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts +8 -0
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +47 -44
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/getEmptyValue.d.ts +2 -0
- package/dist/components/DataGrid/utils/getEmptyValue.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/getEmptyValue.js +8 -0
- package/dist/components/DataGrid/utils/getEmptyValue.js.map +1 -0
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js +2 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.d.ts +32 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.js +22 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.js.map +1 -0
- package/dist/components/DownloadCart/DownloadCartPage.d.ts.map +1 -1
- package/dist/components/DownloadCart/DownloadCartPage.js +183 -185
- package/dist/components/DownloadCart/DownloadCartPage.js.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.css +1 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.d.ts.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js +199 -132
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js +22 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js.map +1 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.scss +170 -0
- package/dist/components/EntityAclEditor/EntityAclEditor.js +8 -8
- package/dist/components/EntityAclEditor/EntityAclEditor.js.map +1 -1
- package/dist/components/EntityAclEditor/InheritanceMessage.d.ts.map +1 -1
- package/dist/components/EntityAclEditor/InheritanceMessage.js +1 -2
- package/dist/components/EntityAclEditor/InheritanceMessage.js.map +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.d.ts.map +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js +1 -0
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.d.ts.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js +15 -14
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js.map +1 -1
- package/dist/components/Forum/DiscussionReply.d.ts +1 -0
- package/dist/components/Forum/DiscussionReply.d.ts.map +1 -1
- package/dist/components/Forum/DiscussionReply.js +19 -19
- package/dist/components/Forum/DiscussionReply.js.map +1 -1
- package/dist/components/Forum/DiscussionThread.d.ts +1 -0
- package/dist/components/Forum/DiscussionThread.d.ts.map +1 -1
- package/dist/components/Forum/DiscussionThread.js +73 -72
- package/dist/components/Forum/DiscussionThread.js.map +1 -1
- package/dist/components/FullTextSearch/FullTextSearch.d.ts.map +1 -1
- package/dist/components/FullTextSearch/FullTextSearch.js +86 -47
- package/dist/components/FullTextSearch/FullTextSearch.js.map +1 -1
- package/dist/components/GenericCard/BioregistryRules.d.ts.map +1 -1
- package/dist/components/GenericCard/BioregistryRules.js +7 -3
- package/dist/components/GenericCard/BioregistryRules.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +157 -157
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/HeaderCard.d.ts.map +1 -1
- package/dist/components/HeaderCard.js +131 -130
- package/dist/components/HeaderCard.js.map +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts.map +1 -1
- package/dist/components/IconSvg/IconSvg.js +2 -1
- package/dist/components/IconSvg/IconSvg.js.map +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.d.ts +4 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.d.ts.map +1 -1
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.js +3 -2
- package/dist/components/MailchimpSubscribeSection/MailchimpSubscribeSection.js.map +1 -1
- package/dist/components/QueryContext/QueryContext.d.ts +6 -0
- package/dist/components/QueryContext/QueryContext.d.ts.map +1 -1
- package/dist/components/QueryContext/QueryContext.js.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +12 -11
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +5 -0
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +32 -29
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/UseRowSet.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/UseRowSet.js +4 -1
- package/dist/components/QueryWrapperPlotNav/UseRowSet.js.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts +59 -0
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts.map +1 -0
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js +174 -0
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js.map +1 -0
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.d.ts +40 -0
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.d.ts.map +1 -0
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.js +100 -0
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.js.map +1 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.d.ts +56 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.d.ts.map +1 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js +73 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js.map +1 -0
- package/dist/components/ShareThisPage/ShareThisPage.js +1 -1
- package/dist/components/ShareThisPage/ShareThisPage.js.map +1 -1
- package/dist/components/SynapseChat/GridAgentChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/GridAgentChat.js +20 -14
- package/dist/components/SynapseChat/GridAgentChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts +3 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.js +51 -36
- package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.css +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js +8 -7
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js.map +1 -1
- package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.scss +16 -0
- package/dist/components/SynapseHomepageV2/WordPressNews.d.ts +3 -1
- package/dist/components/SynapseHomepageV2/WordPressNews.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/WordPressNews.js +9 -8
- package/dist/components/SynapseHomepageV2/WordPressNews.js.map +1 -1
- package/dist/components/SynapseHomepageV2/WordPressNewsItem.d.ts +2 -1
- package/dist/components/SynapseHomepageV2/WordPressNewsItem.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/WordPressNewsItem.js +2 -2
- package/dist/components/SynapseHomepageV2/WordPressNewsItem.js.map +1 -1
- package/dist/components/SynapseTable/SearchV2.d.ts +7 -0
- package/dist/components/SynapseTable/SearchV2.d.ts.map +1 -1
- package/dist/components/SynapseTable/SearchV2.js.map +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.d.ts.map +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.js +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.js.map +1 -1
- package/dist/components/SynapseTable/usePrefetchTableData.d.ts.map +1 -1
- package/dist/components/SynapseTable/usePrefetchTableData.js +6 -5
- package/dist/components/SynapseTable/usePrefetchTableData.js.map +1 -1
- package/dist/components/ToastMessage/ToastMessage.d.ts +1 -1
- package/dist/components/ToastMessage/ToastMessage.d.ts.map +1 -1
- package/dist/components/ToastMessage/ToastMessage.js +2 -2
- package/dist/components/ToastMessage/ToastMessage.js.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.d.ts.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js +157 -148
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.d.ts.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.js +20 -19
- package/dist/components/doi/CreateOrUpdateDoiModal.js.map +1 -1
- package/dist/components/error/ErrorPage.d.ts +0 -4
- package/dist/components/error/ErrorPage.d.ts.map +1 -1
- package/dist/components/error/ErrorPage.js +25 -30
- package/dist/components/error/ErrorPage.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +41 -39
- package/dist/components/widgets/query-filter/FacetFilterControls.d.ts.map +1 -1
- package/dist/components/widgets/query-filter/FacetFilterControls.js +2 -2
- package/dist/components/widgets/query-filter/FacetFilterControls.js.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js.map +1 -1
- package/dist/index.js +52 -50
- package/dist/index.js.map +1 -1
- package/dist/mocks/entity/index.d.ts.map +1 -1
- package/dist/mocks/entity/index.js +18 -16
- package/dist/mocks/entity/index.js.map +1 -1
- package/dist/mocks/mockSearchQueryData.d.ts +14 -0
- package/dist/mocks/mockSearchQueryData.d.ts.map +1 -0
- package/dist/mocks/mockSearchQueryData.js +564 -0
- package/dist/mocks/mockSearchQueryData.js.map +1 -0
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts +22 -0
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -0
- package/dist/mocks/msw/handlers/searchQueryHandlers.js +63 -0
- package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -0
- package/dist/mocks/msw/handlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers.js +9 -7
- package/dist/mocks/msw/handlers.js.map +1 -1
- package/dist/style/components/_cards.scss +15 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-client/SynapseClient.d.ts +7 -1
- package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
- package/dist/synapse-client/SynapseClient.js +422 -417
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/synapse-client/index.js +3 -3
- package/dist/synapse-queries/KeyFactory.d.ts +3 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +6 -0
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/forum/useThread.d.ts +1 -0
- package/dist/synapse-queries/forum/useThread.d.ts.map +1 -1
- package/dist/synapse-queries/forum/useThread.js +19 -12
- package/dist/synapse-queries/forum/useThread.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/APIConstants.d.ts +3 -0
- package/dist/utils/APIConstants.d.ts.map +1 -1
- package/dist/utils/APIConstants.js +2 -2
- package/dist/utils/APIConstants.js.map +1 -1
- package/dist/utils/AppUtils/session/ApplicationSessionManager.d.ts.map +1 -1
- package/dist/utils/AppUtils/session/ApplicationSessionManager.js +7 -4
- package/dist/utils/AppUtils/session/ApplicationSessionManager.js.map +1 -1
- package/dist/utils/functions/EntityTypeUtils.d.ts.map +1 -1
- package/dist/utils/functions/EntityTypeUtils.js +15 -4
- package/dist/utils/functions/EntityTypeUtils.js.map +1 -1
- package/dist/utils/functions/calculateFriendlyFileSize.d.ts.map +1 -1
- package/dist/utils/functions/calculateFriendlyFileSize.js +3 -3
- package/dist/utils/functions/calculateFriendlyFileSize.js.map +1 -1
- package/package.json +3 -3
package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadIneligibleForPackagingFilesFromListButton.js","names":[],"sources":["../../../src/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.tsx"],"sourcesContent":["import { useSynapseContext } from '@/utils'\nimport { implementsExternalFileHandleInterface } from '@/utils/types/IsType'\nimport { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport { Button, LinearProgress, Typography } from '@mui/material'\nimport { Download } from '@mui/icons-material'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport {\n BatchFileRequest,\n BatchFileResult,\n ExternalFileHandle,\n FileEntity,\n FileHandleAssociation,\n FileHandleAssociateType,\n} from '@sage-bionetworks/synapse-types'\nimport { useCallback, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { displayToast } from '../ToastMessage/ToastMessage'\nimport {\n useGetAvailableFilesToDownloadInfinite,\n useGetDownloadListStatistics,\n useRemoveFilesFromDownloadList,\n} from '@/synapse-queries/download/useDownloadList'\nimport { getFiles } from '@/synapse-client/SynapseClient'\nimport { useGetEntityQueryOptions } from '@/synapse-queries/entity/useEntity'\nimport { DialogBase } from '../DialogBase'\nimport { deduplicateFileName, getFileName } from './fileNameUtils'\n\n// showDirectoryPicker is not yet available on the Window interface.\ninterface FileSystemAccessWindow extends Window {\n showDirectoryPicker(options?: {\n mode?: 'read' | 'readwrite'\n startIn?:\n | 'desktop'\n | 'documents'\n | 'downloads'\n | 'music'\n | 'pictures'\n | 'videos'\n }): Promise<FileSystemDirectoryHandle>\n}\n\n/**\n * Type guard to check if File System Access API is available\n */\nfunction supportsFileSystemAccess(\n window: Window,\n): window is FileSystemAccessWindow {\n return 'showDirectoryPicker' in window\n}\n\nconst FILE_BATCH_SIZE = 50 // Maximum batch size for fetching presigned URLs\n\nexport type DownloadIneligibleForPackagingFilesFromListButtonProps = {\n buttonText?: string\n variant?: 'text' | 'outlined' | 'contained'\n}\n\n/**\n * Button component that downloads files from the user's download list that are ineligible for packaging.\n * Uses the infinite query hook to fetch all pages of download list items,\n * batches requests to get presigned URLs, and triggers browser downloads.\n */\nexport function DownloadIneligibleForPackagingFilesFromListButton(\n props: DownloadIneligibleForPackagingFilesFromListButtonProps,\n) {\n const { buttonText = 'Start Multi-file Download', variant = 'contained' } =\n props\n const { accessToken, isAuthenticated } = useSynapseContext()\n const queryClient = useQueryClient()\n const getEntityQueryOptions = useGetEntityQueryOptions<FileEntity>()\n const [isDownloading, setIsDownloading] = useState(false)\n const isDownloadingRef = useRef(false)\n const isCancelledRef = useRef(false)\n const [downloadProgress, setDownloadProgress] = useState<{\n currentFile: string\n fileIndex: number\n totalFiles: number\n bytesDownloaded: number\n totalBytes: number\n } | null>(null)\n\n const { data, status, hasNextPage, fetchNextPage, error } =\n useGetAvailableFilesToDownloadInfinite()\n\n const { mutateAsync: removeFilesFromDownloadList } =\n useRemoveFilesFromDownloadList()\n\n const { refetch: refetchDownloadListStatistics } =\n useGetDownloadListStatistics()\n\n /**\n * Downloads all files from the download list.\n */\n const downloadAllFiles = useCallback(\n async (downloadListItems: typeof data) => {\n // Prevent re-entry if already downloading\n if (isDownloadingRef.current) {\n return\n }\n\n if (!downloadListItems || !isAuthenticated) {\n setIsDownloading(false)\n return\n }\n\n try {\n isDownloadingRef.current = true\n isCancelledRef.current = false\n const allItems = downloadListItems.pages.flatMap(page => page.page)\n\n // Filter to only include files that are NOT eligible for packaging\n const nonPackageableFiles = allItems.filter(\n item => !item.isEligibleForPackaging,\n )\n\n if (nonPackageableFiles.length === 0) {\n displayToast('No non-packageable files available to download', 'info')\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n\n // Determine if File System Access API is available\n const useFileSystemAccess = supportsFileSystemAccess(window)\n\n // Prompt user to select a directory for downloads BEFORE async operations\n // (must be called during user gesture to avoid SecurityError)\n let directoryHandle: FileSystemDirectoryHandle | undefined\n\n if (useFileSystemAccess) {\n // TypeScript narrowing: we know window has showDirectoryPicker at this point\n const fileSystemWindow = window as unknown as FileSystemAccessWindow\n\n try {\n directoryHandle = await fileSystemWindow.showDirectoryPicker({\n mode: 'readwrite',\n })\n } catch (error) {\n // User cancelled directory picker\n console.error('Failed to select directory:', error)\n displayToast(\n 'Directory selection is required to directly download files from the website.',\n 'warning',\n )\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n } else {\n // Show info message for browsers without File System Access API\n displayToast(\n 'Your browser will download files individually to your default downloads folder. Each file may trigger a separate download prompt.',\n 'info',\n )\n }\n\n // Initialize progress tracking\n setDownloadProgress({\n currentFile: '',\n fileIndex: 0,\n totalFiles: nonPackageableFiles.length,\n bytesDownloaded: 0,\n totalBytes: 0,\n })\n\n // Fetch entities to get dataFileHandleId for each file\n // Use React Query's ensureQueryData to leverage cache and built-in retry logic (handles 429s with exponential backoff)\n // Map key combines entity ID and version to handle multiple versions of the same entity\n const entityIdToFileHandleId = new Map<string, string>()\n\n // Fetch all entities in parallel - React Query handles concurrency and retries\n const entityPromises = nonPackageableFiles.map(async item => {\n if (isCancelledRef.current) {\n return\n }\n\n try {\n const entity = await queryClient.ensureQueryData(\n getEntityQueryOptions(\n item.fileEntityId,\n item.versionNumber?.toString(),\n ),\n )\n // Use composite key: entityId-version (or entityId if no version)\n const mapKey = `${entity.id!}-${item.versionNumber ?? 'latest'}`\n entityIdToFileHandleId.set(mapKey, entity.dataFileHandleId)\n } catch (error) {\n console.error(`Failed to fetch entity ${item.fileEntityId}:`, error)\n // Continue even if one entity fails\n }\n })\n\n await Promise.all(entityPromises)\n\n // Convert download list items to file handle associations using the fetched dataFileHandleIds\n const fileHandleAssociations: FileHandleAssociation[] =\n nonPackageableFiles\n .filter(item => {\n const mapKey = `${item.fileEntityId}-${\n item.versionNumber ?? 'latest'\n }`\n return entityIdToFileHandleId.has(mapKey)\n })\n .map(item => {\n const mapKey = `${item.fileEntityId}-${\n item.versionNumber ?? 'latest'\n }`\n return {\n fileHandleId: entityIdToFileHandleId.get(mapKey)!,\n associateObjectId: item.fileEntityId,\n associateObjectType: FileHandleAssociateType.FileEntity,\n }\n })\n\n if (fileHandleAssociations.length === 0) {\n displayToast(\n 'Failed to fetch file information for download',\n 'danger',\n )\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n\n // Split into batches to avoid overwhelming the API\n const batches: FileHandleAssociation[][] = []\n for (\n let i = 0;\n i < fileHandleAssociations.length;\n i += FILE_BATCH_SIZE\n ) {\n batches.push(fileHandleAssociations.slice(i, i + FILE_BATCH_SIZE))\n }\n\n let downloadedCount = 0\n let failedCount = 0\n const successfullyDownloadedItems: typeof nonPackageableFiles = []\n\n // Track used filenames to prevent collisions\n const usedFilenames = new Map<string, number>()\n\n /**\n * Helper function to download file using traditional anchor tag method\n * @returns boolean indicating if the download was successful\n */\n const downloadFileTraditional = async (\n downloadUrl: string,\n fileName: string,\n ): Promise<boolean> => {\n try {\n const response = await fetch(downloadUrl)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const blob = await response.blob()\n const blobUrl = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = blobUrl\n anchor.download = fileName\n anchor.style.display = 'none'\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n\n // Clean up blob URL after a delay to ensure download initiation\n setTimeout(() => URL.revokeObjectURL(blobUrl), 1000)\n\n return true\n } catch (error) {\n console.error(`Failed to download file ${fileName}:`, error)\n // Fallback to window.open method\n try {\n window.open(downloadUrl, '_blank', 'noopener,noreferrer')\n return true\n } catch (fallbackError) {\n console.error(`Fallback window.open also failed:`, fallbackError)\n return false\n }\n }\n }\n\n /**\n * Helper function to process a single file download\n * @returns boolean indicating if download is successful\n */\n const processFileDownload = async (\n fileResult: BatchFileResult['requestedFiles'][0],\n originalItem: (typeof nonPackageableFiles)[0] | undefined,\n ): Promise<boolean> => {\n try {\n let downloadUrl: string | undefined\n\n // Check if this is an external file handle\n if (\n fileResult.fileHandle &&\n implementsExternalFileHandleInterface(fileResult.fileHandle)\n ) {\n // For external file handles, use the externalURL\n downloadUrl = (fileResult.fileHandle as ExternalFileHandle)\n .externalURL\n } else if (fileResult.preSignedURL) {\n // For other file types, use the presigned URL\n downloadUrl = fileResult.preSignedURL\n }\n\n if (!downloadUrl) {\n return false\n }\n\n // Get filename from file result or create a default name\n const baseFileName = getFileName(fileResult, originalItem)\n\n // Handle filename collisions by adding a counter suffix\n const fileName = deduplicateFileName(baseFileName, usedFilenames)\n\n // Update progress with current file info\n const currentFileIndex = downloadedCount + 1\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n currentFile: fileName,\n fileIndex: currentFileIndex,\n bytesDownloaded: 0,\n totalBytes: 0,\n }\n : null,\n )\n\n // Use traditional download method for unsupported browsers\n if (!useFileSystemAccess) {\n const success = await downloadFileTraditional(\n downloadUrl,\n fileName,\n )\n if (success) {\n downloadedCount = currentFileIndex\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n }\n return success\n }\n\n // Use File System Access API for supported browsers\n if (!directoryHandle) {\n return false\n }\n\n try {\n // Fetch the file\n const response = await fetch(downloadUrl)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n // Get total file size from headers\n const contentLength = response.headers.get('content-length')\n const totalBytes = contentLength ? parseInt(contentLength, 10) : 0\n\n // Update progress with file size\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n bytesDownloaded: 0,\n totalBytes,\n }\n : null,\n )\n\n // Create file handle in selected directory\n const fileHandle = await directoryHandle.getFileHandle(fileName, {\n create: true,\n })\n const writableStream = await fileHandle.createWritable()\n\n // Stream the response body to the file with progress tracking\n if (response.body) {\n const reader = response.body.getReader()\n let bytesReceived = 0\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n\n bytesReceived += value.length\n await writableStream.write(value)\n\n // Update progress\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n bytesDownloaded: bytesReceived,\n }\n : null,\n )\n }\n } catch (streamError) {\n await writableStream.abort()\n throw streamError\n } finally {\n await writableStream.close()\n }\n } else {\n // Fallback if streaming not supported\n try {\n const blob = await response.blob()\n await writableStream.write(blob)\n } finally {\n await writableStream.close()\n }\n }\n\n downloadedCount = currentFileIndex\n\n // Track successfully downloaded item for batch removal\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n return true\n } catch (fetchError) {\n console.error(\n `Failed to fetch/write file ${fileResult.fileHandleId}:`,\n fetchError,\n )\n // Fallback to window.open if File System Access API fails\n try {\n downloadFileTraditional(downloadUrl, fileName)\n downloadedCount = currentFileIndex\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n return true\n } catch (fallbackError) {\n console.error(\n `Fallback downloadFileTraditional also failed for ${fileResult.fileHandleId}:`,\n fallbackError,\n )\n return false\n }\n }\n } catch (error) {\n console.error(\n `Failed to download file ${fileResult.fileHandleId}:`,\n error,\n )\n return false\n }\n }\n\n /**\n * Fallback function to fetch files individually when batch fails\n */\n const fetchIndividually = async (\n batch: FileHandleAssociation[],\n ): Promise<void> => {\n console.info(\n `Attempting to fetch ${batch.length} files individually after batch failure`,\n )\n\n for (const fileHandleAssociation of batch) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info('Individual file fetch cancelled by user')\n break\n }\n\n const singleBatch = [fileHandleAssociation]\n try {\n const batchRequest: BatchFileRequest = {\n requestedFiles: singleBatch,\n includeFileHandles: true,\n includePreSignedURLs: true,\n includePreviewPreSignedURLs: false,\n }\n\n const batchResult = await getFiles(batchRequest, accessToken)\n\n if (batchResult.requestedFiles.length > 0) {\n const fileResult = batchResult.requestedFiles[0]\n const originalItem = nonPackageableFiles.find(\n item =>\n item.fileEntityId ===\n fileHandleAssociation.associateObjectId,\n )\n\n const success = await processFileDownload(\n fileResult,\n originalItem,\n )\n if (!success) {\n failedCount++\n }\n } else {\n failedCount++\n }\n } catch (error) {\n console.error(\n `Failed to fetch individual file ${fileHandleAssociation.fileHandleId}:`,\n error,\n )\n failedCount++\n }\n }\n }\n\n // Process each batch\n for (const batch of batches) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info('Download cancelled by user')\n break\n }\n\n // Try to fetch the entire batch (getFiles has built-in retry logic)\n let batchResult: BatchFileResult | null = null\n try {\n const batchRequest: BatchFileRequest = {\n requestedFiles: batch,\n includeFileHandles: true,\n includePreSignedURLs: true,\n includePreviewPreSignedURLs: false,\n }\n batchResult = await getFiles(batchRequest, accessToken)\n } catch (error) {\n console.error('Failed to fetch batch:', error)\n }\n\n if (batchResult) {\n // Batch fetch succeeded, process all files\n for (let i = 0; i < batchResult.requestedFiles.length; i++) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info(\n 'Download cancelled by user during batch processing',\n )\n break\n }\n\n const fileResult = batchResult.requestedFiles[i]\n const originalItem = nonPackageableFiles.find(\n item => item.fileEntityId === batch[i].associateObjectId,\n )\n\n const success = await processFileDownload(\n fileResult,\n originalItem,\n )\n if (!success) {\n failedCount++\n }\n }\n } else {\n // Batch fetch failed after retries, try fetching files individually\n await fetchIndividually(batch)\n }\n }\n\n // Remove all successfully downloaded files from the download list in one batch\n if (successfullyDownloadedItems.length > 0) {\n await removeFilesFromDownloadList({\n batchToRemove: successfullyDownloadedItems.map(\n (item: (typeof nonPackageableFiles)[0]) => ({\n fileEntityId: item.fileEntityId,\n versionNumber: item.versionNumber,\n }),\n ),\n })\n // Refetch statistics after removing files\n await refetchDownloadListStatistics()\n // Scroll to top of page to show updated statistics\n window.scrollTo({ top: 0, behavior: 'smooth' })\n }\n\n // Show completion message\n if (isCancelledRef.current) {\n displayToast(\n `Download cancelled. ${downloadedCount} file${\n downloadedCount !== 1 ? 's were' : ' was'\n } downloaded before cancellation.`,\n 'info',\n )\n } else if (downloadedCount > 0) {\n displayToast(\n `Download started for ${downloadedCount} file${\n downloadedCount !== 1 ? 's' : ''\n }${\n failedCount > 0\n ? `. ${failedCount} file${failedCount !== 1 ? 's' : ''} failed.`\n : '.'\n }`,\n failedCount > 0 ? 'warning' : 'success',\n )\n } else {\n displayToast('No files could be downloaded', 'warning')\n }\n } catch (error) {\n console.error('Error downloading files:', error)\n const message =\n (error as SynapseClientError | undefined)?.reason ??\n (error instanceof Error ? error.message : undefined) ??\n 'An error occurred while downloading files'\n displayToast(message, 'danger')\n } finally {\n setDownloadProgress(null)\n setIsDownloading(false)\n isDownloadingRef.current = false\n }\n },\n [\n accessToken,\n isAuthenticated,\n queryClient,\n getEntityQueryOptions,\n removeFilesFromDownloadList,\n refetchDownloadListStatistics,\n ],\n )\n\n const handleClick = useCallback(async () => {\n if (isDownloading) {\n return\n }\n setIsDownloading(true)\n\n // Fetch all remaining pages imperatively, then download\n try {\n let stillHasNextPage = hasNextPage\n let latestData = data\n while (stillHasNextPage && fetchNextPage) {\n const result = await fetchNextPage()\n stillHasNextPage = result.hasNextPage\n if (result.data) {\n latestData = result.data\n }\n }\n\n // All pages loaded, now download\n if (status === 'success' && latestData) {\n void downloadAllFiles(latestData)\n } else {\n // Failed to load data\n setIsDownloading(false)\n isDownloadingRef.current = false\n displayToast(\n 'Failed to load download list. Please try again.',\n 'danger',\n )\n }\n } catch (error) {\n console.error('Error downloading files:', error)\n setIsDownloading(false)\n isDownloadingRef.current = false\n const message =\n (error as SynapseClientError | undefined)?.reason ??\n (error instanceof Error ? error.message : undefined) ??\n 'An error occurred while preparing files for download'\n displayToast(message, 'danger')\n }\n }, [\n isDownloading,\n hasNextPage,\n fetchNextPage,\n status,\n data,\n downloadAllFiles,\n ])\n\n const handleCancel = useCallback(() => {\n isCancelledRef.current = true\n setDownloadProgress(null)\n setIsDownloading(false)\n isDownloadingRef.current = false\n }, [])\n\n if (error) {\n return null\n }\n\n return (\n <>\n <DialogBase\n open={!!downloadProgress}\n title=\"Downloading Files\"\n hasCloseButton={false}\n onCancel={handleCancel}\n maxWidth=\"sm\"\n content={\n downloadProgress ? (\n <>\n <Typography\n variant=\"body2\"\n color=\"text.secondary\"\n gutterBottom\n id=\"download-progress-description\"\n >\n File {downloadProgress.fileIndex} of{' '}\n {downloadProgress.totalFiles}\n </Typography>\n <Typography variant=\"body2\" noWrap gutterBottom>\n {downloadProgress.currentFile}\n </Typography>\n {downloadProgress.totalBytes > 0 && (\n <>\n <LinearProgress\n variant=\"determinate\"\n value={\n (downloadProgress.bytesDownloaded /\n downloadProgress.totalBytes) *\n 100\n }\n sx={{ my: 2 }}\n aria-label=\"Download progress\"\n />\n <Typography\n variant=\"body2\"\n color=\"text.secondary\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {calculateFriendlyFileSize(\n downloadProgress.bytesDownloaded,\n )}{' '}\n of {calculateFriendlyFileSize(downloadProgress.totalBytes)}\n </Typography>\n </>\n )}\n {downloadProgress.totalBytes === 0 && (\n <LinearProgress sx={{ my: 2 }} aria-label=\"Download progress\" />\n )}\n </>\n ) : null\n }\n actions={\n <Button variant=\"outlined\" color=\"error\" onClick={handleCancel}>\n Cancel\n </Button>\n }\n DialogProps={{\n 'aria-describedby': 'download-progress-description',\n disableEscapeKeyDown: false,\n }}\n />\n <Button\n variant={variant}\n onClick={() => {\n void handleClick()\n }}\n loading={isDownloading}\n startIcon={<Download />}\n >\n {buttonText}\n </Button>\n </>\n )\n}\n\nexport default DownloadIneligibleForPackagingFilesFromListButton\n"],"mappings":";;;;;;;;;;;;;;;;;AA4CA,SAAS,EACP,GACkC;AAClC,QAAO,yBAAyB;;AAGlC,IAAM,IAAkB;AAYxB,SAAgB,EACd,GACA;CACA,IAAM,EAAE,gBAAa,6BAA6B,aAAU,gBAC1D,GACI,EAAE,gBAAa,uBAAoB,GAAmB,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;IACb,cAAW;IACX,CAAA,EACF,kBAAC,GAAD;IACE,SAAQ;IACR,OAAM;IACN,aAAU;IACV,eAAY;cAJd;KAMG,EACC,EAAiB,gBAClB;KAAE;KAAI;KACH,EAA0B,EAAiB,WAAW;KAC/C;MACZ,EAAA,CAAA;GAEJ,EAAiB,eAAe,KAC/B,kBAAC,GAAD;IAAgB,IAAI,EAAE,IAAI,GAAG;IAAE,cAAW;IAAsB,CAAA;GAEjE,EAAA,CAAA,GACD;EAEN,SACE,kBAAC,GAAD;GAAQ,SAAQ;GAAW,OAAM;GAAQ,SAAS;aAAc;GAEvD,CAAA;EAEX,aAAa;GACX,oBAAoB;GACpB,sBAAsB;GACvB;EACD,CAAA,EACF,kBAAC,GAAD;EACW;EACT,eAAe;AACR,MAAa;;EAEpB,SAAS;EACT,WAAW,kBAAC,GAAD,EAAY,CAAA;YAEtB;EACM,CAAA,CACR,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"DownloadIneligibleForPackagingFilesFromListButton.js","names":[],"sources":["../../../src/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.tsx"],"sourcesContent":["import { useSynapseContext } from '@/utils'\nimport { implementsExternalFileHandleInterface } from '@/utils/types/IsType'\nimport { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport {\n Box,\n Button,\n IconButton,\n LinearProgress,\n Paper,\n Typography,\n} from '@mui/material'\nimport { Close, Download } from '@mui/icons-material'\nimport CloudWarning from '@/assets/icons/CloudWarning'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport dayjs from 'dayjs'\nimport duration from 'dayjs/plugin/duration'\nimport relativeTime from 'dayjs/plugin/relativeTime'\nimport {\n BatchFileRequest,\n BatchFileResult,\n ExternalFileHandle,\n FileEntity,\n FileHandleAssociation,\n FileHandleAssociateType,\n} from '@sage-bionetworks/synapse-types'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { displayToast } from '../ToastMessage/ToastMessage'\nimport {\n useGetAvailableFilesToDownloadInfinite,\n useGetDownloadListStatistics,\n useRemoveFilesFromDownloadList,\n} from '@/synapse-queries/download/useDownloadList'\nimport { getFiles } from '@/synapse-client/SynapseClient'\nimport { useGetEntityQueryOptions } from '@/synapse-queries/entity/useEntity'\n\nimport { deduplicateFileName, getFileName } from './fileNameUtils'\nimport styles from './DownloadIneligibleForPackagingFilesFromListButton.module.scss'\n\n// showDirectoryPicker is not yet available on the Window interface.\ninterface FileSystemAccessWindow extends Window {\n showDirectoryPicker(options?: {\n mode?: 'read' | 'readwrite'\n startIn?:\n | 'desktop'\n | 'documents'\n | 'downloads'\n | 'music'\n | 'pictures'\n | 'videos'\n }): Promise<FileSystemDirectoryHandle>\n}\n\n/**\n * Type guard to check if File System Access API is available\n */\nfunction supportsFileSystemAccess(\n window: Window,\n): window is FileSystemAccessWindow {\n return 'showDirectoryPicker' in window\n}\n\nconst FILE_BATCH_SIZE = 50 // Maximum batch size for fetching presigned URLs\nconst ETA_DELAY_MS = 3000 // Wait this long before showing ETA\n\ndayjs.extend(duration)\ndayjs.extend(relativeTime)\n\nexport type DownloadIneligibleForPackagingFilesFromListButtonProps = {\n buttonText?: string\n variant?: 'text' | 'outlined' | 'contained'\n}\n\n/**\n * Button component that downloads files from the user's download list that are ineligible for packaging.\n * Uses the infinite query hook to fetch all pages of download list items,\n * batches requests to get presigned URLs, and triggers browser downloads.\n */\nexport function DownloadIneligibleForPackagingFilesFromListButton(\n props: DownloadIneligibleForPackagingFilesFromListButtonProps,\n) {\n const { buttonText = 'Start Multi-file Download', variant = 'contained' } =\n props\n const { accessToken, isAuthenticated } = useSynapseContext()\n const queryClient = useQueryClient()\n const getEntityQueryOptions = useGetEntityQueryOptions<FileEntity>()\n const [isDownloading, setIsDownloading] = useState(false)\n const isDownloadingRef = useRef(false)\n const [showExternalFileWarning, setShowExternalFileWarning] = useState(false)\n const isCancelledRef = useRef(false)\n const abortControllerRef = useRef<AbortController | null>(null)\n const [downloadProgress, setDownloadProgress] = useState<{\n currentFile: string\n fileIndex: number\n totalFiles: number\n bytesDownloaded: number\n totalBytes: number\n estimatedSecondsRemaining: number | null\n } | null>(null)\n const fileDownloadStartRef = useRef<number | null>(null)\n\n // Accessibility: tracks the last announced file index and progress bucket so\n // the aria-live region only updates on meaningful changes (not every chunk).\n const [announceText, setAnnounceText] = useState('')\n const lastAnnouncedFileIndexRef = useRef<number>(-1)\n const lastAnnouncedPercentBucketRef = useRef<number>(-1)\n\n useEffect(() => {\n if (!downloadProgress) {\n lastAnnouncedFileIndexRef.current = -1\n lastAnnouncedPercentBucketRef.current = -1\n setAnnounceText('')\n return\n }\n\n const { fileIndex, totalFiles, currentFile, bytesDownloaded, totalBytes } =\n downloadProgress\n\n // Announce when a new file starts downloading\n if (fileIndex !== lastAnnouncedFileIndexRef.current) {\n lastAnnouncedFileIndexRef.current = fileIndex\n lastAnnouncedPercentBucketRef.current = -1\n setAnnounceText(\n `Downloading file ${fileIndex} of ${totalFiles}: ${currentFile}`,\n )\n return\n }\n\n // Announce at each 25% milestone (25, 50, 75, 100) once per file\n if (totalBytes > 0) {\n const percent = Math.floor((bytesDownloaded / totalBytes) * 100)\n const bucket = Math.floor(percent / 25) * 25\n if (bucket > 0 && bucket !== lastAnnouncedPercentBucketRef.current) {\n lastAnnouncedPercentBucketRef.current = bucket\n setAnnounceText(`${bucket}% of ${currentFile} downloaded`)\n }\n }\n }, [downloadProgress])\n\n const { data, status, hasNextPage, fetchNextPage, error } =\n useGetAvailableFilesToDownloadInfinite()\n\n const { mutateAsync: removeFilesFromDownloadList } =\n useRemoveFilesFromDownloadList()\n\n const { refetch: refetchDownloadListStatistics } =\n useGetDownloadListStatistics()\n\n /**\n * Downloads all files from the download list.\n */\n const downloadAllFiles = useCallback(\n async (downloadListItems: typeof data) => {\n // Prevent re-entry if already downloading\n if (isDownloadingRef.current) {\n return\n }\n\n if (!downloadListItems || !isAuthenticated) {\n setIsDownloading(false)\n return\n }\n\n try {\n isDownloadingRef.current = true\n isCancelledRef.current = false\n setShowExternalFileWarning(false)\n const allItems = downloadListItems.pages.flatMap(page => page.page)\n\n // Filter to only include files that are NOT eligible for packaging\n const nonPackageableFiles = allItems.filter(\n item => !item.isEligibleForPackaging,\n )\n\n if (nonPackageableFiles.length === 0) {\n displayToast('No non-packageable files available to download', 'info')\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n\n // Determine if File System Access API is available\n const useFileSystemAccess = supportsFileSystemAccess(window)\n\n // Prompt user to select a directory for downloads BEFORE async operations\n // (must be called during user gesture to avoid SecurityError)\n let directoryHandle: FileSystemDirectoryHandle | undefined\n\n if (useFileSystemAccess) {\n // TypeScript narrowing: we know window has showDirectoryPicker at this point\n const fileSystemWindow = window as unknown as FileSystemAccessWindow\n\n try {\n directoryHandle = await fileSystemWindow.showDirectoryPicker({\n mode: 'readwrite',\n })\n } catch (error) {\n // User cancelled directory picker\n console.error('Failed to select directory:', error)\n displayToast(\n 'Directory selection is required to directly download files from the website.',\n 'warning',\n )\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n } else {\n // Show info message for browsers without File System Access API\n displayToast(\n 'Your browser will download files individually to your default downloads folder. Each file may trigger a separate download prompt.',\n 'info',\n )\n }\n\n // Initialize progress tracking\n fileDownloadStartRef.current = null\n setDownloadProgress({\n currentFile: '',\n fileIndex: 0,\n totalFiles: nonPackageableFiles.length,\n bytesDownloaded: 0,\n totalBytes: 0,\n estimatedSecondsRemaining: null,\n })\n\n // Fetch entities to get dataFileHandleId for each file\n // Use React Query's ensureQueryData to leverage cache and built-in retry logic (handles 429s with exponential backoff)\n // Map key combines entity ID and version to handle multiple versions of the same entity\n const entityIdToFileHandleId = new Map<string, string>()\n\n // Fetch all entities in parallel - React Query handles concurrency and retries\n const entityPromises = nonPackageableFiles.map(async item => {\n if (isCancelledRef.current) {\n return\n }\n\n try {\n const entity = await queryClient.ensureQueryData(\n getEntityQueryOptions(\n item.fileEntityId,\n item.versionNumber?.toString(),\n ),\n )\n // Use composite key: entityId-version (or entityId if no version)\n const mapKey = `${entity.id!}-${item.versionNumber ?? 'latest'}`\n entityIdToFileHandleId.set(mapKey, entity.dataFileHandleId)\n } catch (error) {\n console.error(`Failed to fetch entity ${item.fileEntityId}:`, error)\n // Continue even if one entity fails\n }\n })\n\n await Promise.all(entityPromises)\n\n // Convert download list items to file handle associations using the fetched dataFileHandleIds\n const fileHandleAssociations: FileHandleAssociation[] =\n nonPackageableFiles\n .filter(item => {\n const mapKey = `${item.fileEntityId}-${\n item.versionNumber ?? 'latest'\n }`\n return entityIdToFileHandleId.has(mapKey)\n })\n .map(item => {\n const mapKey = `${item.fileEntityId}-${\n item.versionNumber ?? 'latest'\n }`\n return {\n fileHandleId: entityIdToFileHandleId.get(mapKey)!,\n associateObjectId: item.fileEntityId,\n associateObjectType: FileHandleAssociateType.FileEntity,\n }\n })\n\n if (fileHandleAssociations.length === 0) {\n displayToast(\n 'Failed to fetch file information for download',\n 'danger',\n )\n setIsDownloading(false)\n isDownloadingRef.current = false\n return\n }\n\n // Split into batches to avoid overwhelming the API\n const batches: FileHandleAssociation[][] = []\n for (\n let i = 0;\n i < fileHandleAssociations.length;\n i += FILE_BATCH_SIZE\n ) {\n batches.push(fileHandleAssociations.slice(i, i + FILE_BATCH_SIZE))\n }\n\n let downloadedCount = 0\n let failedCount = 0\n const successfullyDownloadedItems: typeof nonPackageableFiles = []\n\n // Track used filenames to prevent collisions\n const usedFilenames = new Map<string, number>()\n\n /**\n * Helper function to download file using traditional anchor tag method\n * @returns boolean indicating if the download was successful\n */\n const downloadFileTraditional = async (\n downloadUrl: string,\n fileName: string,\n ): Promise<boolean> => {\n try {\n const response = await fetch(downloadUrl)\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const blob = await response.blob()\n const blobUrl = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = blobUrl\n anchor.download = fileName\n anchor.style.display = 'none'\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n\n // Clean up blob URL after a delay to ensure download initiation\n setTimeout(() => URL.revokeObjectURL(blobUrl), 1000)\n\n return true\n } catch (error) {\n console.error(`Failed to download file ${fileName}:`, error)\n // Fallback to window.open method\n try {\n window.open(downloadUrl, '_blank', 'noopener,noreferrer')\n return true\n } catch (fallbackError) {\n console.error(`Fallback window.open also failed:`, fallbackError)\n return false\n }\n }\n }\n\n /**\n * Helper function to process a single file download\n * @returns boolean indicating if download is successful\n */\n const processFileDownload = async (\n fileResult: BatchFileResult['requestedFiles'][0],\n originalItem: (typeof nonPackageableFiles)[0] | undefined,\n ): Promise<boolean> => {\n try {\n let downloadUrl: string | undefined\n\n // Check if this is an external file handle\n if (\n fileResult.fileHandle &&\n implementsExternalFileHandleInterface(fileResult.fileHandle)\n ) {\n // For external file handles, use the externalURL\n downloadUrl = (fileResult.fileHandle as ExternalFileHandle)\n .externalURL\n setShowExternalFileWarning(true)\n } else if (fileResult.preSignedURL) {\n // For other file types, use the presigned URL\n downloadUrl = fileResult.preSignedURL\n }\n\n if (!downloadUrl) {\n return false\n }\n\n // Get filename from file result or create a default name\n const baseFileName = getFileName(fileResult, originalItem)\n\n // Handle filename collisions by adding a counter suffix\n const fileName = deduplicateFileName(baseFileName, usedFilenames)\n\n // Update progress with current file info\n const currentFileIndex = downloadedCount + 1\n fileDownloadStartRef.current = null\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n currentFile: fileName,\n fileIndex: currentFileIndex,\n bytesDownloaded: 0,\n totalBytes: 0,\n estimatedSecondsRemaining: null,\n }\n : null,\n )\n\n // Use traditional download method for unsupported browsers\n if (!useFileSystemAccess) {\n const success = await downloadFileTraditional(\n downloadUrl,\n fileName,\n )\n if (success) {\n downloadedCount = currentFileIndex\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n }\n return success\n }\n\n // Use File System Access API for supported browsers\n if (!directoryHandle) {\n return false\n }\n\n try {\n // Fetch the file\n abortControllerRef.current = new AbortController()\n const response = await fetch(downloadUrl, {\n signal: abortControllerRef.current.signal,\n })\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n // Get total file size from headers\n const contentLength = response.headers.get('content-length')\n const totalBytes = contentLength ? parseInt(contentLength, 10) : 0\n\n // Update progress with file size\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n bytesDownloaded: 0,\n totalBytes,\n }\n : null,\n )\n\n // Create file handle in selected directory\n const fileHandle = await directoryHandle.getFileHandle(fileName, {\n create: true,\n })\n const writableStream = await fileHandle.createWritable()\n\n // Stream the response body to the file with progress tracking\n if (response.body) {\n const reader = response.body.getReader()\n let bytesReceived = 0\n let streamAborted = false\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n\n bytesReceived += value.length\n await writableStream.write(value)\n\n // Check for cancellation on every chunk\n if (isCancelledRef.current) {\n streamAborted = true\n reader.cancel()\n await writableStream.abort()\n break\n }\n\n if (fileDownloadStartRef.current === null) {\n fileDownloadStartRef.current = Date.now()\n }\n const elapsedMs = Date.now() - fileDownloadStartRef.current\n let estimatedSecondsRemaining: number | null = null\n if (\n elapsedMs > ETA_DELAY_MS &&\n bytesReceived > 0 &&\n totalBytes > 0\n ) {\n const rate = bytesReceived / elapsedMs\n estimatedSecondsRemaining = Math.max(\n 0,\n (totalBytes - bytesReceived) / rate / 1000,\n )\n }\n\n // Update progress\n setDownloadProgress(prev =>\n prev\n ? {\n ...prev,\n bytesDownloaded: bytesReceived,\n ...(elapsedMs > ETA_DELAY_MS && {\n estimatedSecondsRemaining,\n }),\n }\n : null,\n )\n }\n } catch (streamError) {\n if (!streamAborted) {\n await writableStream.abort()\n streamAborted = true\n }\n throw streamError\n } finally {\n if (!streamAborted) {\n await writableStream.close()\n }\n }\n\n // If cancelled mid-stream, return false without falling through to success path\n if (isCancelledRef.current) {\n return false\n }\n } else {\n // Fallback if streaming not supported\n try {\n const blob = await response.blob()\n await writableStream.write(blob)\n } finally {\n await writableStream.close()\n }\n }\n\n downloadedCount = currentFileIndex\n\n // Track successfully downloaded item for batch removal\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n return true\n } catch (fetchError) {\n // If the fetch was aborted due to cancellation, do not fall back\n if (\n isCancelledRef.current ||\n (fetchError instanceof DOMException &&\n fetchError.name === 'AbortError')\n ) {\n return false\n }\n console.error(\n `Failed to fetch/write file ${fileResult.fileHandleId}:`,\n fetchError,\n )\n // Fallback to window.open if File System Access API fails\n try {\n downloadFileTraditional(downloadUrl, fileName)\n downloadedCount = currentFileIndex\n if (originalItem) {\n successfullyDownloadedItems.push(originalItem)\n }\n return true\n } catch (fallbackError) {\n console.error(\n `Fallback downloadFileTraditional also failed for ${fileResult.fileHandleId}:`,\n fallbackError,\n )\n return false\n }\n }\n } catch (error) {\n console.error(\n `Failed to download file ${fileResult.fileHandleId}:`,\n error,\n )\n return false\n }\n }\n\n /**\n * Fallback function to fetch files individually when batch fails\n */\n const fetchIndividually = async (\n batch: FileHandleAssociation[],\n ): Promise<void> => {\n console.info(\n `Attempting to fetch ${batch.length} files individually after batch failure`,\n )\n\n for (const fileHandleAssociation of batch) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info('Individual file fetch cancelled by user')\n break\n }\n\n const singleBatch = [fileHandleAssociation]\n try {\n const batchRequest: BatchFileRequest = {\n requestedFiles: singleBatch,\n includeFileHandles: true,\n includePreSignedURLs: true,\n includePreviewPreSignedURLs: false,\n }\n\n const batchResult = await getFiles(batchRequest, accessToken)\n\n if (batchResult.requestedFiles.length > 0) {\n const fileResult = batchResult.requestedFiles[0]\n const originalItem = nonPackageableFiles.find(\n item =>\n item.fileEntityId ===\n fileHandleAssociation.associateObjectId,\n )\n\n const success = await processFileDownload(\n fileResult,\n originalItem,\n )\n if (!success) {\n failedCount++\n }\n } else {\n failedCount++\n }\n } catch (error) {\n console.error(\n `Failed to fetch individual file ${fileHandleAssociation.fileHandleId}:`,\n error,\n )\n failedCount++\n }\n }\n }\n\n // Process each batch\n for (const batch of batches) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info('Download cancelled by user')\n break\n }\n\n // Try to fetch the entire batch (getFiles has built-in retry logic)\n let batchResult: BatchFileResult | null = null\n try {\n const batchRequest: BatchFileRequest = {\n requestedFiles: batch,\n includeFileHandles: true,\n includePreSignedURLs: true,\n includePreviewPreSignedURLs: false,\n }\n batchResult = await getFiles(batchRequest, accessToken)\n } catch (error) {\n console.error('Failed to fetch batch:', error)\n }\n\n if (batchResult) {\n // Batch fetch succeeded, process all files\n for (let i = 0; i < batchResult.requestedFiles.length; i++) {\n // Check if user cancelled the operation\n if (isCancelledRef.current) {\n console.info(\n 'Download cancelled by user during batch processing',\n )\n break\n }\n\n const fileResult = batchResult.requestedFiles[i]\n const originalItem = nonPackageableFiles.find(\n item => item.fileEntityId === batch[i].associateObjectId,\n )\n\n const success = await processFileDownload(\n fileResult,\n originalItem,\n )\n if (!success) {\n failedCount++\n }\n }\n } else {\n // Batch fetch failed after retries, try fetching files individually\n await fetchIndividually(batch)\n }\n }\n\n // Remove all successfully downloaded files from the download list in one batch\n if (successfullyDownloadedItems.length > 0) {\n await removeFilesFromDownloadList({\n batchToRemove: successfullyDownloadedItems.map(\n (item: (typeof nonPackageableFiles)[0]) => ({\n fileEntityId: item.fileEntityId,\n versionNumber: item.versionNumber,\n }),\n ),\n })\n // Refetch statistics after removing files\n await refetchDownloadListStatistics()\n // Scroll to top of page to show updated statistics\n window.scrollTo({ top: 0, behavior: 'smooth' })\n }\n\n // Show completion message\n if (isCancelledRef.current) {\n displayToast(\n `Download cancelled. ${downloadedCount} file${\n downloadedCount !== 1 ? 's were' : ' was'\n } downloaded before cancellation.`,\n 'info',\n )\n } else if (downloadedCount > 0) {\n displayToast(\n `Download started for ${downloadedCount} file${\n downloadedCount !== 1 ? 's' : ''\n }${\n failedCount > 0\n ? `. ${failedCount} file${failedCount !== 1 ? 's' : ''} failed.`\n : '.'\n }`,\n failedCount > 0 ? 'warning' : 'success',\n )\n } else {\n displayToast('No files could be downloaded', 'warning')\n }\n } catch (error) {\n console.error('Error downloading files:', error)\n const message =\n (error as SynapseClientError | undefined)?.reason ??\n (error instanceof Error ? error.message : undefined) ??\n 'An error occurred while downloading files'\n displayToast(message, 'danger')\n } finally {\n setDownloadProgress(null)\n setIsDownloading(false)\n isDownloadingRef.current = false\n }\n },\n [\n accessToken,\n isAuthenticated,\n queryClient,\n getEntityQueryOptions,\n removeFilesFromDownloadList,\n refetchDownloadListStatistics,\n ],\n )\n\n const handleClick = useCallback(async () => {\n if (isDownloading) {\n return\n }\n setIsDownloading(true)\n\n // Fetch all remaining pages imperatively, then download\n try {\n let stillHasNextPage = hasNextPage\n let latestData = data\n while (stillHasNextPage && fetchNextPage) {\n const result = await fetchNextPage()\n stillHasNextPage = result.hasNextPage\n if (result.data) {\n latestData = result.data\n }\n }\n\n // All pages loaded, now download\n if (status === 'success' && latestData) {\n void downloadAllFiles(latestData)\n } else {\n // Failed to load data\n setIsDownloading(false)\n isDownloadingRef.current = false\n displayToast(\n 'Failed to load download list. Please try again.',\n 'danger',\n )\n }\n } catch (error) {\n console.error('Error downloading files:', error)\n setIsDownloading(false)\n isDownloadingRef.current = false\n const message =\n (error as SynapseClientError | undefined)?.reason ??\n (error instanceof Error ? error.message : undefined) ??\n 'An error occurred while preparing files for download'\n displayToast(message, 'danger')\n }\n }, [\n isDownloading,\n hasNextPage,\n fetchNextPage,\n status,\n data,\n downloadAllFiles,\n ])\n\n const handleCancel = useCallback(() => {\n isCancelledRef.current = true\n abortControllerRef.current?.abort()\n setDownloadProgress(null)\n setIsDownloading(false)\n isDownloadingRef.current = false\n }, [])\n\n if (error) {\n return null\n }\n\n return (\n <>\n {/* Visually-hidden live region — announces file start and progress milestones to screen readers */}\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={styles.visuallyHidden}\n >\n {announceText}\n </span>\n {!!downloadProgress && showExternalFileWarning && (\n <Paper\n elevation={8}\n className={styles.externalWarningPanel}\n sx={{ zIndex: theme => theme.zIndex.modal }}\n role=\"region\"\n aria-label=\"External file warning\"\n >\n <CloudWarning className={styles.warningIcon} />\n <Box className={styles.warningTextContainer}>\n <Typography className={styles.warningTitleText}>\n Some of your files are hosted externally.\n </Typography>\n <Typography className={styles.progressFileNameText}>\n Downloads may be slower than expected\n </Typography>\n </Box>\n <IconButton\n onClick={() => setShowExternalFileWarning(false)}\n size=\"small\"\n className={styles.warningCloseButton}\n aria-label=\"Dismiss external file warning\"\n >\n <Close />\n </IconButton>\n </Paper>\n )}\n {!!downloadProgress && (\n <Paper\n elevation={8}\n className={styles.progressPanel}\n sx={{ zIndex: theme => theme.zIndex.modal }}\n role=\"region\"\n aria-label=\"Download progress\"\n >\n <Typography className={styles.progressTitleText}>\n Downloading file {downloadProgress.fileIndex} of{' '}\n {downloadProgress.totalFiles}\n </Typography>\n <Typography className={styles.progressFileNameText}>\n {downloadProgress.currentFile}\n </Typography>\n <Box className={styles.progressFooter}>\n <Box className={styles.progressBarContainer}>\n <Box className={styles.progressStats}>\n <Typography className={styles.progressStatsText}>\n {downloadProgress.totalBytes > 0\n ? `${Math.round(\n (downloadProgress.bytesDownloaded /\n downloadProgress.totalBytes) *\n 100,\n )}% ( ${calculateFriendlyFileSize(\n downloadProgress.bytesDownloaded,\n )} / ${calculateFriendlyFileSize(\n downloadProgress.totalBytes,\n )} )`\n : ''}\n </Typography>\n <Typography className={styles.progressStatsText}>\n {downloadProgress.estimatedSecondsRemaining !== null\n ? `About ${dayjs\n .duration({\n seconds: downloadProgress.estimatedSecondsRemaining,\n })\n .humanize()} remaining`\n : ''}\n </Typography>\n </Box>\n <LinearProgress\n variant={\n downloadProgress.totalBytes > 0\n ? 'determinate'\n : 'indeterminate'\n }\n value={\n downloadProgress.totalBytes > 0\n ? (downloadProgress.bytesDownloaded /\n downloadProgress.totalBytes) *\n 100\n : undefined\n }\n aria-label=\"Download progress\"\n className={styles.progressBar}\n />\n </Box>\n <Box className={styles.cancelButtonContainer}>\n <Button\n variant=\"outlined\"\n onClick={handleCancel}\n className={styles.cancelButton}\n >\n Cancel\n </Button>\n </Box>\n </Box>\n </Paper>\n )}\n <Button\n variant={variant}\n onClick={() => {\n void handleClick()\n }}\n loading={isDownloading}\n startIcon={<Download />}\n >\n {buttonText}\n </Button>\n </>\n )\n}\n\nexport default DownloadIneligibleForPackagingFilesFromListButton\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwDA,SAAS,GACP,GACkC;AAClC,QAAO,yBAAyB;;AAGlC,IAAM,IAAkB,IAClB,IAAe;AAErB,EAAM,OAAO,EAAS,EACtB,EAAM,OAAO,EAAa;AAY1B,SAAgB,EACd,GACA;CACA,IAAM,EAAE,gBAAa,6BAA6B,aAAU,gBAC1D,GACI,EAAE,gBAAa,uBAAoB,GAAmB,EACtD,IAAc,IAAgB,EAC9B,IAAwB,GAAsC,EAC9D,CAAC,GAAe,KAAoB,EAAS,GAAM,EACnD,IAAmB,EAAO,GAAM,EAChC,CAAC,IAAyB,KAA8B,EAAS,GAAM,EACvE,IAAiB,EAAO,GAAM,EAC9B,IAAqB,EAA+B,KAAK,EACzD,CAAC,GAAkB,KAAuB,EAOtC,KAAK,EACT,IAAuB,EAAsB,KAAK,EAIlD,CAAC,IAAc,KAAmB,EAAS,GAAG,EAC9C,IAA4B,EAAe,GAAG,EAC9C,IAAgC,EAAe,GAAG;AAExD,SAAgB;AACd,MAAI,CAAC,GAAkB;AAGrB,GAFA,EAA0B,UAAU,IACpC,EAA8B,UAAU,IACxC,EAAgB,GAAG;AACnB;;EAGF,IAAM,EAAE,cAAW,eAAY,gBAAa,oBAAiB,kBAC3D;AAGF,MAAI,MAAc,EAA0B,SAAS;AAGnD,GAFA,EAA0B,UAAU,GACpC,EAA8B,UAAU,IACxC,EACE,oBAAoB,EAAU,MAAM,EAAW,IAAI,IACpD;AACD;;AAIF,MAAI,IAAa,GAAG;GAClB,IAAM,IAAU,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GAAD;MAAK,WAAW,EAAO;gBAAvB,CACE,kBAAC,GAAD;OAAK,WAAW,EAAO;iBAAvB,CACE,kBAAC,GAAD;QAAY,WAAW,EAAO;kBAC3B,EAAiB,aAAa,IAC3B,GAAG,KAAK,MACL,EAAiB,kBAChB,EAAiB,aACjB,IACH,CAAC,MAAM,EACN,EAAiB,gBAClB,CAAC,KAAK,EACL,EAAiB,WAClB,CAAC,MACF;QACO,CAAA,EACb,kBAAC,GAAD;QAAY,WAAW,EAAO;kBAC3B,EAAiB,8BAA8B,OAM5C,KALA,SAAS,EACN,SAAS,EACR,SAAS,EAAiB,2BAC3B,CAAC,CACD,UAAU,CAAC;QAEP,CAAA,CACT;UACN,kBAAC,IAAD;OACE,SACE,EAAiB,aAAa,IAC1B,gBACA;OAEN,OACE,EAAiB,aAAa,IACzB,EAAiB,kBAChB,EAAiB,aACnB,MACA,KAAA;OAEN,cAAW;OACX,WAAW,EAAO;OAClB,CAAA,CACE;SACN,kBAAC,GAAD;MAAK,WAAW,EAAO;gBACrB,kBAAC,GAAD;OACE,SAAQ;OACR,SAAS;OACT,WAAW,EAAO;iBACnB;OAEQ,CAAA;MACL,CAAA,CACF;;IACA;;EAEV,kBAAC,GAAD;GACW;GACT,eAAe;AACR,QAAa;;GAEpB,SAAS;GACT,WAAW,kBAAC,IAAD,EAAY,CAAA;aAEtB;GACM,CAAA;EACR,EAAA,CAAA"}
|
package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import './DownloadIneligibleForPackagingFilesFromListButton.css';var e = {
|
|
2
|
+
visuallyHidden: "_visuallyHidden_58da9_1",
|
|
3
|
+
externalWarningPanel: "_externalWarningPanel_58da9_12",
|
|
4
|
+
warningIcon: "_warningIcon_58da9_29",
|
|
5
|
+
warningTextContainer: "_warningTextContainer_58da9_36",
|
|
6
|
+
warningTitleText: "_warningTitleText_58da9_40",
|
|
7
|
+
warningCloseButton: "_warningCloseButton_58da9_47",
|
|
8
|
+
progressPanel: "_progressPanel_58da9_56",
|
|
9
|
+
progressTitleText: "_progressTitleText_58da9_73",
|
|
10
|
+
progressFileNameText: "_progressFileNameText_58da9_79",
|
|
11
|
+
progressFooter: "_progressFooter_58da9_90",
|
|
12
|
+
progressBarContainer: "_progressBarContainer_58da9_98",
|
|
13
|
+
progressStats: "_progressStats_58da9_105",
|
|
14
|
+
progressStatsText: "_progressStatsText_58da9_110",
|
|
15
|
+
progressBar: "_progressBar_58da9_98",
|
|
16
|
+
cancelButtonContainer: "_cancelButtonContainer_58da9_119",
|
|
17
|
+
cancelButton: "_cancelButton_58da9_119"
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=DownloadIneligibleForPackagingFilesFromListButton.module.js.map
|
package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadIneligibleForPackagingFilesFromListButton.module.js","names":[],"sources":["../../../src/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.scss"],"sourcesContent":["// Hides an element visually while keeping it accessible to screen readers.\n.visuallyHidden {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n$progress-panel-bottom: 20px;\n$progress-panel-height: 150px;\n\n.externalWarningPanel {\n position: fixed;\n bottom: calc(\n #{$progress-panel-height} + 10px\n ); // positioned above the progress panel\n right: 20px;\n width: 500px;\n padding: 16px;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 12px;\n box-sizing: border-box;\n\n // Use &#{&} to increase specificity and override MUI Paper's default styles\n &#{&} {\n border-radius: 0;\n background-color: #223549;\n }\n}\n\n.warningIcon {\n flex-shrink: 0;\n\n // Use &#{&} to increase specificity and override MUI SvgIcon's default styles\n &#{&} {\n font-size: 40px;\n }\n}\n\n.warningTextContainer {\n flex: 1;\n}\n\n.warningTitleText {\n // Use &#{&} to increase specificity and override MUI Typography's default styles\n &#{&} {\n color: white;\n font-size: 14px;\n line-height: 1.4;\n font-weight: 700;\n }\n}\n\n.warningCloseButton {\n // Use &#{&} to increase specificity and override MUI IconButton's default styles\n &#{&} {\n color: white;\n align-self: flex-start;\n flex-shrink: 0;\n\n &:hover {\n color: #889baf;\n }\n }\n}\n\n.progressPanel {\n position: fixed;\n bottom: $progress-panel-bottom;\n right: 20px;\n width: 500px;\n height: $progress-panel-height;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n box-sizing: border-box;\n\n // Use &#{&} to increase specificity and override MUI Paper's default styles\n &#{&} {\n border-radius: 0;\n background-color: #223549;\n }\n}\n\n.progressTitleText {\n // Use &#{&} to increase specificity and override MUI Typography's default styles\n &#{&} {\n color: white;\n font-size: 14px;\n line-height: 1.4;\n }\n}\n\n.progressFileNameText {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n // Use &#{&} to increase specificity and override MUI Typography's default styles\n &#{&} {\n color: #889baf;\n font-size: 13px;\n line-height: 1.4;\n }\n}\n\n.progressFooter {\n display: flex;\n flex: 1;\n gap: 8px;\n align-items: center;\n margin-top: auto;\n}\n\n.progressBarContainer {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.progressStats {\n display: flex;\n justify-content: space-between;\n}\n\n.progressStatsText {\n // Use &#{&} to increase specificity and override MUI Typography's default styles\n &#{&} {\n color: #889baf;\n font-size: 12px;\n }\n}\n\n.progressBar {\n :global(.MuiLinearProgress-bar) {\n background-color: #469285;\n }\n}\n\n.cancelButtonContainer {\n width: 80px;\n display: flex;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.cancelButton {\n // Use &#{&} to increase specificity and override MUI Button's default styles\n &#{&} {\n color: white;\n border-color: white;\n min-width: 0;\n padding: 10px 16px;\n font-size: 0.75rem;\n line-height: 1;\n\n &:hover {\n border-color: #889baf;\n color: #889baf;\n }\n }\n}\n"],"mappings":""}
|
package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.scss
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Hides an element visually while keeping it accessible to screen readers.
|
|
2
|
+
.visuallyHidden {
|
|
3
|
+
border: 0;
|
|
4
|
+
clip: rect(0 0 0 0);
|
|
5
|
+
height: 1px;
|
|
6
|
+
margin: -1px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
padding: 0;
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: 1px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$progress-panel-bottom: 20px;
|
|
14
|
+
$progress-panel-height: 150px;
|
|
15
|
+
|
|
16
|
+
.externalWarningPanel {
|
|
17
|
+
position: fixed;
|
|
18
|
+
bottom: calc(
|
|
19
|
+
#{$progress-panel-height} + 10px
|
|
20
|
+
); // positioned above the progress panel
|
|
21
|
+
right: 20px;
|
|
22
|
+
width: 500px;
|
|
23
|
+
padding: 16px;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 12px;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
|
|
30
|
+
// Use &#{&} to increase specificity and override MUI Paper's default styles
|
|
31
|
+
&#{&} {
|
|
32
|
+
border-radius: 0;
|
|
33
|
+
background-color: #223549;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.warningIcon {
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
|
|
40
|
+
// Use &#{&} to increase specificity and override MUI SvgIcon's default styles
|
|
41
|
+
&#{&} {
|
|
42
|
+
font-size: 40px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.warningTextContainer {
|
|
47
|
+
flex: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.warningTitleText {
|
|
51
|
+
// Use &#{&} to increase specificity and override MUI Typography's default styles
|
|
52
|
+
&#{&} {
|
|
53
|
+
color: white;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
line-height: 1.4;
|
|
56
|
+
font-weight: 700;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.warningCloseButton {
|
|
61
|
+
// Use &#{&} to increase specificity and override MUI IconButton's default styles
|
|
62
|
+
&#{&} {
|
|
63
|
+
color: white;
|
|
64
|
+
align-self: flex-start;
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
color: #889baf;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.progressPanel {
|
|
74
|
+
position: fixed;
|
|
75
|
+
bottom: $progress-panel-bottom;
|
|
76
|
+
right: 20px;
|
|
77
|
+
width: 500px;
|
|
78
|
+
height: $progress-panel-height;
|
|
79
|
+
padding: 16px;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
gap: 4px;
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
|
|
85
|
+
// Use &#{&} to increase specificity and override MUI Paper's default styles
|
|
86
|
+
&#{&} {
|
|
87
|
+
border-radius: 0;
|
|
88
|
+
background-color: #223549;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.progressTitleText {
|
|
93
|
+
// Use &#{&} to increase specificity and override MUI Typography's default styles
|
|
94
|
+
&#{&} {
|
|
95
|
+
color: white;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
line-height: 1.4;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.progressFileNameText {
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
|
|
106
|
+
// Use &#{&} to increase specificity and override MUI Typography's default styles
|
|
107
|
+
&#{&} {
|
|
108
|
+
color: #889baf;
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
line-height: 1.4;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.progressFooter {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex: 1;
|
|
117
|
+
gap: 8px;
|
|
118
|
+
align-items: center;
|
|
119
|
+
margin-top: auto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.progressBarContainer {
|
|
123
|
+
flex: 1;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 4px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.progressStats {
|
|
130
|
+
display: flex;
|
|
131
|
+
justify-content: space-between;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.progressStatsText {
|
|
135
|
+
// Use &#{&} to increase specificity and override MUI Typography's default styles
|
|
136
|
+
&#{&} {
|
|
137
|
+
color: #889baf;
|
|
138
|
+
font-size: 12px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.progressBar {
|
|
143
|
+
:global(.MuiLinearProgress-bar) {
|
|
144
|
+
background-color: #469285;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.cancelButtonContainer {
|
|
149
|
+
width: 80px;
|
|
150
|
+
display: flex;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.cancelButton {
|
|
156
|
+
// Use &#{&} to increase specificity and override MUI Button's default styles
|
|
157
|
+
&#{&} {
|
|
158
|
+
color: white;
|
|
159
|
+
border-color: white;
|
|
160
|
+
min-width: 0;
|
|
161
|
+
padding: 10px 16px;
|
|
162
|
+
font-size: 0.75rem;
|
|
163
|
+
line-height: 1;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
border-color: #889baf;
|
|
167
|
+
color: #889baf;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -152,6 +152,14 @@ var A = y(function(e, t) {
|
|
|
152
152
|
"."
|
|
153
153
|
] })] })
|
|
154
154
|
}),
|
|
155
|
+
!d && !M && j.permissions.canEnableInheritance && /* @__PURE__ */ C(m, {
|
|
156
|
+
isInherited: z,
|
|
157
|
+
setIsInherited: B
|
|
158
|
+
}),
|
|
159
|
+
H && /* @__PURE__ */ C(ce, {
|
|
160
|
+
severity: "error",
|
|
161
|
+
children: H.message
|
|
162
|
+
}),
|
|
155
163
|
/* @__PURE__ */ C(f, {
|
|
156
164
|
isInherited: z,
|
|
157
165
|
canEdit: D(I, z, v, A),
|
|
@@ -169,14 +177,6 @@ var A = y(function(e, t) {
|
|
|
169
177
|
notifyCheckboxValue: V,
|
|
170
178
|
onNotifyCheckboxChange: he,
|
|
171
179
|
showAddRemovePublicButton: !0
|
|
172
|
-
}),
|
|
173
|
-
!d && !M && j.permissions.canEnableInheritance && /* @__PURE__ */ C(m, {
|
|
174
|
-
isInherited: z,
|
|
175
|
-
setIsInherited: B
|
|
176
|
-
}),
|
|
177
|
-
H && /* @__PURE__ */ C(ce, {
|
|
178
|
-
severity: "error",
|
|
179
|
-
children: H.message
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
182
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityAclEditor.js","names":[],"sources":["../../../src/components/EntityAclEditor/EntityAclEditor.tsx"],"sourcesContent":["import {\n useCreateEntityACL,\n useDeleteEntityACL,\n useSuspenseGetCurrentUserProfile,\n useSuspenseGetEntityBenefactorACL,\n useSuspenseGetEntityBundle,\n useUpdateEntityACL,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { BackendDestinationEnum, getEndpoint } from '@/utils/functions'\nimport {\n consolidateResourceAccessList,\n isEntityPublic,\n resourceAccessListIsEqual,\n} from '@/utils/functions/AccessControlListUtils'\nimport { getPrincipalDisplayName } from '@/utils/functions/getPrincipalDisplayName'\nimport { entityTypeToFriendlyName } from '@/utils/functions/EntityTypeUtils'\nimport {\n getAccessTypeFromPermissionLevel,\n PermissionLevel,\n permissionLevelToLabel,\n} from '@/utils/PermissionLevelToAccessType'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Alert, Link, Stack } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n ALL_ENTITY_BUNDLE_FIELDS,\n ResourceAccess,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n Suspense,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\nimport { AclEditor, AclEditorProps } from '../AclEditor/AclEditor'\nimport { AclEditorSkeleton } from '../AclEditor/AclEditorSkeleton'\nimport useUpdateAcl from '../AclEditor/useUpdateAcl'\nimport { SynapseErrorBoundary } from '../error'\nimport FullWidthAlert from '../FullWidthAlert'\nimport { CreateOrDeleteLocalSharingSettingsButton } from './CreateOrDeleteLocalSharingSettingsButton'\nimport { InheritanceMessage } from './InheritanceMessage'\nimport OpenData from './OpenData'\nimport useNotifyNewACLUsers from './useNotifyNewACLUsers'\n\nconst availablePermissionLevels: PermissionLevel[] = [\n 'CAN_VIEW',\n 'CAN_DOWNLOAD',\n 'CAN_EDIT',\n 'CAN_EDIT_DELETE',\n 'CAN_ADMINISTER',\n]\n\nexport type EntityAclEditorProps = {\n /** The ID of the entity on which to view/edit the ACL. Note that the ACL may actually belong to an entity ancestor (benefactor). */\n entityId: string\n /** Invoked when the user can/cannot save the pending changes. */\n onCanSaveChange: (canSaveChanges: boolean) => void\n /** Invoked when changes are successfully made. */\n onUpdateSuccess: () => void\n /** Special case to show specific copy and allow changes to an inherited ACL immediately after a file is uploaded.\n * Note that if this is true, the entityId should be the ID of the folder or project that is the benefactor of the newly uploaded file(s)\n * @defaultValue false */\n isAfterUpload?: boolean\n}\n\nexport type EntityAclEditorHandle = {\n save: () => void\n}\n\nfunction getSubject(entityName: string) {\n return `${entityName} (shared on Synapse)`\n}\n\nfunction getBody(profile: UserProfile, entityId: string) {\n return `${getPrincipalDisplayName(\n {\n userName: profile.userName ?? '',\n firstName: profile.firstName,\n lastName: profile.lastName,\n },\n { showFullName: true, showUsername: false },\n )} has shared an item with you on Synapse:\\n${getEndpoint(\n BackendDestinationEnum.PORTAL_ENDPOINT,\n )}Synapse:${entityId}`\n}\n\nfunction getCanEditResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n publicGroupId: string | undefined,\n): AclEditorProps['canEdit'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot change their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n // Users cannot change permission level for the public group, only add/remove it.\n // To give the public group DOWNLOAD access, ACT must mark it as anonymous access.\n const isPublicGroup =\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n if (isSelf || isPublicGroup) {\n return false\n }\n return true\n }\n}\n\nfunction getCanDeleteResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n): AclEditorProps['canRemoveEntry'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot delete their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n if (isSelf) {\n return false\n }\n return canEdit\n }\n}\n\nfunction getDisplayedPermissionLevelOverride(\n isOpenData: boolean,\n publicGroupId: string | undefined,\n): AclEditorProps['displayedPermissionLevelOverride'] {\n return (resourceAccess: ResourceAccess) => {\n if (\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n ) {\n return isOpenData\n ? permissionLevelToLabel['CAN_DOWNLOAD']\n : permissionLevelToLabel['CAN_VIEW']\n }\n return undefined\n }\n}\n\nconst EntityAclEditor = forwardRef(function EntityAclEditor(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n) {\n const {\n entityId,\n onCanSaveChange,\n onUpdateSuccess,\n isAfterUpload = false,\n } = props\n\n const { data: ownProfile } = useSuspenseGetCurrentUserProfile()\n const { data: realmPrincipals } = useGetRealmPrincipals()\n const { publicGroup: publicGroupId } = realmPrincipals || {}\n const { data: entityBundle } = useSuspenseGetEntityBundle(\n entityId,\n undefined,\n ALL_ENTITY_BUNDLE_FIELDS,\n { staleTime: Infinity },\n )\n const isProject = EntityType.project == entityBundle.entityType\n\n // The parent's benefactor ACL will be shown if the user removes the ACL on the current entity\n const { data: parentAcl } = useSuspenseGetEntityBenefactorACL(\n entityBundle.entity.parentId!,\n {\n staleTime: Infinity,\n },\n )\n\n const consolidatedOriginalResourceAccess = useMemo(\n () =>\n consolidateResourceAccessList(entityBundle.benefactorAcl.resourceAccess),\n [entityBundle.benefactorAcl.resourceAccess],\n )\n\n const parentResourceAccess = useMemo(\n () => parentAcl?.resourceAccess ?? [],\n [parentAcl],\n )\n const canEdit = entityBundle.permissions.canChangePermissions\n const isOpenData = entityBundle.permissions.isEntityOpenData\n const originalIsInherited = !(entityBundle.benefactorAcl.id == entityId)\n const [updatedIsInherited, setUpdatedIsInherited] =\n useState(originalIsInherited)\n const [notifyNewAdditions, setNotifyNewAdditions] = useState(false)\n const [error, setError] = useState<Error>()\n\n const {\n resourceAccessList: updatedResourceAccessList,\n setResourceAccessList,\n addResourceAccessItem,\n updateResourceAccessItem,\n removeResourceAccessItem,\n resetDirtyState,\n } = useUpdateAcl({\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n })\n\n // If `consolidatedOriginalResourceAccess` changes, reset state\n useEffect(() => {\n if (consolidatedOriginalResourceAccess) {\n resetDirtyState()\n setResourceAccessList([...consolidatedOriginalResourceAccess])\n }\n }, [\n consolidatedOriginalResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n ])\n\n // If `originalIsInherited` changes, reset state\n useEffect(() => {\n resetDirtyState()\n setUpdatedIsInherited(originalIsInherited)\n }, [originalIsInherited, resetDirtyState])\n\n // If the editor toggles the inherited state, reset the resource access list\n useEffect(() => {\n if (originalIsInherited == updatedIsInherited) {\n // The user reverted to the original state (regardless of inherited or not)\n setResourceAccessList(consolidatedOriginalResourceAccess)\n } else if (updatedIsInherited) {\n // The user toggled to inherited, update the resource access list to match the parent\n setResourceAccessList(parentResourceAccess)\n } else {\n // The user toggled to local, no need to update the list (the parent's list is already in the editor)\n }\n resetDirtyState()\n }, [\n originalIsInherited,\n consolidatedOriginalResourceAccess,\n parentResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n updatedIsInherited,\n ])\n\n const isPublic = isEntityPublic(\n updatedResourceAccessList,\n realmPrincipals ?? {},\n )\n\n const {\n sendNotification,\n isLoading: isLoadingSendMessageToNewACLUsers,\n isPending: isPendingSendMessageToNewACLUsers,\n } = useNotifyNewACLUsers({\n subject: getSubject(entityBundle.entity.name || ''),\n body: getBody(ownProfile, entityId),\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n newResourceAccessList: updatedResourceAccessList,\n })\n\n const mutationOptions = {\n onSuccess: () => {\n if (notifyNewAdditions) {\n sendNotification()\n }\n onUpdateSuccess()\n },\n onError: (e: Error) => {\n setError(e)\n },\n }\n\n const { mutate: createAcl, isPending: isPendingCreateAcl } =\n useCreateEntityACL(mutationOptions)\n const { mutate: updateAcl, isPending: isPendingUpdateAcl } =\n useUpdateEntityACL(mutationOptions)\n const { mutate: deleteAcl, isPending: isPendingDeleteAcl } =\n useDeleteEntityACL(mutationOptions)\n\n const isPending =\n isPendingCreateAcl ||\n isPendingUpdateAcl ||\n isPendingDeleteAcl ||\n isPendingSendMessageToNewACLUsers\n\n const hasAclChanged = useMemo(() => {\n return (\n originalIsInherited != updatedIsInherited ||\n !resourceAccessListIsEqual(\n consolidatedOriginalResourceAccess,\n updatedResourceAccessList,\n )\n )\n }, [\n consolidatedOriginalResourceAccess,\n originalIsInherited,\n updatedIsInherited,\n updatedResourceAccessList,\n ])\n\n const canSave =\n hasAclChanged || isLoadingSendMessageToNewACLUsers || isPending\n\n const showInheritedAclUpdateWarning = hasAclChanged && isAfterUpload\n\n useEffect(() => {\n onCanSaveChange(canSave)\n }, [onCanSaveChange, canSave])\n\n useImperativeHandle(\n ref,\n () => {\n return {\n save() {\n if (canSave) {\n // Check if the inheritance changed; if so, the ACL should be created/deleted\n if (originalIsInherited != updatedIsInherited) {\n if (updatedIsInherited) {\n deleteAcl(entityId)\n } else {\n createAcl({\n id: entityId,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n // Inheritance did not change; update the ACL\n updateAcl({\n // ensure we get all fields from the original ACL, including the etag\n ...entityBundle.accessControlList!,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n console.error('EntityAclEditor: save() called but canSave is false')\n }\n },\n }\n },\n [\n canSave,\n createAcl,\n deleteAcl,\n entityBundle,\n entityId,\n originalIsInherited,\n updateAcl,\n updatedIsInherited,\n updatedResourceAccessList,\n ],\n )\n\n return (\n <Stack\n sx={{\n gap: 2,\n }}\n >\n <OpenData\n isOpenData={isOpenData}\n isPublic={isPublic}\n currentUserCanUpdateSharingSettings={canEdit}\n />\n <InheritanceMessage\n isProject={isProject}\n isInherited={updatedIsInherited}\n benefactorId={updatedIsInherited ? parentAcl?.id : entityId}\n isAfterUpload={isAfterUpload}\n />\n {showInheritedAclUpdateWarning && (\n <FullWidthAlert\n isGlobal={false}\n variant={'warning'}\n title={`Edits will affect settings of entire ${entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}.`}\n description={\n <>\n <p>\n Editing the settings here will impact the sharing settings for\n all files and folders within this{' '}\n {entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}\n , not just the ones you've recently uploaded.\n </p>\n <p>\n View the instructions above for setting your{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n target={'_blank'}\n >\n Local Sharing Settings\n </Link>\n .\n </p>\n </>\n }\n />\n )}\n <AclEditor\n isInherited={updatedIsInherited}\n canEdit={getCanEditResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n publicGroupId,\n )}\n canRemoveEntry={getCanDeleteResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n )}\n resourceAccessList={updatedResourceAccessList}\n availablePermissionLevels={availablePermissionLevels}\n emptyText={/* This should never happen */ ''}\n displayedPermissionLevelOverride={getDisplayedPermissionLevelOverride(\n isOpenData,\n publicGroupId,\n )}\n onAddPrincipalToAcl={id => {\n if (publicGroupId !== undefined && String(id) === publicGroupId) {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_VIEW'),\n )\n } else {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_DOWNLOAD'),\n )\n }\n }}\n updateResourceAccessItem={updateResourceAccessItem}\n removeResourceAccessItem={removeResourceAccessItem}\n showNotifyCheckbox={true}\n notifyCheckboxValue={notifyNewAdditions}\n onNotifyCheckboxChange={setNotifyNewAdditions}\n showAddRemovePublicButton={true}\n />\n {/* Create / delete local sharing settings button */}\n {!isAfterUpload &&\n !isProject &&\n entityBundle.permissions.canEnableInheritance && (\n <CreateOrDeleteLocalSharingSettingsButton\n isInherited={updatedIsInherited}\n setIsInherited={setUpdatedIsInherited}\n />\n )}\n {error && <Alert severity=\"error\">{error.message}</Alert>}\n </Stack>\n )\n})\n\nconst EntityAclEditorWithSuspense = forwardRef(\n function EntityAclEditorWithSuspense(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n ) {\n return (\n <SynapseErrorBoundary>\n <Suspense fallback={<AclEditorSkeleton />}>\n <EntityAclEditor {...props} ref={ref} />\n </Suspense>\n </SynapseErrorBoundary>\n )\n },\n)\n\nexport default EntityAclEditorWithSuspense\n"],"mappings":";;;;;;;;;;;;;;;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AAM;AACzB,KAAI,MAAkB,KAAA,KAAa,OAAO,EAAG,KAAK,IAChD,EACE,GACA,EAAiC,WAAW,CAC7C,GAED,EACE,GACA,EAAiC,eAAe,CACjD;;IAGqB;IACA;IAC1B,oBAAoB;IACpB,qBAAqB;IACrB,wBAAwB;IACxB,2BAA2B;IAC3B,CAAA;GAED,CAAC,KACA,CAAC,KACD,EAAa,YAAY,wBACvB,kBAAC,GAAD;IACE,aAAa;IACb,gBAAgB;IAChB,CAAA;GAEL,KAAS,kBAAC,IAAD;IAAO,UAAS;cAAS,EAAM;IAAgB,CAAA;GACnD;;EAEV,EAEI,IAA8B,EAClC,SACE,GACA,GACA;AACA,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAqB,CAAA;YACvC,kBAAC,GAAD;GAAiB,GAAI;GAAY;GAAO,CAAA;EAC/B,CAAA,EACU,CAAA;EAG5B"}
|
|
1
|
+
{"version":3,"file":"EntityAclEditor.js","names":[],"sources":["../../../src/components/EntityAclEditor/EntityAclEditor.tsx"],"sourcesContent":["import {\n useCreateEntityACL,\n useDeleteEntityACL,\n useSuspenseGetCurrentUserProfile,\n useSuspenseGetEntityBenefactorACL,\n useSuspenseGetEntityBundle,\n useUpdateEntityACL,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { BackendDestinationEnum, getEndpoint } from '@/utils/functions'\nimport {\n consolidateResourceAccessList,\n isEntityPublic,\n resourceAccessListIsEqual,\n} from '@/utils/functions/AccessControlListUtils'\nimport { getPrincipalDisplayName } from '@/utils/functions/getPrincipalDisplayName'\nimport { entityTypeToFriendlyName } from '@/utils/functions/EntityTypeUtils'\nimport {\n getAccessTypeFromPermissionLevel,\n PermissionLevel,\n permissionLevelToLabel,\n} from '@/utils/PermissionLevelToAccessType'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Alert, Link, Stack } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n ALL_ENTITY_BUNDLE_FIELDS,\n ResourceAccess,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n Suspense,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\nimport { AclEditor, AclEditorProps } from '../AclEditor/AclEditor'\nimport { AclEditorSkeleton } from '../AclEditor/AclEditorSkeleton'\nimport useUpdateAcl from '../AclEditor/useUpdateAcl'\nimport { SynapseErrorBoundary } from '../error'\nimport FullWidthAlert from '../FullWidthAlert'\nimport { CreateOrDeleteLocalSharingSettingsButton } from './CreateOrDeleteLocalSharingSettingsButton'\nimport { InheritanceMessage } from './InheritanceMessage'\nimport OpenData from './OpenData'\nimport useNotifyNewACLUsers from './useNotifyNewACLUsers'\n\nconst availablePermissionLevels: PermissionLevel[] = [\n 'CAN_VIEW',\n 'CAN_DOWNLOAD',\n 'CAN_EDIT',\n 'CAN_EDIT_DELETE',\n 'CAN_ADMINISTER',\n]\n\nexport type EntityAclEditorProps = {\n /** The ID of the entity on which to view/edit the ACL. Note that the ACL may actually belong to an entity ancestor (benefactor). */\n entityId: string\n /** Invoked when the user can/cannot save the pending changes. */\n onCanSaveChange: (canSaveChanges: boolean) => void\n /** Invoked when changes are successfully made. */\n onUpdateSuccess: () => void\n /** Special case to show specific copy and allow changes to an inherited ACL immediately after a file is uploaded.\n * Note that if this is true, the entityId should be the ID of the folder or project that is the benefactor of the newly uploaded file(s)\n * @defaultValue false */\n isAfterUpload?: boolean\n}\n\nexport type EntityAclEditorHandle = {\n save: () => void\n}\n\nfunction getSubject(entityName: string) {\n return `${entityName} (shared on Synapse)`\n}\n\nfunction getBody(profile: UserProfile, entityId: string) {\n return `${getPrincipalDisplayName(\n {\n userName: profile.userName ?? '',\n firstName: profile.firstName,\n lastName: profile.lastName,\n },\n { showFullName: true, showUsername: false },\n )} has shared an item with you on Synapse:\\n${getEndpoint(\n BackendDestinationEnum.PORTAL_ENDPOINT,\n )}Synapse:${entityId}`\n}\n\nfunction getCanEditResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n publicGroupId: string | undefined,\n): AclEditorProps['canEdit'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot change their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n // Users cannot change permission level for the public group, only add/remove it.\n // To give the public group DOWNLOAD access, ACT must mark it as anonymous access.\n const isPublicGroup =\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n if (isSelf || isPublicGroup) {\n return false\n }\n return true\n }\n}\n\nfunction getCanDeleteResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n): AclEditorProps['canRemoveEntry'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot delete their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n if (isSelf) {\n return false\n }\n return canEdit\n }\n}\n\nfunction getDisplayedPermissionLevelOverride(\n isOpenData: boolean,\n publicGroupId: string | undefined,\n): AclEditorProps['displayedPermissionLevelOverride'] {\n return (resourceAccess: ResourceAccess) => {\n if (\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n ) {\n return isOpenData\n ? permissionLevelToLabel['CAN_DOWNLOAD']\n : permissionLevelToLabel['CAN_VIEW']\n }\n return undefined\n }\n}\n\nconst EntityAclEditor = forwardRef(function EntityAclEditor(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n) {\n const {\n entityId,\n onCanSaveChange,\n onUpdateSuccess,\n isAfterUpload = false,\n } = props\n\n const { data: ownProfile } = useSuspenseGetCurrentUserProfile()\n const { data: realmPrincipals } = useGetRealmPrincipals()\n const { publicGroup: publicGroupId } = realmPrincipals || {}\n const { data: entityBundle } = useSuspenseGetEntityBundle(\n entityId,\n undefined,\n ALL_ENTITY_BUNDLE_FIELDS,\n { staleTime: Infinity },\n )\n const isProject = EntityType.project == entityBundle.entityType\n\n // The parent's benefactor ACL will be shown if the user removes the ACL on the current entity\n const { data: parentAcl } = useSuspenseGetEntityBenefactorACL(\n entityBundle.entity.parentId!,\n {\n staleTime: Infinity,\n },\n )\n\n const consolidatedOriginalResourceAccess = useMemo(\n () =>\n consolidateResourceAccessList(entityBundle.benefactorAcl.resourceAccess),\n [entityBundle.benefactorAcl.resourceAccess],\n )\n\n const parentResourceAccess = useMemo(\n () => parentAcl?.resourceAccess ?? [],\n [parentAcl],\n )\n const canEdit = entityBundle.permissions.canChangePermissions\n const isOpenData = entityBundle.permissions.isEntityOpenData\n const originalIsInherited = !(entityBundle.benefactorAcl.id == entityId)\n const [updatedIsInherited, setUpdatedIsInherited] =\n useState(originalIsInherited)\n const [notifyNewAdditions, setNotifyNewAdditions] = useState(false)\n const [error, setError] = useState<Error>()\n\n const {\n resourceAccessList: updatedResourceAccessList,\n setResourceAccessList,\n addResourceAccessItem,\n updateResourceAccessItem,\n removeResourceAccessItem,\n resetDirtyState,\n } = useUpdateAcl({\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n })\n\n // If `consolidatedOriginalResourceAccess` changes, reset state\n useEffect(() => {\n if (consolidatedOriginalResourceAccess) {\n resetDirtyState()\n setResourceAccessList([...consolidatedOriginalResourceAccess])\n }\n }, [\n consolidatedOriginalResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n ])\n\n // If `originalIsInherited` changes, reset state\n useEffect(() => {\n resetDirtyState()\n setUpdatedIsInherited(originalIsInherited)\n }, [originalIsInherited, resetDirtyState])\n\n // If the editor toggles the inherited state, reset the resource access list\n useEffect(() => {\n if (originalIsInherited == updatedIsInherited) {\n // The user reverted to the original state (regardless of inherited or not)\n setResourceAccessList(consolidatedOriginalResourceAccess)\n } else if (updatedIsInherited) {\n // The user toggled to inherited, update the resource access list to match the parent\n setResourceAccessList(parentResourceAccess)\n } else {\n // The user toggled to local, no need to update the list (the parent's list is already in the editor)\n }\n resetDirtyState()\n }, [\n originalIsInherited,\n consolidatedOriginalResourceAccess,\n parentResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n updatedIsInherited,\n ])\n\n const isPublic = isEntityPublic(\n updatedResourceAccessList,\n realmPrincipals ?? {},\n )\n\n const {\n sendNotification,\n isLoading: isLoadingSendMessageToNewACLUsers,\n isPending: isPendingSendMessageToNewACLUsers,\n } = useNotifyNewACLUsers({\n subject: getSubject(entityBundle.entity.name || ''),\n body: getBody(ownProfile, entityId),\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n newResourceAccessList: updatedResourceAccessList,\n })\n\n const mutationOptions = {\n onSuccess: () => {\n if (notifyNewAdditions) {\n sendNotification()\n }\n onUpdateSuccess()\n },\n onError: (e: Error) => {\n setError(e)\n },\n }\n\n const { mutate: createAcl, isPending: isPendingCreateAcl } =\n useCreateEntityACL(mutationOptions)\n const { mutate: updateAcl, isPending: isPendingUpdateAcl } =\n useUpdateEntityACL(mutationOptions)\n const { mutate: deleteAcl, isPending: isPendingDeleteAcl } =\n useDeleteEntityACL(mutationOptions)\n\n const isPending =\n isPendingCreateAcl ||\n isPendingUpdateAcl ||\n isPendingDeleteAcl ||\n isPendingSendMessageToNewACLUsers\n\n const hasAclChanged = useMemo(() => {\n return (\n originalIsInherited != updatedIsInherited ||\n !resourceAccessListIsEqual(\n consolidatedOriginalResourceAccess,\n updatedResourceAccessList,\n )\n )\n }, [\n consolidatedOriginalResourceAccess,\n originalIsInherited,\n updatedIsInherited,\n updatedResourceAccessList,\n ])\n\n const canSave =\n hasAclChanged || isLoadingSendMessageToNewACLUsers || isPending\n\n const showInheritedAclUpdateWarning = hasAclChanged && isAfterUpload\n\n useEffect(() => {\n onCanSaveChange(canSave)\n }, [onCanSaveChange, canSave])\n\n useImperativeHandle(\n ref,\n () => {\n return {\n save() {\n if (canSave) {\n // Check if the inheritance changed; if so, the ACL should be created/deleted\n if (originalIsInherited != updatedIsInherited) {\n if (updatedIsInherited) {\n deleteAcl(entityId)\n } else {\n createAcl({\n id: entityId,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n // Inheritance did not change; update the ACL\n updateAcl({\n // ensure we get all fields from the original ACL, including the etag\n ...entityBundle.accessControlList!,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n console.error('EntityAclEditor: save() called but canSave is false')\n }\n },\n }\n },\n [\n canSave,\n createAcl,\n deleteAcl,\n entityBundle,\n entityId,\n originalIsInherited,\n updateAcl,\n updatedIsInherited,\n updatedResourceAccessList,\n ],\n )\n\n return (\n <Stack\n sx={{\n gap: 2,\n }}\n >\n <OpenData\n isOpenData={isOpenData}\n isPublic={isPublic}\n currentUserCanUpdateSharingSettings={canEdit}\n />\n <InheritanceMessage\n isProject={isProject}\n isInherited={updatedIsInherited}\n benefactorId={updatedIsInherited ? parentAcl?.id : entityId}\n isAfterUpload={isAfterUpload}\n />\n {showInheritedAclUpdateWarning && (\n <FullWidthAlert\n isGlobal={false}\n variant={'warning'}\n title={`Edits will affect settings of entire ${entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}.`}\n description={\n <>\n <p>\n Editing the settings here will impact the sharing settings for\n all files and folders within this{' '}\n {entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}\n , not just the ones you've recently uploaded.\n </p>\n <p>\n View the instructions above for setting your{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n target={'_blank'}\n >\n Local Sharing Settings\n </Link>\n .\n </p>\n </>\n }\n />\n )}\n {/* Create / delete local sharing settings button */}\n {!isAfterUpload &&\n !isProject &&\n entityBundle.permissions.canEnableInheritance && (\n <CreateOrDeleteLocalSharingSettingsButton\n isInherited={updatedIsInherited}\n setIsInherited={setUpdatedIsInherited}\n />\n )}\n {error && <Alert severity=\"error\">{error.message}</Alert>}\n <AclEditor\n isInherited={updatedIsInherited}\n canEdit={getCanEditResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n publicGroupId,\n )}\n canRemoveEntry={getCanDeleteResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n )}\n resourceAccessList={updatedResourceAccessList}\n availablePermissionLevels={availablePermissionLevels}\n emptyText={/* This should never happen */ ''}\n displayedPermissionLevelOverride={getDisplayedPermissionLevelOverride(\n isOpenData,\n publicGroupId,\n )}\n onAddPrincipalToAcl={id => {\n if (publicGroupId !== undefined && String(id) === publicGroupId) {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_VIEW'),\n )\n } else {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_DOWNLOAD'),\n )\n }\n }}\n updateResourceAccessItem={updateResourceAccessItem}\n removeResourceAccessItem={removeResourceAccessItem}\n showNotifyCheckbox={true}\n notifyCheckboxValue={notifyNewAdditions}\n onNotifyCheckboxChange={setNotifyNewAdditions}\n showAddRemovePublicButton={true}\n />\n </Stack>\n )\n})\n\nconst EntityAclEditorWithSuspense = forwardRef(\n function EntityAclEditorWithSuspense(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n ) {\n return (\n <SynapseErrorBoundary>\n <Suspense fallback={<AclEditorSkeleton />}>\n <EntityAclEditor {...props} ref={ref} />\n </Suspense>\n </SynapseErrorBoundary>\n )\n },\n)\n\nexport default EntityAclEditorWithSuspense\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAM,KAA+C;CACnD;CACA;CACA;CACA;CACA;CACD;AAmBD,SAAS,EAAW,GAAoB;AACtC,QAAO,GAAG,EAAW;;AAGvB,SAAS,EAAQ,GAAsB,GAAkB;AACvD,QAAO,GAAG,EACR;EACE,UAAU,EAAQ,YAAY;EAC9B,WAAW,EAAQ;EACnB,UAAU,EAAQ;EACnB,EACD;EAA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ACE,GACA,EAAiC,eAAe,CACjD;;IAGqB;IACA;IAC1B,oBAAoB;IACpB,qBAAqB;IACrB,wBAAwB;IACxB,2BAA2B;IAC3B,CAAA;GACI;;EAEV,EAEI,IAA8B,EAClC,SACE,GACA,GACA;AACA,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAqB,CAAA;YACvC,kBAAC,GAAD;GAAiB,GAAI;GAAY;GAAO,CAAA;EAC/B,CAAA,EACU,CAAA;EAG5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InheritanceMessage.d.ts","sourceRoot":"","sources":["../../../src/components/EntityAclEditor/InheritanceMessage.tsx"],"names":[],"mappings":"AASA,KAAK,uBAAuB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"InheritanceMessage.d.ts","sourceRoot":"","sources":["../../../src/components/EntityAclEditor/InheritanceMessage.tsx"],"names":[],"mappings":"AASA,KAAK,uBAAuB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA2EhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InheritanceMessage.js","names":[],"sources":["../../../src/components/EntityAclEditor/InheritanceMessage.tsx"],"sourcesContent":["import { useGetEntityHeader } from '@/synapse-queries/entity/useGetEntityHeaders'\nimport {\n convertToEntityType,\n entityTypeToFriendlyName,\n} from '@/utils/functions/EntityTypeUtils'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Link, Typography } from '@mui/material'\nimport { EntityLink } from '../EntityLink'\n\ntype InheritanceMessageProps = {\n isProject: boolean\n isInherited: boolean\n isAfterUpload?: boolean\n benefactorId?: string\n}\n\nexport function InheritanceMessage(props: InheritanceMessageProps) {\n const { isProject, isInherited, isAfterUpload = false, benefactorId } = props\n const { data: benefactorHeader } = useGetEntityHeader(\n benefactorId,\n undefined,\n {\n enabled: Boolean(benefactorId),\n },\n )\n\n if (isAfterUpload) {\n return (\n <>\n <Typography variant={'body1'}>\n Currently, the sharing settings are inherited from the{' '}\n {benefactorHeader\n ? entityTypeToFriendlyName(\n convertToEntityType(benefactorHeader.type),\n ).toLowerCase()\n : 'container'}{' '}\n named\n {benefactorId ? (\n <>\n {' '}\n <EntityLink entity={benefactorId} />{' '}\n </>\n ) : (\n ''\n )}\n . If you wish to customize settings for a particular file, folder, or\n table, you must establish <strong>Local Sharing Settings</strong> to\n make modifications.\n </Typography>\n <Typography variant={'body1'}>\n After uploading, choose the file you want to customize sharing\n settings for, then navigate to File Tools >{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n >\n File Sharing Settings\n </Link>\n .\n </Typography>\n </>\n )\n } else if (isProject) {\n return (\n <Typography variant={'body1'}>\n The sharing settings shown below apply to this project and are inherited\n by all project contents unless local sharing settings have been set.\n </Typography>\n )\n } else if (isInherited) {\n return (\n <Typography variant={'body1'}>\n The sharing settings shown below are currently being inherited{' '}\n {benefactorId ? (\n <>\n from <EntityLink entity={benefactorId} />{' '}\n </>\n ) : (\n ''\n )}\n
|
|
1
|
+
{"version":3,"file":"InheritanceMessage.js","names":[],"sources":["../../../src/components/EntityAclEditor/InheritanceMessage.tsx"],"sourcesContent":["import { useGetEntityHeader } from '@/synapse-queries/entity/useGetEntityHeaders'\nimport {\n convertToEntityType,\n entityTypeToFriendlyName,\n} from '@/utils/functions/EntityTypeUtils'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Link, Typography } from '@mui/material'\nimport { EntityLink } from '../EntityLink'\n\ntype InheritanceMessageProps = {\n isProject: boolean\n isInherited: boolean\n isAfterUpload?: boolean\n benefactorId?: string\n}\n\nexport function InheritanceMessage(props: InheritanceMessageProps) {\n const { isProject, isInherited, isAfterUpload = false, benefactorId } = props\n const { data: benefactorHeader } = useGetEntityHeader(\n benefactorId,\n undefined,\n {\n enabled: Boolean(benefactorId),\n },\n )\n\n if (isAfterUpload) {\n return (\n <>\n <Typography variant={'body1'}>\n Currently, the sharing settings are inherited from the{' '}\n {benefactorHeader\n ? entityTypeToFriendlyName(\n convertToEntityType(benefactorHeader.type),\n ).toLowerCase()\n : 'container'}{' '}\n named\n {benefactorId ? (\n <>\n {' '}\n <EntityLink entity={benefactorId} />{' '}\n </>\n ) : (\n ''\n )}\n . If you wish to customize settings for a particular file, folder, or\n table, you must establish <strong>Local Sharing Settings</strong> to\n make modifications.\n </Typography>\n <Typography variant={'body1'}>\n After uploading, choose the file you want to customize sharing\n settings for, then navigate to File Tools >{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n >\n File Sharing Settings\n </Link>\n .\n </Typography>\n </>\n )\n } else if (isProject) {\n return (\n <Typography variant={'body1'}>\n The sharing settings shown below apply to this project and are inherited\n by all project contents unless local sharing settings have been set.\n </Typography>\n )\n } else if (isInherited) {\n return (\n <Typography variant={'body1'}>\n The sharing settings shown below are currently being inherited{' '}\n {benefactorId ? (\n <>\n from <EntityLink entity={benefactorId} />{' '}\n </>\n ) : (\n ''\n )}\n </Typography>\n )\n } else {\n return (\n <Typography variant={'body1'}>\n The local sharing settings shown below are <strong>not</strong> being\n inherited from a parent resource.\n </Typography>\n )\n }\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,EAAmB,GAAgC;CACjE,IAAM,EAAE,cAAW,gBAAa,mBAAgB,IAAO,oBAAiB,GAClE,EAAE,MAAM,MAAqB,EACjC,GACA,KAAA,GACA,EACE,SAAS,EAAQ,GAClB,CACF;AA4DC,QA1DE,IAEA,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EAAY,SAAS;YAArB;GAA8B;GAC2B;GACtD,IACG,EACE,EAAoB,EAAiB,KAAK,CAC3C,CAAC,aAAa,GACf;GAAa;GAAI;GAEpB,IACC,kBAAA,GAAA,EAAA,UAAA;IACG;IACD,kBAAC,GAAD,EAAY,QAAQ,GAAgB,CAAA;IAAC;IACpC,EAAA,CAAA,GAEH;GACA;GAEwB,kBAAC,UAAD,EAAA,UAAQ,0BAA+B,CAAA;;GAEtD;KACb,kBAAC,GAAD;EAAY,SAAS;YAArB;GAA8B;GAEmB;GAC/C,kBAAC,GAAD;IACE,MACE;cAEH;IAEM,CAAA;;GAEI;IACZ,EAAA,CAAA,GAEI,IAEP,kBAAC,GAAD;EAAY,SAAS;YAAS;EAGjB,CAAA,GAEN,IAEP,kBAAC,GAAD;EAAY,SAAS;YAArB;GAA8B;GACmC;GAC9D,IACC,kBAAA,GAAA,EAAA,UAAA;IAAE;IACK,kBAAC,GAAD,EAAY,QAAQ,GAAgB,CAAA;IAAC;IACzC,EAAA,CAAA,GAEH;GAES;MAIb,kBAAC,GAAD;EAAY,SAAS;YAArB;GAA8B;GACe,kBAAC,UAAD,EAAA,UAAQ,OAAY,CAAA;;GAEpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAkB3C,eAAO,MAAM,8BAA8B,kGAEJ,CAAA;AAGvC,eAAO,MAAM,yBAAyB,+DACA,CAAA;AA2DtC,aAAK,cAAc;IACjB,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,kBAAkB,IAAA;IAClB,wBAAwB,IAAA;IACxB,WAAW,IAAA;CACZ;AA6FD,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,UAAU,GACf,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"EntityDownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAkB3C,eAAO,MAAM,8BAA8B,kGAEJ,CAAA;AAGvC,eAAO,MAAM,yBAAyB,+DACA,CAAA;AA2DtC,aAAK,cAAc;IACjB,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,kBAAkB,IAAA;IAClB,wBAAwB,IAAA;IACxB,WAAW,IAAA;CACZ;AA6FD,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,UAAU,GACf,cAAc,EAAE,EAAE,CAoCpB;AA2ED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,6BAA6B,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CAgLA"}
|
|
@@ -129,6 +129,7 @@ function M(e) {
|
|
|
129
129
|
case C.submissionview:
|
|
130
130
|
case C.virtualtable: return [[k.exportTable, k.programmaticAccess]];
|
|
131
131
|
case C.link: return [[k.programmaticAccess]];
|
|
132
|
+
case C.searchindex: return [];
|
|
132
133
|
default: throw Error(`Unhandled EntityType: ${e}`);
|
|
133
134
|
}
|
|
134
135
|
}
|