Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help text for runtime fields source. #85204

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
import React, { useEffect, useState, useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCode } from '@elastic/eui';
import { PainlessLang, PainlessContext } from '@kbn/monaco';
import {
EuiFlexGroup,
Expand Down Expand Up @@ -260,20 +262,25 @@ const RuntimeFieldFormComp = ({
error={getErrorsMessages()}
isInvalid={!isValid}
helpText={
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiLink
href={links.runtimePainless}
target="_blank"
external
data-test-subj="painlessSyntaxLearnMoreLink"
>
{i18n.translate('xpack.runtimeFields.form.script.learnMoreLinkText', {
defaultMessage: 'Learn more about syntax.',
})}
</EuiLink>
</EuiFlexItem>
</EuiFlexGroup>
<FormattedMessage
id="xpack.runtimeFields.form.source.scriptFieldHelpText"
defaultMessage="Runtime fields without a script retrieve values from a field with the same name in {source}. If a field with the same name doesn’t exist, no values return when a search request includes the runtime field. {learnMoreLink}"
values={{
learnMoreLink: (
<EuiLink
href={links.runtimePainless}
target="_blank"
external
data-test-subj="painlessSyntaxLearnMoreLink"
>
{i18n.translate('xpack.runtimeFields.form.script.learnMoreLinkText', {
defaultMessage: 'Learn about script syntax.',
})}
</EuiLink>
),
source: <EuiCode>{'_source'}</EuiCode>,
}}
/>
}
fullWidth
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';

import { FormSchema, fieldValidators } from '../../shared_imports';
import { RUNTIME_FIELD_OPTIONS } from '../../constants';
import { RuntimeField, RuntimeType, ComboBoxOption } from '../../types';
Expand Down Expand Up @@ -44,7 +43,7 @@ export const schema: FormSchema<RuntimeField> = {
script: {
source: {
label: i18n.translate('xpack.runtimeFields.form.defineFieldLabel', {
defaultMessage: 'Define field (optional)',
defaultMessage: 'Define script (optional)',
}),
},
},
Expand Down