Skip to content

Commit

Permalink
fix(SR export): prevent empty sr description when export (#3173)
Browse files Browse the repository at this point in the history
  • Loading branch information
dxlin authored Jun 19, 2023
1 parent 2d8400f commit d51211f
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ export default function createReportDialogPrompt(uiDialogService) {
* @param {string} param0.value - value from input field
*/
const _handleFormSubmit = ({ action, value }) => {
uiDialogService.dismiss({ id: dialogId });
switch (action.id) {
case 'save':
resolve({ action: RESPONSE.CREATE_REPORT, value: value.label });
// Only save if description is not blank otherwise ignore
if (value.label && value.label.trim() !== '') {
resolve({
action: RESPONSE.CREATE_REPORT,
value: value.label.trim(),
});
uiDialogService.dismiss({ id: dialogId });
}
break;
case 'cancel':
uiDialogService.dismiss({ id: dialogId });
resolve({ action: RESPONSE.CANCEL, value: undefined });
break;
}
Expand Down Expand Up @@ -55,8 +62,8 @@ export default function createReportDialogPrompt(uiDialogService) {
};
const onKeyPressHandler = event => {
if (event.key === 'Enter') {
uiDialogService.dismiss({ id: dialogId });
resolve({ action: RESPONSE.CREATE_REPORT, value: value.label });
// Trigger form submit
_handleFormSubmit({ action: { id: 'save' }, value });
}
};
return (
Expand Down

0 comments on commit d51211f

Please sign in to comment.