X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/5385afcada8666051658c6889c83848702497759..3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0:/src/components/tree/tree.tsx diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx index cf4d708d..1b77b5d9 100644 --- a/src/components/tree/tree.tsx +++ b/src/components/tree/tree.tsx @@ -2,18 +2,18 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import 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} /> + }
)} ;