From a1c14f3371bf701aa8a77dfd87996c786b58066f Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Wed, 28 Apr 2021 13:38:57 +0200 Subject: [PATCH] [ML] Adds waiting state for transforms. --- x-pack/plugins/transform/common/api_schemas/common.ts | 2 ++ x-pack/plugins/transform/common/constants.ts | 3 ++- .../components/transform_list/use_columns.tsx | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/transform/common/api_schemas/common.ts b/x-pack/plugins/transform/common/api_schemas/common.ts index 3651af69359a..b84dcd2a4b74 100644 --- a/x-pack/plugins/transform/common/api_schemas/common.ts +++ b/x-pack/plugins/transform/common/api_schemas/common.ts @@ -17,6 +17,7 @@ export const transformIdsSchema = schema.arrayOf( export type TransformIdsSchema = TypeOf; +// 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), @@ -24,6 +25,7 @@ export const transformStateSchema = schema.oneOf([ 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({ diff --git a/x-pack/plugins/transform/common/constants.ts b/x-pack/plugins/transform/common/constants.ts index ce61f27ef255..423b2d001381 100644 --- a/x-pack/plugins/transform/common/constants.ts +++ b/x-pack/plugins/transform/common/constants.ts @@ -77,7 +77,7 @@ 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', @@ -85,6 +85,7 @@ export const TRANSFORM_STATE = { STARTED: 'started', STOPPED: 'stopped', STOPPING: 'stopping', + WAITING: 'waiting', } as const; const transformStates = Object.values(TRANSFORM_STATE); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_columns.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_columns.tsx index a8f6a9a233c6..e186acf31d34 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_columns.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_columns.tsx @@ -30,6 +30,7 @@ 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', @@ -37,6 +38,7 @@ const STATE_COLOR = { started: 'primary', stopped: 'hollow', stopping: 'hollow', + waiting: 'hollow', } as const; export const getTaskStateBadge = ( @@ -202,13 +204,15 @@ export const useColumns = ( {!isBatchTransform && ( - {/* 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 && ( )} - {/* 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) && ( )}