Skip to content

Commit 61b686e

Browse files
authored
fix: prevent unresolvable notifications (#952)
* fix: fixed notification resolution text and message validation issue * fix: updated the changelog
1 parent 154c009 commit 61b686e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ The **need for configuration updates** is **marked bold**.
3636
* Updated Arc42 documentation ([#937](https://github.com/eclipse-tractusx/puris/pull/937))
3737
* Bump helm test workfow to new kubernetes version and latest q-gates puris version ([#938](https://github.com/eclipse-tractusx/puris/pull/938))>>>>>>> main
3838

39+
### Fixes
40+
41+
* Fixed notification resolution validation issue ([#952](https://github.com/eclipse-tractusx/puris/pull/952))
42+
3943
## v3.2.0
4044

4145
The following Changelog lists the changes. Please refer to the [documentation](docs/README.md) for configuration needs and understanding the concept changes.

frontend/src/features/notifications/components/NotificationInformationModal.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export const DemandCapacityNotificationInformationModal = ({
179179
}, [open, demandCapacityNotification, forwardData]);
180180

181181
const handleSaveClick = () => {
182-
if (!isValidDemandCapacityNotification(temporaryDemandCapacityNotification)) {
182+
if (!isValidDemandCapacityNotification(temporaryDemandCapacityNotification) ||
183+
!temporaryDemandCapacityNotification.text?.trim()) {
183184
setFormError(true);
184185
return;
185186
}
@@ -436,8 +437,8 @@ export const DemandCapacityNotificationInformationModal = ({
436437
text: event.target.value,
437438
})
438439
}
439-
error={formError && !temporaryDemandCapacityNotification?.text}
440-
className={formError && !temporaryDemandCapacityNotification?.text ? 'error-textarea' : ''}
440+
error={formError && !temporaryDemandCapacityNotification?.text?.trim()}
441+
className={formError && !temporaryDemandCapacityNotification?.text?.trim() ? 'error-textarea' : ''}
441442
/>
442443
</Grid>
443444
<Typography variant="body3" sx={{color: theme.palette.warning.main, py: 1}} ><ReportProblem></ReportProblem> These notes will be shared with the selected partner. Please do not include sensitive data of third parties.</Typography>

frontend/src/features/notifications/components/NotificationResolutionMessageModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const DemandCapacityNotificationResolutionModal = ({
5555
}, [open]);
5656

5757
const handleSaveClick = () => {
58-
if (resolutionMessage === '') {
58+
if (resolutionMessage === '' || !resolutionMessage?.trim()) {
5959
setFormError(true);
6060
return;
6161
}
@@ -69,7 +69,7 @@ export const DemandCapacityNotificationResolutionModal = ({
6969
affectedSitesBpnsRecipient: [],
7070
affectedSitesBpnsSender: [],
7171
affectedMaterialNumbers: [],
72-
text: ''
72+
text: null
7373
};
7474

7575
putDemandAndCapacityNotification(updatedNotification)
@@ -115,8 +115,8 @@ export const DemandCapacityNotificationResolutionModal = ({
115115
id="resolvingMeasureDescription"
116116
value={resolutionMessage}
117117
onChange={(event) => setResolutionMessage(event.target.value)}
118-
error={formError && !resolutionMessage}
119-
className={formError && !resolutionMessage ? 'error-textarea' : ''}
118+
error={formError && !resolutionMessage?.trim()}
119+
className={formError && !resolutionMessage?.trim() ? 'error-textarea' : ''}
120120
placeholder="Your message"
121121
/>
122122
</Grid>

frontend/src/models/types/data/demand-capacity-notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type DemandCapacityNotification = {
2828
uuid: string,
2929
notificationId: string,
3030
sourceDisruptionId: string,
31-
text: string,
31+
text: string | null,
3232
partnerBpnl: BPNL,
3333
affectedMaterialNumbers: string[],
3434
leadingRootCause: LeadingRootCauseType,

0 commit comments

Comments
 (0)