//
// 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, FreezeIcon } 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'
| 'toggableIcon'
| 'checkbox'
| 'childItem'
- | 'childItemIcon';
+ | 'childItemIcon'
+ | 'frozenIcon';
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
list: {
active: {
color: theme.palette.primary.main,
},
+ frozenIcon: {
+ fontSize: 20,
+ color: theme.palette.grey["600"],
+ marginLeft: '10px',
+ },
});
export enum TreeItemStatus {
open: boolean;
active: boolean;
selected?: boolean;
+ initialState?: boolean;
+ indeterminate?: boolean;
flatTree?: boolean;
status: TreeItemStatus;
items?: Array<TreeItem<T>>;
+ isFrozen?: boolean;
}
export interface TreeProps<T> {
const FlatTree = (props: FlatTreeProps) =>
<div
onContextMenu={(event) => {
- const [action, id] = getActionAndId(event, FLAT_TREE_ACTIONS.contextMenu);
+ const id = getActionAndId(event, FLAT_TREE_ACTIONS.contextMenu)[1];
props.onContextMenu(event, { id } as any);
}}
onClick={(event) => {
<span style={{ fontSize: '0.875rem' }}>
{item.data.name}
</span>
+ {
+ !!item.data.frozenByUuid ? <FreezeIcon className={props.classes.frozenIcon} /> : null
+ }
</span>
</div>
</div>)
: () => this.props.showSelection ? true : false;
const { levelIndentation = 20, itemRightPadding = 20 } = this.props;
-
return <List className={list}>
{items && items.map((it: TreeItem<T>, idx: number) =>
<div key={`item/${level}/${it.id}`}>
{showSelection(it) && !useRadioButtons &&
<Checkbox
checked={it.selected}
+ indeterminate={!it.selected && it.indeterminate}
className={classes.checkbox}
color="primary"
onClick={this.handleCheckboxChange(it)} />}