diff --git a/x-pack/plugins/ml/public/shared.ts b/x-pack/plugins/ml/public/shared.ts index ff83d79adff67..4b1d7ee733dcf 100644 --- a/x-pack/plugins/ml/public/shared.ts +++ b/x-pack/plugins/ml/public/shared.ts @@ -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'; diff --git a/x-pack/plugins/transform/common/utils/date_utils.ts b/x-pack/plugins/transform/common/utils/date_utils.ts deleted file mode 100644 index 2acde91413aca..0000000000000 --- a/x-pack/plugins/transform/common/utils/date_utils.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -// utility functions for handling dates - -// @ts-ignore -import { formatDate } from '@elastic/eui/lib/services/format'; - -export function formatHumanReadableDate(ts: number) { - return formatDate(ts, 'MMMM Do YYYY'); -} - -export function formatHumanReadableDateTime(ts: number) { - return formatDate(ts, 'MMMM Do YYYY, HH:mm'); -} - -export function formatHumanReadableDateTimeSeconds(ts: number) { - return formatDate(ts, 'MMMM Do YYYY, HH:mm:ss'); -} diff --git a/x-pack/plugins/transform/public/app/common/transform.ts b/x-pack/plugins/transform/public/app/common/transform.ts index a7c53e76ec5f9..a02bed2fa65e7 100644 --- a/x-pack/plugins/transform/public/app/common/transform.ts +++ b/x-pack/plugins/transform/public/app/common/transform.ts @@ -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 { diff --git a/x-pack/plugins/transform/public/app/common/transform_list.ts b/x-pack/plugins/transform/public/app/common/transform_list.ts index 17d729a453a05..a27fc0b3e0dbb 100644 --- a/x-pack/plugins/transform/public/app/common/transform_list.ts +++ b/x-pack/plugins/transform/public/app/common/transform_list.ts @@ -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', } diff --git a/x-pack/plugins/transform/public/app/hooks/use_api.ts b/x-pack/plugins/transform/public/app/hooks/use_api.ts index 5d7839cf5fba7..7f6ea817f18d2 100644 --- a/x-pack/plugins/transform/public/app/hooks/use_api.ts +++ b/x-pack/plugins/transform/public/app/hooks/use_api.ts @@ -54,7 +54,9 @@ export const useApi = () => { }); }, getTransformsPreview(obj: PreviewRequestBody): Promise { - 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[] diff --git a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts index b073dace30340..a9f34996b9b51 100644 --- a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts +++ b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts @@ -14,7 +14,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 { diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap deleted file mode 100644 index 1f134cd39948b..0000000000000 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap +++ /dev/null @@ -1,291 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Transform: Transform List Minimal initialization 1`] = ` -, - "data-test-subj": "transformDetailsTab", - "id": "transform-details-tab-fq_date_histogram_1m_1441", - "name": "Transform details", - } - } - onTabClick={[Function]} - size="s" - style={ - Object { - "width": "100%", - } - } - tabs={ - Array [ - Object { - "content": , - "data-test-subj": "transformDetailsTab", - "id": "transform-details-tab-fq_date_histogram_1m_1441", - "name": "Transform details", - }, - Object { - "content": , - "data-test-subj": "transformJsonTab", - "id": "transform-json-tab-fq_date_histogram_1m_1441", - "name": "JSON", - }, - Object { - "content": , - "data-test-subj": "transformMessagesTab", - "id": "transform-messages-tab-fq_date_histogram_1m_1441", - "name": "Messages", - }, - Object { - "content": , - "data-test-subj": "transformPreviewTab", - "id": "transform-preview-tab-fq_date_histogram_1m_1441", - "name": "Preview", - }, - ] - } -/> -`; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx index aac1d8b5a3f9c..18d324c8767c7 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx @@ -13,7 +13,6 @@ describe('Transform: Transform List Actions', () => { const actions = getActions({ forceDisable: false }); expect(actions).toHaveLength(4); - expect(actions[0].isPrimary).toBeTruthy(); expect(typeof actions[0].render).toBe('function'); expect(typeof actions[1].render).toBe('function'); expect(typeof actions[2].render).toBe('function'); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.tsx index 820b9e0e0d062..343b5e4db67e3 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.tsx @@ -19,7 +19,6 @@ import { StopAction } from './action_stop'; export const getActions = ({ forceDisable }: { forceDisable: boolean }) => { return [ { - isPrimary: true, render: (item: TransformListRow) => { if (item.stats.state === TRANSFORM_STATE.STOPPED) { return ; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx index b4198ce3c7244..3c75c33caf840 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx @@ -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'); }); }); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx index 159833354b5ef..5ed2566e8a194 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx @@ -88,8 +88,6 @@ export const getColumns = ( EuiTableComputedColumnType, EuiTableFieldDataColumnType, EuiTableFieldDataColumnType, - EuiTableFieldDataColumnType, - EuiTableFieldDataColumnType, EuiTableComputedColumnType, EuiTableComputedColumnType, EuiTableComputedColumnType, @@ -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', @@ -242,7 +224,7 @@ export const getColumns = ( { name: i18n.translate('xpack.transform.tableActionLabel', { defaultMessage: 'Actions' }), actions, - width: '200px', + width: '80px', }, ]; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx index 7fcaf5e6048f6..846d8a8ccd200 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.test.tsx @@ -4,17 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallow } from 'enzyme'; +import { render, fireEvent } from '@testing-library/react'; import React from 'react'; import moment from 'moment-timezone'; - import { TransformListRow } from '../../../../common'; import { ExpandedRow } from './expanded_row'; import transformListRow from '../../../../common/__mocks__/transform_list_row.json'; +import { within } from '@testing-library/dom'; -jest.mock('../../../../../shared_imports'); - +jest.mock('../../../../../shared_imports', () => ({ + formatHumanReadableDateTimeSeconds: jest.fn(), +})); describe('Transform: Transform List ', () => { // Set timezone to US/Eastern for consistent test results. beforeEach(() => { @@ -25,11 +26,25 @@ describe('Transform: Transform List ', () => { moment.tz.setDefault('Browser'); }); - test('Minimal initialization', () => { + test('Minimal initialization', async () => { const item: TransformListRow = transformListRow; - const wrapper = shallow(); + const { getByText, getByTestId } = render(); + + expect(getByText('Details')).toBeInTheDocument(); + expect(getByText('Stats')).toBeInTheDocument(); + expect(getByText('JSON')).toBeInTheDocument(); + expect(getByText('Messages')).toBeInTheDocument(); + expect(getByText('Preview')).toBeInTheDocument(); + + const tabContent = getByTestId('transformDetailsTabContent'); + expect(tabContent).toBeInTheDocument(); + + expect(getByTestId('transformDetailsTab')).toHaveAttribute('aria-selected', 'true'); + expect(within(tabContent).getByText('General')).toBeInTheDocument(); - expect(wrapper).toMatchSnapshot(); + fireEvent.click(getByTestId('transformStatsTab')); + expect(getByTestId('transformStatsTab')).toHaveAttribute('aria-selected', 'true'); + expect(within(tabContent).getByText('Stats')).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx index 5d58db5b8871e..311aed19e0706 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx @@ -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'; @@ -61,6 +61,44 @@ export const ExpandedRow: FC = ({ item }) => { const state: SectionConfig = { title: 'State', items: stateItems, + position: 'right', + }; + + 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 general: SectionConfig = { + title: 'General', + items: configItems, position: 'left', }; @@ -108,7 +146,7 @@ export const ExpandedRow: FC = ({ item }) => { const checkpointing: SectionConfig = { title: 'Checkpointing', items: checkpointingItems, - position: 'left', + position: 'right', }; const stats: SectionConfig = { @@ -116,7 +154,7 @@ export const ExpandedRow: FC = ({ item }) => { items: Object.entries(item.stats.stats).map((s) => { return { title: s[0].toString(), description: getItemDescription(s[1]) }; }), - position: 'right', + position: 'left', }; const tabs = [ @@ -124,12 +162,23 @@ export const ExpandedRow: FC = ({ item }) => { 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: , + }, + { + 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: , + content: , }, { id: `transform-json-tab-${item.id}`, diff --git a/x-pack/plugins/transform/public/shared_imports.ts b/x-pack/plugins/transform/public/shared_imports.ts index f50ae9274fa4a..e0bbcd0b5d9db 100644 --- a/x-pack/plugins/transform/public/shared_imports.ts +++ b/x-pack/plugins/transform/public/shared_imports.ts @@ -17,6 +17,7 @@ export { fetchChartsData, getErrorMessage, extractErrorMessage, + formatHumanReadableDateTimeSeconds, getDataGridSchemaFromKibanaFieldType, getFieldsFromKibanaIndexPattern, multiColumnSortFactory, diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 0567ee675ee75..1e46733a47e2c 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -15794,7 +15794,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": "無効な名前です。「[」、「]」「>」は使用できず、名前の始めと終わりにはスペースを使用できません。", @@ -15829,7 +15828,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": "失敗", @@ -15990,7 +15988,6 @@ "xpack.transform.transformList.transformDetails.messagesPane.timeLabel": "時間", "xpack.transform.transformList.transformDetails.tabs.transformMessagesLabel": "メッセージ", "xpack.transform.transformList.transformDetails.tabs.transformPreviewLabel": "プレビュー", - "xpack.transform.transformList.transformDetails.tabs.transformSettingsLabel": "ジョブの詳細", "xpack.transform.transformList.transformDocsLinkText": "変換ドキュメント", "xpack.transform.transformList.transformTitle": "データフレームジョブ", "xpack.transform.transformsDescription": "変換を使用して、集約されたインデックスまたはエンティティ中心のインデックスに、既存のElasticsearchインデックスをインデックスします。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 86f2c44c809da..aa1a80c3d18fb 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -15799,7 +15799,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": "名称无效。不允许使用字符“[”、“]”和“>”,且名称不得以空格字符开头或结束。", @@ -15834,7 +15833,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": "失败", @@ -15995,7 +15993,6 @@ "xpack.transform.transformList.transformDetails.messagesPane.timeLabel": "时间", "xpack.transform.transformList.transformDetails.tabs.transformMessagesLabel": "消息", "xpack.transform.transformList.transformDetails.tabs.transformPreviewLabel": "预览", - "xpack.transform.transformList.transformDetails.tabs.transformSettingsLabel": "作业详情", "xpack.transform.transformList.transformDocsLinkText": "转换文档", "xpack.transform.transformList.transformTitle": "数据帧作业", "xpack.transform.transformsDescription": "使用转换将现有 Elasticsearch 索引透视成摘要式或以实体为中心的索引。", diff --git a/x-pack/test/functional/apps/transform/creation_index_pattern.ts b/x-pack/test/functional/apps/transform/creation_index_pattern.ts index 55b2f4a0220ad..bf267c80cdcce 100644 --- a/x-pack/test/functional/apps/transform/creation_index_pattern.ts +++ b/x-pack/test/functional/apps/transform/creation_index_pattern.ts @@ -436,8 +436,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, diff --git a/x-pack/test/functional/apps/transform/creation_saved_search.ts b/x-pack/test/functional/apps/transform/creation_saved_search.ts index ad62f06d1f3cd..bc4ded49660f4 100644 --- a/x-pack/test/functional/apps/transform/creation_saved_search.ts +++ b/x-pack/test/functional/apps/transform/creation_saved_search.ts @@ -239,8 +239,6 @@ export default function ({ getService }: FtrProviderContext) { await transform.table.assertTransformRowFields(testData.transformId, { id: testData.transformId, description: testData.transformDescription, - sourceIndex: testData.expected.sourceIndex, - destinationIndex: testData.destinationIndex, status: testData.expected.row.status, mode: testData.expected.row.mode, progress: testData.expected.row.progress, diff --git a/x-pack/test/functional/services/transform/transform_table.ts b/x-pack/test/functional/services/transform/transform_table.ts index 3155ef0b26050..0c9a5414bdd2b 100644 --- a/x-pack/test/functional/services/transform/transform_table.ts +++ b/x-pack/test/functional/services/transform/transform_table.ts @@ -31,16 +31,6 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { .find('.euiTableCellContent') .text() .trim(), - sourceIndex: $tr - .findTestSubject('transformListColumnSourceIndex') - .find('.euiTableCellContent') - .text() - .trim(), - destinationIndex: $tr - .findTestSubject('transformListColumnDestinationIndex') - .find('.euiTableCellContent') - .text() - .trim(), status: $tr .findTestSubject('transformListColumnStatus') .find('.euiTableCellContent')