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] Transforms: Fix waiting state in transforms list. #98592

Merged
merged 1 commit into from
Apr 29, 2021
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
2 changes: 2 additions & 0 deletions x-pack/plugins/transform/common/api_schemas/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export const transformIdsSchema = schema.arrayOf(

export type TransformIdsSchema = TypeOf<typeof transformIdsSchema>;

// reflects https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformStats.java#L250
export const transformStateSchema = schema.oneOf([
schema.literal(TRANSFORM_STATE.ABORTING),
schema.literal(TRANSFORM_STATE.FAILED),
schema.literal(TRANSFORM_STATE.INDEXING),
schema.literal(TRANSFORM_STATE.STARTED),
schema.literal(TRANSFORM_STATE.STOPPED),
schema.literal(TRANSFORM_STATE.STOPPING),
schema.literal(TRANSFORM_STATE.WAITING),
]);

export const indexPatternTitleSchema = schema.object({
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/transform/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ export const APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES = [

export const APP_INDEX_PRIVILEGES = ['monitor'];

// reflects https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/dataframe/transforms/DataFrameTransformStats.java#L243
// reflects https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformStats.java#L250
export const TRANSFORM_STATE = {
ABORTING: 'aborting',
FAILED: 'failed',
INDEXING: 'indexing',
STARTED: 'started',
STOPPED: 'stopped',
STOPPING: 'stopping',
WAITING: 'waiting',
} as const;

const transformStates = Object.values(TRANSFORM_STATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ import { TRANSFORM_STATE } from '../../../../../../common/constants';
import { getTransformProgress, TransformListRow, TRANSFORM_LIST_COLUMN } from '../../../../common';
import { useActions } from './use_actions';

// reflects https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformStats.java#L250
const STATE_COLOR = {
aborting: 'warning',
failed: 'danger',
indexing: 'primary',
started: 'primary',
stopped: 'hollow',
stopping: 'hollow',
waiting: 'hollow',
} as const;

export const getTaskStateBadge = (
Expand Down Expand Up @@ -202,13 +204,15 @@ export const useColumns = (
{!isBatchTransform && (
<Fragment>
<EuiFlexItem style={{ width: '40px' }} grow={false}>
{/* If not stopped or failed show the animated progress bar */}
{/* If not stopped, failed or waiting show the animated progress bar */}
{item.stats.state !== TRANSFORM_STATE.STOPPED &&
item.stats.state !== TRANSFORM_STATE.WAITING &&
item.stats.state !== TRANSFORM_STATE.FAILED && (
<EuiProgress color="primary" size="m" />
)}
{/* If stopped or failed show an empty (0%) progress bar */}
{/* If stopped, failed or waiting show an empty (0%) progress bar */}
{(item.stats.state === TRANSFORM_STATE.STOPPED ||
item.stats.state === TRANSFORM_STATE.WAITING ||
item.stats.state === TRANSFORM_STATE.FAILED) && (
<EuiProgress value={0} max={100} color="primary" size="m" />
)}
Expand Down