[ARVADOS-WORKBENCH2] updated: 2.1.0-81-g86d0ec68

Git user git at public.arvados.org
Thu Nov 26 20:31:38 UTC 2020


Summary of changes:
 src/components/tree/tree.tsx                            | 17 ++++++++++++-----
 .../side-panel-tree/side-panel-tree.tsx                 |  2 +-
 src/views-components/tree-picker/tree-picker.ts         |  2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)

       via  86d0ec68c0a400ab6d4de1897a68a4593f450b60 (commit)
      from  b14c0722a9327a762d9657ee0d5033843f997e49 (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 86d0ec68c0a400ab6d4de1897a68a4593f450b60
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Thu Nov 26 21:30:26 2020 +0100

    17114: Code cleanup
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index bdc37421..9680e3c0 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -153,10 +153,17 @@ interface FlatTreeProps {
     classes: any;
 }
 
+
+const FLAT_TREE_ACTIONS = {
+    toggleOpen: 'TOGGLE_OPEN',
+    contextMenu: 'CONTEXT_MENU',
+    toggleActive: 'TOGGLE_ACTIVE',
+};
+
 const FlatTree = (props: FlatTreeProps) =>
     <div
         onContextMenu={(event) => {
-            const [action, id] = getActionAndId(event, 'CONTEXT_MENU');
+            const [action, id] = getActionAndId(event, FLAT_TREE_ACTIONS.contextMenu);
             props.onContextMenu(event, { id } as any);
         }}
         onClick={(event) => {
@@ -164,10 +171,10 @@ const FlatTree = (props: FlatTreeProps) =>
 
             if (action && id) {
                 switch (action) {
-                    case 'TOGGLE_OPEN':
+                    case FLAT_TREE_ACTIONS.toggleOpen:
                         props.handleToggleItemOpen({ id } as any, event);
                         break;
-                    case 'TOGGLE_ACTIVE':
+                    case FLAT_TREE_ACTIONS.toggleActive:
                         props.toggleItemActive(event, { id } as any);
                         break;
                     default:
@@ -181,12 +188,12 @@ const FlatTree = (props: FlatTreeProps) =>
                 .map((item: any) => <div key={item.id} data-id={item.id}
                     className={classnames(props.classes.childItem, { [props.classes.active]: item.active })}
                     style={{ paddingLeft: `${item.depth * props.levelIndentation}px` }}>
-                    <i data-action="TOGGLE_OPEN" className={props.classes.toggableIconContainer}>
+                    <i data-action={FLAT_TREE_ACTIONS.toggleOpen} className={props.classes.toggableIconContainer}>
                         <ListItemIcon className={props.getToggableIconClassNames(item.open, item.active)}>
                             {props.getProperArrowAnimation(item.status, item.items!)}
                         </ListItemIcon>
                     </i>
-                    <div data-action="TOGGLE_ACTIVE" className={props.classes.renderContainer}>
+                    <div data-action={FLAT_TREE_ACTIONS.toggleActive} className={props.classes.renderContainer}>
                         <span style={{ display: 'flex', alignItems: 'center' }}>
                             <ProjectIcon className={classnames({ [props.classes.active]: item.active }, props.classes.childItemIcon)} />
                             <span style={{ fontSize: '0.875rem' }}>
diff --git a/src/views-components/side-panel-tree/side-panel-tree.tsx b/src/views-components/side-panel-tree/side-panel-tree.tsx
index 8181caf7..e0d9777d 100644
--- a/src/views-components/side-panel-tree/side-panel-tree.tsx
+++ b/src/views-components/side-panel-tree/side-panel-tree.tsx
@@ -41,7 +41,7 @@ export const SidePanelTree = connect(undefined, mapDispatchToProps)(
     (props: SidePanelTreeActionProps) =>
         <TreePicker {...props} render={renderSidePanelItem} pickerId={SIDE_PANEL_TREE} />);
 
-export const renderSidePanelItem = (item: TreeItem<ProjectResource>) => {
+const renderSidePanelItem = (item: TreeItem<ProjectResource>) => {
     const name = typeof item.data === 'string' ? item.data : item.data.name;
     const warn = typeof item.data !== 'string' && item.data.kind === ResourceKind.PROJECT
         ? <IllegalNamingWarning name={name} />
diff --git a/src/views-components/tree-picker/tree-picker.ts b/src/views-components/tree-picker/tree-picker.ts
index 92dd9589..c34b6c37 100644
--- a/src/views-components/tree-picker/tree-picker.ts
+++ b/src/views-components/tree-picker/tree-picker.ts
@@ -21,7 +21,7 @@ export interface TreePickerProps<T> {
 const flatTree = (depth: number, items?: any): [] => {
     return items ? items.reduce((prev: any, next: any) => {
         const { items } = next;
-        // delete next.items;
+
         return [
             ...prev,
             { ...next, depth },

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list