Merge branch 'github-pr-223'
[arvados.git] / services / workbench2 / src / store / process-panel / process-panel.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { WorkflowInputsData } from 'models/workflow';
6 import { RouterState } from "react-router-redux";
7 import { matchProcessRoute } from "routes/routes";
8 import { ProcessIOParameter } from "views/process-panel/process-io-card";
9 import { CommandOutputParameter } from 'cwlts/mappings/v1.0/CommandOutputParameter';
10
11 export type OutputDetails = {
12     raw?: any;
13     pdh?: string;
14 }
15
16 export interface CUDAFeatures {
17     DriverVersion: string;
18     HardwareCapability: string;
19     DeviceCount: number;
20 }
21
22 export interface NodeInstanceType {
23     Name: string;
24     ProviderType: string;
25     VCPUs: number;
26     RAM: number;
27     Scratch: number;
28     IncludedScratch: number;
29     AddedScratch: number;
30     Price: number;
31     Preemptible: boolean;
32     CUDA: CUDAFeatures;
33 };
34
35 export interface NodeInfo {
36     nodeInfo: NodeInstanceType | null;
37 };
38
39 export interface ProcessPanel {
40     containerRequestUuid: string;
41     filters: { [status: string]: boolean };
42     inputRaw: WorkflowInputsData | null;
43     inputParams: ProcessIOParameter[] | null;
44     outputData: OutputDetails | null;
45     outputDefinitions: CommandOutputParameter[];
46     outputParams: ProcessIOParameter[] | null;
47     nodeInfo: NodeInstanceType | null;
48 }
49
50 export const getProcessPanelCurrentUuid = (router: RouterState) => {
51     const pathname = router.location ? router.location.pathname : '';
52     const match = matchProcessRoute(pathname);
53     return match ? match.params.id : undefined;
54 };