X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6f8e509988756deb7e05a760e718d1ade164fd19..e2502e5af4abc6fa7e84d999df107e0df6cac43b:/src/store/progress-indicator/with-progress.ts diff --git a/src/store/progress-indicator/with-progress.ts b/src/store/progress-indicator/with-progress.ts index 976f7575a6..24f7e3272e 100644 --- a/src/store/progress-indicator/with-progress.ts +++ b/src/store/progress-indicator/with-progress.ts @@ -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) => -// 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) => + 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 }; +};