Skip to content

Commit b159be2

Browse files
committed
Implement UI changes for API Revision Deployment Monitoring
1 parent 6fb70db commit b159be2

File tree

10 files changed

+648
-24
lines changed

10 files changed

+648
-24
lines changed

portals/admin/src/main/webapp/site/public/locales/en.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@
141141
"AdminPages.Gateways.Delete.form.delete.confirmation.message": "Are you sure you want to delete this Gateway Environment?",
142142
"AdminPages.Gateways.Delete.form.delete.confirmation.message.title": "Delete Gateway Environment?",
143143
"AdminPages.Gateways.Delete.form.delete.successful": "Gateway Environment deleted successfully",
144+
"AdminPages.Gateways.GatewayInstances.dialog.close": "Close",
145+
"AdminPages.Gateways.GatewayInstances.dialog.title": "Gateways in {env} Environment",
146+
"AdminPages.Gateways.GatewayInstances.table.header.gatewayID": "Gateway ID",
147+
"AdminPages.Gateways.GatewayInstances.table.header.lastActive": "Last Active",
148+
"AdminPages.Gateways.GatewayInstances.table.header.status": "Status",
149+
"AdminPages.Gateways.GatewayInstances.table.no.records.found": "No live gateway instances found for this environment.",
144150
"AdminPages.Gateways.List.addButtonProps.title": "Add Gateway Environment",
145151
"AdminPages.Gateways.List.addButtonProps.triggerButtonText": "Add Gateway Environment",
146152
"AdminPages.Gateways.List.empty.content.Gateways": "It is possible to create a Gateway environment with virtual hosts to access APIs. API revisions can be attached with Vhost to access it.",
@@ -149,10 +155,12 @@
149155
"AdminPages.Gateways.List.title": "Gateway Environments",
150156
"AdminPages.Gateways.table.header.description": "Description",
151157
"AdminPages.Gateways.table.header.displayName": "Name",
158+
"AdminPages.Gateways.table.header.gatewayInstances": "Gateway Instances",
152159
"AdminPages.Gateways.table.header.gatewayType": "Gateway Type",
153160
"AdminPages.Gateways.table.header.permission": "Visibility",
154161
"AdminPages.Gateways.table.header.type": "Type",
155162
"AdminPages.Gateways.table.header.vhosts": "Virtual Host(s)",
163+
"AdminPages.Gateways.table.gatewayInstances.tooltip.notSupported": "Not supported for this gateway type",
156164
"AdminPages.Governance.Policy.Delete.form.delete.confirmation.message": "Are you sure you want to delete this Policy?",
157165
"AdminPages.Governance.Policy.Delete.form.delete.dialog.btn": "Delete",
158166
"AdminPages.Governance.Policy.Delete.form.delete.dialog.title": "Delete Policy?",

portals/admin/src/main/webapp/site/public/locales/fr.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@
141141
"AdminPages.Gateways.Delete.form.delete.confirmation.message": "Are you sure you want to delete this Gateway Environment?",
142142
"AdminPages.Gateways.Delete.form.delete.confirmation.message.title": "Delete Gateway Environment?",
143143
"AdminPages.Gateways.Delete.form.delete.successful": "Gateway Environment deleted successfully",
144+
"AdminPages.Gateways.GatewayInstances.dialog.close": "Close",
145+
"AdminPages.Gateways.GatewayInstances.dialog.title": "Gateways in {env} Environment",
146+
"AdminPages.Gateways.GatewayInstances.table.header.gatewayID": "Gateway ID",
147+
"AdminPages.Gateways.GatewayInstances.table.header.lastActive": "Last Active",
148+
"AdminPages.Gateways.GatewayInstances.table.header.status": "Status",
149+
"AdminPages.Gateways.GatewayInstances.table.no.records.found": "No live gateway instances found for this environment",
144150
"AdminPages.Gateways.List.addButtonProps.title": "Add Gateway Environment",
145151
"AdminPages.Gateways.List.addButtonProps.triggerButtonText": "Add Gateway Environment",
146152
"AdminPages.Gateways.List.empty.content.Gateways": "It is possible to create a Gateway environment with virtual hosts to access APIs. API revisions can be attached with Vhost to access it.",
@@ -149,10 +155,12 @@
149155
"AdminPages.Gateways.List.title": "Gateway Environments",
150156
"AdminPages.Gateways.table.header.description": "Description",
151157
"AdminPages.Gateways.table.header.displayName": "Name",
158+
"AdminPages.Gateways.table.header.gatewayInstances": "Gateway Instances",
152159
"AdminPages.Gateways.table.header.gatewayType": "Gateway Type",
153160
"AdminPages.Gateways.table.header.permission": "Visibility",
154161
"AdminPages.Gateways.table.header.type": "Type",
155162
"AdminPages.Gateways.table.header.vhosts": "Virtual Host(s)",
163+
"AdminPages.Gateways.table.gatewayInstances.tooltip.notSupported": "Not supported for this gateway type",
156164
"AdminPages.Governance.Policy.Delete.form.delete.confirmation.message": "Are you sure you want to delete this Policy?",
157165
"AdminPages.Governance.Policy.Delete.form.delete.dialog.btn": "Delete",
158166
"AdminPages.Governance.Policy.Delete.form.delete.dialog.title": "Delete Policy?",

