From 2fdc167c183848fc074dcad108f1058d123e6886 Mon Sep 17 00:00:00 2001 From: pkupczyk <piotr.kupczyk@id.ethz.ch> Date: Fri, 11 Nov 2022 15:33:14 +0100 Subject: [PATCH] SSDM-13152 : Exports for master data and metadata UI - adapt to the new result format --- openbis_ng_ui/src/js/components/common/grid/Grid.jsx | 5 +++-- .../src/js/components/common/grid/GridController.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openbis_ng_ui/src/js/components/common/grid/Grid.jsx b/openbis_ng_ui/src/js/components/common/grid/Grid.jsx index c11b023b476..0f0f0726622 100644 --- a/openbis_ng_ui/src/js/components/common/grid/Grid.jsx +++ b/openbis_ng_ui/src/js/components/common/grid/Grid.jsx @@ -1,3 +1,4 @@ +import _ from 'lodash' import React from 'react' import autoBind from 'auto-bind' import { withStyles } from '@material-ui/core/styles' @@ -261,12 +262,12 @@ class Grid extends React.PureComponent { <React.Fragment> <GridExportLoading loading={!!exportState.loading} /> <GridExportError - open={!!exportState.error} + open={!_.isEmpty(exportState.error)} error={exportState.error} onClose={this.controller.handleExportCancel} /> <GridExportWarnings - open={!!exportState.warnings} + open={!_.isEmpty(exportState.warnings)} warnings={exportState.warnings} onDownload={() => this.controller.handleExportDownload( diff --git a/openbis_ng_ui/src/js/components/common/grid/GridController.js b/openbis_ng_ui/src/js/components/common/grid/GridController.js index c26493b0d7a..fe886a6440d 100644 --- a/openbis_ng_ui/src/js/components/common/grid/GridController.js +++ b/openbis_ng_ui/src/js/components/common/grid/GridController.js @@ -1348,7 +1348,7 @@ export default class GridController { }) if (exportResult.status === 'OK') { - const filePath = exportResult.result + const filePath = exportResult.result.file_name const fileName = filePath.substring(filePath.lastIndexOf('/') + 1) const fileUrl = '/openbis/download/?sessionID=' + @@ -1356,10 +1356,10 @@ export default class GridController { '&filePath=' + encodeURIComponent(filePath) - if (exportResult.warnings) { + if (!_.isEmpty(exportResult.result.warnings)) { this.context.setState({ exportState: { - warnings: exportResult.warnings, + warnings: exportResult.result.warnings, fileName, fileUrl } -- GitLab