MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / Process

Function Process

web/packages/tca-layout/src/modules/nodes/process/index.tsx:25–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23const { Column } = Table;
24
25const Process = () => {
26 const { orgSid, nodeId }: any = useParams();
27 const [nodeInfo, setNodeInfo] = useState<any>(null);
28 const [processTableData, setProcessTableData] = useState<Array<any>>([]);
29 const [loading, setLoading] = useState(false);
30
31 const checkedAll = processTableData.every(item => item.checktool.supported);
32 const uncheckedAll = processTableData.every(item => !item.checktool.supported);
33 const checkedAllIndeterminate = !uncheckedAll && !checkedAll;
34
35 const getNodePorcessRequest = async (id: number) => {
36 setLoading(true);
37 const process: { [key: string]: any } = await getNodeProcess(orgSid, id);
38 const data = Object.keys(process).map((key: string) => {
39 const item = process[key];
40 const supported = Object.keys(item).every((k: string) => item[k].supported);
41 const unsupported = Object.keys(item).every((k: string) => !item[k].supported);
42 return {
43 checktool: {
44 name: key,
45 supported,
46 indeterminate: !supported && !unsupported,
47 },
48 ...process[key],
49 };
50 });
51 setProcessTableData(data);
52 setLoading(false);
53 return process;
54 };
55
56 useEffect(() => {
57 (async () => {
58 const node = await getNode(orgSid, nodeId);
59 setNodeInfo(node);
60 await getNodePorcessRequest(nodeId);
61 })();
62 }, []);
63
64 // 全选、全不选
65 const onSelectAllChange = (e: CheckboxChangeEvent) => {
66 setProcessTableData((data: Array<any>) => data.map((item: any) => {
67 Object.keys(item).forEach((key) => {
68 // eslint-disable-next-line no-param-reassign
69 item[key].supported = e.target.checked;
70 if (key === 'checktool') {
71 // eslint-disable-next-line no-param-reassign
72 item[key].indeterminate = false;
73 }
74 });
75 return item;
76 }));
77 };
78
79 // 全选某行,全不选某行
80 const onSelectRowAllChange = (e: CheckboxChangeEvent, index: number) => {
81 setProcessTableData((data: Array<any>) => {
82 const item = data[index];

Callers

nothing calls this directly

Calls 6

getNodeFunction · 0.90
formatDateTimeFunction · 0.90
bytesToSizeFunction · 0.90
getNodePorcessRequestFunction · 0.70
onSelectRowAllChangeFunction · 0.70
onSelectChangeFunction · 0.70

Tested by

no test coverage detected