portals/admin/src/main/webapp/source/src/app/components/GatewayEnvironments/ListGWEnviornments.jsx

Lines changed: 144 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* under the License.
1717
*/
1818

19-
import React from 'react';
19+
import React, { useState } from 'react';
2020
import API from 'AppData/api';
2121
import { FormattedMessage, useIntl } from 'react-intl';
2222
import { Link as RouterLink } from 'react-router-dom';
@@ -27,7 +27,25 @@ import AddEdit from 'AppComponents/GatewayEnvironments/AddEditGWEnvironment';
2727
import { useAppContext } from 'AppComponents/Shared/AppContext';
2828
import Button from '@mui/material/Button';
2929
import EditIcon from '@mui/icons-material/Edit';
30+
import FormatListBulletedIcon from '@mui/icons-material/FormatListBulleted';
31+
import IconButton from '@mui/material/IconButton';
32+
import Tooltip from '@mui/material/Tooltip';
33+
import { styled } from '@mui/material/styles';
3034
import Permission from './Permission';
35+
import ListGatewayInstances from './ListGatewayInstances';
36+
37+
const StyledTooltip = styled(({ className, ...props }) => (
38+
<Tooltip {...props} classes={{ popper: className }} />
39+
))(({ theme }) => ({
40+
'& .MuiTooltip-tooltip': {
41+
backgroundColor: theme.palette.common.white,
42+
color: theme.palette.text.primary,
43+
fontSize: theme.typography.pxToRem(14),
44+
boxShadow: theme.shadows[4],
45+
borderRadius: theme.shape.borderRadius,
46+
border: `1px solid ${theme.palette.divider}`,
47+
},
48+
}));
3149

