mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-28 17:55:15 +02:00
Don't hide anything yet, so remove related code. Plus other code we don't need has been removed.
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { useMemo } from 'react';
|
|
import useApplication from 'hooks/api/getters/useApplication/useApplication';
|
|
import { formatDateYMDHMS } from 'utils/formatDate';
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
|
import { useConnectedInstancesTable } from './useConnectedInstancesTable';
|
|
import { ConnectedInstancesTable } from './ConnectedInstancesTable';
|
|
|
|
export const ConnectedInstances = () => {
|
|
const name = useRequiredPathParam('name');
|
|
const { application } = useApplication(name);
|
|
|
|
const tableData = useMemo(() => {
|
|
return (
|
|
application.instances
|
|
// @ts-expect-error: the type definition here is incomplete. It
|
|
// should be updated as part of this project.
|
|
.filter((instance) => instance.environment === 'production')
|
|
.map(({ instanceId, sdkVersion, clientIp, lastSeen }) => {
|
|
return {
|
|
instanceId,
|
|
ip: clientIp,
|
|
sdkVersion,
|
|
lastSeen: formatDateYMDHMS(lastSeen),
|
|
};
|
|
})
|
|
);
|
|
}, [application]);
|
|
|
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =
|
|
useConnectedInstancesTable(tableData);
|
|
|
|
return (
|
|
<ConnectedInstancesTable
|
|
loading={false}
|
|
headerGroups={headerGroups}
|
|
prepareRow={prepareRow}
|
|
getTableBodyProps={getTableBodyProps}
|
|
getTableProps={getTableProps}
|
|
rows={rows}
|
|
/>
|
|
);
|
|
};
|