Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
{
"config": {
"id": "fq_date_histogram_1m_1441",
"source": { "index": ["farequote-2019"], "query": { "match_all": {} } },
"dest": { "index": "fq_date_histogram_1m_1441" },
"source": {
"index": [
"farequote-2019"
],
"query": {
"match_all": { }
}
},
"dest": {
"index": "fq_date_histogram_1m_1441"
},
"pivot": {
"group_by": {
"@timestamp": {
"date_histogram": { "field": "@timestamp", "calendar_interval": "1m" }
"date_histogram": {
"field": "@timestamp",
"calendar_interval": "1m"
}
}
},
"aggregations": { "responsetime.avg": { "avg": { "field": "responsetime" } } }
"aggregations": {
"responsetime.avg": {
"avg": {
"field": "responsetime"
}
}
}
},
"version": "8.0.0",
"create_time": 1564388146667,
"mode": "batch"
"create_time": 1564388146667
},
"id": "fq_date_histogram_1m_1441",
"checkpointing": {
"last": {
"checkpoint": 1,
"timestamp_millis": 1564388281199
},
"next": {
"checkpoint": 2,
"indexer_state": "stopped",
"checkpoint_progress": {
"total_docs": 86274,
"docs_remaining": 0,
"percent_complete": 100
}
},
"operations_behind": 0
},
"mode": "batch",
"stats": {
"id": "fq_date_histogram_1m_1441",
"task_state": "stopped",
"state": "stopped",
"stats": {
"pages_processed": 16,
"documents_processed": 86274,
Expand All @@ -52,15 +61,6 @@
"checkpoint": 1,
"timestamp_millis": 1564388281199
},
"next": {
"checkpoint": 2,
"indexer_state": "stopped",
"checkpoint_progress": {
"total_docs": 86274,
"docs_remaining": 0,
"percent_complete": 100
}
},
"operations_behind": 0
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import {
createPermissionFailureMessage,
} from '../../../../../privilege/check_privilege';

import { DataFrameTransformListRow, DATA_FRAME_TASK_STATE } from './common';
import { DataFrameTransformListRow, DATA_FRAME_TRANSFORM_STATE } from './common';

interface DeleteActionProps {
item: DataFrameTransformListRow;
}

export const DeleteAction: SFC<DeleteActionProps> = ({ item }) => {
const disabled = item.stats.task_state === DATA_FRAME_TASK_STATE.STARTED;
const disabled = item.stats.state !== DATA_FRAME_TRANSFORM_STATE.STOPPED;

const canDeleteDataFrame: boolean = checkPermission('canDeleteDataFrame');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
createPermissionFailureMessage,
} from '../../../../../privilege/check_privilege';

import { DataFrameTransformListRow, DATA_FRAME_TASK_STATE } from './common';
import { DataFrameTransformListRow, DATA_FRAME_TRANSFORM_STATE } from './common';
import { stopTransform } from '../../services/transform_service';

import { StartAction } from './action_start';
Expand All @@ -26,7 +26,7 @@ export const getActions = () => {
{
isPrimary: true,
render: (item: DataFrameTransformListRow) => {
if (item.stats.task_state !== DATA_FRAME_TASK_STATE.STARTED) {
if (item.stats.state === DATA_FRAME_TRANSFORM_STATE.STOPPED) {
return <StartAction item={item} />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@ import {
import { DataFrameTransformId } from '../../../../common';
import {
getTransformProgress,
DATA_FRAME_TASK_STATE,
DATA_FRAME_TRANSFORM_STATE,
DataFrameTransformListColumn,
DataFrameTransformListRow,
DataFrameTransformStats,
} from './common';
import { getActions } from './actions';

enum TASK_STATE_COLOR {
enum STATE_COLOR {
aborting = 'warning',
failed = 'danger',
indexing = 'primary',
started = 'primary',
stopped = 'hollow',
stopping = 'hollow',
}

export const getTaskStateBadge = (
state: DataFrameTransformStats['task_state'],
state: DataFrameTransformStats['state'],
reason?: DataFrameTransformStats['reason']
) => {
const color = TASK_STATE_COLOR[state];
const color = STATE_COLOR[state];

if (state === DATA_FRAME_TASK_STATE.FAILED && reason !== undefined) {
if (state === DATA_FRAME_TRANSFORM_STATE.FAILED && reason !== undefined) {
return (
<EuiToolTip content={reason}>
<EuiBadge className="mlTaskStateBadge" color={color}>
Expand Down Expand Up @@ -126,10 +129,10 @@ export const getColumns = (
},
{
name: i18n.translate('xpack.ml.dataframe.status', { defaultMessage: 'Status' }),
sortable: (item: DataFrameTransformListRow) => item.stats.task_state,
sortable: (item: DataFrameTransformListRow) => item.stats.state,
truncateText: true,
render(item: DataFrameTransformListRow) {
return getTaskStateBadge(item.stats.task_state, item.stats.reason);
return getTaskStateBadge(item.stats.state, item.stats.reason);
},
width: '100px',
},
Expand All @@ -146,13 +149,17 @@ export const getColumns = (
},
{
name: i18n.translate('xpack.ml.dataframe.progress', { defaultMessage: 'Progress' }),
sortable: getTransformProgress,
sortable: getTransformProgress || 0,
truncateText: true,
render(item: DataFrameTransformListRow) {
const progress = getTransformProgress(item);

const isBatchTransform = typeof item.config.sync === 'undefined';

if (progress === undefined && isBatchTransform === true) {
return null;
}

return (
<EuiFlexGroup alignItems="center" gutterSize="xs">
{isBatchTransform && (
Expand All @@ -170,10 +177,14 @@ export const getColumns = (
{!isBatchTransform && (
<Fragment>
<EuiFlexItem style={{ width: '40px' }} grow={false}>
{item.stats.task_state === DATA_FRAME_TASK_STATE.STARTED && (
<EuiProgress color="primary" size="m" />
)}
{item.stats.task_state === DATA_FRAME_TASK_STATE.STOPPED && (
{/* If not stopped or failed show the animated progress bar */}
{item.stats.state !== DATA_FRAME_TRANSFORM_STATE.STOPPED &&
item.stats.state !== DATA_FRAME_TRANSFORM_STATE.FAILED && (
<EuiProgress color="primary" size="m" />
)}
{/* If stopped or failed show an empty (0%) progress bar */}
{(item.stats.state === DATA_FRAME_TRANSFORM_STATE.STOPPED ||
item.stats.state === DATA_FRAME_TRANSFORM_STATE.FAILED) && (
<EuiProgress value={0} max={100} color="primary" size="m" />
)}
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import mockDataFrameTransformListRow from './__mocks__/data_frame_transform_list
import {
DataFrameTransformListRow,
isCompletedBatchTransform,
DATA_FRAME_TASK_STATE,
DATA_FRAME_TRANSFORM_STATE,
} from './common';

describe('Data Frame: isCompletedBatchTransform()', () => {
Expand All @@ -20,7 +20,7 @@ describe('Data Frame: isCompletedBatchTransform()', () => {
const row = mockDataFrameTransformListRow as DataFrameTransformListRow;
expect(row.stats.checkpointing.last.checkpoint === 1).toBe(true);
expect(row.config.sync === undefined).toBe(true);
expect(row.stats.task_state === DATA_FRAME_TASK_STATE.STOPPED).toBe(true);
expect(row.stats.state === DATA_FRAME_TRANSFORM_STATE.STOPPED).toBe(true);
expect(isCompletedBatchTransform(mockDataFrameTransformListRow)).toBe(true);

// adapt the mock config to resemble a non-completed transform.
Expand Down
Loading