X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2f39812f57c2acbc20a6292964b0a6b3512a9870..341b552800f6866fc3f73b4f6c1468425e485694:/src/index.tsx

diff --git a/src/index.tsx b/src/index.tsx
index 16533edab1..efe3a576df 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -7,7 +7,7 @@ import * as ReactDOM from 'react-dom';
 import { Provider } from "react-redux";
 import { MainPanel } from './views/main-panel/main-panel';
 import './index.css';
-import { Route } from 'react-router';
+import { Route, Switch } from 'react-router';
 import createBrowserHistory from "history/createBrowserHistory";
 import { History } from "history";
 import { configureStore, RootStore } from './store/store';
@@ -25,6 +25,7 @@ import { resourceActionSet } from './views-components/context-menu/action-sets/r
 import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set";
 import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set';
 import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set';
+import { collectionFilesNotSelectedActionSet } from './views-components/context-menu/action-sets/collection-files-not-selected-action-set';
 import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set';
 import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set';
 import { processActionSet } from './views-components/context-menu/action-sets/process-action-set';
@@ -42,23 +43,20 @@ import { setUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions';
 import { trashedCollectionActionSet } from '~/views-components/context-menu/action-sets/trashed-collection-action-set';
 import { ContainerRequestState } from '~/models/container-request';
 import { MountKind } from '~/models/mount-types';
-import { receiveTreePickerData } from '~/store/tree-picker/tree-picker-actions';
-import { loadProject, loadCollection } from './store/tree-picker/tree-picker-actions';
-import { ResourceKind } from '~/models/resource';
+import { setBuildInfo } from '~/store/app-info/app-info-actions';
+import { getBuildInfo } from '~/common/app-info';
+import { DragDropContextProvider } from 'react-dnd';
+import HTML5Backend from 'react-dnd-html5-backend';
+import { initAdvanceFormProjectsTree } from '~/store/search-bar/search-bar-actions';
 
-const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
-const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
-const getBuildInfo = () => getBuildNumber() + " / " + getGitCommit();
-
-const buildInfo = getBuildInfo();
-
-console.log(`Starting arvados [${buildInfo}]`);
+console.log(`Starting arvados [${getBuildInfo()}]`);
 
 addMenuActionSet(ContextMenuKind.ROOT_PROJECT, rootProjectActionSet);
 addMenuActionSet(ContextMenuKind.PROJECT, projectActionSet);
 addMenuActionSet(ContextMenuKind.RESOURCE, resourceActionSet);
 addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
+addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
@@ -83,22 +81,25 @@ fetchConfig()
 
         store.subscribe(initListener(history, store, services, config));
         store.dispatch(initAuth());
+        store.dispatch(setBuildInfo());
         store.dispatch(setCurrentTokenDialogApiHost(apiHost));
         store.dispatch(setUuidPrefix(config.uuidPrefix));
 
         const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props} />;
-        const MainPanelComponent = (props: any) => <MainPanel buildInfo={buildInfo} {...props} />;
+        const MainPanelComponent = (props: any) => <MainPanel {...props} />;
 
         const App = () =>
             <MuiThemeProvider theme={CustomTheme}>
-                <Provider store={store}>
-                    <ConnectedRouter history={history}>
-                        <div>
-                            <Route path={Routes.TOKEN} component={TokenComponent} />
-                            <Route path={Routes.ROOT} component={MainPanelComponent} />
-                        </div>
-                    </ConnectedRouter>
-                </Provider>
+                <DragDropContextProvider backend={HTML5Backend}>
+                    <Provider store={store}>
+                        <ConnectedRouter history={history}>
+                            <Switch>
+                                <Route path={Routes.TOKEN} component={TokenComponent} />
+                                <Route path={Routes.ROOT} component={MainPanelComponent} />
+                            </Switch>
+                        </ConnectedRouter>
+                    </Provider>
+                </DragDropContextProvider>
             </MuiThemeProvider>;
 
         ReactDOM.render(
@@ -116,26 +117,36 @@ const initListener = (history: History, store: RootStore, services: ServiceRepos
             initWebSocket(config, services.authService, store);
             await store.dispatch(loadWorkbench());
             addRouteChangeHandlers(history, store);
-            // createEnumCollectorWorkflow(services);
-            store.dispatch(receiveTreePickerData({
-                id: '',
-                pickerId: 'testPicker',
-                data: [{name: 'Projects', uuid: 'c97qk-tpzed-1k14sp44jonn0n3'}],
-                extractNodeData: value => ({id: value.uuid, value}),
-            }));
-            await store.dispatch(loadProject(
-                'c97qk-tpzed-1k14sp44jonn0n3',
-                'testPicker',
-                [ResourceKind.COLLECTION],
-            ));
-            await store.dispatch(loadCollection(
-                'c97qk-4zz18-9sn8ygaf62chkkd',
-                'testPicker',
-            ));
+            // ToDo: move to searchBar component
+            store.dispatch(initAdvanceFormProjectsTree());
         }
     };
 };
 
+const createDirectoriesArrayCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
+    workflowService.create({
+        name: 'Directories array collector',
+        description: 'Workflow for collecting directories array',
+        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",
+    });
+};
+
+const createPrimitiveArraysCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
+    workflowService.create({
+        name: 'String, Int and Float arrays collector',
+        description: 'Workflow for collecting primitive data arrays',
+        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",
+    });
+};
+
+const createFilesArrayCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
+    workflowService.create({
+        name: 'Files array collector',
+        description: 'Workflow for collecting files array',
+        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",
+    });
+};
+
 const createPrimitivesCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
     workflowService.create({
         name: 'Primitive values collector',
@@ -152,6 +163,22 @@ const createEnumCollectorWorkflow = ({ workflowService }: ServiceRepository) =>
     });
 };
 
+const createFilesCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
+    workflowService.create({
+        name: 'File values collector',
+        description: 'Workflow for collecting file values',
+        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",
+    });
+};
+
+const createCollectionCollectorWorkflow = ({ workflowService }: ServiceRepository) => {
+    workflowService.create({
+        name: 'Collection value collector',
+        description: 'Workflow for collecting a collecion',
+        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",
+    });
+};
+
 const createSampleProcess = ({ containerRequestService }: ServiceRepository) => {
     containerRequestService.create({
         ownerUuid: 'c97qk-j7d0g-s3ngc1z0748hsmf',
