import { ConsoleDetailPropType } from './ConsoleDetailPropType'; import { DescriptionList, DescriptionListGroup, DescriptionListTerm, DescriptionListDescription, Title } from '@patternfly/react-core'; export interface DetailProps extends React.HTMLProps { title?: string; value: string | number; } const Detail: React.FunctionComponent = ({ title, value }: DetailProps) => ( {title} {value} ); export interface ManualConnectionProps extends React.HTMLProps { spice?: ConsoleDetailPropType; vnc?: ConsoleDetailPropType; rdp?: ConsoleDetailPropType; textManualConnection: string; textNoProtocol: string; textConnectWith: string; textAddress: string; textSpiceAddress: string; textVNCAddress: string; textSpicePort: string; textVNCPort: string; textSpiceTlsPort: string; textVNCTlsPort: string; textRDPPort: string; textRdpAddress: string; } export const ManualConnection: React.FunctionComponent = ({ spice = null, vnc = null, rdp = null, textManualConnection = 'Manual Connection', textNoProtocol = 'No connection available.', textConnectWith = 'Connect with any viewer application for following protocols', textAddress = 'Address', textSpiceAddress = 'SPICE Address', textVNCAddress = 'VNC Address', textSpicePort = 'SPICE Port', textVNCPort = 'VNC Port', textSpiceTlsPort = 'SPICE TLS Port', textVNCTlsPort = 'VNC TLS Port', textRDPPort = 'RDP Port', textRdpAddress = 'RDP Address' }: ManualConnectionProps) => { const msg = spice || vnc ? textConnectWith : textNoProtocol; const address = spice && vnc && spice.address === vnc.address && spice.address; const rdpAddress = rdp && rdp.address !== address ? rdp.address : null; return (
{textManualConnection}

{msg}

{address && } {!address && spice && } {rdpAddress && } {spice && spice.port && } {spice && spice.tlsPort && } {!address && vnc && } {vnc && vnc.port && } {vnc && vnc.tlsPort && } {rdp && rdp.port && }
); }; ManualConnection.displayName = 'ManualConnection';