Reactivate withProgress
authorDaniel Kos <daniel.kos@contractors.roche.com>
Sun, 16 Sep 2018 21:14:20 +0000 (23:14 +0200)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Sun, 16 Sep 2018 21:14:20 +0000 (23:14 +0200)
Feature #14186

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/store/progress-indicator/with-progress.ts

index 976f7575a65ba890a84d764861fc94042fe387b8..24f7e3272e34a540fc40d0050109da5dd1408cb3 100644 (file)
@@ -1,20 +1,20 @@
-// // Copyright (C) The Arvados Authors. All rights reserved.
-// //
-// // SPDX-License-Identifier: AGPL-3.0
+// Copyright (C) The Arvados Authors. All rights reserved.
 //
-// import * as React from 'react';
-// import { connect } from 'react-redux';
-// import { RootState } from '~/store/store';
-//
-// export type WithProgressStateProps = {
-//     started: boolean;
-// };
-//
-// export const withProgress = (id: string) =>
-//     (component: React.ComponentType<WithProgressStateProps>) =>
-//         connect(mapStateToProps(id))(component);
-//
-// export const mapStateToProps = (id: string) => (state: RootState): WithProgressStateProps => {
-//     const progress = state.progressIndicator[id];
-//     return progress;
-// };
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { RootState } from '~/store/store';
+
+export type WithProgressStateProps = {
+    working: boolean;
+};
+
+export const withProgress = (id: string) =>
+    (component: React.ComponentType<WithProgressStateProps>) =>
+        connect(mapStateToProps(id))(component);
+
+export const mapStateToProps = (id: string) => (state: RootState): WithProgressStateProps => {
+    const progress = state.progressIndicator.find(p => p.id === id);
+    return { working: progress ? progress.working : false };
+};