Skip to content

Commit

Permalink
avoid updating types and just replace label
Browse files Browse the repository at this point in the history
  • Loading branch information
sabarasaba committed May 31, 2021
1 parent cb43ec8 commit 7d6fddd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
Expand Up @@ -146,7 +146,7 @@ export interface FieldHook<T = unknown, I = T> {
}

export interface FieldConfig<T = unknown, FormType extends FormData = FormData, I = T> {
readonly label?: string | ReactNode;
readonly label?: string;
readonly labelAppend?: string | ReactNode;
readonly helpText?: string | ReactNode;
readonly type?: string;
Expand Down
Expand Up @@ -52,29 +52,13 @@ const fieldsConfig: FieldsConfig = {
defaultValue: false,
deserializer: to.booleanOrUndef,
serializer: from.undefinedIfValue(false),
label: (
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceNameFieldText"
defaultMessage="Extract Device Type"
/>
</EuiFlexItem>
<EuiFlexItem style={{ marginBottom: -4 }}>
<EuiBetaBadge
label="Beta"
tooltipContent={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceNameTooltipText',
{ defaultMessage: 'This functionality is in beta and is subject to change.' }
)}
/>
</EuiFlexItem>
</EuiFlexGroup>
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceTypeFieldHelpText',
{
defaultMessage: 'Extracts device type from the user agent string.',
}
),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceTypeFieldHelpText', {
defaultMessage: 'Extracts device type from the user agent string.',
}),
}
},
};

export const UserAgent: FunctionComponent = () => {
Expand Down Expand Up @@ -123,6 +107,27 @@ export const UserAgent: FunctionComponent = () => {
component={ToggleField}
path="fields.extract_device_type"
data-test-subj="extractDeviceTypeSwitch"
euiFieldProps={{
label: (
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceNameFieldText"
defaultMessage="Extract Device Type"
/>
</EuiFlexItem>
<EuiFlexItem style={{ marginBottom: -4 }}>
<EuiBetaBadge
label="Beta"
tooltipContent={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.userAgentForm.extractDeviceNameTooltipText',
{ defaultMessage: 'This functionality is in beta and is subject to change.' }
)}
/>
</EuiFlexItem>
</EuiFlexGroup>
),
}}
/>

<IgnoreMissingField />
Expand Down

0 comments on commit 7d6fddd

Please sign in to comment.