MCPcopy
hub / github.com/Tencent/CodeAnalysis / Process

Function Process

web/packages/tca-manage/src/modules/process/index.tsx:14–249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12import s from './style.scss';
13
14const Process = () => {
15 const [nodeInfo, setNodeInfo] = useState<any>(null);
16 const [processTableData, setProcessTableData] = useState<Array<any>>([]);
17 const [loading, setLoading] = useState(false);
18
19 const checkedAll = processTableData.every(item => item.checktool.supported);
20 const uncheckedAll = processTableData.every(item => !item.checktool.supported);
21 const checkedAllIndeterminate = !uncheckedAll && !checkedAll;
22
23 const { nodeId }: any = useParams();
24
25 const getNodePorcessRequest = async (id: number) => {
26 setLoading(true);
27 const process: { [key: string]: any } = await getNodeProcess(id);
28 const data = Object.keys(process).map((key: string) => {
29 const item = process[key];
30 const supported = Object.keys(item).every((k: string) => item[k].supported);
31 const unsupported = Object.keys(item).every((k: string) => !item[k].supported);
32 return {
33 checktool: {
34 name: key,
35 supported,
36 indeterminate: !supported && !unsupported,
37 },
38 ...process[key],
39 };
40 });
41 setProcessTableData(data);
42 setLoading(false);
43 return process;
44 };
45
46 useEffect(() => {
47 (async () => {
48 const node = await nodeAPI.getDetail(nodeId);
49 setNodeInfo(node);
50 await getNodePorcessRequest(nodeId);
51 })();
52 }, [nodeId]);
53
54 // 全选、全不选
55 const onSelectAllChange = (checked: boolean) => {
56 setProcessTableData((data: Array<any>) => data.map((item: any) => {
57 Object.keys(item).forEach((key) => {
58 item[key].supported = checked;
59 if (key === 'checktool') {
60 item[key].indeterminate = false;
61 }
62 });
63 return item;
64 }));
65 };
66
67 // 全选某行,全不选某行
68 const onSelectRowAllChange = (checked: boolean, index: number) => {
69 setProcessTableData((data: Array<any>) => {
70 const item = data[index];
71 Object.keys(item).forEach((key) => {

Callers

nothing calls this directly

Calls 6

formatDateTimeFunction · 0.90
bytesToSizeFunction · 0.90
getFunction · 0.85
getNodePorcessRequestFunction · 0.70
onSelectRowAllChangeFunction · 0.70
onSelectChangeFunction · 0.70

Tested by

no test coverage detected