[ARVADOS-WORKBENCH2] updated: 1.1.4-615-gda8c215

Git user git at public.curoverse.com
Fri Aug 17 07:39:25 EDT 2018


Summary of changes:
 src/store/side-panel/side-panel-reducer.ts | 40 +++++++-----------------------
 1 file changed, 9 insertions(+), 31 deletions(-)

       via  da8c21590f014d5c94e9f5c26dde76f48b20f9bc (commit)
      from  12f1a2196ccab628a5e899b70052fcf6ccb0f79f (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 da8c21590f014d5c94e9f5c26dde76f48b20f9bc
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Fri Aug 17 13:39:22 2018 +0200

    Simplify side panel reducer
    
    Feature #13986
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/store/side-panel/side-panel-reducer.ts b/src/store/side-panel/side-panel-reducer.ts
index bda6965..5a45d29 100644
--- a/src/store/side-panel/side-panel-reducer.ts
+++ b/src/store/side-panel/side-panel-reducer.ts
@@ -2,7 +2,6 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as _ from "lodash";
 import { sidePanelActions, SidePanelAction } from './side-panel-action';
 import { SidePanelItem } from '~/components/side-panel/side-panel';
 import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "~/components/icon/icon";
@@ -18,30 +17,15 @@ import { columns as favoritePanelColumns } from "../../views/favorite-panel/favo
 export type SidePanelState = SidePanelItem[];
 
 export const sidePanelReducer = (state: SidePanelState = sidePanelData, action: SidePanelAction) => {
-    if (state.length === 0) {
-        return sidePanelData;
-    } else {
-        return sidePanelActions.match(action, {
-            TOGGLE_SIDE_PANEL_ITEM_OPEN: itemId =>
-                state.map(it => ({...it, open: itemId === it.id && it.open === false})),
-            TOGGLE_SIDE_PANEL_ITEM_ACTIVE: itemId => {
-                const sidePanel = _.cloneDeep(state);
-                resetSidePanelActivity(sidePanel);
-                sidePanel.forEach(it => {
-                    if (it.id === itemId) {
-                        it.active = true;
-                    }
-                });
-                return sidePanel;
-            },
-            RESET_SIDE_PANEL_ACTIVITY: () => {
-                const sidePanel = _.cloneDeep(state);
-                resetSidePanelActivity(sidePanel);
-                return sidePanel;
-            },
-            default: () => state
-        });
-    }
+    return sidePanelActions.match(action, {
+        TOGGLE_SIDE_PANEL_ITEM_OPEN: itemId =>
+            state.map(it => ({...it, open: itemId === it.id && it.open === false})),
+        TOGGLE_SIDE_PANEL_ITEM_ACTIVE: itemId =>
+            state.map(it => ({...it, active: it.id === itemId})),
+        RESET_SIDE_PANEL_ACTIVITY: () =>
+            state.map(it => ({...it, active: false })),
+        default: () => state
+    });
 };
 
 export enum SidePanelIdentifiers {
@@ -107,9 +91,3 @@ export const sidePanelData = [
         active: false,
     }
 ];
-
-function resetSidePanelActivity(sidePanel: SidePanelItem[]) {
-    for (const t of sidePanel) {
-        t.active = false;
-    }
-}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list