[ARVADOS-WORKBENCH2] updated: 1.2.0-947-gcf15eee

Git user git at public.curoverse.com
Mon Nov 26 08:42:45 EST 2018


Summary of changes:
 src/components/data-table-filters/data-table-filters-tree.tsx | 6 +++++-
 src/components/tree/tree.tsx                                  | 5 ++++-
 src/models/tree.ts                                            | 3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

       via  cf15eee86516adcd2430319ca618d795b3c33b5f (commit)
       via  acbcc3e7ea8c92dc96f0b481c8b54ff7c294d273 (commit)
       via  e50ea86d3df3312a2d61ab7c674a2562901141e0 (commit)
      from  496bde686809aa98b6b15e361b0c2a916509345b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit cf15eee86516adcd2430319ca618d795b3c33b5f
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Nov 26 14:42:28 2018 +0100

    Calculate filters tree indentation from subfilters presence
    
    Feature #14258
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-table-filters/data-table-filters-tree.tsx b/src/components/data-table-filters/data-table-filters-tree.tsx
index 0870497..3615451 100644
--- a/src/components/data-table-filters/data-table-filters-tree.tsx
+++ b/src/components/data-table-filters/data-table-filters-tree.tsx
@@ -7,6 +7,7 @@ import { Tree, toggleNodeSelection, getNode, initTreeNode, getNodeChildrenIds }
 import { Tree as TreeComponent, TreeItem, TreeItemStatus } from '~/components/tree/tree';
 import { noop, map } from "lodash/fp";
 import { toggleNodeCollapse } from '~/models/tree';
+import { countNodes, countChildren } from '~/models/tree';
 
 export interface DataTableFilterItem {
     name: string;
@@ -22,8 +23,11 @@ export interface DataTableFilterProps {
 export class DataTableFiltersTree extends React.Component<DataTableFilterProps> {
 
     render() {
+        const { filters } = this.props;
+        const hasSubfilters = countNodes(filters) !== countChildren('')(filters);
         return <TreeComponent
-            items={filtersToTree(this.props.filters)}
+            levelIndentation={hasSubfilters ? undefined : 0}
+            items={filtersToTree(filters)}
             render={renderItem}
             showSelection
             onContextMenu={noop}

commit acbcc3e7ea8c92dc96f0b481c8b54ff7c294d273
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Nov 26 14:39:12 2018 +0100

    Add prop for controlling tree item indentation
    
    Feature #14258
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index 4cbefbd..cccb0a9 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -88,6 +88,7 @@ export interface TreeProps<T> {
     onContextMenu: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
     render: (item: TreeItem<T>, level?: number) => ReactElement<{}>;
     showSelection?: boolean | ((item: TreeItem<T>) => boolean);
+    levelIndentation?: number;
     toggleItemActive: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
     toggleItemOpen: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
     toggleItemSelection?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
@@ -103,10 +104,12 @@ export const Tree = withStyles(styles)(
                 ? this.props.showSelection
                 : () => this.props.showSelection ? true : false;
 
+            const { levelIndentation = 20 } = this.props;
+
             return <List component="div" className={list}>
                 {items && items.map((it: TreeItem<T>, idx: number) =>
                     <div key={`item/${level}/${idx}`}>
-                        <ListItem button className={listItem} style={{ paddingLeft: (level + 1) * 20 }}
+                        <ListItem button className={listItem} style={{ paddingLeft: (level + 1) * levelIndentation }}
                             disableRipple={disableRipple}
                             onClick={event => toggleItemActive(event, it)}
                             onContextMenu={this.handleRowContextMenu(it)}>

commit e50ea86d3df3312a2d61ab7c674a2562901141e0
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Nov 26 14:37:59 2018 +0100

    Add function for counting tree node children
    
    Feature #14258
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/models/tree.ts b/src/models/tree.ts
index 8b71692..bec2f75 100644
--- a/src/models/tree.ts
+++ b/src/models/tree.ts
@@ -98,6 +98,9 @@ export const getNodeDescendants = (id: string, limit = Infinity) => <T>(tree: Tr
 export const countNodes = <T>(tree: Tree<T>) =>
     getNodeDescendantsIds('')(tree).length;
 
+export const countChildren = (id: string) => <T>(tree: Tree<T>) =>
+    getNodeChildren('')(tree).length;
+
 export const getNodeDescendantsIds = (id: string, limit = Infinity) => <T>(tree: Tree<T>): string[] => {
     const node = getNode(id)(tree);
     const children = node ? node.children :

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list