@danikokonn/yarik-frontend-lib 2.0.56-test → 2.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionDialog/ActionDialog.d.ts +1 -2
- package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -1
- package/dist/components/ActionDialog/ActionDialog.js +7 -18
- package/dist/components/ActionDialog/ActionDialogProps.d.ts +1 -1
- package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.d.ts +2 -2
- package/dist/components/ActionDialog/index.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.js +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +1 -2
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.js +5 -5
- package/dist/components/ColumnSearchInput/index.d.ts +2 -2
- package/dist/components/ColumnSearchInput/index.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/index.js +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -3
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +39 -41
- package/dist/components/DateTimeRangePicker/index.d.ts +2 -2
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/index.js +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +1 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +38 -44
- package/dist/components/DatetimeRangeInput/index.d.ts +2 -2
- package/dist/components/DatetimeRangeInput/index.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/index.js +1 -1
- package/dist/components/Footer/Footer.d.ts +1 -2
- package/dist/components/Footer/Footer.d.ts.map +1 -1
- package/dist/components/Footer/Footer.js +5 -13
- package/dist/components/Footer/index.d.ts +1 -1
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.js +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.d.ts +1 -2
- package/dist/components/IpAddressInput/IpAddressInput.d.ts.map +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.js +5 -6
- package/dist/components/IpAddressInput/index.d.ts +2 -2
- package/dist/components/IpAddressInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressInput/index.js +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts +1 -2
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +3 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts +2 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/index.js +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts +1 -2
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.js +6 -6
- package/dist/components/LocalizedDatetimePicker/index.d.ts +2 -2
- package/dist/components/LocalizedDatetimePicker/index.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/index.js +1 -1
- package/dist/components/Navigation/NavMenu.d.ts +4 -3
- package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
- package/dist/components/Navigation/NavMenu.js +23 -27
- package/dist/components/Navigation/Navigation.d.ts +1 -2
- package/dist/components/Navigation/Navigation.d.ts.map +1 -1
- package/dist/components/Navigation/Navigation.js +122 -147
- package/dist/components/Navigation/NavigationProps.d.ts +2 -1
- package/dist/components/Navigation/NavigationProps.d.ts.map +1 -1
- package/dist/components/Navigation/index.d.ts +2 -2
- package/dist/components/Navigation/index.d.ts.map +1 -1
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts +1 -2
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.js +34 -39
- package/dist/components/NumberRangeInput/index.d.ts +2 -2
- package/dist/components/NumberRangeInput/index.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/index.js +1 -1
- package/dist/components/PageWrapper/PageWrapper.d.ts +2 -2
- package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
- package/dist/components/PageWrapper/PageWrapper.js +11 -14
- package/dist/components/PageWrapper/index.d.ts +2 -2
- package/dist/components/PageWrapper/index.d.ts.map +1 -1
- package/dist/components/PageWrapper/index.js +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts +1 -2
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.js +17 -31
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts +4 -4
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/HintOptionsMenu.js +8 -10
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +1 -2
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/RichFilterTextField.js +105 -84
- package/dist/components/RichFilterTextField/index.d.ts +2 -2
- package/dist/components/RichFilterTextField/index.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/index.js +1 -1
- package/dist/components/RichFilterTextField/utils.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/utils.js +13 -5
- package/dist/components/SmartTable/RowContent.d.ts +29 -9
- package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
- package/dist/components/SmartTable/RowContent.js +59 -20
- package/dist/components/SmartTable/SmartTable.d.ts +9 -2
- package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable/SmartTable.js +97 -109
- package/dist/components/SmartTable/SmartTableProps.d.ts +20 -10
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.d.ts +1 -2
- package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.js +5 -4
- package/dist/components/SmartTable/index.d.ts +2 -2
- package/dist/components/SmartTable/index.d.ts.map +1 -1
- package/dist/components/SmartTable/index.js +1 -1
- package/dist/components/SortBtn/SortBtn.d.ts +1 -2
- package/dist/components/SortBtn/SortBtn.d.ts.map +1 -1
- package/dist/components/SortBtn/SortBtn.js +3 -2
- package/dist/components/SortBtn/index.d.ts +2 -2
- package/dist/components/SortBtn/index.d.ts.map +1 -1
- package/dist/components/SortBtn/index.js +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.d.ts +1 -2
- package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.js +82 -43
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts +1 -1
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.d.ts +2 -2
- package/dist/components/SubtaskItem/index.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.js +1 -1
- package/dist/components/TaskLoader/TaskLoader.d.ts +2 -2
- package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
- package/dist/components/TaskLoader/TaskLoader.js +179 -194
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.d.ts +2 -2
- package/dist/components/TaskLoader/index.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.js +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -2
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.js +33 -47
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.d.ts +2 -2
- package/dist/components/TaskStateDialog/index.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.js +1 -1
- package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -2
- package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateAndRunIcon.js +6 -23
- package/dist/components/icons/GenerateIcon.d.ts +1 -2
- package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateIcon.js +6 -21
- package/dist/components/icons/IntegerIcon.d.ts +1 -2
- package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
- package/dist/components/icons/IntegerIcon.js +6 -9
- package/dist/components/icons/ProcessingIcon.d.ts +1 -2
- package/dist/components/icons/ProcessingIcon.d.ts.map +1 -1
- package/dist/components/icons/ProcessingIcon.js +2 -12
- package/dist/components/icons/QueueIcon.d.ts +1 -2
- package/dist/components/icons/QueueIcon.d.ts.map +1 -1
- package/dist/components/icons/QueueIcon.js +6 -9
- package/dist/components/icons/RangeIcon.d.ts +1 -2
- package/dist/components/icons/RangeIcon.d.ts.map +1 -1
- package/dist/components/icons/RangeIcon.js +6 -9
- package/dist/components/icons/RunIcon.d.ts +1 -2
- package/dist/components/icons/RunIcon.d.ts.map +1 -1
- package/dist/components/icons/RunIcon.js +6 -12
- package/dist/components/icons/TextModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TextModeIcon.js +2 -6
- package/dist/components/icons/TreeModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TreeModeIcon.js +2 -6
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.js +1 -1
- package/dist/http.d.ts +2 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -29
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/providers/AirflowProvider.d.ts +5 -4
- package/dist/providers/AirflowProvider.d.ts.map +1 -1
- package/dist/providers/AirflowProvider.js +44 -58
- package/dist/providers/DagStateProvider.d.ts +7 -5
- package/dist/providers/DagStateProvider.d.ts.map +1 -1
- package/dist/providers/DagStateProvider.js +95 -84
- package/dist/providers/SessionProvider.d.ts +3 -1
- package/dist/providers/SessionProvider.d.ts.map +1 -1
- package/dist/providers/SessionProvider.js +14 -7
- package/dist/providers/SnackBarProvider.d.ts +2 -2
- package/dist/providers/SnackBarProvider.d.ts.map +1 -1
- package/dist/providers/SnackBarProvider.js +8 -9
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +4 -4
- package/dist/types.d.ts +17 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -2
- package/package.json +30 -21
- package/dist/components/SmartTable/RuleRow.d.ts +0 -22
- package/dist/components/SmartTable/RuleRow.d.ts.map +0 -1
- package/dist/components/SmartTable/RuleRow.js +0 -35
|
@@ -1,53 +1,61 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import AccessTimeSharpIcon from "@mui/icons-material/AccessTimeSharp";
|
|
3
|
+
import BlockSharpIcon from "@mui/icons-material/BlockSharp";
|
|
4
|
+
import CheckCircleOutlineRoundedIcon from "@mui/icons-material/CheckCircleOutlineRounded";
|
|
5
|
+
import CloudOffIcon from "@mui/icons-material/CloudOff";
|
|
6
|
+
import ErrorOutlineSharpIcon from "@mui/icons-material/ErrorOutlineSharp";
|
|
7
|
+
import RestartAltIcon from "@mui/icons-material/RestartAlt";
|
|
8
|
+
import StopRoundedIcon from "@mui/icons-material/StopRounded";
|
|
9
|
+
import SyncIcon from "@mui/icons-material/Sync";
|
|
2
10
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
11
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
3
12
|
import IconButton from "@mui/material/IconButton";
|
|
13
|
+
import Switch from "@mui/material/Switch";
|
|
4
14
|
import Typography from "@mui/material/Typography";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import CheckCircleOutlineRoundedIcon from "@mui/icons-material/CheckCircleOutlineRounded";
|
|
9
|
-
import ErrorOutlineSharpIcon from "@mui/icons-material/ErrorOutlineSharp";
|
|
10
|
-
import AccessTimeSharpIcon from "@mui/icons-material/AccessTimeSharp";
|
|
11
|
-
import BlockSharpIcon from "@mui/icons-material/BlockSharp";
|
|
12
|
-
import { formatDate, formatDuration, taskStateText, useDebounce, } from "../../utils";
|
|
13
|
-
import SubtaskItem from "../SubtaskItem/SubtaskItem";
|
|
14
|
-
import { getRequest, postRequest } from "../../http";
|
|
15
|
-
import { getCSRFToken } from "../../utils";
|
|
16
|
-
import { useDagRunStateContext } from "../../providers/DagStateProvider";
|
|
15
|
+
import { useEffect, useEffectEvent, useRef, useState } from "react";
|
|
16
|
+
import useSWR from "swr";
|
|
17
|
+
import { postRequest } from "../../http";
|
|
17
18
|
import { useAirflowContext } from "../../providers/AirflowProvider";
|
|
19
|
+
import { useDagRunStateContext } from "../../providers/DagStateProvider";
|
|
20
|
+
import { formatDate, formatDuration, getCSRFToken, taskStateText, useDebounce, } from "../../utils";
|
|
18
21
|
import ProcessingIcon from "../icons/ProcessingIcon";
|
|
19
|
-
|
|
22
|
+
import SubtaskItem from "../SubtaskItem/SubtaskItem";
|
|
23
|
+
const TaskStateIcon = ({ taskState, }) => {
|
|
20
24
|
switch (taskState) {
|
|
21
25
|
case "success":
|
|
22
|
-
return
|
|
26
|
+
return _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "large", color: "success" });
|
|
23
27
|
case "failed":
|
|
24
|
-
return
|
|
28
|
+
return _jsx(ErrorOutlineSharpIcon, { fontSize: "large", color: "error" });
|
|
25
29
|
case "queued":
|
|
26
|
-
return
|
|
30
|
+
return _jsx(AccessTimeSharpIcon, { fontSize: "large" });
|
|
27
31
|
case "running":
|
|
28
|
-
return
|
|
32
|
+
return _jsx(CircularProgress, {});
|
|
33
|
+
case "connerr":
|
|
34
|
+
return _jsx(CloudOffIcon, {});
|
|
29
35
|
default:
|
|
30
|
-
return
|
|
36
|
+
return _jsx(BlockSharpIcon, { fontSize: "large" });
|
|
31
37
|
}
|
|
32
38
|
};
|
|
33
|
-
|
|
39
|
+
const TaskLoader = ({ style, subTitle, onUnauthorized }) => {
|
|
34
40
|
const { airflowAvailable, onLostConnection } = useAirflowContext();
|
|
35
|
-
const { isActive, dagRun, taskInstances, onUpdateState, fetchState } = useDagRunStateContext();
|
|
36
|
-
const [activeTask, setActiveTask] =
|
|
41
|
+
const { isActive, dagRun, taskInstances, onUpdateState, fetchState, error } = useDagRunStateContext();
|
|
42
|
+
const [activeTask, setActiveTask] = useState(taskInstances?.taskInstances.find((ti) => {
|
|
37
43
|
return ti.state === "running";
|
|
38
44
|
}) || null);
|
|
39
|
-
const [logs, setLogs] =
|
|
45
|
+
const [logs, setLogs] = useState([null, null, null]);
|
|
40
46
|
const [blockContols, setBlockControls] = useState(false);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
const [followLogs, setFollowLogs] = useState(true);
|
|
48
|
+
const logContainerRef = useRef(null);
|
|
49
|
+
const scrollDown = useEffectEvent(() => {
|
|
50
|
+
if (logContainerRef.current != null && followLogs) {
|
|
44
51
|
logContainerRef.current.scrollTo({
|
|
45
52
|
left: 0,
|
|
46
53
|
top: logContainerRef.current.scrollHeight,
|
|
47
54
|
behavior: "smooth",
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
|
-
}
|
|
57
|
+
});
|
|
58
|
+
useEffect(() => scrollDown(), [activeTask, logs]);
|
|
51
59
|
const updateActiveTask = () => {
|
|
52
60
|
const newActiveTask = taskInstances?.taskInstances.find((ti) => {
|
|
53
61
|
return ti.state === "running";
|
|
@@ -60,109 +68,103 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
60
68
|
setActiveTask(newActiveTask);
|
|
61
69
|
}
|
|
62
70
|
};
|
|
63
|
-
|
|
71
|
+
useEffect(() => {
|
|
64
72
|
if (isActive) {
|
|
73
|
+
setFollowLogs(true);
|
|
65
74
|
setLogs([null, null, null]);
|
|
66
75
|
}
|
|
67
76
|
}, [isActive]);
|
|
68
|
-
|
|
77
|
+
useEffect(() => {
|
|
69
78
|
const interval = setInterval(() => {
|
|
70
79
|
if (!isActive)
|
|
71
80
|
return;
|
|
72
|
-
|
|
81
|
+
if (followLogs)
|
|
82
|
+
updateActiveTask();
|
|
73
83
|
}, 100);
|
|
74
84
|
return () => {
|
|
75
85
|
clearInterval(interval);
|
|
76
86
|
};
|
|
77
87
|
}, [isActive, taskInstances]);
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
const defaultFetcher = async ([url, dagId, dagRunId, taskId, tryNum, continuationToken,]) => {
|
|
89
|
+
const requestUrl = new URL("http://foo/" + url);
|
|
90
|
+
requestUrl.searchParams.append("dag_id", dagId);
|
|
91
|
+
if (dagRunId)
|
|
92
|
+
requestUrl.searchParams.append("dag_run_id", dagRunId);
|
|
93
|
+
requestUrl.searchParams.append("task_id", taskId);
|
|
94
|
+
requestUrl.searchParams.append("try_num", tryNum.toString());
|
|
95
|
+
if (continuationToken)
|
|
96
|
+
requestUrl.searchParams.append("continuation_token", continuationToken);
|
|
97
|
+
const resultUrl = requestUrl.pathname.substring(1) + requestUrl.search;
|
|
98
|
+
const res = await fetch(resultUrl, { signal: AbortSignal.timeout(10000) });
|
|
99
|
+
if (res.status === 401) {
|
|
100
|
+
onUnauthorized();
|
|
101
|
+
}
|
|
102
|
+
if (!res.ok) {
|
|
103
|
+
throw { ...(await res.json()), status: res.status };
|
|
104
|
+
}
|
|
105
|
+
return res.json();
|
|
106
|
+
};
|
|
107
|
+
const taskIndex = taskInstances != null
|
|
108
|
+
? taskInstances.taskInstances.findIndex((ti) => activeTask != null && ti.taskId === activeTask.taskId)
|
|
109
|
+
: -1;
|
|
110
|
+
const continuationToken = taskIndex >= 0
|
|
111
|
+
? logs[taskIndex] != null
|
|
112
|
+
? logs[taskIndex].continuationToken
|
|
113
|
+
: null
|
|
114
|
+
: null;
|
|
115
|
+
useSWR(airflowAvailable &&
|
|
116
|
+
activeTask != null && [
|
|
117
|
+
"airflow/ti_logs",
|
|
118
|
+
dagRun?.dagId,
|
|
119
|
+
dagRun?.dagRunId,
|
|
120
|
+
activeTask.taskId,
|
|
121
|
+
activeTask.tryNumber,
|
|
122
|
+
continuationToken,
|
|
123
|
+
], defaultFetcher, {
|
|
124
|
+
refreshInterval: isActive ? 1000 : 0,
|
|
125
|
+
keepPreviousData: true,
|
|
126
|
+
onError: (err) => {
|
|
127
|
+
if (err?.status == 401) {
|
|
128
|
+
onUnauthorized();
|
|
129
|
+
}
|
|
130
|
+
console.log("Error while fetching logs");
|
|
131
|
+
if (err && err.status === 503) {
|
|
132
|
+
onLostConnection();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onSuccess: (data) => {
|
|
136
|
+
const newLogs = logs.slice();
|
|
137
|
+
if (!data)
|
|
83
138
|
return;
|
|
84
|
-
if (
|
|
139
|
+
if (data.logs.content.length === 0)
|
|
85
140
|
return;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
dag_id: dagRun?.dagId,
|
|
98
|
-
dag_run_id: dagRun?.dagRunId,
|
|
99
|
-
task_id: activeTask.taskId,
|
|
100
|
-
try_num: activeTask.tryNumber,
|
|
101
|
-
continuation_token: continuationToken,
|
|
102
|
-
},
|
|
103
|
-
successHandler: (resp) => {
|
|
104
|
-
const newLogs = logs.slice();
|
|
105
|
-
if (!resp)
|
|
106
|
-
return;
|
|
107
|
-
if (resp.logs.content.length === 0)
|
|
108
|
-
return;
|
|
109
|
-
if (newLogs[taskIndex] != null) {
|
|
110
|
-
newLogs[taskIndex].continuationToken = resp.logs.continuationToken;
|
|
111
|
-
newLogs[taskIndex].content += resp.logs.content;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
newLogs[taskIndex] = resp.logs;
|
|
115
|
-
}
|
|
116
|
-
setLogs(newLogs);
|
|
117
|
-
},
|
|
118
|
-
errorHandler: (resp) => {
|
|
119
|
-
console.log("Error while fetching logs");
|
|
120
|
-
if (resp && resp.status === 503) {
|
|
121
|
-
onLostConnection();
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}, 500);
|
|
126
|
-
return () => {
|
|
127
|
-
clearInterval(interval);
|
|
128
|
-
};
|
|
129
|
-
}, [isActive, activeTask, dagRun, taskInstances, logs]);
|
|
130
|
-
function handleShowLogs(taskId, tryNum) {
|
|
141
|
+
if (newLogs[taskIndex] != null) {
|
|
142
|
+
newLogs[taskIndex].continuationToken = data.logs.continuationToken;
|
|
143
|
+
newLogs[taskIndex].content += data.logs.content;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
newLogs[taskIndex] = data.logs;
|
|
147
|
+
}
|
|
148
|
+
setLogs(newLogs);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
const handleShowLogs = (taskId) => {
|
|
131
152
|
if (!airflowAvailable)
|
|
132
153
|
return;
|
|
133
154
|
if (activeTask != null && taskId === activeTask.taskId) {
|
|
134
155
|
setActiveTask(null);
|
|
135
156
|
return;
|
|
136
157
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
continuation_token: null,
|
|
145
|
-
},
|
|
146
|
-
successHandler: (resp) => {
|
|
147
|
-
if (!resp)
|
|
148
|
-
return;
|
|
149
|
-
const newActiveTaskIdx = taskInstances != null
|
|
150
|
-
? taskInstances.taskInstances.findIndex((ti) => ti.taskId === taskId)
|
|
151
|
-
: -1;
|
|
152
|
-
setActiveTask(taskInstances?.taskInstances[newActiveTaskIdx] || null);
|
|
153
|
-
const newLogs = logs.slice();
|
|
154
|
-
newLogs[newActiveTaskIdx] = resp.logs;
|
|
155
|
-
setLogs(newLogs);
|
|
156
|
-
},
|
|
157
|
-
errorHandler: (resp) => {
|
|
158
|
-
console.log("Error while getting logs for subtask!");
|
|
159
|
-
if (resp && resp.status === 503) {
|
|
160
|
-
onLostConnection();
|
|
161
|
-
}
|
|
162
|
-
},
|
|
158
|
+
const newActiveTaskIdx = taskInstances != null
|
|
159
|
+
? taskInstances.taskInstances.findIndex((ti) => ti.taskId === taskId)
|
|
160
|
+
: -1;
|
|
161
|
+
setActiveTask(taskInstances?.taskInstances[newActiveTaskIdx] || null);
|
|
162
|
+
setLogs((prev) => {
|
|
163
|
+
const newLogs = prev.filter((_, i) => i === newActiveTaskIdx);
|
|
164
|
+
return newLogs;
|
|
163
165
|
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
+
};
|
|
167
|
+
const handleRestartLoad = () => {
|
|
166
168
|
if (!airflowAvailable)
|
|
167
169
|
return;
|
|
168
170
|
postRequest({
|
|
@@ -183,13 +185,16 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
183
185
|
setLogs([null, null, null]);
|
|
184
186
|
},
|
|
185
187
|
errorHandler: (resp) => {
|
|
188
|
+
if (resp?.status == 401) {
|
|
189
|
+
onUnauthorized();
|
|
190
|
+
}
|
|
186
191
|
console.log("Error restarting task!");
|
|
187
192
|
if (resp && resp.status === 503) {
|
|
188
193
|
onLostConnection();
|
|
189
194
|
}
|
|
190
195
|
},
|
|
191
196
|
});
|
|
192
|
-
}
|
|
197
|
+
};
|
|
193
198
|
const handleStopLoad = useDebounce(() => {
|
|
194
199
|
if (!airflowAvailable)
|
|
195
200
|
return;
|
|
@@ -212,6 +217,9 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
212
217
|
setBlockControls(false);
|
|
213
218
|
},
|
|
214
219
|
errorHandler: (resp) => {
|
|
220
|
+
if (resp?.status == 401) {
|
|
221
|
+
onUnauthorized();
|
|
222
|
+
}
|
|
215
223
|
console.log("Error aborting task!");
|
|
216
224
|
if (resp && resp.status === 503) {
|
|
217
225
|
onLostConnection();
|
|
@@ -221,7 +229,8 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
221
229
|
});
|
|
222
230
|
}, 200);
|
|
223
231
|
const formatEndDate = formatDate(dagRun?.logicalDate || "");
|
|
224
|
-
const formatTaskDuration = formatDuration(taskInstances?.taskInstances.reduce((a, b) => a + (b.duration || 0), 0) ||
|
|
232
|
+
const formatTaskDuration = formatDuration(taskInstances?.taskInstances.reduce((a, b) => a + (b.duration || 0), 0) ||
|
|
233
|
+
0);
|
|
225
234
|
const activeTaskElem = taskInstances?.taskInstances.find((ti) => {
|
|
226
235
|
return activeTask && ti.taskId === activeTask.taskId;
|
|
227
236
|
});
|
|
@@ -238,89 +247,64 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
238
247
|
}, 1550);
|
|
239
248
|
}
|
|
240
249
|
}, 200);
|
|
241
|
-
return (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
React.createElement("div", { style: {
|
|
252
|
-
display: "flex",
|
|
253
|
-
flexDirection: "column",
|
|
254
|
-
justifyContent: "start",
|
|
255
|
-
} },
|
|
256
|
-
React.createElement("div", { style: { height: "10%", width: "auto", flex: "0 0 auto" } },
|
|
257
|
-
React.createElement("div", { style: {
|
|
258
|
-
display: "flex",
|
|
259
|
-
justifyContent: "space-between",
|
|
260
|
-
alignItems: "center",
|
|
261
|
-
height: "100%",
|
|
262
|
-
} },
|
|
263
|
-
React.createElement("div", { style: {
|
|
264
|
-
width: "auto",
|
|
265
|
-
whiteSpace: "nowrap",
|
|
266
|
-
overflow: "hidden",
|
|
267
|
-
} },
|
|
268
|
-
React.createElement("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" } },
|
|
269
|
-
taskStateIcon(dagRun?.state),
|
|
270
|
-
" ",
|
|
271
|
-
React.createElement("span", null,
|
|
272
|
-
taskStateText(dagRun?.state),
|
|
273
|
-
dagRun?.state === "success"
|
|
274
|
-
? (formatEndDate.startsWith("вт") ? " во " : " в ") +
|
|
275
|
-
formatEndDate +
|
|
276
|
-
" за " +
|
|
277
|
-
formatTaskDuration
|
|
278
|
-
: ""))),
|
|
279
|
-
React.createElement("div", { style: { width: "auto", flex: "0 0 auto" } },
|
|
280
|
-
React.createElement("div", { style: {
|
|
250
|
+
return (_jsxs("div", { style: style, children: [_jsxs(Typography, { variant: "h5", style: {
|
|
251
|
+
marginBottom: "1.5rem",
|
|
252
|
+
display: "flex",
|
|
253
|
+
alignItems: "center",
|
|
254
|
+
gap: "0.25rem",
|
|
255
|
+
}, children: [subTitle, " ", _jsx(ProcessingIcon, {})] }), _jsxs("div", { style: {
|
|
256
|
+
display: "flex",
|
|
257
|
+
flexDirection: "column",
|
|
258
|
+
justifyContent: "start",
|
|
259
|
+
}, children: [_jsx("div", { style: { height: "10%", width: "auto", flex: "0 0 auto" }, children: _jsxs("div", { style: {
|
|
281
260
|
display: "flex",
|
|
282
261
|
justifyContent: "space-between",
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
height: "100%",
|
|
264
|
+
}, children: [_jsx("div", { style: {
|
|
265
|
+
width: "auto",
|
|
266
|
+
whiteSpace: "nowrap",
|
|
267
|
+
overflow: "hidden",
|
|
268
|
+
}, children: _jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [_jsx(TaskStateIcon, { taskState: error || !airflowAvailable ? "connerr" : dagRun?.state }), _jsxs("span", { children: [taskStateText(error || !airflowAvailable ? "connerr" : dagRun?.state), dagRun?.state === "success"
|
|
269
|
+
? (formatEndDate.startsWith("вт") ? " во " : " в ") +
|
|
270
|
+
formatEndDate +
|
|
271
|
+
" за " +
|
|
272
|
+
formatTaskDuration
|
|
273
|
+
: ""] })] }) }), _jsx("div", { style: { width: "auto", flex: "0 0 auto" }, children: _jsxs("div", { style: {
|
|
274
|
+
display: "flex",
|
|
275
|
+
justifyContent: "space-between",
|
|
276
|
+
width: "auto",
|
|
277
|
+
flex: "0 0 auto",
|
|
278
|
+
gap: "0.25rem",
|
|
279
|
+
}, children: [_jsx(FormControlLabel, { control: _jsx(Switch, { checked: followLogs, onChange: (_, c) => setFollowLogs(c) }), label: "\u0421\u043B\u0435\u0434\u043E\u0432\u0430\u0442\u044C" }), _jsx(IconButton, { id: "updateTaskStateBtn", color: "default", title: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435", size: "small", onClick: (e) => {
|
|
280
|
+
setBlockControls(true);
|
|
281
|
+
handleClick(e.currentTarget, () => {
|
|
282
|
+
fetchState();
|
|
283
|
+
updateActiveTask();
|
|
284
|
+
}, "around");
|
|
285
|
+
}, disabled: !airflowAvailable || blockContols, sx: {
|
|
286
|
+
transition: "transform 0.5s linear",
|
|
287
|
+
"&.around": {
|
|
288
|
+
animation: "rotate-around 0.5s linear 0.1s 3 running",
|
|
289
|
+
},
|
|
290
|
+
}, children: _jsx(SyncIcon, { fontSize: "large" }) }), _jsx(IconButton, { id: "taskRestartBtn", color: "info", title: "\u041F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0437\u0430\u0434\u0430\u0447\u0443", size: "small", disabled: !airflowAvailable ||
|
|
291
|
+
dagRun?.state !== "failed" ||
|
|
292
|
+
blockContols, onClick: (e) => {
|
|
293
|
+
setBlockControls(true);
|
|
294
|
+
handleClick(e.currentTarget, handleRestartLoad, "around");
|
|
295
|
+
}, sx: {
|
|
296
|
+
transition: "transform 0.5s linear",
|
|
297
|
+
"&.around": {
|
|
298
|
+
animation: "rotate-around 0.5s linear 0.1s 3 running",
|
|
299
|
+
},
|
|
300
|
+
}, children: _jsx(RestartAltIcon, { fontSize: "large" }) }), _jsx(IconButton, { color: "error", title: "\u041F\u0440\u0435\u0440\u0432\u0430\u0442\u044C \u0437\u0430\u0434\u0430\u0447\u0443", size: "small", disabled: !airflowAvailable ||
|
|
301
|
+
dagRun?.state !== "running" ||
|
|
302
|
+
blockContols, onClick: () => {
|
|
303
|
+
setBlockControls(true);
|
|
304
|
+
handleStopLoad();
|
|
305
|
+
}, children: _jsx(StopRoundedIcon, { fontSize: "large" }) })] }) })] }) }), _jsx("div", { style: { height: "90%", width: "auto", flex: "0 0 auto" }, children: _jsx("div", { style: { maxHeight: "100%", overflow: "auto" }, children: taskInstances?.taskInstances.map((ti, idx) => {
|
|
306
|
+
return (_jsx(SubtaskItem, { taskInstance: ti, expanded: idx === activeTaskNumber, expandedLogContainerRef: idx === activeTaskNumber ? logContainerRef : undefined, onShowLogs: handleShowLogs, logs: logs[idx] != null ? logs[idx].content : "" }, idx));
|
|
307
|
+
}) }) })] }), _jsx("style", { children: `
|
|
324
308
|
@keyframes rotate-around {
|
|
325
309
|
from {
|
|
326
310
|
transform: rotate(0deg);
|
|
@@ -329,5 +313,6 @@ export default function TaskLoader({ style, subTitle }) {
|
|
|
329
313
|
transform: rotate(-360deg);
|
|
330
314
|
}
|
|
331
315
|
}
|
|
332
|
-
`)));
|
|
333
|
-
}
|
|
316
|
+
` })] }));
|
|
317
|
+
};
|
|
318
|
+
export default TaskLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskLoaderProps.d.ts","sourceRoot":"","sources":["../../../src/components/TaskLoader/TaskLoaderProps.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TaskLoaderProps.d.ts","sourceRoot":"","sources":["../../../src/components/TaskLoader/TaskLoaderProps.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,IAAI,IAAI,CAAC;CACxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default } from "./TaskLoader";
|
|
2
1
|
export * from "./TaskLoader";
|
|
3
|
-
export { default
|
|
2
|
+
export { default } from "./TaskLoader";
|
|
4
3
|
export * from "./TaskLoaderProps";
|
|
4
|
+
export { type default as TaskLoaderProps } from "./TaskLoaderProps";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TaskLoader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TaskLoader/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,KAAK,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import TaskStateDialogProps from "./TaskStateDialogProps";
|
|
3
|
-
export default function TaskStateDialog({ taskTitle, subTitle, appendedTitle, visible, mousePos, disableClosing, additionalControls, disableTransition, onClose, }: TaskStateDialogProps):
|
|
2
|
+
export default function TaskStateDialog({ taskTitle, subTitle, appendedTitle, visible, mousePos, disableClosing, additionalControls, disableTransition, onClose, onUnauthorized, }: TaskStateDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
//# sourceMappingURL=TaskStateDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskStateDialog.d.ts","sourceRoot":"","sources":["../../../src/components/TaskStateDialog/TaskStateDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TaskStateDialog.d.ts","sourceRoot":"","sources":["../../../src/components/TaskStateDialog/TaskStateDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAwB1D,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,SAAS,EACT,QAAQ,EACR,aAAa,EACb,OAAO,EACP,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,cAAc,GACf,EAAE,oBAAoB,2CA8LtB"}
|