mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Lens] Fix inline dimension button label (#215476)
## Summary Fix for #209696. <img width="368" alt="Screenshot 2025-03-21 at 1 49 14 PM" src="https://github.com/user-attachments/assets/69052665-a194-459b-9c2a-835f4230a99b" /> <img width="381" alt="Screenshot 2025-03-21 at 1 49 53 PM" src="https://github.com/user-attachments/assets/7cf6b7eb-4d1e-40fc-a28f-597634441eb1" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
This commit is contained in:
parent
935fc0f758
commit
a3fe0cd460
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 (
|
||||
|
|
|
@ -703,6 +703,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