16118: Restricts UI elements when a collection is read-only.
[arvados-workbench2.git] / src / components / file-tree / file-tree.tsx
index 0a96254c58607c2ccc477a1128c624fb75f76cc9..34a11cd60c78529b472bfe1d269edfa6a117ce19 100644 (file)
@@ -12,6 +12,8 @@ export interface FileTreeProps {
     onMenuOpen: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
     onSelectionToggle: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
     onCollapseToggle: (id: string, status: TreeItemStatus) => void;
+    onFileClick: (id: string) => void;
+    currentItemUuid?: string;
 }
 
 export class FileTree extends React.Component<FileTreeProps> {
@@ -24,7 +26,8 @@ export class FileTree extends React.Component<FileTreeProps> {
             onContextMenu={this.handleContextMenu}
             toggleItemActive={this.handleToggleActive}
             toggleItemOpen={this.handleToggle}
-            toggleItemSelection={this.handleSelectionChange} />;
+            toggleItemSelection={this.handleSelectionChange}
+            currentItemUuid={this.props.currentItemUuid} />;
     }
 
     handleContextMenu = (event: React.MouseEvent<any>, item: TreeItem<FileTreeData>) => {
@@ -36,7 +39,9 @@ export class FileTree extends React.Component<FileTreeProps> {
         this.props.onCollapseToggle(id, status);
     }
 
-    handleToggleActive = () => { return; };
+    handleToggleActive = (_: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => {
+        this.props.onFileClick(item.id);
+    }
 
     handleSelectionChange = (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => {
         event.stopPropagation();