Skip to content

Commit

Permalink
Simplify setting default values of report config dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernricks committed Jan 24, 2025
1 parent e0c61af commit 1e707ee
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/web/pages/reportconfigs/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,26 +275,23 @@ class Dialog extends React.Component {
value: format.id,
}));

const defaultValues = {
name: _('Unnamed'),
comment: '',
};

const reportConfigValues = isDefined(reportConfig)
const defaultValues = isDefined(reportConfig)
? {
...reportConfig,
id: reportConfig.id,
name: reportConfig.name,
comment: isDefined(reportConfig.comment) ? reportConfig.comment : '',
}
: undefined;
: {
name: _('Unnamed'),
comment: '',
};

const {reportFormatId, originalParamInfo, params, paramsUsingDefault} =
this.state;

return (
<SaveDialog
defaultValues={
isDefined(reportConfigValues) ? reportConfigValues : defaultValues
}
defaultValues={defaultValues}
title={title}
onClose={onClose}
onSave={this.handleSave}
Expand Down

0 comments on commit 1e707ee

Please sign in to comment.