import React from 'react'; import { FormFieldContainer, FileInput, TextInput, } from '@mongodb-js/compass-components'; function TLSClientCertificate({ tlsCertificateKeyFile, tlsCertificateKeyFilePassword, disabled, displayDatabaseConnectionUserHints = true, optional = true, updateTLSClientCertificate, updateTLSClientCertificatePassword, }: { tlsCertificateKeyFile?: string | null; tlsCertificateKeyFilePassword?: string | null; disabled: boolean; displayDatabaseConnectionUserHints?: boolean; optional?: boolean; updateTLSClientCertificate: ( newClientCertificateKeyFile: string | null ) => void; updateTLSClientCertificatePassword: (newPassword: string | null) => void; }): React.ReactElement { return ( <> { updateTLSClientCertificate( files && files.length > 0 ? files[0] : null ); }} showFileOnNewLine optional={optional} optionalMessage={ optional && displayDatabaseConnectionUserHints ? 'Optional (required with X.509 auth)' : undefined } /> ) => { updateTLSClientCertificatePassword(value); }} disabled={disabled} data-testid="tlsCertificateKeyFilePassword-input" id="tlsCertificateKeyFilePassword" label="Client Key Password" type="password" value={tlsCertificateKeyFilePassword || ''} optional /> ); } export default TLSClientCertificate;