mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[Lens] Fix inline dimension button label (#215476)](https://github.com/elastic/kibana/pull/215476) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Andreana Malama","email":"72010092+andrimal@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-24T14:35:47Z","message":"[Lens] Fix inline dimension button label (#215476)\n\n## Summary\n\nFix for #209696. \n\n<img width=\"368\" alt=\"Screenshot 2025-03-21 at 1 49 14 PM\"\nsrc=\"https://github.com/user-attachments/assets/69052665-a194-459b-9c2a-835f4230a99b\"\n/>\n<img width=\"381\" alt=\"Screenshot 2025-03-21 at 1 49 53 PM\"\nsrc=\"https://github.com/user-attachments/assets/7cf6b7eb-4d1e-40fc-a28f-597634441eb1\"\n/>\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a3fe0cd46090d5b3210c423469ee424e646eeb5f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Lens] Fix inline dimension button label","number":215476,"url":"https://github.com/elastic/kibana/pull/215476","mergeCommit":{"message":"[Lens] Fix inline dimension button label (#215476)\n\n## Summary\n\nFix for #209696. \n\n<img width=\"368\" alt=\"Screenshot 2025-03-21 at 1 49 14 PM\"\nsrc=\"https://github.com/user-attachments/assets/69052665-a194-459b-9c2a-835f4230a99b\"\n/>\n<img width=\"381\" alt=\"Screenshot 2025-03-21 at 1 49 53 PM\"\nsrc=\"https://github.com/user-attachments/assets/7cf6b7eb-4d1e-40fc-a28f-597634441eb1\"\n/>\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a3fe0cd46090d5b3210c423469ee424e646eeb5f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215476","number":215476,"mergeCommit":{"message":"[Lens] Fix inline dimension button label (#215476)\n\n## Summary\n\nFix for #209696. \n\n<img width=\"368\" alt=\"Screenshot 2025-03-21 at 1 49 14 PM\"\nsrc=\"https://github.com/user-attachments/assets/69052665-a194-459b-9c2a-835f4230a99b\"\n/>\n<img width=\"381\" alt=\"Screenshot 2025-03-21 at 1 49 53 PM\"\nsrc=\"https://github.com/user-attachments/assets/7cf6b7eb-4d1e-40fc-a28f-597634441eb1\"\n/>\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Marco Liberati <dej611@users.noreply.github.com>","sha":"a3fe0cd46090d5b3210c423469ee424e646eeb5f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Andreana Malama <72010092+andrimal@users.noreply.github.com>
This commit is contained in:
parent
373b370506
commit
35786f153d
2 changed files with 20 additions and 3 deletions
|
@ -33,6 +33,7 @@ import {
|
|||
} from '../../../../types';
|
||||
|
||||
interface EmptyButtonProps {
|
||||
isInlineEditing: boolean;
|
||||
columnId: string;
|
||||
onClick: (id: string) => void;
|
||||
group: VisualizationDimensionGroupConfig;
|
||||
|
@ -56,12 +57,24 @@ const defaultButtonLabels = {
|
|||
),
|
||||
};
|
||||
|
||||
const DefaultEmptyButton = ({ columnId, group, onClick }: EmptyButtonProps) => {
|
||||
const defaultInlineButtonLabels = {
|
||||
ariaLabel: (l: string) =>
|
||||
i18n.translate('xpack.lens.indexPattern.addColumnAriaLabel.inline', {
|
||||
defaultMessage: 'Add a field to {groupLabel}',
|
||||
values: { groupLabel: l },
|
||||
}),
|
||||
label: (
|
||||
<FormattedMessage id="xpack.lens.configure.emptyConfig.inline" defaultMessage="Add a field" />
|
||||
),
|
||||
};
|
||||
|
||||
const DefaultEmptyButton = ({ isInlineEditing, columnId, group, onClick }: EmptyButtonProps) => {
|
||||
const { buttonAriaLabel, buttonLabel } = group.labels || {};
|
||||
const defaultLabels = isInlineEditing ? defaultInlineButtonLabels : defaultButtonLabels;
|
||||
return (
|
||||
<EmptyDimensionButtonInner
|
||||
label={buttonLabel || defaultButtonLabels.label}
|
||||
ariaLabel={buttonAriaLabel || defaultButtonLabels.ariaLabel(group.groupLabel)}
|
||||
label={buttonLabel || defaultLabels.label}
|
||||
ariaLabel={buttonAriaLabel || defaultLabels.ariaLabel(group.groupLabel)}
|
||||
dataTestSubj="lns-empty-dimension"
|
||||
onClick={() => onClick(columnId)}
|
||||
/>
|
||||
|
@ -98,6 +111,7 @@ export function EmptyDimensionButton({
|
|||
activeVisualization,
|
||||
order,
|
||||
target,
|
||||
isInlineEditing,
|
||||
}: {
|
||||
order: [2, number, number, number];
|
||||
group: VisualizationDimensionGroupConfig;
|
||||
|
@ -116,6 +130,7 @@ export function EmptyDimensionButton({
|
|||
label: string;
|
||||
};
|
||||
};
|
||||
isInlineEditing: boolean;
|
||||
}) {
|
||||
const [{ dragging }] = useDragDropContext();
|
||||
|
||||
|
@ -177,6 +192,7 @@ export function EmptyDimensionButton({
|
|||
columnId: value.columnId,
|
||||
onClick,
|
||||
group,
|
||||
isInlineEditing,
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
@ -644,6 +644,7 @@ export function LayerPanel(props: LayerPanelProps) {
|
|||
}}
|
||||
onDrop={onDrop}
|
||||
indexPatterns={dataViews.indexPatterns}
|
||||
isInlineEditing={isInlineEditing}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue