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