[8.18] Fixes UI bugs in semantic text UI and index mgmt mappings tab (#209638) (#209918)

# Backport

This will backport the following commits from `main` to `8.18`:
- [Fixes UI bugs in semantic text UI and index mgmt mappings tab
(#209638)](https://github.com/elastic/kibana/pull/209638)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Michael
DeFazio","email":"michael.defazio@elastic.co"},"sourceCommit":{"committedDate":"2025-02-05T20:55:48Z","message":"Fixes
UI bugs in semantic text UI and index mgmt mappings tab (#209638)\n\n##
Summary\r\n\r\nA few minor UI clean up fixes on the index mappings tab
for Stack\r\nManagement. Also touches the inference popover (shows on
both search and\r\nstack management views)\r\n\r\n- Fixes layout shift
when choosing semantic text as a field option\r\n- Changs about panel to
`subdued`\r\n- Fixes responsive behavior for about panel\r\n - max-width
on large breakpoint\r\n- Inference popover styling updates \r\n-
Decreases gap size in mapping column to reduce space between
sections\r\n\r\n_Responsive and About panel updates_\r\n![CleanShot
2025-02-04 at 14
24\r\n16@2x](https://github.com/user-attachments/assets/448bc537-6f98-4c34-96df-f553f089dca2)\r\n![CleanShot
2025-02-04 at 14
14\r\n15@2x](https://github.com/user-attachments/assets/0dd6851c-6299-47b6-9549-38f7ce822427)\r\n\r\n\r\n_Inference
popover styling cleanup_\r\n![CleanShot 2025-02-04 at 11
19\r\n50@2x](https://github.com/user-attachments/assets/fdfef447-6d35-419b-a276-55c1b442d749)\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~If a
plugin configuration key changed, check if it needs to be\r\nallowlisted
in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.~\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Samiul Monir
<samiul.monir@elastic.co>","sha":"ab7aae4c498eb8787775d07c186886049752ea45","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana
Management","release_note:skip","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"Fixes
UI bugs in semantic text UI and index mgmt mappings
tab","number":209638,"url":"https://github.com/elastic/kibana/pull/209638","mergeCommit":{"message":"Fixes
UI bugs in semantic text UI and index mgmt mappings tab (#209638)\n\n##
Summary\r\n\r\nA few minor UI clean up fixes on the index mappings tab
for Stack\r\nManagement. Also touches the inference popover (shows on
both search and\r\nstack management views)\r\n\r\n- Fixes layout shift
when choosing semantic text as a field option\r\n- Changs about panel to
`subdued`\r\n- Fixes responsive behavior for about panel\r\n - max-width
on large breakpoint\r\n- Inference popover styling updates \r\n-
Decreases gap size in mapping column to reduce space between
sections\r\n\r\n_Responsive and About panel updates_\r\n![CleanShot
2025-02-04 at 14
24\r\n16@2x](https://github.com/user-attachments/assets/448bc537-6f98-4c34-96df-f553f089dca2)\r\n![CleanShot
2025-02-04 at 14
14\r\n15@2x](https://github.com/user-attachments/assets/0dd6851c-6299-47b6-9549-38f7ce822427)\r\n\r\n\r\n_Inference
popover styling cleanup_\r\n![CleanShot 2025-02-04 at 11
19\r\n50@2x](https://github.com/user-attachments/assets/fdfef447-6d35-419b-a276-55c1b442d749)\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~If a
plugin configuration key changed, check if it needs to be\r\nallowlisted
in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.~\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Samiul Monir
<samiul.monir@elastic.co>","sha":"ab7aae4c498eb8787775d07c186886049752ea45"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/209912","number":209912,"state":"OPEN"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209638","number":209638,"mergeCommit":{"message":"Fixes
UI bugs in semantic text UI and index mgmt mappings tab (#209638)\n\n##
Summary\r\n\r\nA few minor UI clean up fixes on the index mappings tab
for Stack\r\nManagement. Also touches the inference popover (shows on
both search and\r\nstack management views)\r\n\r\n- Fixes layout shift
when choosing semantic text as a field option\r\n- Changs about panel to
`subdued`\r\n- Fixes responsive behavior for about panel\r\n - max-width
on large breakpoint\r\n- Inference popover styling updates \r\n-
Decreases gap size in mapping column to reduce space between
sections\r\n\r\n_Responsive and About panel updates_\r\n![CleanShot
2025-02-04 at 14
24\r\n16@2x](https://github.com/user-attachments/assets/448bc537-6f98-4c34-96df-f553f089dca2)\r\n![CleanShot
2025-02-04 at 14
14\r\n15@2x](https://github.com/user-attachments/assets/0dd6851c-6299-47b6-9549-38f7ce822427)\r\n\r\n\r\n_Inference
popover styling cleanup_\r\n![CleanShot 2025-02-04 at 11
19\r\n50@2x](https://github.com/user-attachments/assets/fdfef447-6d35-419b-a276-55c1b442d749)\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~If a
plugin configuration key changed, check if it needs to be\r\nallowlisted
in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.~\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Samiul Monir
<samiul.monir@elastic.co>","sha":"ab7aae4c498eb8787775d07c186886049752ea45"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Michael DeFazio <michael.defazio@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Samiul Monir 2025-02-05 18:53:16 -05:00 committed by GitHub
parent 395ea5e91c
commit de77c245a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 91 additions and 89 deletions

View file

@ -7,11 +7,11 @@
import {
EuiButton,
EuiCallOut,
EuiContextMenuItem,
EuiContextMenuPanel,
EuiFlexGroup,
EuiFlexItem,
EuiFormRow,
EuiHorizontalRule,
EuiPanel,
EuiPopover,
@ -19,7 +19,6 @@ import {
EuiSelectableOption,
EuiSpacer,
EuiText,
EuiTitle,
EuiIcon,
EuiLink,
EuiLoadingSpinner,
@ -160,7 +159,7 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
</>
}
isOpen={isInferencePopoverVisible}
panelPaddingSize="m"
panelPaddingSize="none"
closePopover={() => setIsInferencePopoverVisible(!isInferencePopoverVisible)}
>
<EuiContextMenuPanel>
@ -204,55 +203,55 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
)}
</EuiContextMenuPanel>
<EuiHorizontalRule margin="none" />
<EuiPanel color="transparent" paddingSize="s">
<EuiTitle size="xxxs">
<h3>
{i18n.translate(
<EuiContextMenuPanel>
<EuiPanel color="transparent" paddingSize="s">
<EuiFormRow
label={i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.inferenceId.popover.selectable.Label',
{
defaultMessage: 'Existing endpoints',
}
)}
</h3>
</EuiTitle>
<EuiSpacer size="xs" />
<EuiSelectable
aria-label={i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.inferenceId.popover.selectable.ariaLabel',
{
defaultMessage: 'Existing endpoints',
}
)}
data-test-subj={dataTestSubj}
searchable
isLoading={isLoading}
singleSelection="always"
defaultChecked
searchProps={{
compressed: true,
placeholder: i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.inferenceId.popover.selectable.placeholder',
{
defaultMessage: 'Search',
}
),
}}
options={options}
onChange={(newOptions) => {
setValue(newOptions.find((option) => option.checked)?.label || '');
}}
>
{(list, search) => (
<>
{search}
{list}
</>
)}
</EuiSelectable>
</EuiPanel>
>
<EuiSelectable
aria-label={i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.inferenceId.popover.selectable.ariaLabel',
{
defaultMessage: 'Existing endpoints',
}
)}
data-test-subj={dataTestSubj}
searchable
isLoading={isLoading}
singleSelection="always"
defaultChecked
searchProps={{
compressed: true,
placeholder: i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.inferenceId.popover.selectable.placeholder',
{
defaultMessage: 'Search',
}
),
}}
options={options}
onChange={(newOptions) => {
setValue(newOptions.find((option) => option.checked)?.label || '');
}}
>
{(list, search) => (
<>
{search}
<EuiHorizontalRule margin="xs" />
{list}
</>
)}
</EuiSelectable>
</EuiFormRow>
</EuiPanel>
</EuiContextMenuPanel>
<EuiHorizontalRule margin="none" />
<EuiContextMenuItem icon={<EuiIcon type="help" color="primary" />} size="s">
<EuiContextMenuItem icon={<EuiIcon type="help" color="primary" />} size="m">
<EuiLink
href={docLinks.links.inferenceManagement.inferenceAPIDocumentation}
target="_blank"
@ -271,7 +270,7 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
return (
<>
<EuiSpacer />
<EuiFlexGroup data-test-subj="selectInferenceId">
<EuiFlexGroup data-test-subj="selectInferenceId" alignItems="flexEnd">
<EuiFlexItem grow={false}>
{inferencePopover()}
{isInferenceFlyoutVisible ? (
@ -286,18 +285,20 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
</Suspense>
) : null}
</EuiFlexItem>
<EuiFlexItem grow={true}>
<EuiCallOut
size="s"
color="warning"
title={i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.noReferenceModelStartWarningMessage',
{
defaultMessage:
'The referenced model for this inference endpoint will be started when adding this field.',
}
)}
/>
<EuiFlexItem grow={false}>
<EuiPanel color="transparent" paddingSize="s">
<EuiText color="subdued" size="s">
<p>
{i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.noReferenceModelStartWarningMessage',
{
defaultMessage:
'The referenced model for this inference endpoint will be started when adding this field.',
}
)}
</p>
</EuiText>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</>

View file

@ -11,6 +11,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiOutsideClickDetector,
EuiPanel,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
@ -18,7 +19,7 @@ import { TrainedModelStat } from '@kbn/ml-plugin/common/types/trained_models';
import { MlPluginStart } from '@kbn/ml-plugin/public';
import classNames from 'classnames';
import React, { useEffect, useRef } from 'react';
import { EUI_SIZE, TYPE_DEFINITION } from '../../../../constants';
import { TYPE_DEFINITION } from '../../../../constants';
import { fieldSerializer } from '../../../../lib';
import { getFieldByPathName, isSemanticTextField } from '../../../../lib/utils';
import { useDispatch, useMappingsState } from '../../../../mappings_state_context';
@ -281,6 +282,7 @@ export const CreateField = React.memo(function CreateFieldComponent({
return (
<>
<EuiSpacer size="s" />
<EuiOutsideClickDetector onOutsideClick={onClickOutside}>
<Form
form={form}
@ -288,20 +290,15 @@ export const CreateField = React.memo(function CreateFieldComponent({
onSubmit={submitForm}
data-test-subj="createFieldForm"
>
<div
<EuiPanel
color="subdued"
paddingSize="m"
className={classNames('mappingsEditor__createFieldWrapper', {
'mappingsEditor__createFieldWrapper--toggle':
Boolean(maxNestedDepth) && maxNestedDepth! > 0,
'mappingsEditor__createFieldWrapper--multiField': isMultiField,
})}
style={{
paddingLeft: `${
isMultiField
? paddingLeft! - EUI_SIZE * 1.5 // As there are no "L" bullet list we need to substract some indent
: paddingLeft
}px`,
}}
ref={createFieldFormRef}
panelRef={createFieldFormRef}
tabIndex={0}
>
<div className="mappingsEditor__createFieldContent">
@ -312,7 +309,7 @@ export const CreateField = React.memo(function CreateFieldComponent({
{isSemanticText && <SelectInferenceId />}
{renderFormActions()}
</div>
</div>
</EuiPanel>
</Form>
</EuiOutsideClickDetector>
</>

View file

@ -22,6 +22,7 @@ import {
EuiText,
EuiTitle,
useGeneratedHtmlId,
useEuiBreakpoint,
} from '@elastic/eui';
import { css } from '@emotion/react';
import { i18n } from '@kbn/i18n';
@ -400,24 +401,27 @@ export const DetailsPageMappingsContent: FunctionComponent<{
<EuiSpacer />
</EuiFlexItem>
);
const showAboutMappingsStyles = css`
${useEuiBreakpoint(['xl'])} {
max-width: 480px;
}
`;
const mappingsWrapperStyles = css`
height: 100%;
${useEuiBreakpoint(['xl'])} {
flex-wrap: nowrap;
}
`;
return (
// using "rowReverse" to keep docs links on the top of the mappings code block on smaller screen
<>
<EuiFlexGroup
wrap
direction="rowReverse"
css={css`
height: 100%;
`}
>
<EuiFlexGroup wrap direction="rowReverse" css={mappingsWrapperStyles}>
{showAboutMappings && (
<EuiFlexItem
grow={1}
css={css`
min-width: 400px;
`}
>
<EuiPanel grow={false} paddingSize="l">
<EuiFlexItem grow={false} css={showAboutMappingsStyles}>
<EuiPanel grow={false} paddingSize="l" color="subdued">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiIcon type="iInCircle" />
@ -465,7 +469,7 @@ export const DetailsPageMappingsContent: FunctionComponent<{
)}
</EuiFlexItem>
)}
<EuiFlexGroup direction="column">
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexGroup gutterSize="s" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<MappingsFilter
@ -535,14 +539,14 @@ export const DetailsPageMappingsContent: FunctionComponent<{
</EuiFilterGroup>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexItem grow={true}>
{hasMLPermissions && (
{hasMLPermissions && (
<EuiFlexItem grow={true}>
<SemanticTextBanner
isSemanticTextEnabled={isSemanticTextEnabled}
isPlatinumLicense={isPlatinumLicense}
/>
)}
</EuiFlexItem>
</EuiFlexItem>
)}
{errorSavingMappings}
{isAddingFields && (
<EuiFlexItem grow={false} ref={pendingFieldsRef} tabIndex={0}>