@@ -86,55 +86,22 @@ const ManageDriftPage = () => {
86
86
acc . currentDeviationsCount += item . currentDeviationsCount || 0 ;
87
87
acc . alignedCount += item . alignedCount || 0 ;
88
88
acc . customerSpecificDeviations += item . customerSpecificDeviationsCount || 0 ;
89
+ acc . deniedDeviationsCount += item . deniedDeviationsCount || 0 ;
89
90
90
- // Use allDeviations array which contains standardDisplayName for template policies
91
- if ( item . allDeviations && Array . isArray ( item . allDeviations ) ) {
92
- const allDeviations = item . allDeviations . filter ( ( dev ) => dev !== null ) ;
93
-
94
- // Filter deviations by state/status
95
- const currentDeviations = allDeviations . filter (
96
- ( d ) => d . state === "current" || d . Status === "New" || ( ! d . state && ! d . Status )
97
- ) ;
98
- const acceptedDeviations = allDeviations . filter (
99
- ( d ) => d . state === "accepted" || d . Status === "Accepted"
100
- ) ;
101
- const customerSpecificDeviations = allDeviations . filter (
102
- ( d ) =>
103
- d . state === "customerSpecific" ||
104
- d . Status === "CustomerSpecific" ||
105
- d . Status === "Customer Specific"
106
- ) ;
107
- const deniedDeleteDeviations = allDeviations . filter (
108
- ( d ) =>
109
- d . state === "deniedDelete" ||
110
- d . Status === "DeniedDelete" ||
111
- d . Status === "Denied - Delete"
112
- ) ;
113
- const deniedRemediateDeviations = allDeviations . filter (
114
- ( d ) =>
115
- d . state === "deniedRemediate" ||
116
- d . Status === "DeniedRemediate" ||
117
- d . Status === "Denied - Remediate"
91
+ // Use the API's direct arrays instead of filtering allDeviations
92
+ if ( item . currentDeviations && Array . isArray ( item . currentDeviations ) ) {
93
+ acc . currentDeviations . push ( ...item . currentDeviations . filter ( ( dev ) => dev !== null ) ) ;
94
+ }
95
+ if ( item . acceptedDeviations && Array . isArray ( item . acceptedDeviations ) ) {
96
+ acc . acceptedDeviations . push ( ...item . acceptedDeviations . filter ( ( dev ) => dev !== null ) ) ;
97
+ }
98
+ if ( item . customerSpecificDeviations && Array . isArray ( item . customerSpecificDeviations ) ) {
99
+ acc . customerSpecificDeviationsList . push (
100
+ ...item . customerSpecificDeviations . filter ( ( dev ) => dev !== null )
118
101
) ;
119
-
120
- acc . currentDeviations . push ( ...currentDeviations ) ;
121
- acc . acceptedDeviations . push ( ...acceptedDeviations ) ;
122
- acc . customerSpecificDeviationsList . push ( ...customerSpecificDeviations ) ;
123
- acc . deniedDeleteDeviationsList . push ( ...deniedDeleteDeviations ) ;
124
- acc . deniedRemediateDeviationsList . push ( ...deniedRemediateDeviations ) ;
125
- } else {
126
- // Fallback to separate arrays if allDeviations is not available
127
- if ( item . currentDeviations && Array . isArray ( item . currentDeviations ) ) {
128
- acc . currentDeviations . push ( ...item . currentDeviations . filter ( ( dev ) => dev !== null ) ) ;
129
- }
130
- if ( item . acceptedDeviations && Array . isArray ( item . acceptedDeviations ) ) {
131
- acc . acceptedDeviations . push ( ...item . acceptedDeviations . filter ( ( dev ) => dev !== null ) ) ;
132
- }
133
- if ( item . customerSpecificDeviations && Array . isArray ( item . customerSpecificDeviations ) ) {
134
- acc . customerSpecificDeviationsList . push (
135
- ...item . customerSpecificDeviations . filter ( ( dev ) => dev !== null )
136
- ) ;
137
- }
102
+ }
103
+ if ( item . deniedDeviations && Array . isArray ( item . deniedDeviations ) ) {
104
+ acc . deniedDeviationsList . push ( ...item . deniedDeviations . filter ( ( dev ) => dev !== null ) ) ;
138
105
}
139
106
140
107
// Use the latest data collection timestamp
@@ -153,11 +120,11 @@ const ManageDriftPage = () => {
153
120
currentDeviationsCount : 0 ,
154
121
alignedCount : 0 ,
155
122
customerSpecificDeviations : 0 ,
123
+ deniedDeviationsCount : 0 ,
156
124
currentDeviations : [ ] ,
157
125
acceptedDeviations : [ ] ,
158
126
customerSpecificDeviationsList : [ ] ,
159
- deniedDeleteDeviationsList : [ ] ,
160
- deniedRemediateDeviationsList : [ ] ,
127
+ deniedDeviationsList : [ ] ,
161
128
latestDataCollection : null ,
162
129
}
163
130
) ;
@@ -305,6 +272,14 @@ const ManageDriftPage = () => {
305
272
label : "Status" ,
306
273
value : getDeviationStatusText ( statusOverride || deviation . Status || deviation . state ) ,
307
274
} ,
275
+ {
276
+ label : "Reason" ,
277
+ value : deviation . Reason || "N/A" ,
278
+ } ,
279
+ {
280
+ label : "User" ,
281
+ value : deviation . lastChangedByUser || "N/A" ,
282
+ } ,
308
283
{
309
284
label : "Last Updated" ,
310
285
value : processedDriftData . latestDataCollection
@@ -325,13 +300,9 @@ const ManageDriftPage = () => {
325
300
processedDriftData . customerSpecificDeviationsList ,
326
301
"customerspecific"
327
302
) ;
328
- const deniedDeleteDeviationItems = createDeviationItems (
329
- processedDriftData . deniedDeleteDeviationsList ,
330
- "denieddelete"
331
- ) ;
332
- const deniedRemediateDeviationItems = createDeviationItems (
333
- processedDriftData . deniedRemediateDeviationsList ,
334
- "deniedremediate"
303
+ const deniedDeviationItems = createDeviationItems (
304
+ processedDriftData . deniedDeviationsList ,
305
+ "denied"
335
306
) ;
336
307
337
308
const handleMenuClick = ( event , itemId ) => {
@@ -712,54 +683,23 @@ const ManageDriftPage = () => {
712
683
} ;
713
684
} ) ;
714
685
715
- // Add action buttons to denied delete deviation items
716
- const deniedDeleteDeviationItemsWithActions = deniedDeleteDeviationItems . map ( ( item ) => ( {
686
+ // Add action buttons to denied deviation items
687
+ const deniedDeviationItemsWithActions = deniedDeviationItems . map ( ( item ) => ( {
717
688
...item ,
718
689
actionButton : (
719
690
< >
720
691
< Button
721
692
variant = "outlined"
722
693
endIcon = { < ExpandMore /> }
723
- onClick = { ( e ) => handleMenuClick ( e , `denied-delete- ${ item . id } ` ) }
694
+ onClick = { ( e ) => handleMenuClick ( e , `denied-${ item . id } ` ) }
724
695
size = "small"
725
696
>
726
697
Actions
727
698
</ Button >
728
699
< Menu
729
- anchorEl = { anchorEl [ `denied-delete-${ item . id } ` ] }
730
- open = { Boolean ( anchorEl [ `denied-delete-${ item . id } ` ] ) }
731
- onClose = { ( ) => handleMenuClose ( `denied-delete-${ item . id } ` ) }
732
- >
733
- < MenuItem onClick = { ( ) => handleDeviationAction ( "accept" , item ) } >
734
- < Check sx = { { mr : 1 , color : "success.main" } } />
735
- Accept
736
- </ MenuItem >
737
- < MenuItem onClick = { ( ) => handleDeviationAction ( "accept-customer-specific" , item ) } >
738
- < CheckCircle sx = { { mr : 1 , color : "info.main" } } />
739
- Accept - Customer Specific
740
- </ MenuItem >
741
- </ Menu >
742
- </ >
743
- ) ,
744
- } ) ) ;
745
-
746
- // Add action buttons to denied remediate deviation items
747
- const deniedRemediateDeviationItemsWithActions = deniedRemediateDeviationItems . map ( ( item ) => ( {
748
- ...item ,
749
- actionButton : (
750
- < >
751
- < Button
752
- variant = "outlined"
753
- endIcon = { < ExpandMore /> }
754
- onClick = { ( e ) => handleMenuClick ( e , `denied-remediate-${ item . id } ` ) }
755
- size = "small"
756
- >
757
- Actions
758
- </ Button >
759
- < Menu
760
- anchorEl = { anchorEl [ `denied-remediate-${ item . id } ` ] }
761
- open = { Boolean ( anchorEl [ `denied-remediate-${ item . id } ` ] ) }
762
- onClose = { ( ) => handleMenuClose ( `denied-remediate-${ item . id } ` ) }
700
+ anchorEl = { anchorEl [ `denied-${ item . id } ` ] }
701
+ open = { Boolean ( anchorEl [ `denied-${ item . id } ` ] ) }
702
+ onClose = { ( ) => handleMenuClose ( `denied-${ item . id } ` ) }
763
703
>
764
704
< MenuItem onClick = { ( ) => handleDeviationAction ( "accept" , item ) } >
765
705
< Check sx = { { mr : 1 , color : "success.main" } } />
@@ -939,16 +879,6 @@ const ManageDriftPage = () => {
939
879
</ MenuItem >
940
880
</ Menu >
941
881
942
- { /* What If Button */ }
943
- < Button
944
- variant = "outlined"
945
- endIcon = { < ExpandMore /> }
946
- onClick = { ( e ) => setWhatIfAnchorEl ( e . currentTarget ) }
947
- size = "small"
948
- startIcon = { < Science /> }
949
- >
950
- What If
951
- </ Button >
952
882
< Menu
953
883
anchorEl = { whatIfAnchorEl }
954
884
open = { Boolean ( whatIfAnchorEl ) }
@@ -969,6 +899,7 @@ const ManageDriftPage = () => {
969
899
< CippBannerListCard
970
900
items = { deviationItemsWithActions }
971
901
isCollapsible = { true }
902
+ layout = { "single" }
972
903
isFetching = { driftApi . isFetching }
973
904
/>
974
905
</ Box >
@@ -982,6 +913,7 @@ const ManageDriftPage = () => {
982
913
< CippBannerListCard
983
914
items = { acceptedDeviationItemsWithActions }
984
915
isCollapsible = { true }
916
+ layout = { "single" }
985
917
isFetching = { driftApi . isFetching }
986
918
/>
987
919
</ Box >
@@ -996,34 +928,22 @@ const ManageDriftPage = () => {
996
928
< CippBannerListCard
997
929
items = { customerSpecificDeviationItemsWithActions }
998
930
isCollapsible = { true }
931
+ layout = { "single" }
999
932
isFetching = { driftApi . isFetching }
1000
933
/>
1001
934
</ Box >
1002
935
) }
1003
936
1004
- { /* Denied Delete Deviations Section */ }
1005
- { deniedDeleteDeviationItemsWithActions . length > 0 && (
1006
- < Box >
1007
- < Typography variant = "h6" sx = { { mb : 2 } } >
1008
- Denied Deviations - Delete
1009
- </ Typography >
1010
- < CippBannerListCard
1011
- items = { deniedDeleteDeviationItemsWithActions }
1012
- isCollapsible = { true }
1013
- isFetching = { driftApi . isFetching }
1014
- />
1015
- </ Box >
1016
- ) }
1017
-
1018
- { /* Denied Remediate Deviations Section */ }
1019
- { deniedRemediateDeviationItemsWithActions . length > 0 && (
937
+ { /* Denied Deviations Section */ }
938
+ { deniedDeviationItemsWithActions . length > 0 && (
1020
939
< Box >
1021
940
< Typography variant = "h6" sx = { { mb : 2 } } >
1022
- Denied Deviations - Remediate
941
+ Denied Deviations
1023
942
</ Typography >
1024
943
< CippBannerListCard
1025
- items = { deniedRemediateDeviationItemsWithActions }
944
+ items = { deniedDeviationItemsWithActions }
1026
945
isCollapsible = { true }
946
+ layout = { "single" }
1027
947
isFetching = { driftApi . isFetching }
1028
948
/>
1029
949
</ Box >
@@ -1037,6 +957,13 @@ const ManageDriftPage = () => {
1037
957
< CippApiDialog
1038
958
createDialog = { createDialog }
1039
959
title = "Confirmation"
960
+ fields = { [
961
+ {
962
+ type : "textField" ,
963
+ name : "reason" ,
964
+ label : "Reason for change (Mandatory)" ,
965
+ } ,
966
+ ] }
1040
967
api = { {
1041
968
url : "/api/ExecUpdateDriftDeviation" ,
1042
969
type : "POST" ,
0 commit comments