X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/91fdf9e2d937de38309f1464b30cb699df4f6389..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 97ec3bf9..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; @@ -48,7 +48,6 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ wrapper: { display: 'flex', minHeight: '600px', - marginBottom: '1rem', color: 'rgba(0, 0, 0, 0.87)', fontSize: '0.875rem', fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif', @@ -202,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(''); @@ -279,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) { @@ -316,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 @@ -446,9 +439,6 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState { - if (!collectionAutofetchEnabled) { - setCollectionAutofetchEnabled(true); - } onOptionsMenuOpen(ev, isWritable); }}> @@ -456,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)])}> @@ -490,7 +480,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState data-parent-path={name} className={classNames(classes.row, getActiveClass(name))} key={id}> - {getItemIcon(type, getActiveClass(name))} + {getItemIcon(type, getActiveClass(name))}
{name}
@@ -508,7 +498,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
-
+
@@ -518,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' @@ -568,7 +555,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
} } - :
No data available
+ :
This collection is empty
}} :
}