X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0a7823d45623c1472f0ddc9b3e1dfa5619be2353..14b107de3fe4c29f4a37f1958bad99e2b82d2b24:/src/components/collection-panel-files/collection-panel-files.tsx diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 459d9d20..05b49363 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -28,7 +28,7 @@ export interface CollectionPanelFilesProps { isWritable: boolean; isLoading: boolean; tooManyFiles: boolean; - onUploadDataClick: () => void; + onUploadDataClick: (targetLocation?: string) => void; onSearchChange: (searchValue: string) => void; onItemMenuOpen: (event: React.MouseEvent, item: TreeItem, isWritable: boolean) => void; onOptionsMenuOpen: (event: React.MouseEvent, isWritable: boolean) => void; @@ -201,7 +201,6 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState const [path, setPath]: any = React.useState([]); const [pathData, setPathData]: any = React.useState({}); const [isLoading, setIsLoading] = React.useState(false); - const [collectionAutofetchEnabled, setCollectionAutofetchEnabled] = React.useState(false); const [leftSearch, setLeftSearch] = React.useState(''); const [rightSearch, setRightSearch] = React.useState(''); @@ -278,13 +277,12 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState } }, [rightKey]); // eslint-disable-line react-hooks/exhaustive-deps + const currentPDH = (collectionPanel.item || {}).portableDataHash; React.useEffect(() => { - const hash = (collectionPanel.item || {}).portableDataHash; - - if (hash && collectionAutofetchEnabled) { + if (currentPDH) { fetchData([leftKey, rightKey], true); } - }, [(collectionPanel.item || {}).portableDataHash]); // eslint-disable-line react-hooks/exhaustive-deps + }, [currentPDH]); // eslint-disable-line react-hooks/exhaustive-deps React.useEffect(() => { if (rightData) { @@ -315,10 +313,6 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState if (id) { onItemMenuOpen(event, item, isWritable); - - if (!collectionAutofetchEnabled) { - setCollectionAutofetchEnabled(true); - } } }, [onItemMenuOpen, isWritable, rightData] // eslint-disable-line react-hooks/exhaustive-deps @@ -445,9 +439,6 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState { - if (!collectionAutofetchEnabled) { - setCollectionAutofetchEnabled(true); - } onOptionsMenuOpen(ev, isWritable); }}> @@ -455,7 +446,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
-
1 ? classes.leftPanelVisible : classes.leftPanelHidden)}> +
1 ? classes.leftPanelVisible : classes.leftPanelHidden)} data-cy="collection-files-left-panel"> 1 ? classes.backButton : classes.backButtonHidden}> setPath([...path.slice(0, path.length -1)])}> @@ -507,7 +498,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
-
+
@@ -517,10 +508,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState className={classes.uploadButton} data-cy='upload-button' onClick={() => { - if (!collectionAutofetchEnabled) { - setCollectionAutofetchEnabled(true); - } - onUploadDataClick(); + onUploadDataClick(rightKey === leftKey ? undefined : rightKey); }} variant='contained' color='primary'