[ARVADOS-WORKBENCH2] updated: 1.2.0-532-g3badd05

Git user git at public.curoverse.com
Thu Oct 4 08:35:27 EDT 2018


Summary of changes:
 src/services/collection-service/collection-service.ts  |  5 ++---
 src/services/common-service/common-resource-service.ts | 18 ++++--------------
 src/services/groups-service/groups-service.ts          |  5 +++--
 src/views/collection-panel/collection-panel.tsx        |  1 -
 4 files changed, 9 insertions(+), 20 deletions(-)

       via  3badd0539b3ba8e20db4c1243a02ce8dc6eb56a9 (commit)
      from  4a96a184698695992ecbeb5600210984341163a6 (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 3badd0539b3ba8e20db4c1243a02ce8dc6eb56a9
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Thu Oct 4 14:35:18 2018 +0200

    modify common resource service, clean code
    
    Feature #14278
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/services/collection-service/collection-service.ts b/src/services/collection-service/collection-service.ts
index eb48e9d..4072901 100644
--- a/src/services/collection-service/collection-service.ts
+++ b/src/services/collection-service/collection-service.ts
@@ -70,8 +70,6 @@ export class CollectionService extends TrashableResourceService<CollectionResour
 
     }
 
-    // ToDo: add get method
-
     update(uuid: string, data: Partial<CollectionResource>) {
         if (uuid && data) {
             const { properties } = data;
@@ -84,7 +82,8 @@ export class CollectionService extends TrashableResourceService<CollectionResour
                     .defaultResponse(
                         this.serverApi
                             .put<CollectionResource>(this.resourceType + uuid, mappedData),
-                        this.actions
+                        this.actions,
+                        false
                     );
             }
         }
diff --git a/src/services/common-service/common-resource-service.ts b/src/services/common-service/common-resource-service.ts
index 90677b0..70c1df0 100644
--- a/src/services/common-service/common-resource-service.ts
+++ b/src/services/common-service/common-resource-service.ts
@@ -62,7 +62,7 @@ export class CommonResourceService<T extends Resource> {
             }
         }
 
-    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions): Promise<R> {
+    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions, mapKeys = true): Promise<R> {
         const reqId = uuid();
         actions.progressFn(reqId, true);
         return promise
@@ -70,7 +70,9 @@ export class CommonResourceService<T extends Resource> {
                 actions.progressFn(reqId, false);
                 return data;
             })
-            .then(CommonResourceService.mapResponseKeys)
+            .then((response: { data: any }) => {
+                return mapKeys ? CommonResourceService.mapResponseKeys(response) : response.data;
+            })
             .catch(({ response }) => {
                 actions.progressFn(reqId, false);
                 const errors = CommonResourceService.mapResponseKeys(response) as Errors;
@@ -79,18 +81,6 @@ export class CommonResourceService<T extends Resource> {
             });
     }
 
-    static customResponse<R>(promise: AxiosPromise<R>, actions: ApiActions): Promise<R> {
-        const reqId = uuid();
-        actions.progressFn(reqId, true);
-        return promise
-            .then(data => {
-                actions.progressFn(reqId, false);
-                return data;
-            })
-            .then((response: { data: any }) => response.data);
-    }
-
-
     protected serverApi: AxiosInstance;
     protected resourceType: string;
     protected actions: ApiActions;
diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index ec80851..bf92836 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -45,12 +45,13 @@ export class GroupsService<T extends GroupResource = GroupResource> extends Tras
             order: order ? order : undefined
         };
 
-        const response = await CommonResourceService.customResponse(
+        const response = await CommonResourceService.defaultResponse(
             this.serverApi
                 .get(this.resourceType + `${uuid}/contents`, {
                     params: CommonResourceService.mapKeys(_.camelCase)(params)
                 }),
-            this.actions
+            this.actions, 
+            false
         );
         const { items, ...res } = response;
         const mappedItems = items.map((item: any) => {
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 379a2eb..96c2fc9 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -119,7 +119,6 @@ export const CollectionPanel = withStyles(styles)(
                                     <Grid item xs={12}>
                                         {
                                             Object.keys(item.properties).map(k => {
-                                                console.log('k: ', k);
                                                 return <Chip key={k} className={classes.tag}
                                                     onDelete={this.handleDelete(k)}
                                                     label={`${k}: ${item.properties[k]}`} />;

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list