[ARVADOS-WORKBENCH2] updated: 1.2.0-226-g46f597d

Git user git at public.curoverse.com
Mon Sep 3 06:43:49 EDT 2018


Summary of changes:
 src/store/trash/trash-actions.ts                   | 58 ++++++++++------------
 .../context-menu/actions/trash-action.tsx          |  4 +-
 src/views-components/data-explorer/renderers.tsx   | 16 +++---
 src/views/project-panel/project-panel.tsx          |  2 +-
 src/views/trash-panel/trash-panel.tsx              |  5 +-
 5 files changed, 38 insertions(+), 47 deletions(-)

       via  46f597da5c34d80250cc7efd87d2ce087528ed5f (commit)
      from  3eeb63ce55c9156f96f933a0cff5eab3dab86392 (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 46f597da5c34d80250cc7efd87d2ce087528ed5f
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Mon Sep 3 12:43:45 2018 +0200

    CR fixes
    
    Feature #13828
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index 34d034a..4b2000d 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -14,25 +14,23 @@ export const toggleProjectTrashed = (resource: { uuid: string; name: string, isT
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
         if (resource.isTrashed) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." }));
-            return services.groupsService.untrash(resource.uuid).then(() => {
-                dispatch<any>(activateSidePanelTreeItem(resource.uuid));
-                dispatch(trashPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.CLOSE_SNACKBAR());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Restored from trash",
-                    hideDuration: 2000
-                }));
-            });
+            await services.groupsService.untrash(resource.uuid);
+            dispatch<any>(activateSidePanelTreeItem(resource.uuid));
+            dispatch(trashPanelActions.REQUEST_ITEMS());
+            dispatch(snackbarActions.CLOSE_SNACKBAR());
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Restored from trash",
+                hideDuration: 2000
+            }));
         } else {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash..." }));
-            return services.groupsService.trash(resource.uuid).then(() => {
-                dispatch<any>(loadSidePanelTreeProjects(resource.ownerUuid!!));
-                dispatch(snackbarActions.CLOSE_SNACKBAR());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Added to trash",
-                    hideDuration: 2000
-                }));
-            });
+            await services.groupsService.trash(resource.uuid);
+            dispatch<any>(loadSidePanelTreeProjects(resource.ownerUuid!!));
+            dispatch(snackbarActions.CLOSE_SNACKBAR());
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Added to trash",
+                hideDuration: 2000
+            }));
         }
     };
 
@@ -40,21 +38,19 @@ export const toggleCollectionTrashed = (resource: { uuid: string; name: string,
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
         if (resource.isTrashed) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." }));
-            return services.collectionService.untrash(resource.uuid).then(() => {
-                dispatch(trashPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Restored from trash",
-                    hideDuration: 2000
-                }));
-            });
+            await services.collectionService.untrash(resource.uuid);
+            dispatch(trashPanelActions.REQUEST_ITEMS());
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Restored from trash",
+                hideDuration: 2000
+            }));
         } else {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash..." }));
-            return services.collectionService.trash(resource.uuid).then(() => {
-                dispatch(projectPanelActions.REQUEST_ITEMS());
-                dispatch(snackbarActions.OPEN_SNACKBAR({
-                    message: "Added to trash",
-                    hideDuration: 2000
-                }));
-            });
+            await services.collectionService.trash(resource.uuid);
+            dispatch(projectPanelActions.REQUEST_ITEMS());
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Added to trash",
+                hideDuration: 2000
+            }));
         }
     };
diff --git a/src/views-components/context-menu/actions/trash-action.tsx b/src/views-components/context-menu/actions/trash-action.tsx
index d6c8b2f..e465bb6 100644
--- a/src/views-components/context-menu/actions/trash-action.tsx
+++ b/src/views-components/context-menu/actions/trash-action.tsx
@@ -22,8 +22,6 @@ export const ToggleTrashAction = connect(mapStateToProps)((props: { isTrashed?:
                 : <TrashIcon/>}
         </ListItemIcon>
         <ListItemText style={{ textDecoration: 'none' }}>
-            {props.isTrashed
-                ? <>Restore</>
-                : <>Move to trash</>}
+            {props.isTrashed ? "Restore" : "Move to trash"}
         </ListItemText>
     </ListItem >);
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 2e1d608..9bcbcf6 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -35,7 +35,7 @@ export const renderName = (item: { name: string; uuid: string, kind: string }) =
 
 export const ResourceName = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return resource || { name: '', uuid: '', kind: '' };
     })(renderName);
 
@@ -58,19 +58,19 @@ export const renderDate = (date?: string) => {
 
 export const ResourceLastModifiedDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { date: resource ? resource.modifiedAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
 export const ResourceTrashDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as TrashResource | undefined;
+        const resource = getResource<TrashResource>(props.uuid)(state.resources);
         return { date: resource ? resource.trashAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
 export const ResourceDeleteDate = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as TrashResource | undefined;
+        const resource = getResource<TrashResource>(props.uuid)(state.resources);
         return { date: resource ? resource.deleteAt : '' };
     })((props: { date: string }) => renderDate(props.date));
 
@@ -81,7 +81,7 @@ export const renderFileSize = (fileSize?: number) =>
 
 export const ResourceFileSize = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return {};
     })((props: { fileSize?: number }) => renderFileSize(props.fileSize));
 
@@ -92,7 +92,7 @@ export const renderOwner = (owner: string) =>
 
 export const ResourceOwner = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { owner: resource ? resource.ownerUuid : '' };
     })((props: { owner: string }) => renderOwner(props.owner));
 
@@ -103,7 +103,7 @@ export const renderType = (type: string) =>
 
 export const ResourceType = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+        const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
         return { type: resource ? resource.kind : '' };
     })((props: { type: string }) => renderType(props.type));
 
@@ -114,6 +114,6 @@ export const renderStatus = (item: { status?: string }) =>
 
 export const ProcessStatus = connect(
     (state: RootState, props: { uuid: string }) => {
-        const resource = getResource(props.uuid)(state.resources) as ProcessResource | undefined;
+        const resource = getResource<ProcessResource>(props.uuid)(state.resources);
         return { status: resource ? resource.state : '-' };
     })((props: { status: string }) => renderType(props.status));
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index ebaba83..d3b0474 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -197,7 +197,7 @@ export const ProjectPanel = withStyles(styles)(
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
                 const kind = resourceKindToContextMenuKind(resourceUuid);
-                const resource = getResource(resourceUuid)(this.props.resources) as ProjectResource;
+                const resource = getResource<ProjectResource>(resourceUuid)(this.props.resources);
                 if (kind && resource) {
                     this.props.dispatch<any>(openContextMenu(event, {
                         name: resource.name,
diff --git a/src/views/trash-panel/trash-panel.tsx b/src/views/trash-panel/trash-panel.tsx
index 5aa4559..0d3a4dd 100644
--- a/src/views/trash-panel/trash-panel.tsx
+++ b/src/views/trash-panel/trash-panel.tsx
@@ -60,10 +60,7 @@ export const trashPanelColumns: DataColumns<string, TrashPanelFilter> = [
         configurable: true,
         sortDirection: SortDirection.ASC,
         filters: [],
-        render: uuid => {
-            console.log(uuid);
-            return <ResourceName uuid={uuid}/>;
-        },
+        render: uuid => <ResourceName uuid={uuid}/>,
         width: "450px"
     },
     {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list