3250
/**
3351
* API call to get Gateway labels
@@ -53,6 +71,23 @@ export default function ListGWEnviornments() {
5371
const intl = useIntl();
5472
let columProps;
5573
const { settings } = useAppContext();
74+
// Dialog state for Live Gateways
75+
const [liveGatewaysOpen, setLiveGatewaysOpen] = useState(false);
76+
const [selectedEnvId, setSelectedEnvId] = useState(null);
77+
const [selectedEnvName, setSelectedEnvName] = useState('');
78+
79+
const handleOpenLiveGateways = (envId, envName) => {
80+
setSelectedEnvId(envId);
81+
setSelectedEnvName(envName);
82+
setLiveGatewaysOpen(true);
83+
};
84+
85+
const handleCloseLiveGateways = () => {
86+
setLiveGatewaysOpen(false);
87+
setSelectedEnvId(null);
88+
setSelectedEnvName('');
89+
};
90+
5691
const isGatewayTypeAvailable = settings.gatewayTypes.length >= 2;
5792
if (isGatewayTypeAvailable) {
5893
columProps = [
@@ -139,6 +174,48 @@ export default function ListGWEnviornments() {
139174
},
140175
},
141176
},
177+
...(settings.isGatewayNotificationEnabled ? [
178+
{
179+
name: 'gatewayInstances',
180+
label: intl.formatMessage({
181+
id: 'AdminPages.Gateways.table.header.gatewayInstances',
182+
defaultMessage: 'Gateway Instances',
183+
}),
184+
options: {
185+
sort: false,
186+
customBodyRender: (value, tableMeta) => {
187+
if (typeof tableMeta.rowData === 'object') {
188+
const envId = tableMeta.rowData[8]; // 'id' is the last column
189+
const envName = tableMeta.rowData[1]; // 'displayName'
190+
const gatewayType = tableMeta.rowData[2]; // 'gatewayType'
191+
const isDisabled = gatewayType !== 'Regular';
192+
193+
const button = (
194+
<IconButton
195+
onClick={() => handleOpenLiveGateways(envId, envName)}
196+
disabled={isDisabled}
197+
>
198+
<FormatListBulletedIcon aria-label='gateway-instances-list-icon' />
199+
</IconButton>
200+
);
201+
202+
return isDisabled ? (
203+
<StyledTooltip
204+
title={intl.formatMessage({
205+
id: 'AdminPages.Gateways.table.gatewayInstances.tooltip.notSupported',
206+
defaultMessage: 'Not supported for this gateway type',
207+
})}
208+
>
209+
<span>{button}</span>
210+
</StyledTooltip>
211+
) : button;
212+
} else {
213+
return <div />;
214+
}
215+
},
216+
},
217+
},
218+
] : []),
142219
{ name: 'id', options: { display: false } },
143220
];
144221
} else {
@@ -216,6 +293,48 @@ export default function ListGWEnviornments() {
216293
},
217294
},
218295
},
296+
...(settings.isGatewayNotificationEnabled ? [
297+
{
298+
name: 'gatewayInstances',
299+
label: intl.formatMessage({
300+
id: 'AdminPages.Gateways.table.header.gatewayInstances',
301+
defaultMessage: 'Gateway Instances',
302+
}),
303+
options: {
304+
sort: false,
305+
customBodyRender: (value, tableMeta) => {
306+
if (typeof tableMeta.rowData === 'object') {
307+
const envId = tableMeta.rowData[8]; // 'id' is the last column
308+
const envName = tableMeta.rowData[1]; // 'displayName'
309+
const gatewayType = tableMeta.rowData[2]; // 'gatewayType'
310+
const isDisabled = gatewayType !== 'Regular';
311+
312+
const button = (
313+
<IconButton
314+
onClick={() => handleOpenLiveGateways(envId, envName)}
315+
disabled={isDisabled}
316+
>
317+
<FormatListBulletedIcon aria-label='gateway-instances-list-icon' />
318+
</IconButton>
319+
);
320+
321+
return isDisabled ? (
322+
<StyledTooltip
323+
title={intl.formatMessage({
324+
id: 'AdminPages.Gateways.table.gatewayInstances.tooltip.notSupported',
325+
defaultMessage: 'Not supported for this gateway type',
326+
})}
327+
>
328+
<span>{button}</span>
329+
</StyledTooltip>
330+
) : button;
331+
} else {
332+
return <div />;
333+
}
334+
},
335+
},
336+
},
337+
] : []),
219338
{ name: 'id', options: { display: false } },
220339
];
221340
}
@@ -284,21 +403,29 @@ export default function ListGWEnviornments() {
284403
};
285404

286405
return (
287-
<ListBase
288-
columProps={columProps}
289-
pageProps={pageProps}
290-
addButtonProps={addButtonProps}
291-
searchProps={searchProps}
292-
emptyBoxProps={emptyBoxProps}
293-
apiCall={apiCall}
294-
EditComponent={AddEdit}
295-
addButtonOverride={addCreateButton()}
296-
editComponentProps={{
297-
icon: <EditIcon />,
298-
title: 'Edit Gateway Label',
299-
routeTo: '/settings/environments/',
300-
}}
301-
DeleteComponent={Delete}
302-
/>
406+
<>
407+
<ListBase
408+
columProps={columProps}
409+
pageProps={pageProps}
410+
addButtonProps={addButtonProps}
411+
searchProps={searchProps}
412+
emptyBoxProps={emptyBoxProps}
413+
apiCall={apiCall}
414+
EditComponent={AddEdit}
415+
addButtonOverride={addCreateButton()}
416+
editComponentProps={{
417+
icon: <EditIcon />,
418+
title: 'Edit Gateway Label',
419+
routeTo: '/settings/environments/',
420+
}}
421+
DeleteComponent={Delete}
422+
/>
423+
<ListGatewayInstances
424+
open={liveGatewaysOpen}
425+
onClose={handleCloseLiveGateways}
426+
environmentId={selectedEnvId}
427+
environmentName={selectedEnvName}
428+
/>
429+
</>
303430
);
304431
}

0 commit comments

Comments
 (0)