synapse-react-client 4.0.10 → 4.0.11
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.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/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/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/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/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/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/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/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/synapse-queries/KeyFactory.d.ts +1 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +3 -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 +1 -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/package.json +4 -4
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,EACtD,IAAc,GAAgB,EAC9B,IAAwB,GAAsC,EAC9D,CAA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;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 0,\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,KAAK,MAAO,IAAkB,IAAc,IAAI,EAC1D,IAAS,K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AAD;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,iBACjB,EACD,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
|
+
}
|
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDownloadButton.js","names":[],"sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"sourcesContent":["import { useGetEntity, useGetVersions } from '@/synapse-queries'\nimport {\n useAddFileToDownloadList,\n useGetAddToDownloadListStats,\n} from '@/synapse-queries/index'\nimport { useSynapseContext } from '@/utils'\nimport {\n entityTypeToFriendlyName,\n hasFilesInView,\n isContainerType,\n isDataset,\n isEntityView,\n isVersionableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { useDirectDownloadHandler } from '@/utils/hooks/useDirectDownloadHandler'\nimport { isFileEntity } from '@/utils/types/IsType'\nimport { DownloadOutlined as DownloadIcon } from '@mui/icons-material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n FileHandleAssociateType,\n QueryBundleRequest,\n} from '@sage-bionetworks/synapse-types'\nimport { RefObject, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { displayFilesWereAddedToDownloadListSuccess } from '../download_list/DownloadConfirmationUtils'\nimport { EntityDownloadConfirmation } from '../EntityDownloadConfirmation'\nimport { DropdownMenu, DropdownMenuItem } from '../menu/DropdownMenu'\nimport { ModalDownload } from '../ModalDownload/ModalDownload'\nimport { ProgrammaticInstructionsModal } from '../ProgrammaticInstructionsModal/ProgrammaticInstructionsModal'\nimport { displayToast } from '../ToastMessage/index'\n\n// WIP\n// Per Nick Grosenbacher: For this to be reusable, I think we would also need to accept versionNumber as a prop. Where we would have the following behavior:\n// - If the version number is present, use it\n// - If the version number is null, do not use it,\n// - If the version number is undefined, then we would try to do the 'smart' thing-- get the latest version for datasets, otherwise don't use it.\n\n// Have to keep these consts outside of getProgrammaticAccessCode because\n// they are being called in ProgrammaticTableDownload.tsx\n// Python client import and login instructions\nexport const PYTHON_CLIENT_IMPORT_AND_LOGIN = `import synapseclient\nsyn = synapseclient.Synapse()\nsyn.login(authToken=\"YOUR_TOKEN_HERE\")`\n\n// R client import and login instructions\nexport const R_CLIENT_IMPORT_AND_LOGIN = `library(synapser)\nsynLogin(authToken=\"YOUR_TOKEN_HERE\")`\n\ntype ProgrammaticAccessCode = {\n cliCode: string | undefined\n rCode: string | undefined\n pythonCode: string | undefined\n}\n\n// Generate programmatic access code snippet content based on entity type\nfunction getProgrammaticAccessCode(\n type: EntityType,\n entityId: string,\n version: number | undefined,\n): ProgrammaticAccessCode {\n const id =\n type === EntityType.dataset && version ? `${entityId}.${version}` : entityId\n switch (type) {\n case EntityType.file:\n case EntityType.folder:\n case EntityType.project:\n case EntityType.link:\n return {\n cliCode: `synapse get -r ${entityId}`,\n rCode: `${R_CLIENT_IMPORT_AND_LOGIN} \\n\n# Download file\nsynGet('${entityId}')`,\n pythonCode: `${PYTHON_CLIENT_IMPORT_AND_LOGIN} \\n\n# Download file\nsyn.get('${entityId}')`,\n }\n case EntityType.dockerrepo:\n return {\n cliCode: `docker login -u <synapse username> -p <synapse password> docker.synapse.org \\n\ndocker pull docker.synapse.org/${entityId}/myrepo`,\n rCode: undefined,\n pythonCode: undefined,\n }\n case EntityType.dataset:\n case EntityType.entityview:\n case EntityType.datasetcollection:\n case EntityType.table:\n case EntityType.materializedview:\n case EntityType.submissionview:\n case EntityType.virtualtable:\n case EntityType.recordset:\n return {\n cliCode: `synapse get -q \"SELECT * FROM ${id}\"`,\n rCode: `${R_CLIENT_IMPORT_AND_LOGIN} \\n\nquery <- synTableQuery(\"SELECT * FROM ${id}\")\nread.table(query$filepath, sep=\",\")`,\n pythonCode: `${PYTHON_CLIENT_IMPORT_AND_LOGIN} \\n\nquery = syn.tableQuery(\"SELECT * FROM ${id}\")\nquery.asDataFrame()`,\n }\n default:\n throw new Error(`Unhandled EntityType: ${type}`)\n }\n}\n\nenum DownloadAction {\n downloadFile,\n addToCart,\n programmaticAccess,\n programmaticAccessDocker,\n exportTable,\n}\n\n// Function that creates menu items for download actions\nfunction getMenuItemForAction(\n entityId: string,\n entityName: string,\n entityType: EntityType,\n downloadAction: DownloadAction,\n setShowProgrammaticAccess: (show: boolean) => void,\n setShowExportMetadata: (show: boolean) => void,\n addFileToDownloadList: (params: {\n entityId: string\n entityVersionNumber: number | undefined\n }) => void,\n setShowDownloadConfirmation: (show: boolean) => void,\n versionNumber?: number,\n addToCartDisabled?: boolean,\n onDownloadFile?: () => void,\n isAuthenticated?: boolean,\n): DropdownMenuItem {\n switch (downloadAction) {\n case DownloadAction.downloadFile:\n return {\n text: 'Download File',\n onClick: () => {\n if (onDownloadFile) onDownloadFile()\n },\n tooltipText: isAuthenticated\n ? 'Download this file directly'\n : 'Sign in to download this file',\n disabled: !isAuthenticated,\n }\n case DownloadAction.addToCart:\n return {\n text: 'Add to Download List',\n disabled: addToCartDisabled,\n tooltipText: getAddToCartTooltip(entityType, !!addToCartDisabled),\n onClick: () => {\n if (\n entityType === EntityType.file ||\n entityType === EntityType.recordset\n ) {\n addFileToDownloadList({\n entityId,\n entityVersionNumber: versionNumber,\n })\n } else {\n setShowDownloadConfirmation(true)\n }\n },\n }\n case DownloadAction.programmaticAccess:\n return {\n text: 'Programmatic Access',\n onClick: () => {\n setShowProgrammaticAccess(true)\n },\n tooltipText: 'View programmatic access options',\n }\n case DownloadAction.programmaticAccessDocker:\n return {\n text: 'Programmatic Access (Docker)',\n onClick: () => {\n setShowProgrammaticAccess(true)\n },\n tooltipText: 'View programmatic options to pull Docker image',\n }\n case DownloadAction.exportTable:\n return {\n text: 'Export Table',\n onClick: () => {\n setShowExportMetadata(true)\n },\n tooltipText: 'Export table data',\n }\n }\n}\n\n/**\n * Determines the tooltip message based on the entity type and its \"add to cart\" status.\n */\nconst getAddToCartTooltip = (\n entityType: EntityType,\n isDisabled: boolean,\n): string => {\n if (!isDisabled) {\n return 'Add file(s) to your download list'\n }\n const entityFriendlyName = entityTypeToFriendlyName(entityType)\n return `This ${entityFriendlyName} has no accessible files`\n}\n\n// Function that returns DropdownMenuItem\nexport function getDownloadActionsForEntityType(\n type: EntityType,\n): DownloadAction[][] {\n switch (type) {\n case EntityType.file:\n case EntityType.recordset:\n return [\n [DownloadAction.downloadFile],\n [DownloadAction.addToCart, DownloadAction.programmaticAccess],\n ]\n case EntityType.project:\n case EntityType.folder:\n return [[DownloadAction.addToCart, DownloadAction.programmaticAccess]]\n case EntityType.dockerrepo:\n return [[DownloadAction.programmaticAccessDocker]]\n case EntityType.entityview:\n case EntityType.dataset:\n return [\n [\n DownloadAction.exportTable,\n DownloadAction.programmaticAccess,\n DownloadAction.addToCart,\n ],\n ]\n case EntityType.datasetcollection:\n case EntityType.table:\n case EntityType.materializedview:\n case EntityType.submissionview:\n case EntityType.virtualtable:\n return [[DownloadAction.exportTable, DownloadAction.programmaticAccess]]\n case EntityType.link:\n return [[DownloadAction.programmaticAccess]]\n default:\n // this will fail if a new EntityType is added and not handled\n throw new Error(`Unhandled EntityType: ${type}`)\n }\n}\n\n// get the appropriate version number for download based on entity type\n// for datasets: returns the most recent released version if any exist, undefined otherwise\n// for other entities: returns the current version number\nfunction useGetLatestVersionNumber(entityId: string, entityType: EntityType) {\n // get entity data\n const { data: entityData, isLoading: entityDataLoading } =\n useGetEntity(entityId) // No version = latest\n\n // for datasets, check if any versions exist and use the most recent one\n const mustGetVersion = entityType === EntityType.dataset\n const { data: versionsData, isLoading: versionsLoading } = useGetVersions(\n entityId,\n 0,\n 1,\n {\n enabled: mustGetVersion,\n },\n )\n\n let latestVersionNumber: number | undefined\n\n if (mustGetVersion) {\n // for datasets, check if any versions exist\n if (versionsData?.results && versionsData.results.length > 0) {\n // Use the most recent released version (first in the list, since versions are returned in descending order)\n latestVersionNumber = versionsData.results[0].versionNumber\n } else {\n // no versions exist, use undefined (will use current/draft version)\n latestVersionNumber = undefined\n }\n } else {\n // for non-datasets, use the entity's version number\n latestVersionNumber =\n entityData && isVersionableEntity(entityData)\n ? entityData.versionNumber\n : undefined\n }\n\n const isLoading = entityDataLoading || versionsLoading\n\n return { latestVersionNumber, isLoading }\n}\n\n// create default queryBundleRequest with appropriate SQL\nfunction getDefaultQueryBundleRequestForEntity(\n entityId: string,\n versionNumber: number | undefined,\n entityType: EntityType,\n): QueryBundleRequest {\n let sql: string\n\n if (entityType === EntityType.dataset) {\n // for datasets:\n // - if a version number exists (released version), use it: syn123.5\n // - if no version number (no released versions), use current/draft: syn123\n sql = versionNumber\n ? `SELECT * FROM ${entityId}.${versionNumber}`\n : `SELECT * FROM ${entityId}`\n } else {\n // For non-datasets, always use entity ID without version\n sql = `SELECT * FROM ${entityId}`\n }\n\n return {\n concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest',\n entityId: `${entityId}`,\n query: {\n sql: sql,\n },\n partMask: 0,\n }\n}\n\nexport function EntityDownloadButton(props: {\n entityId: string\n name: string\n entityType: EntityType\n downloadConfirmationContainer?: RefObject<HTMLElement | null>\n disabled?: boolean\n}) {\n // get the appropriate version number for the entity\n const { latestVersionNumber } = useGetLatestVersionNumber(\n props.entityId,\n props.entityType,\n )\n // create queryBundleRequest with appropriate SQL based on entity type and version\n const defaultQueryBundleRequest = getDefaultQueryBundleRequestForEntity(\n props.entityId,\n latestVersionNumber,\n props.entityType,\n )\n\n // Get context and download functionality\n const { downloadCartPageUrl, isAuthenticated } = useSynapseContext()\n const { mutate: addFileToDownloadList } = useAddFileToDownloadList({\n onSuccess: data => {\n if (data.numberOfFilesAdded > 0) {\n displayFilesWereAddedToDownloadListSuccess(downloadCartPageUrl)\n } else {\n displayToast('0 Files added to your Download List', 'info')\n }\n },\n onError: error => {\n displayToast(error.reason, 'danger')\n },\n })\n\n // state to manage programmatic access modal visibility\n const [showProgrammaticAccess, setShowProgrammaticAccess] =\n useState<boolean>(false)\n\n // state to manage download confirmation visibility and loading\n const [showDownloadConfirmation, setShowDownloadConfirmation] =\n useState<boolean>(false)\n const [downloadConfirmationLoading, setDownloadConfirmationLoading] =\n useState<boolean>(false)\n\n const handleCloseProgrammaticAccess = () => {\n setShowProgrammaticAccess(false)\n }\n\n const isFolderOrProject = isContainerType(props.entityType)\n\n const {\n data: folderOrProjectStats,\n isLoading: isLoadingFolderOrProjectStats,\n } = useGetAddToDownloadListStats(\n {\n concreteType:\n 'org.sagebionetworks.repo.model.download.AddToDownloadListStatsRequest',\n request: {\n parentId: props.entityId,\n concreteType:\n 'org.sagebionetworks.repo.model.download.AddToDownloadListRequest',\n recursive: true,\n },\n },\n {\n enabled: isFolderOrProject,\n },\n )\n\n const folderOrProjectHasNoFiles =\n isFolderOrProject &&\n (isLoadingFolderOrProjectStats || folderOrProjectStats?.fileCount === 0)\n\n const { data: entityData } = useGetEntity(props.entityId)\n\n const { downloadFile } = useDirectDownloadHandler()\n\n const fileHandleId =\n entityData && isFileEntity(entityData)\n ? entityData.dataFileHandleId\n : undefined\n\n const onDownloadFile = fileHandleId\n ? () => {\n void downloadFile({\n fileHandleId,\n associatedObjectId: props.entityId,\n associatedObjectType: FileHandleAssociateType.FileEntity,\n })\n }\n : undefined\n\n const entityViewHasNoFiles =\n entityData && isEntityView(entityData) && !hasFilesInView(entityData)\n\n const datasetHasNoFiles =\n entityData &&\n isDataset(entityData) &&\n (!entityData.items || entityData.items.length === 0)\n\n const addToCartDisabled =\n folderOrProjectHasNoFiles || entityViewHasNoFiles || datasetHasNoFiles\n\n // state to manage export metadata modal visibility\n const [showExportMetadata, setShowExportMetadata] = useState<boolean>(false)\n\n const handleCloseExportMetadata = () => {\n setShowExportMetadata(false)\n }\n\n // Create download menu items\n const downloadActions = getDownloadActionsForEntityType(props.entityType)\n const downloadMenuItems = downloadActions.map(actionGroup =>\n actionGroup.map(action =>\n getMenuItemForAction(\n props.entityId,\n props.name,\n props.entityType,\n action,\n setShowProgrammaticAccess,\n setShowExportMetadata,\n addFileToDownloadList,\n setShowDownloadConfirmation,\n latestVersionNumber,\n addToCartDisabled,\n onDownloadFile,\n isAuthenticated,\n ),\n ),\n )\n\n // Return programmatic access modal content\n const { cliCode, rCode, pythonCode } = getProgrammaticAccessCode(\n props.entityType,\n props.entityId,\n latestVersionNumber,\n )\n\n const downloadConfirmation = showDownloadConfirmation ? (\n <EntityDownloadConfirmation\n entityId={props.entityId}\n handleClose={() => setShowDownloadConfirmation(false)}\n onIsLoadingChange={setDownloadConfirmationLoading}\n />\n ) : null\n\n return (\n <>\n <DropdownMenu\n items={downloadMenuItems}\n dropdownButtonText=\"Download\"\n buttonTooltip=\"Download options for this entity\"\n buttonProps={{\n variant: 'outlined',\n startIcon: <DownloadIcon />,\n disabled: props.disabled || downloadConfirmationLoading,\n }}\n />\n {downloadConfirmation &&\n (props.downloadConfirmationContainer?.current\n ? createPortal(\n downloadConfirmation,\n props.downloadConfirmationContainer.current,\n )\n : downloadConfirmation)}\n <ProgrammaticInstructionsModal\n show={showProgrammaticAccess}\n title={`Programmatic Access: ${props.name}`}\n onClose={handleCloseProgrammaticAccess}\n pythonCode={pythonCode}\n rCode={rCode}\n cliCode={cliCode}\n helpUrl=\"https://help.synapse.org/docs/Synapse-Docker-Registry.2011037752.html#SynapseDockerRegistry-UsingDockerImagesStoredintheSynapseDockerRegistry\"\n />\n {showExportMetadata && (\n <ModalDownload\n queryBundleRequest={defaultQueryBundleRequest}\n onClose={handleCloseExportMetadata}\n />\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,IAAiC,iGAKjC,IAA4B;AAUzC,SAAS,EACP,GACA,GACA,GACwB;CACxB,IAAM,IACJ,MAAS,EAAW,WAAW,IAAU,GAAG,EAAS,GAAG,MAAY;AACtE,SAAQ,GAAR;EACE,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAA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;GAC/C,CAAC;KAEJ,KAAA,GAEE,IACJ,KAAc,EAAa,EAAW,IAAI,CAAC,EAAe,EAAW,EAEjE,IACJ,KACA,EAAU,EAAW,KACpB,CAAC,EAAW,SAAS,EAAW,MAAM,WAAW,IAE9C,IACJ,KAA6B,KAAwB,GAGjD,CAAC,GAAoB,KAAyB,EAAkB,GAAM,EAEtE,WAAkC;AACtC,IAAsB,GAAM;IAKxB,KADkB,EAAgC,EAAM,WACpC,CAAgB,KAAI,MAC5C,EAAY,KAAI,MACd,EACE,EAAM,UACN,EAAM,MACN,EAAM,YACN,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,EACD,CACF,CACF,EAGK,EAAE,aAAS,WAAO,mBAAe,EACrC,EAAM,YACN,EAAM,UACN,EACD,EAEK,IAAuB,IAC3B,kBAAC,GAAD;EACE,UAAU,EAAM;EAChB,mBAAmB,EAA4B,GAAM;EACrD,mBAAmB;EACnB,CAAA,GACA;AAEJ,QACE,mBAAA,GAAA,EAAA,UAAA;EACE,kBAAC,GAAD;GACE,OAAO;GACP,oBAAmB;GACnB,eAAc;GACd,aAAa;IACX,SAAS;IACT,WAAW,kBAAC,GAAD,EAAgB,CAAA;IAC3B,UAAU,EAAM,YAAY;IAC7B;GACD,CAAA;EACD,MACE,EAAM,+BAA+B,UAClC,EACE,GACA,EAAM,8BAA8B,QACrC,GACD;EACN,kBAAC,GAAD;GACE,MAAM;GACN,OAAO,wBAAwB,EAAM;GACrC,SAAS;GACG;GACL;GACE;GACT,SAAQ;GACR,CAAA;EACD,KACC,kBAAC,GAAD;GACE,oBAAoB;GACpB,SAAS;GACT,CAAA;EAEH,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"EntityDownloadButton.js","names":[],"sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"sourcesContent":["import { useGetEntity, useGetVersions } from '@/synapse-queries'\nimport {\n useAddFileToDownloadList,\n useGetAddToDownloadListStats,\n} from '@/synapse-queries/index'\nimport { useSynapseContext } from '@/utils'\nimport {\n entityTypeToFriendlyName,\n hasFilesInView,\n isContainerType,\n isDataset,\n isEntityView,\n isVersionableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { useDirectDownloadHandler } from '@/utils/hooks/useDirectDownloadHandler'\nimport { isFileEntity } from '@/utils/types/IsType'\nimport { DownloadOutlined as DownloadIcon } from '@mui/icons-material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n FileHandleAssociateType,\n QueryBundleRequest,\n} from '@sage-bionetworks/synapse-types'\nimport { RefObject, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { displayFilesWereAddedToDownloadListSuccess } from '../download_list/DownloadConfirmationUtils'\nimport { EntityDownloadConfirmation } from '../EntityDownloadConfirmation'\nimport { DropdownMenu, DropdownMenuItem } from '../menu/DropdownMenu'\nimport { ModalDownload } from '../ModalDownload/ModalDownload'\nimport { ProgrammaticInstructionsModal } from '../ProgrammaticInstructionsModal/ProgrammaticInstructionsModal'\nimport { displayToast } from '../ToastMessage/index'\n\n// WIP\n// Per Nick Grosenbacher: For this to be reusable, I think we would also need to accept versionNumber as a prop. Where we would have the following behavior:\n// - If the version number is present, use it\n// - If the version number is null, do not use it,\n// - If the version number is undefined, then we would try to do the 'smart' thing-- get the latest version for datasets, otherwise don't use it.\n\n// Have to keep these consts outside of getProgrammaticAccessCode because\n// they are being called in ProgrammaticTableDownload.tsx\n// Python client import and login instructions\nexport const PYTHON_CLIENT_IMPORT_AND_LOGIN = `import synapseclient\nsyn = synapseclient.Synapse()\nsyn.login(authToken=\"YOUR_TOKEN_HERE\")`\n\n// R client import and login instructions\nexport const R_CLIENT_IMPORT_AND_LOGIN = `library(synapser)\nsynLogin(authToken=\"YOUR_TOKEN_HERE\")`\n\ntype ProgrammaticAccessCode = {\n cliCode: string | undefined\n rCode: string | undefined\n pythonCode: string | undefined\n}\n\n// Generate programmatic access code snippet content based on entity type\nfunction getProgrammaticAccessCode(\n type: EntityType,\n entityId: string,\n version: number | undefined,\n): ProgrammaticAccessCode {\n const id =\n type === EntityType.dataset && version ? `${entityId}.${version}` : entityId\n switch (type) {\n case EntityType.file:\n case EntityType.folder:\n case EntityType.project:\n case EntityType.link:\n return {\n cliCode: `synapse get -r ${entityId}`,\n rCode: `${R_CLIENT_IMPORT_AND_LOGIN} \\n\n# Download file\nsynGet('${entityId}')`,\n pythonCode: `${PYTHON_CLIENT_IMPORT_AND_LOGIN} \\n\n# Download file\nsyn.get('${entityId}')`,\n }\n case EntityType.dockerrepo:\n return {\n cliCode: `docker login -u <synapse username> -p <synapse password> docker.synapse.org \\n\ndocker pull docker.synapse.org/${entityId}/myrepo`,\n rCode: undefined,\n pythonCode: undefined,\n }\n case EntityType.dataset:\n case EntityType.entityview:\n case EntityType.datasetcollection:\n case EntityType.table:\n case EntityType.materializedview:\n case EntityType.submissionview:\n case EntityType.virtualtable:\n case EntityType.recordset:\n return {\n cliCode: `synapse get -q \"SELECT * FROM ${id}\"`,\n rCode: `${R_CLIENT_IMPORT_AND_LOGIN} \\n\nquery <- synTableQuery(\"SELECT * FROM ${id}\")\nread.table(query$filepath, sep=\",\")`,\n pythonCode: `${PYTHON_CLIENT_IMPORT_AND_LOGIN} \\n\nquery = syn.tableQuery(\"SELECT * FROM ${id}\")\nquery.asDataFrame()`,\n }\n default:\n throw new Error(`Unhandled EntityType: ${type}`)\n }\n}\n\nenum DownloadAction {\n downloadFile,\n addToCart,\n programmaticAccess,\n programmaticAccessDocker,\n exportTable,\n}\n\n// Function that creates menu items for download actions\nfunction getMenuItemForAction(\n entityId: string,\n entityName: string,\n entityType: EntityType,\n downloadAction: DownloadAction,\n setShowProgrammaticAccess: (show: boolean) => void,\n setShowExportMetadata: (show: boolean) => void,\n addFileToDownloadList: (params: {\n entityId: string\n entityVersionNumber: number | undefined\n }) => void,\n setShowDownloadConfirmation: (show: boolean) => void,\n versionNumber?: number,\n addToCartDisabled?: boolean,\n onDownloadFile?: () => void,\n isAuthenticated?: boolean,\n): DropdownMenuItem {\n switch (downloadAction) {\n case DownloadAction.downloadFile:\n return {\n text: 'Download File',\n onClick: () => {\n if (onDownloadFile) onDownloadFile()\n },\n tooltipText: isAuthenticated\n ? 'Download this file directly'\n : 'Sign in to download this file',\n disabled: !isAuthenticated,\n }\n case DownloadAction.addToCart:\n return {\n text: 'Add to Download List',\n disabled: addToCartDisabled,\n tooltipText: getAddToCartTooltip(entityType, !!addToCartDisabled),\n onClick: () => {\n if (\n entityType === EntityType.file ||\n entityType === EntityType.recordset\n ) {\n addFileToDownloadList({\n entityId,\n entityVersionNumber: versionNumber,\n })\n } else {\n setShowDownloadConfirmation(true)\n }\n },\n }\n case DownloadAction.programmaticAccess:\n return {\n text: 'Programmatic Access',\n onClick: () => {\n setShowProgrammaticAccess(true)\n },\n tooltipText: 'View programmatic access options',\n }\n case DownloadAction.programmaticAccessDocker:\n return {\n text: 'Programmatic Access (Docker)',\n onClick: () => {\n setShowProgrammaticAccess(true)\n },\n tooltipText: 'View programmatic options to pull Docker image',\n }\n case DownloadAction.exportTable:\n return {\n text: 'Export Table',\n onClick: () => {\n setShowExportMetadata(true)\n },\n tooltipText: 'Export table data',\n }\n }\n}\n\n/**\n * Determines the tooltip message based on the entity type and its \"add to cart\" status.\n */\nconst getAddToCartTooltip = (\n entityType: EntityType,\n isDisabled: boolean,\n): string => {\n if (!isDisabled) {\n return 'Add file(s) to your download list'\n }\n const entityFriendlyName = entityTypeToFriendlyName(entityType)\n return `This ${entityFriendlyName} has no accessible files`\n}\n\n// Function that returns DropdownMenuItem\nexport function getDownloadActionsForEntityType(\n type: EntityType,\n): DownloadAction[][] {\n switch (type) {\n case EntityType.file:\n case EntityType.recordset:\n return [\n [DownloadAction.downloadFile],\n [DownloadAction.addToCart, DownloadAction.programmaticAccess],\n ]\n case EntityType.project:\n case EntityType.folder:\n return [[DownloadAction.addToCart, DownloadAction.programmaticAccess]]\n case EntityType.dockerrepo:\n return [[DownloadAction.programmaticAccessDocker]]\n case EntityType.entityview:\n case EntityType.dataset:\n return [\n [\n DownloadAction.exportTable,\n DownloadAction.programmaticAccess,\n DownloadAction.addToCart,\n ],\n ]\n case EntityType.datasetcollection:\n case EntityType.table:\n case EntityType.materializedview:\n case EntityType.submissionview:\n case EntityType.virtualtable:\n return [[DownloadAction.exportTable, DownloadAction.programmaticAccess]]\n case EntityType.link:\n return [[DownloadAction.programmaticAccess]]\n case EntityType.searchindex:\n return []\n default:\n // this will fail if a new EntityType is added and not handled\n throw new Error(`Unhandled EntityType: ${type}`)\n }\n}\n\n// get the appropriate version number for download based on entity type\n// for datasets: returns the most recent released version if any exist, undefined otherwise\n// for other entities: returns the current version number\nfunction useGetLatestVersionNumber(entityId: string, entityType: EntityType) {\n // get entity data\n const { data: entityData, isLoading: entityDataLoading } =\n useGetEntity(entityId) // No version = latest\n\n // for datasets, check if any versions exist and use the most recent one\n const mustGetVersion = entityType === EntityType.dataset\n const { data: versionsData, isLoading: versionsLoading } = useGetVersions(\n entityId,\n 0,\n 1,\n {\n enabled: mustGetVersion,\n },\n )\n\n let latestVersionNumber: number | undefined\n\n if (mustGetVersion) {\n // for datasets, check if any versions exist\n if (versionsData?.results && versionsData.results.length > 0) {\n // Use the most recent released version (first in the list, since versions are returned in descending order)\n latestVersionNumber = versionsData.results[0].versionNumber\n } else {\n // no versions exist, use undefined (will use current/draft version)\n latestVersionNumber = undefined\n }\n } else {\n // for non-datasets, use the entity's version number\n latestVersionNumber =\n entityData && isVersionableEntity(entityData)\n ? entityData.versionNumber\n : undefined\n }\n\n const isLoading = entityDataLoading || versionsLoading\n\n return { latestVersionNumber, isLoading }\n}\n\n// create default queryBundleRequest with appropriate SQL\nfunction getDefaultQueryBundleRequestForEntity(\n entityId: string,\n versionNumber: number | undefined,\n entityType: EntityType,\n): QueryBundleRequest {\n let sql: string\n\n if (entityType === EntityType.dataset) {\n // for datasets:\n // - if a version number exists (released version), use it: syn123.5\n // - if no version number (no released versions), use current/draft: syn123\n sql = versionNumber\n ? `SELECT * FROM ${entityId}.${versionNumber}`\n : `SELECT * FROM ${entityId}`\n } else {\n // For non-datasets, always use entity ID without version\n sql = `SELECT * FROM ${entityId}`\n }\n\n return {\n concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest',\n entityId: `${entityId}`,\n query: {\n sql: sql,\n },\n partMask: 0,\n }\n}\n\nexport function EntityDownloadButton(props: {\n entityId: string\n name: string\n entityType: EntityType\n downloadConfirmationContainer?: RefObject<HTMLElement | null>\n disabled?: boolean\n}) {\n // get the appropriate version number for the entity\n const { latestVersionNumber } = useGetLatestVersionNumber(\n props.entityId,\n props.entityType,\n )\n // create queryBundleRequest with appropriate SQL based on entity type and version\n const defaultQueryBundleRequest = getDefaultQueryBundleRequestForEntity(\n props.entityId,\n latestVersionNumber,\n props.entityType,\n )\n\n // Get context and download functionality\n const { downloadCartPageUrl, isAuthenticated } = useSynapseContext()\n const { mutate: addFileToDownloadList } = useAddFileToDownloadList({\n onSuccess: data => {\n if (data.numberOfFilesAdded > 0) {\n displayFilesWereAddedToDownloadListSuccess(downloadCartPageUrl)\n } else {\n displayToast('0 Files added to your Download List', 'info')\n }\n },\n onError: error => {\n displayToast(error.reason, 'danger')\n },\n })\n\n // state to manage programmatic access modal visibility\n const [showProgrammaticAccess, setShowProgrammaticAccess] =\n useState<boolean>(false)\n\n // state to manage download confirmation visibility and loading\n const [showDownloadConfirmation, setShowDownloadConfirmation] =\n useState<boolean>(false)\n const [downloadConfirmationLoading, setDownloadConfirmationLoading] =\n useState<boolean>(false)\n\n const handleCloseProgrammaticAccess = () => {\n setShowProgrammaticAccess(false)\n }\n\n const isFolderOrProject = isContainerType(props.entityType)\n\n const {\n data: folderOrProjectStats,\n isLoading: isLoadingFolderOrProjectStats,\n } = useGetAddToDownloadListStats(\n {\n concreteType:\n 'org.sagebionetworks.repo.model.download.AddToDownloadListStatsRequest',\n request: {\n parentId: props.entityId,\n concreteType:\n 'org.sagebionetworks.repo.model.download.AddToDownloadListRequest',\n recursive: true,\n },\n },\n {\n enabled: isFolderOrProject,\n },\n )\n\n const folderOrProjectHasNoFiles =\n isFolderOrProject &&\n (isLoadingFolderOrProjectStats || folderOrProjectStats?.fileCount === 0)\n\n const { data: entityData } = useGetEntity(props.entityId)\n\n const { downloadFile } = useDirectDownloadHandler()\n\n const fileHandleId =\n entityData && isFileEntity(entityData)\n ? entityData.dataFileHandleId\n : undefined\n\n const onDownloadFile = fileHandleId\n ? () => {\n void downloadFile({\n fileHandleId,\n associatedObjectId: props.entityId,\n associatedObjectType: FileHandleAssociateType.FileEntity,\n })\n }\n : undefined\n\n const entityViewHasNoFiles =\n entityData && isEntityView(entityData) && !hasFilesInView(entityData)\n\n const datasetHasNoFiles =\n entityData &&\n isDataset(entityData) &&\n (!entityData.items || entityData.items.length === 0)\n\n const addToCartDisabled =\n folderOrProjectHasNoFiles || entityViewHasNoFiles || datasetHasNoFiles\n\n // state to manage export metadata modal visibility\n const [showExportMetadata, setShowExportMetadata] = useState<boolean>(false)\n\n const handleCloseExportMetadata = () => {\n setShowExportMetadata(false)\n }\n\n // Create download menu items\n const downloadActions = getDownloadActionsForEntityType(props.entityType)\n const downloadMenuItems = downloadActions.map(actionGroup =>\n actionGroup.map(action =>\n getMenuItemForAction(\n props.entityId,\n props.name,\n props.entityType,\n action,\n setShowProgrammaticAccess,\n setShowExportMetadata,\n addFileToDownloadList,\n setShowDownloadConfirmation,\n latestVersionNumber,\n addToCartDisabled,\n onDownloadFile,\n isAuthenticated,\n ),\n ),\n )\n\n // Return programmatic access modal content\n const { cliCode, rCode, pythonCode } = getProgrammaticAccessCode(\n props.entityType,\n props.entityId,\n latestVersionNumber,\n )\n\n const downloadConfirmation = showDownloadConfirmation ? (\n <EntityDownloadConfirmation\n entityId={props.entityId}\n handleClose={() => setShowDownloadConfirmation(false)}\n onIsLoadingChange={setDownloadConfirmationLoading}\n />\n ) : null\n\n return (\n <>\n <DropdownMenu\n items={downloadMenuItems}\n dropdownButtonText=\"Download\"\n buttonTooltip=\"Download options for this entity\"\n buttonProps={{\n variant: 'outlined',\n startIcon: <DownloadIcon />,\n disabled: props.disabled || downloadConfirmationLoading,\n }}\n />\n {downloadConfirmation &&\n (props.downloadConfirmationContainer?.current\n ? createPortal(\n downloadConfirmation,\n props.downloadConfirmationContainer.current,\n )\n : downloadConfirmation)}\n <ProgrammaticInstructionsModal\n show={showProgrammaticAccess}\n title={`Programmatic Access: ${props.name}`}\n onClose={handleCloseProgrammaticAccess}\n pythonCode={pythonCode}\n rCode={rCode}\n cliCode={cliCode}\n helpUrl=\"https://help.synapse.org/docs/Synapse-Docker-Registry.2011037752.html#SynapseDockerRegistry-UsingDockerImagesStoredintheSynapseDockerRegistry\"\n />\n {showExportMetadata && (\n <ModalDownload\n queryBundleRequest={defaultQueryBundleRequest}\n onClose={handleCloseExportMetadata}\n />\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,IAAiC,iGAKjC,IAA4B;AAUzC,SAAS,EACP,GACA,GACA,GACwB;CACxB,IAAM,IACJ,MAAS,EAAW,WAAW,IAAU,GAAG,EAAS,GAAG,MAAY;AACtE,SAAQ,GAAR;EACE,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW,KACd,QAAO;GACL,SAAS,kBAAkB;GAC3B,OAAO,GAAG,EAA0B;;UAElC,EAAS;GACX,YAAY,GAAG,EAA+B;;WAE3C,EAAS;GACb;EACH,KAAK,EAAW,WACd,QAAO;GACL,SAAS;iCACgB,EAAS;GAClC,OAAO,KAAA;GACP,YAAY,KAAA;GACb;EACH,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW;EAChB,KAAK,EAAW,UACd,QAAO;GACL,SAAS,iCAAiC,EAAG;GAC7C,OAAO,GAAG,EAA0B;wCACJ,EAAG;;GAEnC,YAAY,GAAG,EAA+B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AAe,EACrC,EAAM,YACN,EAAM,UACN,EACD,EAEK,IAAuB,IAC3B,kBAAC,GAAD;EACE,UAAU,EAAM;EAChB,mBAAmB,EAA4B,GAAM;EACrD,mBAAmB;EACnB,CAAA,GACA;AAEJ,QACE,mBAAA,GAAA,EAAA,UAAA;EACE,kBAAC,GAAD;GACE,OAAO;GACP,oBAAmB;GACnB,eAAc;GACd,aAAa;IACX,SAAS;IACT,WAAW,kBAAC,GAAD,EAAgB,CAAA;IAC3B,UAAU,EAAM,YAAY;IAC7B;GACD,CAAA;EACD,MACE,EAAM,+BAA+B,UAClC,EACE,GACA,EAAM,8BAA8B,QACrC,GACD;EACN,kBAAC,GAAD;GACE,MAAM;GACN,OAAO,wBAAwB,EAAM;GACrC,SAAS;GACG;GACL;GACE;GACT,SAAQ;GACR,CAAA;EACD,KACC,kBAAC,GAAD;GACE,oBAAoB;GACpB,SAAS;GACT,CAAA;EAEH,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityViewMaskEditor.d.ts","sourceRoot":"","sources":["../../../src/components/EntityViewScopeEditor/EntityViewMaskEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityViewMaskEditor.d.ts","sourceRoot":"","sources":["../../../src/components/EntityViewScopeEditor/EntityViewMaskEditor.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAUD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,WAShD;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CA0C5E"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Alert as e, Checkbox as t, FormControlLabel as n, FormGroup as r, Typography as i } from "@mui/material";
|
|
2
2
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import { ENTITY_VIEW_TYPE_MASK_DATASET as c,
|
|
3
|
+
import { ENTITY_VIEW_TYPE_MASK_DATASET as c, ENTITY_VIEW_TYPE_MASK_DOCKER as l, ENTITY_VIEW_TYPE_MASK_FILE as u, ENTITY_VIEW_TYPE_MASK_FOLDER as d, ENTITY_VIEW_TYPE_MASK_TABLE as f } from "@sage-bionetworks/synapse-types";
|
|
4
4
|
//#region src/components/EntityViewScopeEditor/EntityViewMaskEditor.tsx
|
|
5
|
-
var
|
|
6
|
-
["Files",
|
|
7
|
-
["Folders",
|
|
8
|
-
["Tables",
|
|
9
|
-
["Datasets", c]
|
|
5
|
+
var p = [
|
|
6
|
+
["Files", u],
|
|
7
|
+
["Folders", d],
|
|
8
|
+
["Tables", f],
|
|
9
|
+
["Datasets", c],
|
|
10
|
+
["Docker Repositories", l]
|
|
10
11
|
];
|
|
11
|
-
function
|
|
12
|
-
return
|
|
12
|
+
function m(e) {
|
|
13
|
+
return p.forEach(([, t]) => {
|
|
13
14
|
(e & t) !== 0 && (e -= t);
|
|
14
15
|
}), e === 0;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
let { value: l, onChange: u, disabled: d = !1 } = c,
|
|
17
|
+
function h(c) {
|
|
18
|
+
let { value: l, onChange: u, disabled: d = !1 } = c, f = !m(l);
|
|
18
19
|
return /* @__PURE__ */ s(a, { children: [
|
|
19
20
|
/* @__PURE__ */ o(i, {
|
|
20
21
|
variant: "body1",
|
|
@@ -27,17 +28,17 @@ function m(c) {
|
|
|
27
28
|
}),
|
|
28
29
|
/* @__PURE__ */ o(r, {
|
|
29
30
|
sx: { gap: 1 },
|
|
30
|
-
children:
|
|
31
|
+
children: p.map(([e, r]) => /* @__PURE__ */ o(n, {
|
|
31
32
|
control: /* @__PURE__ */ o(t, {}),
|
|
32
33
|
label: e,
|
|
33
34
|
checked: (l & r) > 0,
|
|
34
|
-
disabled:
|
|
35
|
+
disabled: f || d,
|
|
35
36
|
onChange: () => {
|
|
36
37
|
u(l ^ r);
|
|
37
38
|
}
|
|
38
39
|
}, e))
|
|
39
40
|
}),
|
|
40
|
-
|
|
41
|
+
f && /* @__PURE__ */ o(e, {
|
|
41
42
|
severity: "warning",
|
|
42
43
|
sx: { my: 2.25 },
|
|
43
44
|
children: "A custom mask is in use. Changes cannot be made in the UI."
|
|
@@ -45,6 +46,6 @@ function m(c) {
|
|
|
45
46
|
] });
|
|
46
47
|
}
|
|
47
48
|
//#endregion
|
|
48
|
-
export {
|
|
49
|
+
export { h as default, m as isMaskSupportedInUI };
|
|
49
50
|
|
|
50
51
|
//# sourceMappingURL=EntityViewMaskEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityViewMaskEditor.js","names":[],"sources":["../../../src/components/EntityViewScopeEditor/EntityViewMaskEditor.tsx"],"sourcesContent":["import {\n Alert,\n Checkbox,\n FormControlLabel,\n FormGroup,\n Typography,\n} from '@mui/material'\nimport {\n ENTITY_VIEW_TYPE_MASK_DATASET,\n ENTITY_VIEW_TYPE_MASK_FILE,\n ENTITY_VIEW_TYPE_MASK_FOLDER,\n ENTITY_VIEW_TYPE_MASK_TABLE,\n} from '@sage-bionetworks/synapse-types'\n\nexport type EntityViewMaskEditorProps = {\n value: number\n onChange: (mask: number) => void\n disabled?: boolean\n}\n\nconst maskLabelPairs: [string, number][] = [\n ['Files', ENTITY_VIEW_TYPE_MASK_FILE],\n ['Folders', ENTITY_VIEW_TYPE_MASK_FOLDER],\n ['Tables', ENTITY_VIEW_TYPE_MASK_TABLE],\n ['Datasets', ENTITY_VIEW_TYPE_MASK_DATASET],\n]\n\nexport function isMaskSupportedInUI(value: number) {\n maskLabelPairs.forEach(([, mask]) => {\n // Remove each supported bit\n if ((value & mask) !== 0) {\n value = value - mask\n }\n })\n // If value is not zero, then some unsupported bit remains\n return value === 0\n}\n\nexport default function EntityViewMaskEditor(props: EntityViewMaskEditorProps) {\n const { value, onChange, disabled = false } = props\n\n const customMaskInUse = !isMaskSupportedInUI(value)\n\n return (\n <>\n <Typography\n variant={'body1'}\n sx={{\n mt: 2.5,\n mb: 1.25,\n fontWeight: 700,\n }}\n >\n Include in View\n </Typography>\n <FormGroup sx={{ gap: 1 }}>\n {maskLabelPairs.map(([label, mask]) => (\n <FormControlLabel\n control={<Checkbox />}\n key={label}\n label={label}\n checked={\n // Checked if the mask bit is set\n (value & mask) > 0\n }\n disabled={customMaskInUse || disabled}\n onChange={() => {\n // Toggle the clicked mask value with XOR\n onChange(value ^ mask)\n }}\n />\n ))}\n </FormGroup>\n {customMaskInUse && (\n <Alert severity={'warning'} sx={{ my: 2.25 }}>\n A custom mask is in use. Changes cannot be made in the UI.\n </Alert>\n )}\n </>\n )\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"EntityViewMaskEditor.js","names":[],"sources":["../../../src/components/EntityViewScopeEditor/EntityViewMaskEditor.tsx"],"sourcesContent":["import {\n Alert,\n Checkbox,\n FormControlLabel,\n FormGroup,\n Typography,\n} from '@mui/material'\nimport {\n ENTITY_VIEW_TYPE_MASK_DATASET,\n ENTITY_VIEW_TYPE_MASK_FILE,\n ENTITY_VIEW_TYPE_MASK_FOLDER,\n ENTITY_VIEW_TYPE_MASK_TABLE,\n ENTITY_VIEW_TYPE_MASK_DOCKER,\n} from '@sage-bionetworks/synapse-types'\n\nexport type EntityViewMaskEditorProps = {\n value: number\n onChange: (mask: number) => void\n disabled?: boolean\n}\n\nconst maskLabelPairs: [string, number][] = [\n ['Files', ENTITY_VIEW_TYPE_MASK_FILE],\n ['Folders', ENTITY_VIEW_TYPE_MASK_FOLDER],\n ['Tables', ENTITY_VIEW_TYPE_MASK_TABLE],\n ['Datasets', ENTITY_VIEW_TYPE_MASK_DATASET],\n ['Docker Repositories', ENTITY_VIEW_TYPE_MASK_DOCKER],\n]\n\nexport function isMaskSupportedInUI(value: number) {\n maskLabelPairs.forEach(([, mask]) => {\n // Remove each supported bit\n if ((value & mask) !== 0) {\n value = value - mask\n }\n })\n // If value is not zero, then some unsupported bit remains\n return value === 0\n}\n\nexport default function EntityViewMaskEditor(props: EntityViewMaskEditorProps) {\n const { value, onChange, disabled = false } = props\n\n const customMaskInUse = !isMaskSupportedInUI(value)\n\n return (\n <>\n <Typography\n variant={'body1'}\n sx={{\n mt: 2.5,\n mb: 1.25,\n fontWeight: 700,\n }}\n >\n Include in View\n </Typography>\n <FormGroup sx={{ gap: 1 }}>\n {maskLabelPairs.map(([label, mask]) => (\n <FormControlLabel\n control={<Checkbox />}\n key={label}\n label={label}\n checked={\n // Checked if the mask bit is set\n (value & mask) > 0\n }\n disabled={customMaskInUse || disabled}\n onChange={() => {\n // Toggle the clicked mask value with XOR\n onChange(value ^ mask)\n }}\n />\n ))}\n </FormGroup>\n {customMaskInUse && (\n <Alert severity={'warning'} sx={{ my: 2.25 }}>\n A custom mask is in use. Changes cannot be made in the UI.\n </Alert>\n )}\n </>\n )\n}\n"],"mappings":";;;;AAqBA,IAAM,IAAqC;CACzC,CAAC,SAAS,EAA2B;CACrC,CAAC,WAAW,EAA6B;CACzC,CAAC,UAAU,EAA4B;CACvC,CAAC,YAAY,EAA8B;CAC3C,CAAC,uBAAuB,EAA6B;CACtD;AAED,SAAgB,EAAoB,GAAe;AAQjD,QAPA,EAAe,SAAS,GAAG,OAAU;AAEnC,GAAK,IAAQ,OAAU,MACrB,KAAgB;GAElB,EAEK,MAAU;;AAGnB,SAAwB,EAAqB,GAAkC;CAC7E,IAAM,EAAE,UAAO,aAAU,cAAW,OAAU,GAExC,IAAkB,CAAC,EAAoB,EAAM;AAEnD,QACE,kBAAA,GAAA,EAAA,UAAA;EACE,kBAAC,GAAD;GACE,SAAS;GACT,IAAI;IACF,IAAI;IACJ,IAAI;IACJ,YAAY;IACb;aACF;GAEY,CAAA;EACb,kBAAC,GAAD;GAAW,IAAI,EAAE,KAAK,GAAG;aACtB,EAAe,KAAK,CAAC,GAAO,OAC3B,kBAAC,GAAD;IACE,SAAS,kBAAC,GAAD,EAAY,CAAA;IAEd;IACP,UAEG,IAAQ,KAAQ;IAEnB,UAAU,KAAmB;IAC7B,gBAAgB;AAEd,OAAS,IAAQ,EAAK;;IAExB,EAXK,EAWL,CACF;GACQ,CAAA;EACX,KACC,kBAAC,GAAD;GAAO,UAAU;GAAW,IAAI,EAAE,IAAI,MAAM;aAAE;GAEtC,CAAA;EAET,EAAA,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { DiscussionReplyBundle } from '@sage-bionetworks/synapse-types';
|
|
|
2
2
|
export type DiscussionReplyProps = {
|
|
3
3
|
reply: DiscussionReplyBundle;
|
|
4
4
|
isReplyAuthorModerator?: boolean;
|
|
5
|
+
isForumModerator?: boolean;
|
|
5
6
|
onClickLink?: () => void;
|
|
6
7
|
};
|
|
7
8
|
export declare function DiscussionReply(props: DiscussionReplyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscussionReply.d.ts","sourceRoot":"","sources":["../../../src/components/Forum/DiscussionReply.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EAEtB,MAAM,iCAAiC,CAAA;AAcxC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,qBAAqB,CAAA;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"DiscussionReply.d.ts","sourceRoot":"","sources":["../../../src/components/Forum/DiscussionReply.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EAEtB,MAAM,iCAAiC,CAAA;AAcxC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,qBAAqB,CAAA;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA8H1D"}
|