Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Transform: Table enhancements #69307

Merged
merged 7 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions x-pack/plugins/ml/public/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ export * from '../common/types/audit_message';

export * from '../common/util/anomaly_utils';
export * from '../common/util/errors';

export * from '../common/util/validators';

export * from './application/formatters/metric_change_description';

export * from './application/components/data_grid';
export * from './application/data_frame_analytics/common';
export * from './application/util/date_utils';
22 changes: 0 additions & 22 deletions x-pack/plugins/transform/common/utils/date_utils.ts

This file was deleted.

2 changes: 2 additions & 0 deletions x-pack/plugins/transform/public/app/common/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export interface CreateRequestBody extends PreviewRequestBody {

export interface TransformPivotConfig extends CreateRequestBody {
id: TransformId;
create_time?: number;
version?: string;
}

export enum REFRESH_TRANSFORM_LIST_STATE {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/transform/public/app/common/transform_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { TransformStats } from './transform_stats';

// Used to pass on attribute names to table columns
export enum TRANSFORM_LIST_COLUMN {
CONFIG_DEST_INDEX = 'config.dest.index',
CONFIG_SOURCE_INDEX = 'config.source.index',
DESCRIPTION = 'config.description',
ID = 'id',
}
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/transform/public/app/hooks/use_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export const useApi = () => {
});
},
getTransformsPreview(obj: PreviewRequestBody): Promise<GetTransformsResponse> {
return http.post(`${API_BASE_PATH}transforms/_preview`, { body: JSON.stringify(obj) });
return http.post(`${API_BASE_PATH}transforms/_preview`, {
body: JSON.stringify(obj),
});
},
startTransforms(
transformsInfo: TransformEndpointRequest[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n';
import { ES_FIELD_TYPES } from '../../../../../../src/plugins/data/common';

import { dictionaryToArray } from '../../../common/types/common';
import { formatHumanReadableDateTimeSeconds } from '../../../common/utils/date_utils';
import { formatHumanReadableDateTimeSeconds } from '../../shared_imports';
import { getNestedProperty } from '../../../common/utils/object_utils';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ describe('Transform: Job List Columns', () => {
test('getColumns()', () => {
const columns = getColumns([], () => {}, []);

expect(columns).toHaveLength(9);
expect(columns).toHaveLength(7);
expect(columns[0].isExpander).toBeTruthy();
expect(columns[1].name).toBe('ID');
expect(columns[2].name).toBe('Description');
expect(columns[3].name).toBe('Source index');
expect(columns[4].name).toBe('Destination index');
expect(columns[5].name).toBe('Status');
expect(columns[6].name).toBe('Mode');
expect(columns[7].name).toBe('Progress');
expect(columns[8].name).toBe('Actions');
expect(columns[3].name).toBe('Status');
expect(columns[4].name).toBe('Mode');
expect(columns[5].name).toBe('Progress');
expect(columns[6].name).toBe('Actions');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ export const getColumns = (
EuiTableComputedColumnType<TransformListRow>,
EuiTableFieldDataColumnType<TransformListRow>,
EuiTableFieldDataColumnType<TransformListRow>,
EuiTableFieldDataColumnType<TransformListRow>,
EuiTableFieldDataColumnType<TransformListRow>,
EuiTableComputedColumnType<TransformListRow>,
EuiTableComputedColumnType<TransformListRow>,
EuiTableComputedColumnType<TransformListRow>,
Expand Down Expand Up @@ -143,22 +141,6 @@ export const getColumns = (
sortable: true,
truncateText: true,
},
{
field: TRANSFORM_LIST_COLUMN.CONFIG_SOURCE_INDEX,
'data-test-subj': 'transformListColumnSourceIndex',
name: i18n.translate('xpack.transform.sourceIndex', { defaultMessage: 'Source index' }),
sortable: true,
truncateText: true,
},
{
field: TRANSFORM_LIST_COLUMN.CONFIG_DEST_INDEX,
'data-test-subj': 'transformListColumnDestinationIndex',
name: i18n.translate('xpack.transform.destinationIndex', {
defaultMessage: 'Destination index',
}),
sortable: true,
truncateText: true,
},
{
name: i18n.translate('xpack.transform.status', { defaultMessage: 'Status' }),
'data-test-subj': 'transformListColumnStatus',
Expand Down Expand Up @@ -242,7 +224,7 @@ export const getColumns = (
{
name: i18n.translate('xpack.transform.tableActionLabel', { defaultMessage: 'Actions' }),
actions,
width: '200px',
width: '100px',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop the separate 'Start' action and just have it available in the dropdown menu shown from the ... button.

},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { ExpandedRow } from './expanded_row';

import transformListRow from '../../../../common/__mocks__/transform_list_row.json';

jest.mock('../../../../../shared_imports');

jest.mock('../../../../../shared_imports', () => ({
formatHumanReadableDateTimeSeconds: jest.fn(),
}));
describe('Transform: Transform List <ExpandedRow />', () => {
// Set timezone to US/Eastern for consistent test results.
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { EuiTabbedContent } from '@elastic/eui';

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

import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils';

import moment from 'moment-timezone';
import { formatHumanReadableDateTimeSeconds } from '../../../../../shared_imports';
import { TransformListRow } from '../../../../common';
import { ExpandedRowDetailsPane, SectionConfig } from './expanded_row_details_pane';
import { ExpandedRowJsonPane } from './expanded_row_json_pane';
Expand Down Expand Up @@ -64,6 +64,45 @@ export const ExpandedRow: FC<Props> = ({ item }) => {
position: 'left',
};

const configItems: Item[] = [
{
title: 'transform_id',
description: item.id,
},
{
title: 'transform_version',
description: item.config.version,
},
{
title: 'description',
description: item.config.description ?? '',
},
{
title: 'create_time',
description: formatHumanReadableDateTimeSeconds(
moment(item.config.create_time).unix() * 1000
),
},
{
title: 'source_index',
description: Array.isArray(item.config.source.index)
? item.config.source.index[0]
: item.config.source.index,
},
{
title: 'destination_index',
description: Array.isArray(item.config.dest.index)
? item.config.dest.index[0]
: item.config.dest.index,
},
];

const settings: SectionConfig = {
title: 'General',
items: configItems,
position: 'left',
};

const checkpointingItems: Item[] = [];
if (item.stats.checkpointing.last !== undefined) {
checkpointingItems.push({
Expand Down Expand Up @@ -108,28 +147,51 @@ export const ExpandedRow: FC<Props> = ({ item }) => {
const checkpointing: SectionConfig = {
title: 'Checkpointing',
items: checkpointingItems,
position: 'left',
position: 'right',
};

const stats: SectionConfig = {
title: 'Stats',
items: Object.entries(item.stats.stats).map((s) => {
return { title: s[0].toString(), description: getItemDescription(s[1]) };
}),
position: 'right',
position: 'left',
};

const tabs = [
{
id: `transform-settings-tab-${item.id}`,
'data-test-subj': 'transformSettingsTab',
name: i18n.translate(
'xpack.transform.transformList.transformDetails.tabs.transformSettingsLabel',
{
defaultMessage: 'Settings',
peteharverson marked this conversation as resolved.
Show resolved Hide resolved
}
),
content: <ExpandedRowDetailsPane sections={[settings]} />,
},

{
id: `transform-details-tab-${item.id}`,
'data-test-subj': 'transformDetailsTab',
name: i18n.translate(
'xpack.transform.transformList.transformDetails.tabs.transformSettingsLabel',
'xpack.transform.transformList.transformDetails.tabs.transformDetailsLabel',
{
defaultMessage: 'Details',
}
),
content: <ExpandedRowDetailsPane sections={[state, checkpointing]} />,
},
{
id: `transform-stats-tab-${item.id}`,
'data-test-subj': 'transformStatsTab',
name: i18n.translate(
'xpack.transform.transformList.transformDetails.tabs.transformStatsLabel',
{
defaultMessage: 'Transform details',
defaultMessage: 'Stats',
}
),
content: <ExpandedRowDetailsPane sections={[state, checkpointing, stats]} />,
content: <ExpandedRowDetailsPane sections={[stats]} />,
},
{
id: `transform-json-tab-${item.id}`,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/transform/public/shared_imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
export {
getErrorMessage,
extractErrorMessage,
formatHumanReadableDateTimeSeconds,
getDataGridSchemaFromKibanaFieldType,
getFieldsFromKibanaIndexPattern,
multiColumnSortFactory,
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -15830,7 +15830,6 @@
"xpack.transform.cloneTransform.breadcrumbTitle": "クローン変換",
"xpack.transform.createTransform.breadcrumbTitle": "変換の作成",
"xpack.transform.description": "説明",
"xpack.transform.destinationIndex": "デスティネーションインデックス",
"xpack.transform.groupby.popoverForm.aggLabel": "集約",
"xpack.transform.groupBy.popoverForm.aggNameAlreadyUsedError": "別のグループ分けの構成が既にこの名前を使用しています。",
"xpack.transform.groupBy.popoverForm.aggNameInvalidCharError": "無効な名前です。「[」、「]」「>」は使用できず、名前の始めと終わりにはスペースを使用できません。",
Expand Down Expand Up @@ -15865,7 +15864,6 @@
"xpack.transform.pivotPreview.PivotPreviewNoDataCalloutBody": "プレビューリクエストはデータを返しませんでした。オプションのクエリがデータを返し、グループ分け基準により使用されるフィールドと集約フィールドに値が存在することを確認してください。",
"xpack.transform.pivotPreview.PivotPreviewTitle": "ピボットプレビューを変換",
"xpack.transform.progress": "進捗",
"xpack.transform.sourceIndex": "ソースインデックス",
"xpack.transform.statsBar.batchTransformsLabel": "一斉",
"xpack.transform.statsBar.continuousTransformsLabel": "連続",
"xpack.transform.statsBar.failedTransformsLabel": "失敗",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -15835,7 +15835,6 @@
"xpack.transform.cloneTransform.breadcrumbTitle": "克隆转换",
"xpack.transform.createTransform.breadcrumbTitle": "创建转换",
"xpack.transform.description": "描述",
"xpack.transform.destinationIndex": "目标 IP",
"xpack.transform.groupby.popoverForm.aggLabel": "聚合",
"xpack.transform.groupBy.popoverForm.aggNameAlreadyUsedError": "其他分组依据配置已使用该名称。",
"xpack.transform.groupBy.popoverForm.aggNameInvalidCharError": "名称无效。不允许使用字符“[”、“]”和“>”,且名称不得以空格字符开头或结束。",
Expand Down Expand Up @@ -15870,7 +15869,6 @@
"xpack.transform.pivotPreview.PivotPreviewNoDataCalloutBody": "预览请求未返回任何数据。请确保可选查询返回数据且存在分组依据和聚合字段使用的字段的值。",
"xpack.transform.pivotPreview.PivotPreviewTitle": "转换数据透视表预览",
"xpack.transform.progress": "进度",
"xpack.transform.sourceIndex": "源索引",
"xpack.transform.statsBar.batchTransformsLabel": "批量",
"xpack.transform.statsBar.continuousTransformsLabel": "连续",
"xpack.transform.statsBar.failedTransformsLabel": "失败",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ export default function ({ getService }: FtrProviderContext) {
await transform.table.assertTransformRowFields(testData.transformId, {
id: testData.transformId,
description: testData.transformDescription,
sourceIndex: testData.source,
destinationIndex: testData.destinationIndex,
status: testData.expected.row.status,
mode: testData.expected.row.mode,
progress: testData.expected.row.progress,
Expand Down