[ML] DFA: Fix layout of job status in expanded row. (#204978)

## Summary

This removes the usage of `EuiBetaBadge` to display the job status. This
EUI component has a semantic meaning to be used to display a "beta",
"experimental" or other status of a feature, in this case it was used to
render the data frame analytics job status. Instead, the job status now
gets rendered in the same way like the other items in the list.

Before:

![CleanShot 2024-12-19 at 17 36
44@2x](https://github.com/user-attachments/assets/17c80e89-8e67-4400-b431-3a1e4c78d642)

After:

![CleanShot 2025-01-07 at 16 43
26@2x](https://github.com/user-attachments/assets/2240d4a7-fb77-4a5b-bfbd-6efeaeda7383)

### Checklist

- [ ] 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/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
This commit is contained in:
Walter Rafelsberger 2025-01-07 18:34:40 +01:00 committed by GitHub
parent fd702efdd3
commit c4371e9de5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 120 additions and 43 deletions

View file

@ -155,9 +155,23 @@ export const ExpandedRow: FC<Props> = ({ item }) => {
defaultMessage: 'Overall',
}),
items: [
{ title: 'badge', description: stateValues.state },
{
title: 'Create time',
title: i18n.translate(
'xpack.ml.dataframe.analyticsList.expandedRow.tabs.jobSettings.status',
{
defaultMessage: 'Status',
}
),
type: 'badge',
description: stateValues.state,
},
{
title: i18n.translate(
'xpack.ml.dataframe.analyticsList.expandedRow.tabs.jobSettings.createTime',
{
defaultMessage: 'Create time',
}
),
description: formatHumanReadableDateTimeSeconds(
moment(item.config.create_time).unix() * 1000
),

View file

@ -10,8 +10,8 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
import {
EuiBadge,
EuiBasicTable,
EuiBetaBadge,
EuiDescriptionListDescription,
EuiDescriptionListTitle,
EuiFlexGroup,
@ -25,6 +25,7 @@ import {
export interface SectionItem {
title: string;
type?: 'plain' | 'badge';
description: string | ReactElement;
}
export interface SectionConfig {
@ -41,35 +42,28 @@ export const OverallDetails: FC<{
overallDetails: SectionConfig;
}> = ({ overallDetails }) => (
<EuiFlexGroup alignItems="center" wrap data-test-subj={overallDetails.dataTestSubj}>
{overallDetails.items.map((item) => {
const key = item.title;
if (item.title === 'badge') {
return (
<EuiFlexItem grow={false} key={key}>
<EuiBetaBadge label={item.description} color="subdued" title={item.title} />
{overallDetails.items.map((item) => (
<EuiFlexItem grow={false} key={item.title}>
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexItem grow={false}>
<EuiDescriptionListDescription className="descriptionListTitle">
<EuiText size="xs">{item.title}</EuiText>
</EuiDescriptionListDescription>
</EuiFlexItem>
);
}
return (
<EuiFlexItem grow={false} key={key}>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiDescriptionListDescription className="descriptionListTitle">
<EuiText size="xs">{item.title}</EuiText>
</EuiDescriptionListDescription>
</EuiFlexItem>
<EuiFlexItem>
<EuiDescriptionListTitle className="descriptionListDescription">
<EuiFlexItem>
<EuiDescriptionListTitle className="descriptionListDescription">
{item.type === 'badge' ? (
<EuiBadge color="hollow">{item.description}</EuiBadge>
) : (
<EuiText size="s">
<h5>{item.description}</h5>
</EuiText>
</EuiDescriptionListTitle>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
);
})}
)}
</EuiDescriptionListTitle>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
))}
</EuiFlexGroup>
);

View file

@ -123,7 +123,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'25mb',

View file

@ -119,7 +119,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'20mb',
@ -219,7 +220,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'20mb',
@ -317,7 +319,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '7mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'7mb',
'Version',
],
},
{
section: 'stats',
@ -407,7 +416,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '6mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'6mb',
'Version',
],
},
{
section: 'stats',

View file

@ -135,7 +135,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '2mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'2mb',
'Version',
],
},
{
section: 'stats',

View file

@ -83,7 +83,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '1mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'1mb',
'Version',
],
},
{
section: 'stats',
@ -160,7 +167,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '1mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'1mb',
'Version',
],
},
{
section: 'stats',
@ -237,7 +251,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '1mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'1mb',
'Version',
],
},
{
section: 'stats',
@ -315,7 +336,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '1mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'1mb',
'Version',
],
},
{
section: 'stats',

View file

@ -119,7 +119,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'16mb',

View file

@ -89,7 +89,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'10mb',
@ -177,7 +178,8 @@ export default function ({ getService }: FtrProviderContext) {
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: [
'STOPPED',
'Status',
'stopped',
'Create time',
'Model memory limit',
'10mb',
@ -264,7 +266,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '5mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'5mb',
'Version',
],
},
{
section: 'stats',
@ -346,7 +355,14 @@ export default function ({ getService }: FtrProviderContext) {
{
section: 'state',
// Don't include the 'Create time' value entry as it's not stable.
expectedEntries: ['STOPPED', 'Create time', 'Model memory limit', '5mb', 'Version'],
expectedEntries: [
'Status',
'stopped',
'Create time',
'Model memory limit',
'5mb',
'Version',
],
},
{
section: 'stats',