[ARVADOS-WORKBENCH2] created: 1.2.0-431-gfaf6a19

Git user git at public.curoverse.com
Mon Sep 24 14:10:00 EDT 2018


        at  faf6a194fd097d34d8c539e067afdf59b60ac0a6 (commit)


commit faf6a194fd097d34d8c539e067afdf59b60ac0a6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Sep 24 20:09:51 2018 +0200

    Update progress-indicator-reducer
    
    Feature #14163
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/progress-indicator/progress-indicator-reducer.ts b/src/store/progress-indicator/progress-indicator-reducer.ts
index 89885af..dbd1beb 100644
--- a/src/store/progress-indicator/progress-indicator-reducer.ts
+++ b/src/store/progress-indicator/progress-indicator-reducer.ts
@@ -9,21 +9,28 @@ export type ProgressIndicatorState = { id: string, working: boolean }[];
 const initialState: ProgressIndicatorState = [];
 
 export const progressIndicatorReducer = (state: ProgressIndicatorState = initialState, action: ProgressIndicatorAction) => {
-    const startWorking = (id: string) => state.find(p => p.id === id) ? state : state.concat({ id, working: true });
     const stopWorking = (id: string) => state.filter(p => p.id !== id);
 
     return progressIndicatorActions.match(action, {
-        START_WORKING: id => startWorking(id),
+        START_WORKING: id => startWorking(id, state),
         STOP_WORKING: id => stopWorking(id),
         PERSIST_STOP_WORKING: id => state.map(p => ({
             ...p,
             working: p.id === id ? false : p.working
         })),
-        TOGGLE_WORKING: ({ id, working }) => working ? startWorking(id) : stopWorking(id),
+        TOGGLE_WORKING: ({ id, working }) => working ? startWorking(id, state) : stopWorking(id),
         default: () => state,
     });
 };
 
+const startWorking = (id: string, state: ProgressIndicatorState) => {
+    return getProgressIndicator(id)(state)
+        ? state.map(indicator => indicator.id === id
+            ? { ...indicator, working: true }
+            : indicator)
+        : state.concat({ id, working: true });
+};
+
 export function isSystemWorking(state: ProgressIndicatorState): boolean {
     return state.length > 0 && state.reduce((working, p) => working ? true : p.working, false);
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list