Merge branch '14917-searching-by-properties'
[arvados.git] / src / index.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import * as ReactDOM from 'react-dom';
7 import { Provider } from "react-redux";
8 import { MainPanel } from '~/views/main-panel/main-panel';
9 import '~/index.css';
10 import { Route, Switch } from 'react-router';
11 import createBrowserHistory from "history/createBrowserHistory";
12 import { History } from "history";
13 import { configureStore, RootStore } from '~/store/store';
14 import { ConnectedRouter } from "react-router-redux";
15 import { ApiToken } from "~/views-components/api-token/api-token";
16 import { initAuth } from "~/store/auth/auth-action";
17 import { configActions } from "~/store/config/config-action";
18 import { createServices } from "~/services/services";
19 import { MuiThemeProvider } from '@material-ui/core/styles';
20 import { CustomTheme } from '~/common/custom-theme';
21 import { fetchConfig } from '~/common/config';
22 import { addMenuActionSet, ContextMenuKind } from '~/views-components/context-menu/context-menu';
23 import { rootProjectActionSet } from "~/views-components/context-menu/action-sets/root-project-action-set";
24 import { projectActionSet } from "~/views-components/context-menu/action-sets/project-action-set";
25 import { resourceActionSet } from '~/views-components/context-menu/action-sets/resource-action-set';
26 import { favoriteActionSet } from "~/views-components/context-menu/action-sets/favorite-action-set";
27 import { collectionFilesActionSet } from '~/views-components/context-menu/action-sets/collection-files-action-set';
28 import { collectionFilesItemActionSet } from '~/views-components/context-menu/action-sets/collection-files-item-action-set';
29 import { collectionFilesNotSelectedActionSet } from '~/views-components/context-menu/action-sets/collection-files-not-selected-action-set';
30 import { collectionActionSet } from '~/views-components/context-menu/action-sets/collection-action-set';
31 import { collectionResourceActionSet } from '~/views-components/context-menu/action-sets/collection-resource-action-set';
32 import { processActionSet } from '~/views-components/context-menu/action-sets/process-action-set';
33 import { loadWorkbench } from '~/store/workbench/workbench-actions';
34 import { Routes } from '~/routes/routes';
35 import { trashActionSet } from "~/views-components/context-menu/action-sets/trash-action-set";
36 import { ServiceRepository } from '~/services/services';
37 import { initWebSocket } from '~/websocket/websocket';
38 import { Config } from '~/common/config';
39 import { addRouteChangeHandlers } from './routes/route-change-handlers';
40 import { setCurrentTokenDialogApiHost } from '~/store/current-token-dialog/current-token-dialog-actions';
41 import { processResourceActionSet } from '~/views-components/context-menu/action-sets/process-resource-action-set';
42 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
43 import { setUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions';
44 import { trashedCollectionActionSet } from '~/views-components/context-menu/action-sets/trashed-collection-action-set';
45 import { ContainerRequestState } from '~/models/container-request';
46 import { MountKind } from '~/models/mount-types';
47 import { setBuildInfo } from '~/store/app-info/app-info-actions';
48 import { getBuildInfo } from '~/common/app-info';
49 import { DragDropContextProvider } from 'react-dnd';
50 import HTML5Backend from 'react-dnd-html5-backend';
51 import { initAdvanceFormProjectsTree } from '~/store/search-bar/search-bar-actions';
52 import { repositoryActionSet } from '~/views-components/context-menu/action-sets/repository-action-set';
53 import { sshKeyActionSet } from '~/views-components/context-menu/action-sets/ssh-key-action-set';
54 import { keepServiceActionSet } from '~/views-components/context-menu/action-sets/keep-service-action-set';
55 import { loadVocabulary } from '~/store/vocabulary/vocabulary-actions';
56 import { virtualMachineActionSet } from '~/views-components/context-menu/action-sets/virtual-machine-action-set';
57 import { userActionSet } from '~/views-components/context-menu/action-sets/user-action-set';
58 import { computeNodeActionSet } from '~/views-components/context-menu/action-sets/compute-node-action-set';
59 import { apiClientAuthorizationActionSet } from '~/views-components/context-menu/action-sets/api-client-authorization-action-set';
60 import { groupActionSet } from '~/views-components/context-menu/action-sets/group-action-set';
61 import { groupMemberActionSet } from '~/views-components/context-menu/action-sets/group-member-action-set';
62 import { linkActionSet } from '~/views-components/context-menu/action-sets/link-action-set';
63 import { loadFileViewersConfig } from '~/store/file-viewers/file-viewers-actions';
64
65 console.log(`Starting arvados [${getBuildInfo()}]`);
66
67 addMenuActionSet(ContextMenuKind.ROOT_PROJECT, rootProjectActionSet);
68 addMenuActionSet(ContextMenuKind.PROJECT, projectActionSet);
69 addMenuActionSet(ContextMenuKind.RESOURCE, resourceActionSet);
70 addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
71 addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
72 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
73 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
74 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
75 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
76 addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
77 addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
78 addMenuActionSet(ContextMenuKind.PROCESS_RESOURCE, processResourceActionSet);
79 addMenuActionSet(ContextMenuKind.TRASH, trashActionSet);
80 addMenuActionSet(ContextMenuKind.REPOSITORY, repositoryActionSet);
81 addMenuActionSet(ContextMenuKind.SSH_KEY, sshKeyActionSet);
82 addMenuActionSet(ContextMenuKind.VIRTUAL_MACHINE, virtualMachineActionSet);
83 addMenuActionSet(ContextMenuKind.KEEP_SERVICE, keepServiceActionSet);
84 addMenuActionSet(ContextMenuKind.USER, userActionSet);
85 addMenuActionSet(ContextMenuKind.LINK, linkActionSet);
86 addMenuActionSet(ContextMenuKind.NODE, computeNodeActionSet);
87 addMenuActionSet(ContextMenuKind.API_CLIENT_AUTHORIZATION, apiClientAuthorizationActionSet);
88 addMenuActionSet(ContextMenuKind.GROUPS, groupActionSet);
89 addMenuActionSet(ContextMenuKind.GROUP_MEMBER, groupMemberActionSet);
90
91 fetchConfig()
92     .then(({ config, apiHost }) => {
93         const history = createBrowserHistory();
94         const services = createServices(config, {
95             progressFn: (id, working) => {
96                 store.dispatch(progressIndicatorActions.TOGGLE_WORKING({ id, working }));
97             },
98             errorFn: (id, error) => {
99                 // console.error("Backend error:", error);
100                 // store.dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Backend error", kind: SnackbarKind.ERROR }));
101             }
102         });
103         const store = configureStore(history, services);
104
105         store.subscribe(initListener(history, store, services, config));
106         store.dispatch(initAuth(config));
107         store.dispatch(setBuildInfo());
108         store.dispatch(setCurrentTokenDialogApiHost(apiHost));
109         store.dispatch(loadVocabulary);
110         store.dispatch(loadFileViewersConfig);
111
112         const TokenComponent = (props: any) => <ApiToken authService={services.authService} config={config} {...props} />;
113         const MainPanelComponent = (props: any) => <MainPanel {...props} />;
114
115         const App = () =>
116             <MuiThemeProvider theme={CustomTheme}>
117                 <DragDropContextProvider backend={HTML5Backend}>
118                     <Provider store={store}>
119                         <ConnectedRouter history={history}>
120                             <Switch>
121                                 <Route path={Routes.TOKEN} component={TokenComponent} />
122                                 <Route path={Routes.ROOT} component={MainPanelComponent} />
123                             </Switch>
124                         </ConnectedRouter>
125                     </Provider>
126                 </DragDropContextProvider>
127             </MuiThemeProvider>;
128
129         ReactDOM.render(
130             <App />,
131             document.getElementById('root') as HTMLElement
132         );
133     });
134
135 const initListener = (history: History, store: RootStore, services: ServiceRepository, config: Config) => {
136     let initialized = false;
137     return async () => {
138         const { router, auth } = store.getState();
139         if (router.location && auth.user && !initialized) {
140             initialized = true;
141             initWebSocket(config, services.authService, store);
142             await store.dispatch(loadWorkbench());
143             addRouteChangeHandlers(history, store);
144             // ToDo: move to searchBar component
145             store.dispatch(initAdvanceFormProjectsTree());
146         }
147     };
148 };
149
150 const createDirectoriesArrayCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
151     workflowService.create({
152         name: 'Directories array collector',
153         description: 'Workflow for collecting directories array',
154         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"multiple_collections\":\n          $(inputs.multiple_collections)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type:\n      type: array\n      items: Directory\n    id: '#input_collector.cwl/multiple_collections'\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type:\n      type: array\n      items: Directory\n    label: Multiple Collections\n    doc: This should allow for selecting multiple collections.\n    id: '#main/multiple_collections'\n    default:\n    - class: Directory\n      location: keep:1e1682585d576f031b2d8b4944f989ee+57\n      basename: 1e1682585d576f031b2d8b4944f989ee+57\n    - class: Directory\n      location: keep:326f692370e9e121fcbd013796f7352a+57\n      basename: 326f692370e9e121fcbd013796f7352a+57\n  \n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/multiple_collections'\n      id: '#main/input_collector/multiple_collections'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
155     });
156 };
157
158 const createPrimitiveArraysCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
159     workflowService.create({
160         name: 'String, Int and Float arrays collector',
161         description: 'Workflow for collecting primitive data arrays',
162         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"string array\":\n          $(inputs.example_string_array)\n        \"int array\":\n          $(inputs.example_int_array)\n        \"float array\":\n          $(inputs.example_float_array)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type:\n      type: array\n      items: string\n    id: '#input_collector.cwl/example_string_array'\n  - type:\n      type: array\n      items: int\n    id: '#input_collector.cwl/example_int_array'\n  - type:\n      type: array\n      items: float\n    id: '#input_collector.cwl/example_float_array'\n  \n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type:\n      type: array\n      items: string\n    label: Freetext Array\n    doc: This should allow for entering multiple strings.\n    id: '#main/example_string_array'\n    default:\n    - This is the first string\n    - This is the second string\n  - type:\n      type: array\n      items: int\n    label: Integer Array\n    doc: This should allow for entering multiple integers.\n    id: '#main/example_int_array'\n    default:\n    - 3\n    - 6\n  - type:\n      type: array\n      items: float\n    label: Float Array\n    doc: This should allow for entering multiple floats.\n    id: '#main/example_float_array'\n    default:\n    - 3.33\n    - 66.6\n\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/example_string_array'\n      id: '#main/input_collector/example_string_array'\n    - source: '#main/example_int_array'\n      id: '#main/input_collector/example_int_array'\n    - source: '#main/example_float_array'\n      id: '#main/input_collector/example_float_array'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
163     });
164 };
165
166 const createFilesArrayCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
167     workflowService.create({
168         name: 'Files array collector',
169         description: 'Workflow for collecting files array',
170         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"multiple_files\":\n          $(inputs.multiple_files)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type:\n      type: array\n      items: File\n    id: '#input_collector.cwl/multiple_files'\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n\n  baseCommand: [cat]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type:\n      type: array\n      items: File\n    label: Multiple Files\n    doc: This should allow for selecting multiple files.\n    id: '#main/multiple_files'\n    default:\n      - class: File\n        location: keep:af831660d820bcbb98f473355e6e1b85+67/fileA\n        basename: fileA\n        nameroot: fileA\n        nameext: ''\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/multiple_files'\n      id: '#main/input_collector/multiple_files'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
171     });
172 };
173
174 const createPrimitivesCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
175     workflowService.create({
176         name: 'Primitive values collector',
177         description: 'Workflow for collecting primitive values',
178         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"flag\":\n          $(inputs.example_flag)\n        \"string\":\n          $(inputs.example_string)\n        \"int\":\n          $(inputs.example_int)\n        \"long\":\n          $(inputs.example_long)\n        \"float\":\n          $(inputs.example_float)\n        \"double\":\n          $(inputs.example_double)\n    class: InitialWorkDirRequirement\n  inputs:\n  - type: double\n    id: '#input_collector.cwl/example_double'\n  - type: boolean\n    id: '#input_collector.cwl/example_flag'\n  - type: float\n    id: '#input_collector.cwl/example_float'\n  - type: int\n    id: '#input_collector.cwl/example_int'\n  - type: long\n    id: '#input_collector.cwl/example_long'\n  - type: string\n    id: '#input_collector.cwl/example_string'\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: Workflw for collecting primitive values\n  inputs:\n  - type: double\n    label: Double value\n    doc: This should allow for entering a decimal number (64-bit).\n    id: '#main/example_double'\n    default: 0.3333333333333333\n  - type: boolean\n    label: Boolean Flag\n    doc: This should render as in checkbox.\n    id: '#main/example_flag'\n    default: true\n  - type: float\n    label: Float value\n    doc: This should allow for entering a decimal number (32-bit).\n    id: '#main/example_float'\n    default: 0.15625\n  - type: int\n    label: Integer Number\n    doc: This should allow for entering a number (32-bit signed).\n    id: '#main/example_int'\n    default: 2147483647\n  - type: long\n    label: Long Number\n    doc: This should allow for entering a number (64-bit signed).\n    id: '#main/example_long'\n    default: 9223372036854775807\n  - type: string\n    label: Freetext\n    doc: This should allow for entering an arbitrary char sequence.\n    id: '#main/example_string'\n    default: This is a string\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/example_double'\n      id: '#main/input_collector/example_double'\n    - source: '#main/example_flag'\n      id: '#main/input_collector/example_flag'\n    - source: '#main/example_float'\n      id: '#main/input_collector/example_float'\n    - source: '#main/example_int'\n      id: '#main/input_collector/example_int'\n    - source: '#main/example_long'\n      id: '#main/input_collector/example_long'\n    - source: '#main/example_string'\n      id: '#main/input_collector/example_string'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
179     });
180 };
181
182 const createEnumCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
183     workflowService.create({
184         name: 'Enum values collector',
185         description: 'Workflow for collecting enum values',
186         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"enum_type\":\n          $(inputs.enum_type)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type:\n      type: enum\n      symbols: ['#input_collector.cwl/enum_type/OTU table', '#input_collector.cwl/enum_type/Pathway\n          table', '#input_collector.cwl/enum_type/Function table', '#input_collector.cwl/enum_type/Ortholog\n          table']\n    id: '#input_collector.cwl/enum_type'\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type:\n      type: enum\n      symbols: ['#main/enum_type/OTU table', '#main/enum_type/Pathway table', '#main/enum_type/Function\n          table', '#main/enum_type/Ortholog table']\n      name: '#enum_typef4179c7f-45f9-482d-a5db-1abb86698384'\n    label: Enumeration Type\n    doc: This should render as a drop-down menu.\n    id: '#main/enum_type'\n    default: OTU table\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/enum_type'\n      id: '#main/input_collector/enum_type'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
187     });
188 };
189
190 const createFilesCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
191     workflowService.create({
192         name: 'File values collector',
193         description: 'Workflow for collecting file values',
194         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"single_file\":\n          $(inputs.single_file.basename)\n        \"optional_file\":\n          $(inputs.optional_file.basename)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type:\n    - 'null'\n    - File\n    id: '#input_collector.cwl/optional_file'\n  - type:\n    - 'null'\n    - File\n    id: '#input_collector.cwl/optional_file_missing_label'\n  - type: File\n    id: '#input_collector.cwl/single_file'\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type:\n    - 'null'\n    - File\n    label: Single File (Optional)\n    doc: This should allow for single File selection only. Input should be marked\n      as optional and not enforced by form validation.\n    id: '#main/optional_file'\n    default:\n      class: File\n      location: keep:af831660d820bcbb98f473355e6e1b85+67/fileA\n      basename: fileA\n      nameroot: fileA\n      nameext: ''\n  - type:\n    - 'null'\n    - File\n    doc: Label should be the input field name because of missing label.\n    id: '#main/optional_file_missing_label'\n  - type: File\n    label: Single File\n    doc: This should allow for single File selection only.\n    id: '#main/single_file'\n    default:\n      class: File\n      location: keep:af831660d820bcbb98f473355e6e1b85+67/fileA\n      basename: fileA\n      nameroot: fileA\n      nameext: ''\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/optional_file'\n      id: '#main/input_collector/optional_file'\n    - source: '#main/single_file'\n      id: '#main/input_collector/single_file'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
195     });
196 };
197
198 const createCollectionCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
199     workflowService.create({
200         name: 'Collection value collector',
201         description: 'Workflow for collecting a collecion',
202         definition: "cwlVersion: v1.0\n$graph:\n- class: CommandLineTool\n\n  requirements:\n  - listing:\n    - entryname: input_collector.log\n      entry: |\n        \"collection\":\n          $(inputs.collection.location)\n\n    class: InitialWorkDirRequirement\n  inputs:\n  - type: Directory\n    id: '#input_collector.cwl/collection'\n\n  outputs:\n  - type: File\n    outputBinding:\n      glob: '*'\n    id: '#input_collector.cwl/output'\n\n  baseCommand: [echo]\n  id: '#input_collector.cwl'\n- class: Workflow\n  doc: This is the description of the workflow\n  inputs:\n  - type: Directory\n    label: Single Collection\n    doc: This should allow for single Collection selection only.\n    id: '#main/collection'\n    default:\n      class: Directory\n      location: keep:af831660d820bcbb98f473355e6e1b85+67\n      basename: af831660d820bcbb98f473355e6e1b85+67\n  outputs:\n  - type: File\n    outputSource: '#main/input_collector/output'\n\n    id: '#main/log_file'\n  steps:\n  - run: '#input_collector.cwl'\n    in:\n    - source: '#main/collection'\n      id: '#main/input_collector/collection'\n    out: ['#main/input_collector/output']\n    id: '#main/input_collector'\n  id: '#main'\n",
203     });
204 };
205
206 const createSampleProcess = ({ containerRequestService }: ServiceRepository) => {
207     containerRequestService.create({
208         ownerUuid: 'c97qk-j7d0g-s3ngc1z0748hsmf',
209         name: 'Simple process 7',
210         state: ContainerRequestState.COMMITTED,
211         mounts: {
212             '/var/spool/cwl': {
213                 kind: MountKind.COLLECTION,
214                 writable: true,
215             },
216             'stdout': {
217                 kind: MountKind.MOUNTED_FILE,
218                 path: '/var/spool/cwl/cwl.output.json'
219             },
220             '/var/lib/cwl/workflow.json': {
221                 kind: MountKind.JSON,
222                 content: {
223                     "cwlVersion": "v1.0",
224                     "$graph": [
225                         {
226                             "class": "CommandLineTool",
227                             "requirements": [
228                                 {
229                                     "listing": [
230                                         {
231                                             "entryname": "input_collector.log",
232                                             "entry": "$(inputs.single_file.basename)\n"
233                                         }
234                                     ],
235                                     "class": "InitialWorkDirRequirement"
236                                 }
237                             ],
238                             "inputs": [
239                                 {
240                                     "type": "File",
241                                     "id": "#input_collector.cwl/single_file"
242                                 }
243                             ],
244                             "outputs": [
245                                 {
246                                     "type": "File",
247                                     "outputBinding": {
248                                         "glob": "*"
249                                     },
250                                     "id": "#input_collector.cwl/output"
251                                 }
252                             ],
253                             "baseCommand": [
254                                 "echo"
255                             ],
256                             "id": "#input_collector.cwl"
257                         },
258                         {
259                             "class": "Workflow",
260                             "doc": "This is the description of the workflow",
261                             "inputs": [
262                                 {
263                                     "type": "File",
264                                     "label": "Single File",
265                                     "doc": "This should allow for single File selection only.",
266                                     "id": "#main/single_file"
267                                 }
268                             ],
269                             "outputs": [
270                                 {
271                                     "type": "File",
272                                     "outputSource": "#main/input_collector/output",
273                                     "id": "#main/log_file"
274                                 }
275                             ],
276                             "steps": [
277                                 {
278                                     "run": "#input_collector.cwl",
279                                     "in": [
280                                         {
281                                             "source": "#main/single_file",
282                                             "id": "#main/input_collector/single_file"
283                                         }
284                                     ],
285                                     "out": [
286                                         "#main/input_collector/output"
287                                     ],
288                                     "id": "#main/input_collector"
289                                 }
290                             ],
291                             "id": "#main"
292                         }
293                     ]
294                 },
295             },
296             '/var/lib/cwl/cwl.input.json': {
297                 kind: MountKind.JSON,
298                 content: {
299                     "single_file": {
300                         "class": "File",
301                         "location": "keep:233454526794c0a2d56a305baeff3d30+145/1.txt",
302                         "basename": "fileA"
303                     }
304                 },
305             }
306         },
307         runtimeConstraints: {
308             API: true,
309             vcpus: 1,
310             ram: 1073741824,
311         },
312         containerImage: 'arvados/jobs:1.1.4.20180618144723',
313         cwd: '/var/spool/cwl',
314         command: [
315             'arvados-cwl-runner',
316             '--local',
317             '--api=containers',
318             "--project-uuid=c97qk-j7d0g-s3ngc1z0748hsmf",
319             '/var/lib/cwl/workflow.json#main',
320             '/var/lib/cwl/cwl.input.json'
321         ],
322         outputPath: '/var/spool/cwl',
323         priority: 1,
324     });
325 };
326
327 // force build comment #1