@@ -74,10 +74,15 @@ const processDeploymentWindowAppGroupOverviewMap = importComponentFromFELibrary(
74
74
null ,
75
75
'function' ,
76
76
)
77
- // TODO: remove from fe-lib
78
- // const ClonePipelineButton = importComponentFromFELibrary('ClonePipelineButton ', null, 'function')
77
+ const AppGroupManageTrafficDrawer = importComponentFromFELibrary ( 'AppGroupManageTrafficDrawer' , null , 'function' )
78
+ const ManageTrafficButton = importComponentFromFELibrary ( 'ManageTrafficButton ' , null , 'function' )
79
79
const ClonePipelineMenuButton = importComponentFromFELibrary ( 'ClonePipelineMenuButton' , null , 'function' )
80
80
const ClonePipelineModal = importComponentFromFELibrary ( 'ClonePipelineModal' , null , 'function' )
81
+ const getManageTrafficMenuButtonConfig = importComponentFromFELibrary (
82
+ 'getManageTrafficMenuButtonConfig' ,
83
+ null ,
84
+ 'function' ,
85
+ )
81
86
82
87
const EnvironmentOverview = ( {
83
88
appGroupListData,
@@ -111,6 +116,7 @@ const EnvironmentOverview = ({
111
116
Record < string , { type : string ; excludedUserEmails : string [ ] ; userActionState : ACTION_STATE ; isActive : boolean } >
112
117
> ( { } )
113
118
const [ restartLoader , setRestartLoader ] = useState < boolean > ( false )
119
+ const [ isManageTrafficDrawerOpen , setIsManageTrafficDrawerOpen ] = useState ( false )
114
120
115
121
// HOOKS
116
122
const { envId } = useParams < { envId : string } > ( )
@@ -285,10 +291,14 @@ const EnvironmentOverview = ({
285
291
286
292
const handleBulkSelectionWidgetClose = ( ) => setSelectedAppDetailsList ( [ ] )
287
293
294
+ const handleOpenManageTrafficDrawer = ( ) => setIsManageTrafficDrawerOpen ( true )
295
+
296
+ const handleCloseManageTrafficDrawer = ( ) => setIsManageTrafficDrawerOpen ( false )
297
+
288
298
// CONFIGS
289
299
const environmentOverviewTableRows = ( appListData ?. appInfoList ?? [ ] ) . map < EnvironmentOverviewTableRow > (
290
300
( appInfo ) => ( {
291
- environment : {
301
+ app : {
292
302
id : appInfo . appId ,
293
303
name : appInfo . application ,
294
304
commits : appInfo . commits ,
@@ -502,13 +512,7 @@ const EnvironmentOverview = ({
502
512
< span className = "flex" >
503
513
< GridIcon className = "icon-dim-20 mr-8 scn-9" /> { GROUP_LIST_HEADER . APPLICATIONS }
504
514
</ span >
505
- < Button
506
- dataTestId = "environment-overview-table-manage-traffic"
507
- startIcon = { < Icon name = "ic-traffic-signal" color = { null } /> }
508
- variant = { ButtonVariantType . secondary }
509
- size = { ComponentSizeType . medium }
510
- text = "Manage Traffic"
511
- />
515
+ { ManageTrafficButton && < ManageTrafficButton onClick = { handleOpenManageTrafficDrawer } /> }
512
516
</ div >
513
517
< EnvironmentOverviewTable
514
518
rows = { environmentOverviewTableRows }
@@ -519,19 +523,26 @@ const EnvironmentOverview = ({
519
523
{ /* MODALS */ }
520
524
{ renderOverviewModal ( ) }
521
525
526
+ { AppGroupManageTrafficDrawer && isManageTrafficDrawerOpen && (
527
+ < AppGroupManageTrafficDrawer
528
+ envId = { + envId }
529
+ envName = { appListData . environment }
530
+ appInfoList = { appListData ?. appInfoList }
531
+ initialSelectedAppList = { selectedAppDetailsList }
532
+ onClose = { handleCloseManageTrafficDrawer }
533
+ />
534
+ ) }
535
+
522
536
{ /* BULK SELECTION WIDGET */ }
523
537
{ ! ! selectedAppDetailsList . length && (
524
538
< EnvironmentOverviewBulkSelectionWidget
525
539
parentRef = { parentRef }
526
540
count = { selectedAppDetailsList . length }
527
541
onClose = { handleBulkSelectionWidgetClose }
528
542
popUpMenuItems = { [
529
- {
530
- label : 'Manage Traffic' ,
531
- iconName : 'ic-traffic-signal' ,
532
- // TODO: open manage traffic drawer here
533
- onClick : ( ) => { } ,
534
- } ,
543
+ ...( getManageTrafficMenuButtonConfig
544
+ ? [ getManageTrafficMenuButtonConfig ( { onClick : handleOpenManageTrafficDrawer } ) ]
545
+ : [ ] ) ,
535
546
...( ClonePipelineMenuButton && appListData . environment
536
547
? [
537
548
< ClonePipelineMenuButton
0 commit comments