|
|
@ -2,10 +2,13 @@ import { FC, useEffect, useState } from 'react'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
Box as MUIBox, |
|
|
|
Box as MUIBox, |
|
|
|
BoxProps as MUIBoxProps, |
|
|
|
BoxProps as MUIBoxProps, |
|
|
|
|
|
|
|
IconButton as MUIIconButton, |
|
|
|
|
|
|
|
IconButtonProps as MUIIconButtonProps, |
|
|
|
iconButtonClasses as muiIconButtonClasses, |
|
|
|
iconButtonClasses as muiIconButtonClasses, |
|
|
|
} from '@mui/material'; |
|
|
|
} from '@mui/material'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
Check as MUICheckIcon, |
|
|
|
Check as MUICheckIcon, |
|
|
|
|
|
|
|
Close as MUICloseIcon, |
|
|
|
DragHandle as MUIDragHandleIcon, |
|
|
|
DragHandle as MUIDragHandleIcon, |
|
|
|
} from '@mui/icons-material'; |
|
|
|
} from '@mui/icons-material'; |
|
|
|
import { |
|
|
|
import { |
|
|
@ -90,12 +93,25 @@ const DataGridCellText: FC<BodyTextProps> = ({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type BriefNetworkInterfaceOptionalProps = { |
|
|
|
|
|
|
|
onClose?: MUIIconButtonProps['onClick']; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BRIEF_NETWORK_INTERFACE_DEFAULT_PROPS: Required< |
|
|
|
|
|
|
|
Omit<BriefNetworkInterfaceOptionalProps, 'onClose'> |
|
|
|
|
|
|
|
> & |
|
|
|
|
|
|
|
Pick<BriefNetworkInterfaceOptionalProps, 'onClose'> = { |
|
|
|
|
|
|
|
onClose: undefined, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const BriefNetworkInterface: FC< |
|
|
|
const BriefNetworkInterface: FC< |
|
|
|
MUIBoxProps & { |
|
|
|
MUIBoxProps & |
|
|
|
|
|
|
|
BriefNetworkInterfaceOptionalProps & { |
|
|
|
networkInterface: NetworkInterfaceOverviewMetadata; |
|
|
|
networkInterface: NetworkInterfaceOverviewMetadata; |
|
|
|
} |
|
|
|
} |
|
|
|
> = ({ |
|
|
|
> = ({ |
|
|
|
networkInterface: { networkInterfaceName, networkInterfaceState }, |
|
|
|
networkInterface: { networkInterfaceName, networkInterfaceState }, |
|
|
|
|
|
|
|
onClose, |
|
|
|
sx: rootSx, |
|
|
|
sx: rootSx, |
|
|
|
...restRootProps |
|
|
|
...restRootProps |
|
|
|
}) => ( |
|
|
|
}) => ( |
|
|
@ -118,9 +134,16 @@ const BriefNetworkInterface: FC< |
|
|
|
sx={{ height: 'auto' }} |
|
|
|
sx={{ height: 'auto' }} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<BodyText text={networkInterfaceName} /> |
|
|
|
<BodyText text={networkInterfaceName} /> |
|
|
|
|
|
|
|
{onClose && ( |
|
|
|
|
|
|
|
<MUIIconButton onClick={onClose} size="small" sx={{ color: GREY }}> |
|
|
|
|
|
|
|
<MUICloseIcon /> |
|
|
|
|
|
|
|
</MUIIconButton> |
|
|
|
|
|
|
|
)} |
|
|
|
</MUIBox> |
|
|
|
</MUIBox> |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BriefNetworkInterface.defaultProps = BRIEF_NETWORK_INTERFACE_DEFAULT_PROPS; |
|
|
|
|
|
|
|
|
|
|
|
const createNetworkInterfaceTableColumns = ( |
|
|
|
const createNetworkInterfaceTableColumns = ( |
|
|
|
handleDragMouseDown: ( |
|
|
|
handleDragMouseDown: ( |
|
|
|
row: NetworkInterfaceOverviewMetadata, |
|
|
|
row: NetworkInterfaceOverviewMetadata, |
|
|
@ -376,12 +399,6 @@ const NetworkInterfaceList: FC = () => { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<BodyText |
|
|
|
|
|
|
|
text={`Network interface held: ${ |
|
|
|
|
|
|
|
networkInterfaceHeld?.networkInterfaceName || 'none' |
|
|
|
|
|
|
|
}`}
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{networkInputs.map(({ interfaces, ipAddress, name, subnetMask }) => ( |
|
|
|
{networkInputs.map(({ interfaces, ipAddress, name, subnetMask }) => ( |
|
|
|
<InnerPanel key={`network-input-${name.toLowerCase()}`}> |
|
|
|
<InnerPanel key={`network-input-${name.toLowerCase()}`}> |
|
|
|
<InnerPanelHeader> |
|
|
|
<InnerPanelHeader> |
|
|
@ -414,12 +431,29 @@ const NetworkInterfaceList: FC = () => { |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{interfaces.length > 0 ? ( |
|
|
|
{interfaces.length > 0 ? ( |
|
|
|
interfaces.map((networkInterface) => ( |
|
|
|
interfaces.map( |
|
|
|
|
|
|
|
(networkInterface, networkInterfaceIndex) => { |
|
|
|
|
|
|
|
const { networkInterfaceUUID } = networkInterface; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
<BriefNetworkInterface |
|
|
|
<BriefNetworkInterface |
|
|
|
key={`brief-network-interface-${networkInterface.networkInterfaceUUID}`} |
|
|
|
key={`brief-network-interface-${networkInterfaceUUID}`} |
|
|
|
networkInterface={networkInterface} |
|
|
|
networkInterface={networkInterface} |
|
|
|
|
|
|
|
onClose={() => { |
|
|
|
|
|
|
|
interfaces.splice(networkInterfaceIndex, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
networkInterfaceInputMap[ |
|
|
|
|
|
|
|
networkInterfaceUUID |
|
|
|
|
|
|
|
].isApplied = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setNetworkInterfaceInputMap({ |
|
|
|
|
|
|
|
...networkInterfaceInputMap, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
)) |
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<BodyText text="Drag interfaces here to add." /> |
|
|
|
<BodyText text="Drag interfaces here to add." /> |
|
|
|
)} |
|
|
|
)} |
|
|
|