-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
235 additions
and
67 deletions.
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
x-pack/legacy/plugins/uptime/public/components/settings/certificate_form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { useSelector } from 'react-redux'; | ||
import { | ||
EuiDescribedFormGroup, | ||
EuiFormRow, | ||
EuiCode, | ||
EuiFieldNumber, | ||
EuiTitle, | ||
EuiSpacer, | ||
EuiSelect, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
import { defaultDynamicSettings } from '../../../common/runtime_types'; | ||
import { selectDynamicSettings } from '../../state/selectors'; | ||
|
||
export const CertificateExpirationForm: React.FC = ({ | ||
onChange, | ||
formFields, | ||
fieldErrors, | ||
isDisabled, | ||
}) => { | ||
const dss = useSelector(selectDynamicSettings); | ||
|
||
return ( | ||
<> | ||
<EuiTitle size="s"> | ||
<h3> | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.certificationSectionTitle" | ||
defaultMessage="Certificate Expiration" | ||
/> | ||
</h3> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
<EuiDescribedFormGroup | ||
title={ | ||
<h4> | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesTitle" | ||
defaultMessage="Uptime indices" | ||
/> | ||
</h4> | ||
} | ||
description={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesDescription" | ||
defaultMessage="Index pattern for matching indices that contain Heartbeat data" | ||
/> | ||
} | ||
> | ||
<EuiFormRow | ||
describedByIds={['heartbeatIndices']} | ||
error={fieldErrors?.heartbeatIndices} | ||
fullWidth | ||
helpText={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesDefaultValue" | ||
defaultMessage="The default value is {defaultValue}" | ||
values={{ | ||
defaultValue: <EuiCode>{defaultDynamicSettings.heartbeatIndices}</EuiCode>, | ||
}} | ||
/> | ||
} | ||
isInvalid={!!fieldErrors?.heartbeatIndices} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesLabel" | ||
defaultMessage="Error state" | ||
/> | ||
} | ||
> | ||
<EuiFlexGroup> | ||
<EuiFlexItem grow={2}> | ||
<EuiFieldNumber | ||
data-test-subj={`heartbeat-indices-input-${dss.loading ? 'loading' : 'loaded'}`} | ||
fullWidth | ||
disabled={isDisabled} | ||
isLoading={dss.loading} | ||
value={formFields?.heartbeatIndices || ''} | ||
onChange={(event: any) => onChange('heartbeatIndices', event.currentTarget.value)} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={1}> | ||
<EuiSelect /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFormRow> | ||
<EuiFormRow | ||
describedByIds={['heartbeatIndices']} | ||
error={fieldErrors?.heartbeatIndices} | ||
fullWidth | ||
helpText={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesDefaultValue" | ||
defaultMessage="The default value is {defaultValue}" | ||
values={{ | ||
defaultValue: <EuiCode>{defaultDynamicSettings.heartbeatIndices}</EuiCode>, | ||
}} | ||
/> | ||
} | ||
isInvalid={!!fieldErrors?.heartbeatIndices} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesLabel" | ||
defaultMessage="Warning state" | ||
/> | ||
} | ||
> | ||
<EuiFlexGroup> | ||
<EuiFlexItem grow={2}> | ||
<EuiFieldNumber | ||
data-test-subj={`heartbeat-indices-input-${dss.loading ? 'loading' : 'loaded'}`} | ||
fullWidth | ||
disabled={isDisabled} | ||
isLoading={dss.loading} | ||
value={formFields?.heartbeatIndices || ''} | ||
onChange={(event: any) => onChange('heartbeatIndices', event.currentTarget.value)} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={1}> | ||
<EuiSelect /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFormRow> | ||
</EuiDescribedFormGroup> | ||
</> | ||
); | ||
}; |
84 changes: 84 additions & 0 deletions
84
x-pack/legacy/plugins/uptime/public/components/settings/indices_form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { useSelector } from 'react-redux'; | ||
import { | ||
EuiDescribedFormGroup, | ||
EuiFormRow, | ||
EuiCode, | ||
EuiFieldText, | ||
EuiTitle, | ||
EuiSpacer, | ||
} from '@elastic/eui'; | ||
import { defaultDynamicSettings } from '../../../common/runtime_types'; | ||
import { selectDynamicSettings } from '../../state/selectors'; | ||
|
||
export const IndicesForm: React.FC = ({ onChange, formFields, fieldErrors, isDisabled }) => { | ||
const dss = useSelector(selectDynamicSettings); | ||
|
||
return ( | ||
<> | ||
<EuiTitle size="s"> | ||
<h3> | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.indicesSectionTitle" | ||
defaultMessage="Indices" | ||
/> | ||
</h3> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
<EuiDescribedFormGroup | ||
title={ | ||
<h4> | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesTitle" | ||
defaultMessage="Uptime indices" | ||
/> | ||
</h4> | ||
} | ||
description={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesDescription" | ||
defaultMessage="Index pattern for matching indices that contain Heartbeat data" | ||
/> | ||
} | ||
> | ||
<EuiFormRow | ||
describedByIds={['heartbeatIndices']} | ||
error={fieldErrors?.heartbeatIndices} | ||
fullWidth | ||
helpText={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesDefaultValue" | ||
defaultMessage="The default value is {defaultValue}" | ||
values={{ | ||
defaultValue: <EuiCode>{defaultDynamicSettings.heartbeatIndices}</EuiCode>, | ||
}} | ||
/> | ||
} | ||
isInvalid={!!fieldErrors?.heartbeatIndices} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.uptime.sourceConfiguration.heartbeatIndicesLabel" | ||
defaultMessage="Heartbeat indices" | ||
/> | ||
} | ||
> | ||
<EuiFieldText | ||
data-test-subj={`heartbeat-indices-input-${dss.loading ? 'loading' : 'loaded'}`} | ||
fullWidth | ||
disabled={isDisabled} | ||
isLoading={dss.loading} | ||
value={formFields?.heartbeatIndices || ''} | ||
onChange={(event: any) => onChange('heartbeatIndices', event.currentTarget.value)} | ||
/> | ||
</EuiFormRow> | ||
</EuiDescribedFormGroup> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters