diff --git a/client/modules/_common_components/src/datafiles/DatafilesBreadcrumb/DatafilesBreadcrumb.tsx b/client/modules/_common_components/src/datafiles/DatafilesBreadcrumb/DatafilesBreadcrumb.tsx index 50c7a922db..1a59b8bedf 100644 --- a/client/modules/_common_components/src/datafiles/DatafilesBreadcrumb/DatafilesBreadcrumb.tsx +++ b/client/modules/_common_components/src/datafiles/DatafilesBreadcrumb/DatafilesBreadcrumb.tsx @@ -1,7 +1,12 @@ import { Breadcrumb, BreadcrumbProps } from 'antd'; import React from 'react'; import styles from './DatafilesBreadcrumb.module.css'; -import { getSystemRootDisplayName, useAuthenticatedUser } from '@client/hooks'; +import { + getSystemRootDisplayName, + useAuthenticatedUser, + USER_MYDATA_SYSTEM, + USER_WORK_SYSTEM, +} from '@client/hooks'; function getPathRoutes( baseRoute: string, @@ -50,13 +55,6 @@ export const DatafilesBreadcrumb: React.FC< ); }; -function isUserHomeSystem(system: string) { - return [ - 'designsafe.storage.default', - 'designsafe.storage.frontera.work', - ].includes(system); -} - export const BaseFileListingBreadcrumb: React.FC< { api: string; @@ -78,7 +76,10 @@ export const BaseFileListingBreadcrumb: React.FC< const { user } = useAuthenticatedUser(); const rootAlias = systemRootAlias || getSystemRootDisplayName(api, system, systemLabel); - const systemRoot = isUserHomeSystem(system) ? '/' + user?.username : ''; + let systemRoot = ''; + if (system === USER_MYDATA_SYSTEM) systemRoot = '/' + user?.username; + if (system === USER_WORK_SYSTEM) systemRoot = '/work/' + user?.homedir; + return ( diff --git a/client/modules/_hooks/src/datafiles/index.ts b/client/modules/_hooks/src/datafiles/index.ts index df24b2e502..6c528a1d42 100644 --- a/client/modules/_hooks/src/datafiles/index.ts +++ b/client/modules/_hooks/src/datafiles/index.ts @@ -22,10 +22,7 @@ export { useUploadFile } from './useUploadFile'; export { useUploadFolder } from './useUploadFolder'; export { useFileDetail } from './useFileDetail'; -export { - usePathDisplayName, - getSystemRootDisplayName, -} from './usePathDisplayName'; +export * from './usePathDisplayName'; export * from './nees'; export * from './projects'; diff --git a/client/modules/_hooks/src/datafiles/usePathDisplayName.ts b/client/modules/_hooks/src/datafiles/usePathDisplayName.ts index 1ef5bc39fb..7f74981912 100644 --- a/client/modules/_hooks/src/datafiles/usePathDisplayName.ts +++ b/client/modules/_hooks/src/datafiles/usePathDisplayName.ts @@ -1,6 +1,9 @@ import { useCallback } from 'react'; import { useAuthenticatedUser } from '../useAuthenticatedUser'; +export const USER_MYDATA_SYSTEM = 'designsafe.storage.default'; +export const USER_WORK_SYSTEM = 'cloud.data'; + export function getSystemRootDisplayName( api: string, system: string, @@ -9,10 +12,11 @@ export function getSystemRootDisplayName( if (api === 'googledrive') return 'Google Drive'; if (api === 'box') return 'Box'; if (api === 'dropbox') return 'Dropbox'; + return ( { - 'designsafe.storage.default': 'My Data', - 'designsafe.storage.frontera.work': 'HPC Work', + [USER_MYDATA_SYSTEM]: 'My Data', + [USER_WORK_SYSTEM]: 'Work', 'designsafe.storage.community': 'Community Data', }[system] ?? label ); @@ -23,20 +27,22 @@ function _getPathDisplayName( system: string, path: string, label: string, - username?: string + username?: string, + homedir?: string ) { const usernamePath = encodeURIComponent('/' + username); + const workdirPath = `/work/${homedir}`; if (!path) return getSystemRootDisplayName(api, system, label); if (api === 'googledrive' && !path) return 'Google Drive'; if (api === 'dropbox' && !path) return 'Dropbox'; if (api === 'box' && !path) return 'Box'; - if (system === 'designsafe.storage.default' && path === usernamePath) { + if (system === USER_MYDATA_SYSTEM && path === usernamePath) { return 'My Data'; } - if (system === 'designsafe.storage.frontera.work' && path === usernamePath) { - return 'HPC Work'; + if (system === USER_WORK_SYSTEM && path === workdirPath) { + return 'Work'; } return decodeURIComponent(path).split('/').slice(-1)[0] || label; @@ -47,7 +53,14 @@ export function usePathDisplayName() { const getPathDisplayName = useCallback( (api: string, system: string, path: string, label: string = 'Data Files') => - _getPathDisplayName(api, system, path, label, user?.username), + _getPathDisplayName( + api, + system, + path, + label, + user?.username, + user?.homedir + ), [user] ); diff --git a/client/modules/_hooks/src/systems/types.ts b/client/modules/_hooks/src/systems/types.ts index 742588cfd0..afc7f718bb 100644 --- a/client/modules/_hooks/src/systems/types.ts +++ b/client/modules/_hooks/src/systems/types.ts @@ -61,6 +61,7 @@ export type TTapisSystem = { label?: string; keyservice?: boolean; isMyData?: boolean; + hasWork?: boolean; portalNames: string[]; }; importRefId?: string; diff --git a/client/modules/_hooks/src/useAuthenticatedUser.ts b/client/modules/_hooks/src/useAuthenticatedUser.ts index 0d74822a25..794e20176a 100644 --- a/client/modules/_hooks/src/useAuthenticatedUser.ts +++ b/client/modules/_hooks/src/useAuthenticatedUser.ts @@ -4,6 +4,7 @@ export type TUser = { lastName: string; email: string; institution: string; + homedir: string; }; declare global { diff --git a/client/modules/datafiles/src/DatafilesModal/CopyModal/CopyModal.tsx b/client/modules/datafiles/src/DatafilesModal/CopyModal/CopyModal.tsx index 5afa8d33a1..62554daa90 100644 --- a/client/modules/datafiles/src/DatafilesModal/CopyModal/CopyModal.tsx +++ b/client/modules/datafiles/src/DatafilesModal/CopyModal/CopyModal.tsx @@ -154,8 +154,8 @@ export const CopyModal: React.FC<{ setShowProjects(false); setDest({ destApi: 'tapis', - destSystem: 'designsafe.storage.frontera.work', - destPath: encodeURIComponent('/' + user?.username), + destSystem: 'cloud.data', + destPath: encodeURIComponent('/work/' + user?.homedir), }); break; case 'myprojects': @@ -250,7 +250,7 @@ export const CopyModal: React.FC<{