[ARVADOS-WORKBENCH2] updated: 1.1.4-16-g25dbcc4

Git user git at public.curoverse.com
Tue Jun 12 17:20:33 EDT 2018


Summary of changes:
 src/common/api/filter-builder.ts                | 3 ++-
 src/components/tree/tree.tsx                    | 6 +++---
 src/services/project-service/project-service.ts | 9 +++++----
 src/views/workbench/workbench.tsx               | 9 ++++++++-
 4 files changed, 18 insertions(+), 9 deletions(-)

       via  25dbcc4a5b95924e8a9d1d385ac0fe87f6c658bd (commit)
      from  b57a24f2a59938be52c78d453dea00d5cd54720d (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 25dbcc4a5b95924e8a9d1d385ac0fe87f6c658bd
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Tue Jun 12 23:20:12 2018 +0200

    Added dynamic sub projects loading
    
    Feature #13610
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/common/api/filter-builder.ts b/src/common/api/filter-builder.ts
index c4c29b4..3f8e323 100644
--- a/src/common/api/filter-builder.ts
+++ b/src/common/api/filter-builder.ts
@@ -3,7 +3,8 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 export enum FilterField {
-    UUID = "uuid"
+    UUID = "uuid",
+    OWNER_UUID = "owner_uuid"
 }
 
 export default class FilterBuilder {
diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index 3a64473..d8397d6 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -44,8 +44,8 @@ interface TreeProps<T> {
 }
 
 class Tree<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
-    renderArrow (items: Array<TreeItem<T>> | undefined, arrowClass: string, isOpen: boolean){
-        return items && items.length > 0 ? <i className={`${arrowClass} ${isOpen ? "fas fa-caret-down" : `fas fa-caret-down ${this.props.classes.arrowRotate}`}`} /> : ''
+    renderArrow (items: boolean, arrowClass: string, open: boolean){
+        return <i className={`${arrowClass} ${open ? "fas fa-caret-down" : `fas fa-caret-down ${this.props.classes.arrowRotate}`}`} />
     }
     render(): ReactElement<any> {
         const level = this.props.level ? this.props.level : 0;
@@ -55,7 +55,7 @@ class Tree<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
             {items && items.map((it: TreeItem<T>, idx: number) =>
              <div key={`item/${level}/${idx}`}>
                 <ListItem button onClick={() => toggleItem(it.id)} className={list} style={{paddingLeft: (level + 1) * 20}}>
-                    {this.renderArrow(it.items, it.active ? activeArrow : arrow, it.open)}
+                    {this.renderArrow(true, it.active ? activeArrow : arrow, it.open)}
                     {render(it, level)}
                 </ListItem>
                 {it.items && it.items.length > 0 &&
diff --git a/src/services/project-service/project-service.ts b/src/services/project-service/project-service.ts
index 2b1bcff..9350dab 100644
--- a/src/services/project-service/project-service.ts
+++ b/src/services/project-service/project-service.ts
@@ -33,15 +33,15 @@ interface GroupsResponse {
 }
 
 export default class ProjectService {
-    public getProjectList = (parentUuid?: string) => (dispatch: Dispatch) => {
+    public getProjectList = (parentUuid?: string) => (dispatch: Dispatch): Promise<Project[]> => {
         dispatch(actions.PROJECTS_REQUEST());
 
         const ub = new UrlBuilder('/groups');
         const fb = new FilterBuilder();
-        fb.addEqual(FilterField.UUID, parentUuid);
-        const url = ub.addParam('filter', fb.get()).get();
+        fb.addEqual(FilterField.OWNER_UUID, parentUuid);
+        const url = ub.addParam('filters', fb.get()).get();
 
-        serverApi.get<GroupsResponse>(url).then(groups => {
+        return serverApi.get<GroupsResponse>(url).then(groups => {
             const projects = groups.data.items.map(g => ({
                 name: g.name,
                 createdAt: g.created_at,
@@ -51,6 +51,7 @@ export default class ProjectService {
                 ownerUuid: g.owner_uuid
             } as Project));
             dispatch(actions.PROJECTS_SUCCESS({projects, parentItemId: parentUuid}));
+            return projects;
         });
     };
 }
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 00fab70..d18d113 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -27,6 +27,7 @@ import projectActions from "../../store/project/project-action"
 import ProjectTree from '../../components/project-tree/project-tree';
 import { TreeItem } from "../../components/tree/tree";
 import { Project } from "../../models/project";
+import { projectService } from '../../services/services';
 
 const drawerWidth = 240;
 
@@ -103,6 +104,12 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
         });
     };
 
+    toggleProjectTreeItem = (itemId: string) => {
+        this.props.dispatch<any>(projectService.getProjectList(itemId)).then(() => {
+            this.props.dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM(itemId));
+        });
+    };
+
     render() {
         const {classes, user} = this.props;
         return (
@@ -159,7 +166,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                     <div className={classes.toolbar}/>
                     <ProjectTree
                         projects={this.props.projects}
-                        toggleProjectTreeItem={itemId => this.props.dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM(itemId))}/>
+                        toggleProjectTreeItem={this.toggleProjectTreeItem}/>
                 </Drawer>}
                 <main className={classes.content}>
                     <div className={classes.toolbar}/>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list