mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] Transforms: Adds a type column to the transforms management table (#106990)
* [ML] Transforms: Adds a type column to the transforms management table * [ML] Stabilize checks for transform table expanded row content * [ML] Remove unnecessary expected row data type field * [ML] Add timeouts to assertTransformExpandedRow existOrFail calls * [ML] Use separate retry for each expanded row tab click * [ML] Remove skip from permissions tests * [ML] Correct suite title for read permissions tests
This commit is contained in:
parent
4eec61a5f9
commit
8f175803be
11 changed files with 106 additions and 32 deletions
|
@ -247,6 +247,7 @@ export const ExpandedRow: FC<Props> = ({ item }) => {
|
|||
onTabClick={() => {}}
|
||||
expand={false}
|
||||
style={{ width: '100%' }}
|
||||
data-test-subj="transformExpandedRowTabbedContent"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -9,7 +9,12 @@ import React from 'react';
|
|||
import { EuiBadge, SearchFilterConfig } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { TermClause, FieldClause, Value } from './common';
|
||||
import { TRANSFORM_MODE, TRANSFORM_STATE } from '../../../../../../common/constants';
|
||||
import {
|
||||
TRANSFORM_FUNCTION,
|
||||
TRANSFORM_MODE,
|
||||
TRANSFORM_STATE,
|
||||
} from '../../../../../../common/constants';
|
||||
import { isLatestTransform, isPivotTransform } from '../../../../../../common/types/transform';
|
||||
import { TransformListRow } from '../../../../common';
|
||||
import { getTaskStateBadge } from './use_columns';
|
||||
|
||||
|
@ -93,7 +98,20 @@ export const filterTransforms = (
|
|||
// the status value is an array of string(s) e.g. ['failed', 'stopped']
|
||||
ts = transforms.filter((transform) => (c.value as Value[]).includes(transform.stats.state));
|
||||
} else {
|
||||
ts = transforms.filter((transform) => transform.mode === c.value);
|
||||
ts = transforms.filter((transform) => {
|
||||
if (c.field === 'mode') {
|
||||
return transform.mode === c.value;
|
||||
}
|
||||
if (c.field === 'type') {
|
||||
if (c.value === TRANSFORM_FUNCTION.PIVOT) {
|
||||
return isPivotTransform(transform.config);
|
||||
}
|
||||
if (c.value === TRANSFORM_FUNCTION.LATEST) {
|
||||
return isLatestTransform(transform.config);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,14 @@ describe('Transform: Job List Columns', () => {
|
|||
|
||||
const columns: ReturnType<typeof useColumns>['columns'] = result.current.columns;
|
||||
|
||||
expect(columns).toHaveLength(7);
|
||||
expect(columns).toHaveLength(8);
|
||||
expect(columns[0].isExpander).toBeTruthy();
|
||||
expect(columns[1].name).toBe('ID');
|
||||
expect(columns[2].name).toBe('Description');
|
||||
expect(columns[3].name).toBe('Status');
|
||||
expect(columns[4].name).toBe('Mode');
|
||||
expect(columns[5].name).toBe('Progress');
|
||||
expect(columns[6].name).toBe('Actions');
|
||||
expect(columns[3].name).toBe('Type');
|
||||
expect(columns[4].name).toBe('Status');
|
||||
expect(columns[5].name).toBe('Mode');
|
||||
expect(columns[6].name).toBe('Progress');
|
||||
expect(columns[7].name).toBe('Actions');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,7 +23,11 @@ import {
|
|||
RIGHT_ALIGNMENT,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { TransformId } from '../../../../../../common/types/transform';
|
||||
import {
|
||||
isLatestTransform,
|
||||
isPivotTransform,
|
||||
TransformId,
|
||||
} from '../../../../../../common/types/transform';
|
||||
import { TransformStats } from '../../../../../../common/types/transform_stats';
|
||||
import { TRANSFORM_STATE } from '../../../../../../common/constants';
|
||||
|
||||
|
@ -95,6 +99,7 @@ export const useColumns = (
|
|||
EuiTableComputedColumnType<TransformListRow>,
|
||||
EuiTableComputedColumnType<TransformListRow>,
|
||||
EuiTableComputedColumnType<TransformListRow>,
|
||||
EuiTableComputedColumnType<TransformListRow>,
|
||||
EuiTableActionsColumnType<TransformListRow>
|
||||
] = [
|
||||
{
|
||||
|
@ -145,6 +150,27 @@ export const useColumns = (
|
|||
sortable: true,
|
||||
truncateText: true,
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.transform.type', { defaultMessage: 'Type' }),
|
||||
'data-test-subj': 'transformListColumnType',
|
||||
sortable: (item: TransformListRow) => item.mode,
|
||||
truncateText: true,
|
||||
render(item: TransformListRow) {
|
||||
let transformType = i18n.translate('xpack.transform.type.unknown', {
|
||||
defaultMessage: 'unknown',
|
||||
});
|
||||
if (isPivotTransform(item.config) === true) {
|
||||
transformType = i18n.translate('xpack.transform.type.pivot', { defaultMessage: 'pivot' });
|
||||
}
|
||||
if (isLatestTransform(item.config) === true) {
|
||||
transformType = i18n.translate('xpack.transform.type.latest', {
|
||||
defaultMessage: 'latest',
|
||||
});
|
||||
}
|
||||
return <EuiBadge color="hollow">{transformType}</EuiBadge>;
|
||||
},
|
||||
width: '100px',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.transform.status', { defaultMessage: 'Status' }),
|
||||
'data-test-subj': 'transformListColumnStatus',
|
||||
|
|
|
@ -578,6 +578,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
await transform.table.assertTransformRowFields(testData.transformId, {
|
||||
id: testData.transformId,
|
||||
description: testData.transformDescription,
|
||||
type: testData.type,
|
||||
status: testData.expected.row.status,
|
||||
mode: testData.expected.row.mode,
|
||||
progress: testData.expected.row.progress,
|
||||
|
|
|
@ -279,6 +279,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
await transform.table.assertTransformRowFields(testData.transformId, {
|
||||
id: testData.transformId,
|
||||
description: testData.transformDescription,
|
||||
type: testData.type,
|
||||
status: testData.expected.row.status,
|
||||
mode: testData.expected.row.mode,
|
||||
progress: testData.expected.row.progress,
|
||||
|
|
|
@ -24,6 +24,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
expected: {
|
||||
row: {
|
||||
status: TRANSFORM_STATE.STOPPED,
|
||||
type: 'pivot',
|
||||
mode: 'batch',
|
||||
progress: 100,
|
||||
},
|
||||
|
@ -35,6 +36,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
expected: {
|
||||
row: {
|
||||
status: TRANSFORM_STATE.STOPPED,
|
||||
type: 'pivot',
|
||||
mode: 'continuous',
|
||||
progress: undefined,
|
||||
},
|
||||
|
@ -50,6 +52,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
messageText: 'updated transform.',
|
||||
row: {
|
||||
status: TRANSFORM_STATE.STOPPED,
|
||||
type: 'latest',
|
||||
mode: 'batch',
|
||||
progress: 100,
|
||||
},
|
||||
|
@ -106,6 +109,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
await transform.table.assertTransformRowFields(testData.originalConfig.id, {
|
||||
id: testData.originalConfig.id,
|
||||
description: testData.originalConfig.description,
|
||||
type: testData.expected.row.type,
|
||||
status: testData.expected.row.status,
|
||||
mode: testData.expected.row.mode,
|
||||
progress: testData.expected.row.progress,
|
||||
|
|
|
@ -70,6 +70,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
messageText: 'updated transform.',
|
||||
row: {
|
||||
status: TRANSFORM_STATE.STOPPED,
|
||||
type: 'pivot',
|
||||
mode: 'batch',
|
||||
progress: '100',
|
||||
},
|
||||
|
@ -85,6 +86,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
messageText: 'updated transform.',
|
||||
row: {
|
||||
status: TRANSFORM_STATE.STOPPED,
|
||||
type: 'latest',
|
||||
mode: 'batch',
|
||||
progress: '100',
|
||||
},
|
||||
|
@ -170,6 +172,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
await transform.table.assertTransformRowFields(testData.originalConfig.id, {
|
||||
id: testData.originalConfig.id,
|
||||
description: testData.transformDescription,
|
||||
type: testData.expected.row.type,
|
||||
status: testData.expected.row.status,
|
||||
mode: testData.expected.row.mode,
|
||||
progress: testData.expected.row.progress,
|
||||
|
|
|
@ -13,8 +13,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const esArchiver = getService('esArchiver');
|
||||
const transform = getService('transform');
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/107043
|
||||
describe.skip('for user with full transform access', function () {
|
||||
describe('for user with full transform access', function () {
|
||||
describe('with no data loaded', function () {
|
||||
before(async () => {
|
||||
await transform.securityUI.loginAsTransformPowerUser();
|
||||
|
|
|
@ -13,8 +13,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const esArchiver = getService('esArchiver');
|
||||
const transform = getService('transform');
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/107043
|
||||
describe.skip('for user with full transform access', function () {
|
||||
describe('for user with read only transform access', function () {
|
||||
describe('with no data loaded', function () {
|
||||
before(async () => {
|
||||
await transform.securityUI.loginAsTransformViewer();
|
||||
|
|
|
@ -37,6 +37,11 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {
|
|||
.find('.euiTableCellContent')
|
||||
.text()
|
||||
.trim(),
|
||||
type: $tr
|
||||
.findTestSubject('transformListColumnType')
|
||||
.find('.euiTableCellContent')
|
||||
.text()
|
||||
.trim(),
|
||||
status: $tr
|
||||
.findTestSubject('transformListColumnStatus')
|
||||
.find('.euiTableCellContent')
|
||||
|
@ -190,38 +195,54 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {
|
|||
});
|
||||
}
|
||||
|
||||
public async assertTransformExpandedRow() {
|
||||
await testSubjects.click('transformListRowDetailsToggle');
|
||||
public async ensureDetailsOpen() {
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
if (!(await testSubjects.exists('transformExpandedRowTabbedContent'))) {
|
||||
await testSubjects.click('transformListRowDetailsToggle');
|
||||
await testSubjects.existOrFail('transformExpandedRowTabbedContent', { timeout: 1000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// The expanded row should show the details tab content by default
|
||||
await testSubjects.existOrFail('transformDetailsTab');
|
||||
await testSubjects.existOrFail('~transformDetailsTabContent');
|
||||
public async ensureDetailsClosed() {
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
if (await testSubjects.exists('transformExpandedRowTabbedContent')) {
|
||||
await testSubjects.click('transformListRowDetailsToggle');
|
||||
await testSubjects.missingOrFail('transformExpandedRowTabbedContent', { timeout: 1000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async switchToExpandedRowTab(tabSubject: string, contentSubject: string) {
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
await testSubjects.click(tabSubject);
|
||||
await testSubjects.existOrFail(contentSubject, { timeout: 1000 });
|
||||
});
|
||||
}
|
||||
|
||||
public async assertTransformExpandedRow() {
|
||||
await this.ensureDetailsOpen();
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
// The expanded row should show the details tab content by default
|
||||
await testSubjects.existOrFail('transformDetailsTab', { timeout: 1000 });
|
||||
await testSubjects.existOrFail('~transformDetailsTabContent', { timeout: 1000 });
|
||||
});
|
||||
|
||||
// Walk through the rest of the tabs and check if the corresponding content shows up
|
||||
await testSubjects.existOrFail('transformJsonTab');
|
||||
await testSubjects.click('transformJsonTab');
|
||||
await testSubjects.existOrFail('~transformJsonTabContent');
|
||||
|
||||
await testSubjects.existOrFail('transformMessagesTab');
|
||||
await testSubjects.click('transformMessagesTab');
|
||||
await testSubjects.existOrFail('~transformMessagesTabContent');
|
||||
|
||||
await testSubjects.existOrFail('transformPreviewTab');
|
||||
await testSubjects.click('transformPreviewTab');
|
||||
await testSubjects.existOrFail('~transformPivotPreview');
|
||||
await this.switchToExpandedRowTab('transformJsonTab', '~transformJsonTabContent');
|
||||
await this.switchToExpandedRowTab('transformMessagesTab', '~transformMessagesTabContent');
|
||||
await this.switchToExpandedRowTab('transformPreviewTab', '~transformPivotPreview');
|
||||
}
|
||||
|
||||
public async assertTransformExpandedRowMessages(expectedText: string) {
|
||||
await testSubjects.click('transformListRowDetailsToggle');
|
||||
await this.ensureDetailsOpen();
|
||||
|
||||
// The expanded row should show the details tab content by default
|
||||
await testSubjects.existOrFail('transformDetailsTab');
|
||||
await testSubjects.existOrFail('~transformDetailsTabContent');
|
||||
|
||||
// Click on the messages tab and assert the messages
|
||||
await testSubjects.existOrFail('transformMessagesTab');
|
||||
await testSubjects.click('transformMessagesTab');
|
||||
await testSubjects.existOrFail('~transformMessagesTabContent');
|
||||
await this.switchToExpandedRowTab('transformMessagesTab', '~transformMessagesTabContent');
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
const actualText = await testSubjects.getVisibleText('~transformMessagesTabContent');
|
||||
expect(actualText.toLowerCase()).to.contain(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue