fix(SR export): prevent empty sr description when export (#3173)
This commit is contained in:
parent
2d8400f9d8
commit
d51211f6b9
@ -20,12 +20,19 @@ export default function createReportDialogPrompt(uiDialogService) {
|
|||||||
* @param {string} param0.value - value from input field
|
* @param {string} param0.value - value from input field
|
||||||
*/
|
*/
|
||||||
const _handleFormSubmit = ({ action, value }) => {
|
const _handleFormSubmit = ({ action, value }) => {
|
||||||
uiDialogService.dismiss({ id: dialogId });
|
|
||||||
switch (action.id) {
|
switch (action.id) {
|
||||||
case 'save':
|
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;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
|
uiDialogService.dismiss({ id: dialogId });
|
||||||
resolve({ action: RESPONSE.CANCEL, value: undefined });
|
resolve({ action: RESPONSE.CANCEL, value: undefined });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -55,8 +62,8 @@ export default function createReportDialogPrompt(uiDialogService) {
|
|||||||
};
|
};
|
||||||
const onKeyPressHandler = event => {
|
const onKeyPressHandler = event => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
uiDialogService.dismiss({ id: dialogId });
|
// Trigger form submit
|
||||||
resolve({ action: RESPONSE.CREATE_REPORT, value: value.label });
|
_handleFormSubmit({ action: { id: 'save' }, value });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user