@skbkontur/cassandra-distributed-task-queue-ui
Version:
.NET library implementing distributed task queue machinery using Apache Cassandra
52 lines • 3.01 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIconColor = void 0;
exports.TaskStateIcon = TaskStateIcon;
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 = 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 = (0, react_1.useContext)(react_ui_1.ThemeContext);
switch (taskState) {
case TaskState_1.TaskState.Unknown:
return (0, jsx_runtime_1.jsx)(QuestionSquareIcon16Regular_1.QuestionSquareIcon16Regular, { color: (0, exports.getIconColor)(theme, "warning") });
case TaskState_1.TaskState.New:
return (0, jsx_runtime_1.jsx)(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: (0, exports.getIconColor)(theme, "waiting") });
case TaskState_1.TaskState.WaitingForRerun:
return (0, jsx_runtime_1.jsx)(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: (0, exports.getIconColor)(theme, "waiting") });
case TaskState_1.TaskState.WaitingForRerunAfterError:
return (0, jsx_runtime_1.jsx)(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: (0, exports.getIconColor)(theme, "error") });
case TaskState_1.TaskState.Finished:
return (0, jsx_runtime_1.jsx)(CheckAIcon16Regular_1.CheckAIcon16Regular, { color: (0, exports.getIconColor)(theme, "success") });
case TaskState_1.TaskState.InProcess:
return (0, jsx_runtime_1.jsx)(TimeClockIcon16Regular_1.TimeClockIcon16Regular, { color: (0, exports.getIconColor)(theme, "waiting") });
case TaskState_1.TaskState.Fatal:
return (0, jsx_runtime_1.jsx)(XCircleIcon16Regular_1.XCircleIcon16Regular, { color: (0, exports.getIconColor)(theme, "error") });
case TaskState_1.TaskState.Canceled:
return (0, jsx_runtime_1.jsx)(XIcon16Regular_1.XIcon16Regular, { color: (0, exports.getIconColor)(theme, "error") });
default:
return (0, jsx_runtime_1.jsx)(CheckAIcon16Regular_1.CheckAIcon16Regular, {});
}
}
//# sourceMappingURL=TaskStateIcon.js.map
;