@@ -26,8 +26,8 @@ import {
2626 buildFileSystemSelection ,
2727 buildFileSystemSelectionPath ,
2828 splitFileSystemSelection ,
29- buildFileSystemNavigationPath ,
3029 buildBreadcrumbNavigation ,
30+ buildFileSystemNavigationPath ,
3131} from '~/modules/filesystem/helpers/filesystem-helper'
3232import { formatDateTime } from '~/helpers/date-helper'
3333import { FileTableSortableColumn } from '~/helpers/ui-table-helper'
@@ -62,7 +62,6 @@ import LoadingButton from '~/components/buttons/LoadingButton'
6262import SimplePanel from '~/components/panels/SimplePanel'
6363// views
6464import SimpleView , { SimpleViewSize } from '~/components/views/SimpleView'
65- import { showInputValidation } from '~/components/forms/validations/ValidationForm'
6665
6766const copyToClipboard = ( file : File , fileSystem : FileSystem ) => {
6867 const path = `${ fileSystem . path } /${ file . name } `
@@ -74,9 +73,16 @@ interface FileItemProps {
7473 currentPath : string
7574 fileSystem : FileSystem
7675 system : System
76+ accountName : string
7777}
7878
79- const FileItem : React . FC < FileItemProps > = ( { file, currentPath, fileSystem, system } ) => {
79+ const FileItem : React . FC < FileItemProps > = ( {
80+ file,
81+ currentPath,
82+ fileSystem,
83+ system,
84+ accountName,
85+ } ) => {
8086 const [ changeOwnershipDialogOpen , setChangeOwnershipDialogOpen ] = useState ( false )
8187 const [ changePermissionDialogDialogOpen , setChangePermissionDialogDialogOpen ] = useState ( false )
8288 const [ checksumDialogOpen , setChecksumDialogOpen ] = useState ( false )
@@ -148,6 +154,7 @@ const FileItem: React.FC<FileItemProps> = ({ file, currentPath, fileSystem, syst
148154 system = { system . name }
149155 file = { file }
150156 currentPath = { currentPath }
157+ accountName = { accountName }
151158 open = { downloadkDialogOpen }
152159 onClose = { ( ) => setDownloadDialogOpen ( false ) }
153160 />
@@ -303,9 +310,16 @@ interface DirectoryItemProps {
303310 currentPath : string
304311 fileSystem : FileSystem
305312 system : System
313+ accountName : string
306314}
307315
308- const DirectoryItem : React . FC < DirectoryItemProps > = ( { file, currentPath, fileSystem, system } ) => {
316+ const DirectoryItem : React . FC < DirectoryItemProps > = ( {
317+ file,
318+ currentPath,
319+ fileSystem,
320+ system,
321+ accountName,
322+ } ) => {
309323 const [ changeOwnershipDialogOpen , setChangeOwnershipDialogOpen ] = useState ( false )
310324 const [ changePermissionDialogDialogOpen , setChangePermissionDialogDialogOpen ] = useState ( false )
311325 const [ copyDialogOpen , setCopyDialogOpen ] = useState ( false )
@@ -316,7 +330,7 @@ const DirectoryItem: React.FC<DirectoryItemProps> = ({ file, currentPath, fileSy
316330 const [ removeDialogOpen , setRemoveDialogOpen ] = useState ( false )
317331 const { name } = file
318332
319- const navigationPath = buildFileSystemNavigationPath ( system . name , currentPath , name )
333+ const navigationPath = buildFileSystemNavigationPath ( system . name , currentPath , accountName , name )
320334 return (
321335 < tr className = 'even:bg-blue-50' >
322336 < td className = 'px-4 py-3 font-medium' >
@@ -493,14 +507,21 @@ interface BreadcrumbNavigationProps {
493507 currentPath : string
494508 system : System
495509 fileSystem : FileSystem
510+ accountName : string
496511}
497512
498513const BreadcrumbNavigation : React . FC < BreadcrumbNavigationProps > = ( {
499514 currentPath,
500515 system,
501516 fileSystem,
517+ accountName,
502518} ) => {
503- const navigationData = buildBreadcrumbNavigation ( currentPath , fileSystem . path , system . name )
519+ const navigationData = buildBreadcrumbNavigation (
520+ currentPath ,
521+ fileSystem . path ,
522+ system . name ,
523+ accountName ,
524+ )
504525 return (
505526 < >
506527 < nav className = 'flex rounded-md p-2 mb-4 border border-gray-200' aria-label = 'Breadcrumb' >
@@ -540,6 +561,7 @@ interface FileSystemSelectionData {
540561 system : System
541562 systems : System [ ]
542563 username : string
564+ accountName : string
543565}
544566
545567const FileSystemSelection : React . FC < FileSystemSelectionData > = ( {
@@ -548,11 +570,12 @@ const FileSystemSelection: React.FC<FileSystemSelectionData> = ({
548570 system,
549571 systems,
550572 username,
573+ accountName,
551574} ) => {
552575 const onChangeHandler = ( event : any ) => {
553576 const selectedValue = event . target . value
554577 const { systemName, fileSystemPath } = splitFileSystemSelection ( selectedValue )
555- const newNavigationPath = buildFileSystemNavigationPath ( systemName , fileSystemPath )
578+ const newNavigationPath = buildFileSystemNavigationPath ( systemName , fileSystemPath , accountName )
556579 window . location . href = newNavigationPath
557580 }
558581
@@ -618,13 +641,15 @@ interface FileListTableProps {
618641 currentPath : string
619642 fileSystem : FileSystem
620643 system : System
644+ accountName : string
621645}
622646
623647const FileListTable : React . FC < FileListTableProps > = ( {
624648 files,
625649 currentPath,
626650 fileSystem,
627651 system,
652+ accountName,
628653} ) => {
629654 const [ sortableColumns , setSortableColumns ] = useState < FileTableSortableColumn [ ] > ( [ ] )
630655 const [ fileSystemList , setFileSystemList ] = useState < any [ ] > ( [ ] )
@@ -655,6 +680,7 @@ const FileListTable: React.FC<FileListTableProps> = ({
655680 currentPath = { currentPath }
656681 fileSystem = { fileSystem }
657682 system = { system }
683+ accountName = { accountName }
658684 />
659685 ) : (
660686 < FileItem
@@ -663,6 +689,7 @@ const FileListTable: React.FC<FileListTableProps> = ({
663689 currentPath = { currentPath }
664690 fileSystem = { fileSystem }
665691 system = { system }
692+ accountName = { accountName }
666693 />
667694 ) ,
668695 ) }
@@ -687,7 +714,7 @@ const FileTransferInfo: React.FC<any> = ({ file, uploadLimit }) => {
687714}
688715
689716// TODO: Code refactoring and improvements (remove duplication, create ad-hoc components, ...)
690- const FileUpload : React . FC < any > = ( { system, currentPath, fileUploadLimit } ) => {
717+ const FileUpload : React . FC < any > = ( { system, currentPath, fileUploadLimit, accountName } ) => {
691718 const [ uploading , setUploading ] = useState ( false )
692719 const [ fileToUploadSelected , setFileToUploadSelected ] = useState < any | null > ( null )
693720 const [ fileTransferUploadResult , setFileTransferUploadResult ] = useState < any | null > ( null )
@@ -696,7 +723,7 @@ const FileUpload: React.FC<any> = ({ system, currentPath, fileUploadLimit }) =>
696723 const [ uploadError , setUploadError ] = useState < HttpErrorResponse | null > ( null )
697724 const singleDraggableFileUploadRef = useRef < any > ( null )
698725 const [ formValues , setFormValues ] = useState ( {
699- account : '' ,
726+ account : accountName ,
700727 } )
701728
702729 const isFileSizeOk = ( file : any ) => {
@@ -805,8 +832,9 @@ const FileUpload: React.FC<any> = ({ system, currentPath, fileUploadLimit }) =>
805832 type = 'text'
806833 name = 'account'
807834 value = { formValues . account }
835+ disabled
808836 onChange = { ( e ) => setFormValues ( { ...formValues , account : e . target . value } ) }
809- className = 'border-gray-300 focus:border-blue-300 focus:ring-blue-300 mt-1 block w-full rounded-md border py-2 px-3 shadow-sm sm:text-sm focus:outline-none'
837+ className = 'border-gray-300 focus:border-blue-300 focus:ring-blue-300 mt-1 block w-full rounded-md border py-2 px-3 shadow-sm sm:text-sm focus:outline-none disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed '
810838 />
811839 { /* {showInputValidation({
812840 fieldName: 'name',
@@ -895,6 +923,8 @@ const FileListView: React.FC<FileListViewProps> = ({
895923 </ div >
896924 )
897925
926+ console . log ( 'Account Name:' , accountName )
927+
898928 return (
899929 < SimpleView title = 'File Manager' size = { SimpleViewSize . FULL } >
900930 < SimplePanel title = { 'Filesystem' } className = 'mb-[330px]' actionsButtons = { actionsButtons } >
@@ -912,19 +942,22 @@ const FileListView: React.FC<FileListViewProps> = ({
912942 system = { system }
913943 systems = { systems }
914944 username = { username }
945+ accountName = { accountName }
915946 />
916947 </ div >
917948 < BreadcrumbNavigation
918949 currentPath = { currentPath }
919950 system = { system }
920951 fileSystem = { fileSystem }
952+ accountName = { accountName }
921953 />
922954 { remoteFsError == null && (
923955 < FileUpload
924956 system = { system }
925957 currentPath = { currentPath }
926958 setLocalError = { setLocalError }
927959 fileUploadLimit = { fileUploadLimit }
960+ accountName = { accountName }
928961 />
929962 ) }
930963
@@ -937,6 +970,7 @@ const FileListView: React.FC<FileListViewProps> = ({
937970 currentPath = { currentPath }
938971 fileSystem = { fileSystem }
939972 system = { system }
973+ accountName = { accountName }
940974 />
941975 ) }
942976 { ! fileList ||
0 commit comments