Skip to content

Commit

Permalink
feat: refactor index check flyout translations and tooltips
Browse files Browse the repository at this point in the history
- Moved CHECK_NOW translation to a new file for better organization.
- Updated tooltip translations for various stats in the StatsRollup
component.
- Improved consistency in tooltip messages across the application.
- Renamed actions in the summary table from "Check now" to "Check index"
and "View details" to "View check details"
  • Loading branch information
kapral18 committed Aug 21, 2024
1 parent ecb27b7 commit a9dca35
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import { EMPTY_STAT, getDocsCount, getSizeInBytes } from '../../../helpers';
import { MeteringStatsIndex, PatternRollup } from '../../../types';
import { useDataQualityContext } from '../../data_quality_context';
import { IndexProperties } from '../../index_properties';
import { CHECK_NOW } from '../../summary_table/translations';
import { getIlmPhase } from '../helpers';
import { IndexResultBadge } from '../../index_result_badge';
import { useCurrentWindowWidth } from '../../../use_current_window_width';
import { CHECK_NOW } from './translations';

export interface Props {
ilmExplain: Record<string, IlmExplainLifecycleLifecycleExplain> | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { i18n } from '@kbn/i18n';

export const CHECK_NOW: string = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.indexCheckFlyout.checkNowButton',
{
defaultMessage: 'Check now',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,24 @@ describe('StatsRollup', () => {
describe.each([
[
'Docs',
'The total count of docs, in indices matching the {pattern} pattern',
'The total count of docs, in all indices',
'Total number of docs in indices matching this index pattern',
'Total number of docs in all indices',
],
[
'Incompatible fields',
'The total count of fields incompatible with ECS, in indices matching the {pattern} pattern',
'The total count of fields incompatible with ECS, in all indices that were checked',
],
[
'Indices',
'The total count of indices matching the {pattern} pattern',
'The total count of all indices',
'Total number of checked fields incompatible with ECS in indices matching this index pattern',
'Total number of checked fields incompatible with ECS',
],
['Indices', 'Total number of indices matching this index pattern', 'Total number of indices'],
[
'Indices checked',
'The total count of indices checked that match the {pattern} pattern',
'The total count of all indices checked',
'Total number of checked indices matching this index pattern',
'Total number of checked indices',
],
[
'Size',
'The total size of the primary indices matching the {pattern} pattern (does not include replicas)',
'The total size of all primary indices (does not include replicas)',
'Total size of indices (excluding replicas) matching this index pattern',
'Total size of indices (excluding replicas)',
],
])('%s count tooltips', (statLabelText, patternTooltipText, noPatternTooltipText) => {
describe('when pattern is provided', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const StatsRollupComponent: React.FC<Props> = ({
<Stat
tooltipText={
pattern != null
? i18n.INCOMPATIBLE_PATTERN_TOOL_TIP(pattern)
? i18n.TOTAL_INCOMPATIBLE_PATTERN_TOOL_TIP
: i18n.TOTAL_INCOMPATIBLE_TOOL_TIP
}
badgeText={incompatible != null ? formatNumber(incompatible) : EMPTY_STAT}
Expand All @@ -72,8 +72,8 @@ const StatsRollupComponent: React.FC<Props> = ({
<Stat
tooltipText={
pattern != null
? i18n.TOTAL_COUNT_OF_INDICES_CHECKED_MATCHING_PATTERN_TOOL_TIP(pattern)
: i18n.TOTAL_INDICES_CHECKED_TOOL_TIP
? i18n.TOTAL_CHECKED_INDICES_PATTERN_TOOL_TIP
: i18n.TOTAL_CHECKED_INDICES_TOOL_TIP
}
badgeText={indicesChecked != null ? formatNumber(indicesChecked) : EMPTY_STAT}
>
Expand All @@ -84,9 +84,7 @@ const StatsRollupComponent: React.FC<Props> = ({
<StyledStatWrapperFlexItem grow={false}>
<Stat
tooltipText={
pattern != null
? i18n.TOTAL_COUNT_OF_INDICES_MATCHING_PATTERN_TOOL_TIP(pattern)
: i18n.TOTAL_INDICES_TOOL_TIP
pattern != null ? i18n.TOTAL_INDICES_PATTERN_TOOL_TIP : i18n.TOTAL_INDICES_TOOL_TIP
}
badgeText={indices != null ? formatNumber(indices) : '0'}
>
Expand All @@ -98,9 +96,7 @@ const StatsRollupComponent: React.FC<Props> = ({
<StyledStatWrapperFlexItem grow={false}>
<Stat
tooltipText={
pattern != null
? i18n.INDICES_SIZE_PATTERN_TOOL_TIP(pattern)
: i18n.TOTAL_SIZE_TOOL_TIP
pattern != null ? i18n.TOTAL_SIZE_PATTERN_TOOL_TIP : i18n.TOTAL_SIZE_TOOL_TIP
}
badgeText={sizeInBytes != null ? formatBytes(sizeInBytes) : EMPTY_STAT}
>
Expand All @@ -112,7 +108,7 @@ const StatsRollupComponent: React.FC<Props> = ({
<StyledStatWrapperFlexItem grow={false}>
<Stat
tooltipText={
pattern != null ? i18n.INDEX_DOCS_PATTERN_TOOL_TIP(pattern) : i18n.TOTAL_DOCS_TOOL_TIP
pattern != null ? i18n.TOTAL_DOCS_PATTERN_TOOL_TIP : i18n.TOTAL_DOCS_TOOL_TIP
}
badgeText={docsCount != null ? formatNumber(docsCount) : EMPTY_STAT}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export const INDICES = i18n.translate(
export const PATTERN_OR_INDEX_TOOLTIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.patternSummary.patternOrIndexTooltip',
{
defaultMessage: 'A pattern or specific index',
defaultMessage: 'Index name or pattern',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,17 @@ export const CHECKED = i18n.translate(
}
);

export const CUSTOM = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.customLabel',
export const DOCS = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.docsLabel',
{
defaultMessage: 'Custom',
defaultMessage: 'Docs',
}
);

export const CUSTOM_INDEX_TOOL_TIP = (indexName: string) =>
i18n.translate('securitySolutionPackages.ecsDataQualityDashboard.statLabels.customIndexToolTip', {
values: { indexName },
defaultMessage: 'A count of the custom field mappings in the {indexName} index',
});

export const CUSTOM_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.customPatternToolTip',
{
values: { pattern },
defaultMessage:
'The total count of custom field mappings, in indices matching the {pattern} pattern',
}
);

export const DOCS = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.docsLabel',
export const SIZE = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.sizeLabel',
{
defaultMessage: 'Docs',
defaultMessage: 'Size',
}
);

Expand All @@ -51,43 +35,6 @@ export const INCOMPATIBLE_FIELDS = i18n.translate(
}
);

export const INCOMPATIBLE_INDEX_TOOL_TIP = (indexName: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.incompatibleIndexToolTip',
{
values: { indexName },
defaultMessage: 'Mappings and values incompatible with ECS, in the {indexName} index',
}
);

export const INCOMPATIBLE_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.incompatiblePatternToolTip',
{
values: { pattern },
defaultMessage:
'The total count of fields incompatible with ECS, in indices matching the {pattern} pattern',
}
);

export const INDEX_DOCS_COUNT_TOOL_TIP = (indexName: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.indexDocsCountToolTip',
{
values: { indexName },
defaultMessage: 'A count of the docs in the {indexName} index',
}
);

export const INDEX_DOCS_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.indexDocsPatternToolTip',
{
values: { pattern },
defaultMessage: 'The total count of docs, in indices matching the {pattern} pattern',
}
);

export const INDICES = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.indicesLabel',
{
Expand All @@ -109,91 +56,80 @@ export const SAME_FAMILY = i18n.translate(
}
);

export const SAME_FAMILY_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.sameFamilyPatternToolTip',
{
values: { pattern },
defaultMessage:
'The total count of fields in the same family as the type specified by ECS, in indices matching the {pattern} pattern',
}
);
export const INCOMPATIBLE_INDEX_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.incompatibleIndexToolTip',
{
defaultMessage: 'Mappings and values incompatible with ECS',
}
);

export const SIZE = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.sizeLabel',
export const TOTAL_INCOMPATIBLE_PATTERN_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalIncompatiblePatternToolTip',
{
defaultMessage: 'Size',
defaultMessage:
'Total number of checked fields incompatible with ECS in indices matching this index pattern',
}
);

export const TOTAL_DOCS_PATTERN_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalDocsPatternToolTip',
{
defaultMessage: 'Total number of docs in indices matching this index pattern',
}
);

export const TOTAL_SIZE_PATTERN_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalSizePatternToolTip',
{
defaultMessage: 'Total size of indices (excluding replicas) matching this index pattern',
}
);

export const TOTAL_CHECKED_INDICES_PATTERN_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalCheckedIndicesPatternToolTip',
{
defaultMessage: 'Total number of checked indices matching this index pattern',
}
);

export const INDICES_SIZE_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.indicesSizePatternToolTip',
{
values: { pattern },
defaultMessage:
'The total size of the primary indices matching the {pattern} pattern (does not include replicas)',
}
);

export const TOTAL_COUNT_OF_INDICES_CHECKED_MATCHING_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalCountOfIndicesCheckedMatchingPatternToolTip',
{
values: { pattern },
defaultMessage: 'The total count of indices checked that match the {pattern} pattern',
}
);

export const TOTAL_COUNT_OF_INDICES_MATCHING_PATTERN_TOOL_TIP = (pattern: string) =>
i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalCountOfIndicesMatchingPatternToolTip',
{
values: { pattern },
defaultMessage: 'The total count of indices matching the {pattern} pattern',
}
);
export const TOTAL_INDICES_PATTERN_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalIndicesPatternToolTip',
{
defaultMessage: 'Total number of indices matching this index pattern',
}
);

export const TOTAL_DOCS_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalDocsToolTip',
{
defaultMessage: 'The total count of docs, in all indices',
defaultMessage: 'Total number of docs in all indices',
}
);

export const TOTAL_INCOMPATIBLE_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalIncompatibleToolTip',
{
defaultMessage:
'The total count of fields incompatible with ECS, in all indices that were checked',
defaultMessage: 'Total number of checked fields incompatible with ECS',
}
);

export const TOTAL_INDICES_CHECKED_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalIndicesCheckedToolTip',
export const TOTAL_CHECKED_INDICES_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalCheckedIndicesToolTip',
{
defaultMessage: 'The total count of all indices checked',
defaultMessage: 'Total number of checked indices',
}
);

export const TOTAL_INDICES_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalIndicesToolTip',
{
defaultMessage: 'The total count of all indices',
}
);

export const TOTAL_SAME_FAMILY_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalSameFamilyToolTip',
{
defaultMessage:
'The total count of fields in the same family as the ECS type, in all indices that were checked',
defaultMessage: 'Total number of indices',
}
);

export const TOTAL_SIZE_TOOL_TIP = i18n.translate(
'securitySolutionPackages.ecsDataQualityDashboard.statLabels.totalSizeToolTip',
{
defaultMessage: 'The total size of all primary indices (does not include replicas)',
defaultMessage: 'Total size of indices (excluding replicas)',
}
);
Loading

0 comments on commit a9dca35

Please sign in to comment.