+
+export const loadNodeJson = (containerRequest: ContainerRequestResource) =>
+ async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ const noLog = { nodeInfo: null };
+ if (!containerRequest.logUuid) {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ return;
+ };
+ try {
+ const filesPromise = services.collectionService.files(containerRequest.logUuid);
+ const collectionPromise = services.collectionService.get(containerRequest.logUuid);
+ const [files] = await Promise.all([filesPromise, collectionPromise]);
+
+ // Fetch node.json from keep
+ const nodeFile = files.find((file) => file.name === 'node.json') as CollectionFile | undefined;
+ let nodeData = nodeFile ? await services.collectionService.getFileContents(nodeFile) : undefined;
+ if (nodeData && (nodeData = JSON.parse(nodeData))) {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO({
+ nodeInfo: nodeData as NodeInstanceType
+ }));
+ } else {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ }
+ } catch {
+ dispatch<ProcessPanelAction>(processPanelActions.SET_NODE_INFO(noLog));
+ }
+ };
+