@danikokonn/yarik-frontend-lib 2.1.0 → 2.1.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubtaskItem.d.ts","sourceRoot":"","sources":["../../../src/components/SubtaskItem/SubtaskItem.tsx"],"names":[],"mappings":"AAgBA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAmBlD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,uBAAuB,GACxB,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SubtaskItem.d.ts","sourceRoot":"","sources":["../../../src/components/SubtaskItem/SubtaskItem.tsx"],"names":[],"mappings":"AAgBA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAmBlD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,uBAAuB,GACxB,EAAE,gBAAgB,2CAsIlB"}
|
|
@@ -12,7 +12,7 @@ import AccordionDetails from "@mui/material/AccordionDetails";
|
|
|
12
12
|
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
13
13
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
14
14
|
import moment from "moment";
|
|
15
|
-
import { useState } from "react";
|
|
15
|
+
import { useEffect, useState } from "react";
|
|
16
16
|
import { taskStateText } from "../../utils";
|
|
17
17
|
const SubtaskState = ({ state }) => {
|
|
18
18
|
switch (state) {
|
|
@@ -34,6 +34,16 @@ export default function SubtaskItem({ taskInstance, logs, expanded, onShowLogs,
|
|
|
34
34
|
const [copyVisible, setCopyVisible] = useState(false);
|
|
35
35
|
const [copyText, setCopyText] = useState("Копировать");
|
|
36
36
|
const theme = useTheme();
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (expanded) {
|
|
39
|
+
setCopyVisible(true);
|
|
40
|
+
setCopyText("Копировать");
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setCopyVisible(false);
|
|
44
|
+
setCopyText("Копировать");
|
|
45
|
+
}
|
|
46
|
+
}, [expanded]);
|
|
37
47
|
const formatEndDate = new Date(taskInstance.executionDate).toLocaleString("ru", {
|
|
38
48
|
weekday: "short",
|
|
39
49
|
month: "short",
|
|
@@ -51,17 +61,6 @@ export default function SubtaskItem({ taskInstance, logs, expanded, onShowLogs,
|
|
|
51
61
|
});
|
|
52
62
|
return (_jsxs(Accordion, { disableGutters: true, expanded: expanded, onChange: () => onShowLogs(taskInstance.taskId, taskInstance.tryNumber), disabled: !["running", "success", "failed"].includes(taskInstance.state || ""), sx: {
|
|
53
63
|
position: "relative",
|
|
54
|
-
}, slotProps: {
|
|
55
|
-
transition: {
|
|
56
|
-
onEntered: () => {
|
|
57
|
-
setCopyVisible(true);
|
|
58
|
-
setCopyText("Копировать");
|
|
59
|
-
},
|
|
60
|
-
onExit: () => {
|
|
61
|
-
setCopyVisible(false);
|
|
62
|
-
setCopyText("Копировать");
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
64
|
}, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ExpandMore, {}), children: _jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [_jsx(SubtaskState, { state: taskInstance.state }), _jsxs("span", { children: [taskInstance.taskId, " - ", taskStateText(taskInstance.state), taskInstance.state === "success"
|
|
66
65
|
? (formatEndDate.startsWith("вт") ? " во " : " в ") +
|
|
67
66
|
formatEndDate +
|