@skbkontur/cassandra-distributed-task-queue-ui
Version:
.NET library implementing distributed task queue machinery using Apache Cassandra
53 lines • 3.08 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskStateIcon = exports.getIconColor = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const CheckAIcon16Regular_1 = require("@skbkontur/icons/CheckAIcon16Regular");
const QuestionSquareIcon16Regular_1 = require("@skbkontur/icons/QuestionSquareIcon16Regular");
const TimeClockIcon16Regular_1 = require("@skbkontur/icons/TimeClockIcon16Regular");
const XCircleIcon16Regular_1 = require("@skbkontur/icons/XCircleIcon16Regular");
const XIcon16Regular_1 = require("@skbkontur/icons/XIcon16Regular");
const react_ui_1 = require("@skbkontur/react-ui");
const react_1 = tslib_1.__importDefault(require("react"));
const TaskState_1 = require("../../Domain/Api/TaskState");
const getIconColor = (theme, severity) => {
switch (severity) {
case "error":
return theme.linkDangerHoverColor;
case "success":
return theme.linkSuccessColor;
case "waiting":
return theme.textColorDisabled;
case "warning":
return theme.warningMain;
default:
return undefined;
}
};
exports.getIconColor = getIconColor;
function TaskStateIcon({ taskState }) {
const theme = react_1.default.useContext(react_ui_1.ThemeContext);
switch (taskState) {
case TaskState_1.TaskState.Unknown:
return jsx_runtime_1.jsx(QuestionSquareIcon16Regular_1.QuestionSquareIcon16Regular, { color: exports.getIconColor(theme, "warning") }, void 0);
case TaskState_1.TaskState.New:
return jsx_runtime_1.jsx(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: exports.getIconColor(theme, "waiting") }, void 0);
case TaskState_1.TaskState.WaitingForRerun:
return jsx_runtime_1.jsx(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: exports.getIconColor(theme, "waiting") }, void 0);
case TaskState_1.TaskState.WaitingForRerunAfterError:
return jsx_runtime_1.jsx(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: exports.getIconColor(theme, "error") }, void 0);
case TaskState_1.TaskState.Finished:
return jsx_runtime_1.jsx(CheckAIcon16Regular_1.CheckAIcon16Regular, { color: exports.getIconColor(theme, "success") }, void 0);
case TaskState_1.TaskState.InProcess:
return jsx_runtime_1.jsx(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: exports.getIconColor(theme, "waiting") }, void 0);
case TaskState_1.TaskState.Fatal:
return jsx_runtime_1.jsx(XCircleIcon16Regular_1.XCircleIcon16Regular, { color: exports.getIconColor(theme, "error") }, void 0);
case TaskState_1.TaskState.Canceled:
return jsx_runtime_1.jsx(XIcon16Regular_1.XIcon16Regular, { color: exports.getIconColor(theme, "error") }, void 0);
default:
return jsx_runtime_1.jsx(CheckAIcon16Regular_1.CheckAIcon16Regular, {}, void 0);
}
}
exports.TaskStateIcon = TaskStateIcon;
//# sourceMappingURL=TaskStateIcon.js.map
;