2022-10-30 03:54:14 +00:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
CloseOutlined,
|
|
|
|
ClockCircleOutlined,
|
|
|
|
CheckOutlined,
|
2023-02-20 03:52:06 +00:00
|
|
|
MinusOutlined,
|
2022-10-30 03:54:14 +00:00
|
|
|
ExclamationOutlined,
|
|
|
|
} from '@ant-design/icons';
|
2022-11-11 15:37:41 +00:00
|
|
|
import { NAMESPACE } from './locale';
|
2022-10-30 03:54:14 +00:00
|
|
|
|
|
|
|
export const EXECUTION_STATUS = {
|
|
|
|
QUEUEING: null,
|
|
|
|
STARTED: 0,
|
2023-02-20 03:52:06 +00:00
|
|
|
RESOLVED: 1,
|
2022-10-30 03:54:14 +00:00
|
|
|
FAILED: -1,
|
2023-02-20 03:52:06 +00:00
|
|
|
ERROR: -2,
|
|
|
|
ABORTED: -3,
|
|
|
|
CANCELED: -4,
|
|
|
|
REJECTED: -5
|
2022-10-30 03:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const ExecutionStatusOptions = [
|
2022-11-11 15:37:41 +00:00
|
|
|
{ value: EXECUTION_STATUS.QUEUEING, label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`, color: 'blue' },
|
|
|
|
{ value: EXECUTION_STATUS.STARTED, label: `{{t("On going", { ns: "${NAMESPACE}" })}}`, color: 'gold' },
|
2023-02-20 03:52:06 +00:00
|
|
|
{ value: EXECUTION_STATUS.RESOLVED, label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`, color: 'green' },
|
2022-11-11 15:37:41 +00:00
|
|
|
{ value: EXECUTION_STATUS.FAILED, label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`, color: 'red' },
|
2023-02-20 03:52:06 +00:00
|
|
|
{ value: EXECUTION_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: 'red' },
|
|
|
|
{ value: EXECUTION_STATUS.ABORTED, label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`, color: 'red' },
|
|
|
|
{ value: EXECUTION_STATUS.CANCELED, label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`, color: 'volcano' },
|
|
|
|
{ value: EXECUTION_STATUS.REJECTED, label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`, color: 'volcano' },
|
2022-10-30 03:54:14 +00:00
|
|
|
];
|
|
|
|
|
2023-02-20 03:52:06 +00:00
|
|
|
export const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce((map, option) => Object.assign(map, { [option.value as number]: option }), {});
|
2022-10-30 03:54:14 +00:00
|
|
|
|
|
|
|
export const JOB_STATUS = {
|
|
|
|
PENDING: 0,
|
|
|
|
RESOLVED: 1,
|
2023-02-20 03:52:06 +00:00
|
|
|
FAILED: -1,
|
|
|
|
ERROR: -2,
|
|
|
|
ABORTED: -3,
|
|
|
|
CANCELED: -4,
|
|
|
|
REJECTED: -5
|
2022-10-30 03:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const JobStatusOptions = [
|
2023-02-20 03:52:06 +00:00
|
|
|
{ value: JOB_STATUS.PENDING, label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`, color: 'gold', icon: <ClockCircleOutlined /> },
|
|
|
|
{ value: JOB_STATUS.RESOLVED, label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`, color: 'green', icon: <CheckOutlined /> },
|
|
|
|
{ value: JOB_STATUS.FAILED, label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`, color: 'red', icon: <ExclamationOutlined /> },
|
|
|
|
{ value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: 'red', icon: <CloseOutlined /> },
|
|
|
|
{ value: JOB_STATUS.ABORTED, label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`, color: 'red', icon: <MinusOutlined rotate={90} /> },
|
|
|
|
{ value: JOB_STATUS.CANCELED, label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`, color: 'volcano', icon: <MinusOutlined rotate={45} /> },
|
|
|
|
{ value: JOB_STATUS.REJECTED, label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`, color: 'volcano', icon: <MinusOutlined /> },
|
2022-10-30 03:54:14 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
export const JobStatusOptionsMap = JobStatusOptions.reduce((map, option) => Object.assign(map, { [option.value]: option }), {});
|