kibana/packages/cloud/deployment_details/deployment_details_es_input.tsx
2023-09-28 04:20:53 -07:00

48 lines
1.4 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React, { type FC } from 'react';
import {
EuiFormRow,
EuiFieldText,
EuiCopy,
EuiButtonIcon,
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
export const DeploymentDetailsEsInput: FC<{ elasticsearchUrl: string }> = ({
elasticsearchUrl,
}) => {
return (
<EuiFormRow
label={i18n.translate('cloud.deploymentDetails.elasticEndpointLabel', {
defaultMessage: 'Elastic endpoint',
})}
fullWidth
>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem>
<EuiFieldText
value={elasticsearchUrl}
fullWidth
disabled
data-test-subj="deploymentDetailsEsEndpoint"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiCopy textToCopy={elasticsearchUrl}>
{(copy) => (
<EuiButtonIcon onClick={copy} iconType="copyClipboard" display="base" size="m" />
)}
</EuiCopy>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFormRow>
);
};