X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c15afcee286bb8ab694f488e2ccd490b56794e47..25216cc7acedc987c26a159f0b640210c0ef101e:/src/components/tree/tree.tsx diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx index cf4d708d..3b1145fe 100644 --- a/src/components/tree/tree.tsx +++ b/src/components/tree/tree.tsx @@ -5,15 +5,15 @@ import * as React from 'react'; import { List, ListItem, ListItemIcon, Checkbox, Radio, Collapse } from "@material-ui/core"; import { StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core/styles'; -import { CollectionIcon, DefaultIcon, DirectoryIcon, FileIcon, ProjectIcon, FilterGroupIcon } from '~/components/icon/icon'; +import { CollectionIcon, DefaultIcon, DirectoryIcon, FileIcon, ProjectIcon, FilterGroupIcon } from 'components/icon/icon'; import { ReactElement } from "react"; import CircularProgress from '@material-ui/core/CircularProgress'; import classnames from "classnames"; -import { ArvadosTheme } from '~/common/custom-theme'; +import { ArvadosTheme } from 'common/custom-theme'; import { SidePanelRightArrowIcon } from '../icon/icon'; -import { ResourceKind } from '~/models/resource'; -import { GroupClass } from '~/models/group'; +import { ResourceKind } from 'models/resource'; +import { GroupClass } from 'models/group'; type CssRules = 'list' | 'listItem' @@ -155,6 +155,9 @@ interface FlatTreeProps { getProperArrowAnimation: Function; itemsMap?: Map>; classes: any; + showSelection: any; + useRadioButtons?: boolean; + handleCheckboxChange: Function; } const FLAT_TREE_ACTIONS = { @@ -163,7 +166,7 @@ const FLAT_TREE_ACTIONS = { toggleActive: 'TOGGLE_ACTIVE', }; -const ItemIcon = React.memo(({type, kind, active, groupClass, classes}: any) => { +const ItemIcon = React.memo(({ type, kind, active, groupClass, classes }: any) => { let Icon = ProjectIcon; if (groupClass === GroupClass.FILTER) { @@ -184,7 +187,7 @@ const ItemIcon = React.memo(({type, kind, active, groupClass, classes}: any) => } if (kind) { - switch(kind) { + switch (kind) { case ResourceKind.COLLECTION: Icon = CollectionIcon; break; @@ -231,6 +234,17 @@ const FlatTree = (props: FlatTreeProps) => {props.getProperArrowAnimation(item.status, item.items!)} + {props.showSelection(item) && !props.useRadioButtons && + } + {props.showSelection(item) && props.useRadioButtons && + }
@@ -293,29 +307,32 @@ export const Tree = withStyles(styles)( { it.open && it.items && it.items.length > 0 && it.flatTree ? - : + + : - - - + toggleItemSelection={this.props.toggleItemSelection} /> + }
)} ;