File tree Expand file tree Collapse file tree 5 files changed +62
-0
lines changed
frontend/app/src/entities/proposed-changes/ui/action-button Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,18 @@ export const ApproveButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
33
33
/>
34
34
) ;
35
35
} ,
36
+ onError : ( ) => {
37
+ toast (
38
+ < Alert
39
+ type = { ALERT_TYPES . ERROR }
40
+ message = {
41
+ hasApproved
42
+ ? "An error occurred while canceling the approval"
43
+ : "An error occurred while approving"
44
+ }
45
+ />
46
+ ) ;
47
+ } ,
36
48
} ) ;
37
49
38
50
const handleAction = ( event : React . MouseEvent < HTMLButtonElement > ) => {
@@ -72,6 +84,8 @@ export const ApproveButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
72
84
} }
73
85
disabled = { isPending }
74
86
data-testid = "proposed-change-action-button-select"
87
+ aria-label = "More actions"
88
+ type = "button"
75
89
>
76
90
< Icon icon = "mdi:unfold-more-horizontal" />
77
91
</ Button >
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ export const CloseButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
24
24
} ) ;
25
25
toast ( < Alert type = { ALERT_TYPES . SUCCESS } message = { "Proposed change closed!" } /> ) ;
26
26
} ,
27
+ onError : ( ) => {
28
+ toast (
29
+ < Alert
30
+ type = { ALERT_TYPES . ERROR }
31
+ message = { "An error occurred while closing the propsoed change" }
32
+ />
33
+ ) ;
34
+ } ,
27
35
} ) ;
28
36
29
37
const handleAction = ( event : React . MouseEvent < HTMLButtonElement > ) => {
@@ -66,6 +74,8 @@ export const CloseButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
66
74
} }
67
75
disabled = { isPending }
68
76
data-testid = "proposed-change-action-button-select"
77
+ aria-label = "More actions"
78
+ type = "button"
69
79
>
70
80
< Icon icon = "mdi:unfold-more-horizontal" />
71
81
</ Button >
Original file line number Diff line number Diff line change @@ -30,6 +30,18 @@ export const DraftButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
30
30
/>
31
31
) ;
32
32
} ,
33
+ onError : ( ) => {
34
+ toast (
35
+ < Alert
36
+ type = { ALERT_TYPES . ERROR }
37
+ message = {
38
+ isDraft
39
+ ? "An error occurred while removing draft status"
40
+ : "An error occurred while moving to draft"
41
+ }
42
+ />
43
+ ) ;
44
+ } ,
33
45
} ) ;
34
46
35
47
const handleAction = ( event : React . MouseEvent < HTMLButtonElement > ) => {
@@ -74,6 +86,8 @@ export const DraftButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
74
86
} }
75
87
disabled = { isPending }
76
88
data-testid = "proposed-change-action-button-select"
89
+ aria-label = "More actions"
90
+ type = "button"
77
91
>
78
92
< Icon icon = "mdi:unfold-more-horizontal" />
79
93
</ Button >
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ export const MergeButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
24
24
} ) ;
25
25
toast ( < Alert type = { ALERT_TYPES . SUCCESS } message = { "Proposed change merged!" } /> ) ;
26
26
} ,
27
+ onError : ( ) => {
28
+ toast (
29
+ < Alert
30
+ type = { ALERT_TYPES . ERROR }
31
+ message = { "An error occurred while merging proposed change" }
32
+ />
33
+ ) ;
34
+ } ,
27
35
} ) ;
28
36
29
37
const handleAction = ( event : React . MouseEvent < HTMLButtonElement > ) => {
@@ -66,6 +74,8 @@ export const MergeButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
66
74
} }
67
75
disabled = { isPending }
68
76
data-testid = "proposed-change-action-button-select"
77
+ aria-label = "More actions"
78
+ type = "button"
69
79
>
70
80
< Icon icon = "mdi:unfold-more-horizontal" />
71
81
</ Button >
Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ export const RejectButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
32
32
/>
33
33
) ;
34
34
} ,
35
+ onError : ( ) => {
36
+ toast (
37
+ < Alert
38
+ type = { ALERT_TYPES . ERROR }
39
+ message = {
40
+ hasRejected
41
+ ? "An error occurred while canceling the rejection"
42
+ : "An error occurred while rejecting proposed change"
43
+ }
44
+ />
45
+ ) ;
46
+ } ,
35
47
} ) ;
36
48
37
49
const handleAction = ( event : React . MouseEvent < HTMLButtonElement > ) => {
@@ -71,6 +83,8 @@ export const RejectButton = ({ setOpen }: ProposedChangeActionButtonProps) => {
71
83
} }
72
84
disabled = { isPending }
73
85
data-testid = "proposed-change-action-button-select"
86
+ aria-label = "More actions"
87
+ type = "button"
74
88
>
75
89
< Icon icon = "mdi:unfold-more-horizontal" />
76
90
</ Button >
You can’t perform that action at this time.
0 commit comments