Skip to content

Commit

Permalink
[ML] DFA: Fix layout of job status in expanded row. (elastic#204978)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
walterra authored and kowalczyk-krzysztof committed Jan 7, 2025
1 parent e9b24bd commit aa548dd
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import React from 'react';
import { i18n } from '@kbn/i18n';

import {
EuiBadge,
EuiBasicTable,
EuiBetaBadge,
EuiDescriptionListDescription,
EuiDescriptionListTitle,
EuiFlexGroup,
Expand All @@ -25,6 +25,7 @@ import {

export interface SectionItem {
title: string;
type?: 'plain' | 'badge';
description: string | ReactElement;
}
export interface SectionConfig {
Expand All @@ -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>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit aa548dd

Please sign in to comment.