MCPcopy
hub / github.com/man-group/dtale / load

Method load

frontend/static/network/NetworkDisplay.tsx:262–300  ·  view source on GitHub ↗

* Load network data to be displayed in vis-network graph. * * @return a promise which executes a load of network data.

()

Source from the content-addressed store, hash-verified

260 * @return a promise which executes a load of network data.
261 */
262 private async load(): Promise<void> {
263 const currParams = networkUtils.buildParams(this.state);
264 if (!currParams.to || !currParams.from) {
265 this.network?.destroy?.();
266 this.network = undefined;
267 this.setState({ ...networkUtils.buildState(), loadingDtypes: false, dtypes: this.state.dtypes });
268 return;
269 }
270 this.setState({ loadingData: true });
271 const response = await NetworkRepository.getData(this.props.dataId, currParams);
272 if (response?.error) {
273 this.setState({ error: <RemovableError {...response} />, loadingData: false });
274 return;
275 }
276 const { nodes, edges } = response!;
277 if (this.state.weight) {
278 edges.forEach((edge) => (edge.title = `Weight: ${edge.value}`));
279 }
280 nodes.forEach((node) => (node.title = node.label));
281 const nodesDataset = new DataSet(nodes);
282 const edgesDataset = new DataSet(edges);
283 this.draw(nodesDataset, edgesDataset);
284 const networkNodes = (this.network as any)?.body.nodes;
285 let groupsMapping: GroupColor[] = [];
286 if (response?.groups && Object.keys(response.groups).length > 1) {
287 groupsMapping = Object.entries(response.groups).map(([nodeGroup, nodeId]) => [
288 nodeGroup,
289 { ...networkNodes[nodeId]?.options?.color },
290 ]);
291 }
292 this.setState({
293 params: currParams,
294 loadingData: false,
295 allNodes: nodesDataset.get({ returnType: 'Object' }),
296 highlightActive: false,
297 groups: groupsMapping,
298 error: undefined,
299 });
300 }
301
302 /**
303 * Draw the vis-network graph.

Callers 12

componentDidMountMethod · 0.95
getDataFunction · 0.80
CodeExportFunction · 0.80
AggregationsFunction · 0.80
loadDetailsFunction · 0.80
loadChartDataFunction · 0.80
InstancesFunction · 0.80
loadVarianceFunction · 0.80
updateChartTypeFunction · 0.80
safe_loadsFunction · 0.80
loader_funcFunction · 0.80

Calls 4

drawMethod · 0.95
destroyMethod · 0.45
keysMethod · 0.45
getMethod · 0.45

Tested by 1

updateChartTypeFunction · 0.64