Skip to content

Commit

Permalink
Fix: bug loading status button in download report dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-mng authored and timopollmeier committed Jul 17, 2024
1 parent 2596273 commit a11f731
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/web/pages/reports/downloadreportdialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


import React, {useState} from 'react';

import styled from 'styled-components';
Expand All @@ -19,7 +18,7 @@ import {renderSelectItems} from 'web/utils/render';

import ComposerContent, {
COMPOSER_CONTENT_DEFAULTS,
} from 'web/components/dialog/composercontent'; /* eslint-disable-line max-len */
} from 'web/components/dialog/composercontent';
import ThresholdMessage from 'web/pages/reports/thresholdmessage';

import SaveDialog from 'web/components/dialog/savedialog';
Expand All @@ -43,7 +42,6 @@ const DownloadReportDialog = ({
includeOverrides = COMPOSER_CONTENT_DEFAULTS.includeOverrides,
reportConfigId,
reportConfigs,
reportFormatId,
reportFormats,
showThresholdMessage = false,
storeAsDefault,
Expand All @@ -59,10 +57,11 @@ const DownloadReportDialog = ({
reportConfigId = selectSaveId(reportConfigs, defaultReportConfigId, '');
}

const [reportFormatIdInState, setReportFormatId] = useState(
const [reportFormatIdInState, setReportFormatIdInState] = useState(
selectSaveId(reportFormats, defaultReportFormatId),
);
const [reportConfigIdInState, setReportConfigId] = useState(reportConfigId);
const [reportConfigIdInState, setReportConfigIdInState] =
useState(reportConfigId);

const unControlledValues = {
includeNotes,
Expand All @@ -71,16 +70,16 @@ const DownloadReportDialog = ({
};

const handleReportFormatIdChange = value => {
setReportConfigId('');
setReportFormatId(value);
setReportConfigIdInState('');
setReportFormatIdInState(value);
};

const handleReportConfigIdChange = value => {
setReportConfigId(value);
setReportConfigIdInState(value);
};

const handleSave = values => {
onSave({
const handleSave = async values => {
await onSave({
...values,
reportConfigId: reportConfigIdInState,
reportFormatId: reportFormatIdInState,
Expand Down Expand Up @@ -159,7 +158,6 @@ DownloadReportDialog.propTypes = {
includeOverrides: PropTypes.number,
reportConfigId: PropTypes.id,
reportConfigs: PropTypes.array,
reportFormatId: PropTypes.id,
reportFormats: PropTypes.array,
showThresholdMessage: PropTypes.bool,
storeAsDefault: PropTypes.bool,
Expand All @@ -169,5 +167,3 @@ DownloadReportDialog.propTypes = {
};

export default DownloadReportDialog;

// vim: set ts=2 sw=2 tw=80:

0 comments on commit a11f731

Please sign in to comment.