@centreon/ui 25.1.8 → 25.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,13 +5,13 @@ import { Modal } from '../../components/Modal';
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
labelDiscard,
|
|
8
|
-
|
|
9
|
-
labelDoYouWantToResolveErrors,
|
|
8
|
+
labelDoYouWantToQuit,
|
|
10
9
|
labelDoYouWantToSaveChanges,
|
|
11
10
|
labelIfYouClickOnDiscard,
|
|
12
|
-
|
|
11
|
+
labelLeave,
|
|
13
12
|
labelSave,
|
|
14
|
-
|
|
13
|
+
labelStay,
|
|
14
|
+
labelYourFormHasUnsavedChanges
|
|
15
15
|
} from './translatedLabels';
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
@@ -32,15 +32,17 @@ const UnsavedChangesDialog = ({
|
|
|
32
32
|
dialogOpened
|
|
33
33
|
}: Props): JSX.Element | null => {
|
|
34
34
|
const { t } = useTranslation();
|
|
35
|
+
|
|
35
36
|
const labelTitle = isValidForm
|
|
36
37
|
? labelDoYouWantToSaveChanges
|
|
37
|
-
:
|
|
38
|
+
: labelDoYouWantToQuit;
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
+
const lebelConfirm = isValidForm ? labelSave : labelLeave;
|
|
41
|
+
const labelCancel = isValidForm ? labelDiscard : labelStay;
|
|
40
42
|
|
|
41
43
|
const labelMessage = isValidForm
|
|
42
44
|
? labelIfYouClickOnDiscard
|
|
43
|
-
:
|
|
45
|
+
: labelYourFormHasUnsavedChanges;
|
|
44
46
|
|
|
45
47
|
if (not(dialogOpened)) {
|
|
46
48
|
return null;
|
|
@@ -58,11 +60,11 @@ const UnsavedChangesDialog = ({
|
|
|
58
60
|
<Modal.Actions
|
|
59
61
|
disabled={isSubmitting}
|
|
60
62
|
labels={{
|
|
61
|
-
cancel: t(
|
|
62
|
-
confirm: t(
|
|
63
|
+
cancel: t(labelCancel),
|
|
64
|
+
confirm: t(lebelConfirm)
|
|
63
65
|
}}
|
|
64
|
-
onCancel={discardChanges}
|
|
65
|
-
onConfirm={isValidForm ? saveChanges :
|
|
66
|
+
onCancel={isValidForm ? discardChanges : closeDialog}
|
|
67
|
+
onConfirm={isValidForm ? saveChanges : discardChanges}
|
|
66
68
|
/>
|
|
67
69
|
</Modal>
|
|
68
70
|
);
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
export const labelDiscard = 'Discard';
|
|
2
|
-
export const
|
|
2
|
+
export const labelSave = 'Save';
|
|
3
|
+
|
|
4
|
+
export const labelLeave = 'Leave';
|
|
5
|
+
export const labelStay = 'Stay';
|
|
6
|
+
|
|
3
7
|
export const labelIfYouClickOnDiscard =
|
|
4
8
|
'If you click on Discard, your changes will not be saved.';
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
export const labelDoYouWantToQuit = 'Do you want to leave this page?';
|
|
10
|
+
|
|
11
|
+
export const labelYourFormHasUnsavedChanges =
|
|
12
|
+
'Your changes will not be saved if you leave this page.';
|
|
8
13
|
export const labelDoYouWantToSaveChanges = 'Do you want to save the changes?';
|
|
9
|
-
export const labelDoYouWantToResolveErrors =
|
|
10
|
-
'Do you want to resolve the errors?';
|
|
11
|
-
export const labelSave = 'Save';
|
|
12
14
|
|
|
13
15
|
export default {
|
|
14
16
|
labelDiscard,
|
|
15
|
-
labelDoYouWantToQuitWithoutResolving,
|
|
16
|
-
labelDoYouWantToResolveErrors,
|
|
17
|
-
labelDoYouWantToSaveChanges,
|
|
18
|
-
labelIfYouClickOnDiscard,
|
|
19
|
-
labelResolve,
|
|
20
17
|
labelSave,
|
|
21
|
-
|
|
18
|
+
labelLeave,
|
|
19
|
+
labelStay,
|
|
20
|
+
labelIfYouClickOnDiscard,
|
|
21
|
+
labelDoYouWantToQuit,
|
|
22
|
+
labelYourFormHasUnsavedChanges,
|
|
23
|
+
labelDoYouWantToSaveChanges
|
|
22
24
|
};
|