[ARVADOS-WORKBENCH2] created: 1.3.0-82-g222a009

Git user git at public.curoverse.com
Fri Dec 7 12:38:16 EST 2018


        at  222a0099d2b8285b8770092f5da01314e0c7de7d (commit)


commit 222a0099d2b8285b8770092f5da01314e0c7de7d
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 18:37:38 2018 +0100

    Use selectPreset in RunProcessSecondStepForm
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/run-process-panel/run-process-second-step.tsx b/src/views/run-process-panel/run-process-second-step.tsx
index eb3615f..d547fba 100644
--- a/src/views/run-process-panel/run-process-second-step.tsx
+++ b/src/views/run-process-panel/run-process-second-step.tsx
@@ -14,7 +14,7 @@ import { RUN_PROCESS_INPUTS_FORM } from './run-process-inputs-form';
 import { RunProcessAdvancedForm } from './run-process-advanced-form';
 import { createSelector, createStructuredSelector } from 'reselect';
 import { WorkflowPresetSelect } from '~/views/run-process-panel/workflow-preset-select';
-import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
+import { selectPreset } from '~/store/run-process-panel/run-process-panel-actions';
 
 export interface RunProcessSecondStepFormDataProps {
     inputs: CommandInputParameter[];
@@ -54,7 +54,7 @@ const mapStateToProps = createStructuredSelector({
 });
 
 export type RunProcessSecondStepFormProps = RunProcessSecondStepFormDataProps & RunProcessSecondStepFormActionProps;
-export const RunProcessSecondStepForm = connect(mapStateToProps, { onPresetChange: runProcessPanelActions.SELECT_WORKFLOW_PRESET })(
+export const RunProcessSecondStepForm = connect(mapStateToProps, { onPresetChange: selectPreset })(
     ({ inputs, workflow, selectedPreset, presets, onPresetChange, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
         <Grid container spacing={16}>
             <Grid item xs={12}>

commit 4c3faee100f2d676bb18dc68f7cf1c4ac25ae50d
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 18:37:13 2018 +0100

    Create action that selects a preset and updates form values
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/run-process-panel/run-process-panel-actions.ts b/src/store/run-process-panel/run-process-panel-actions.ts
index 80094ca..c01cee2 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -6,8 +6,8 @@ import { Dispatch } from 'redux';
 import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { ServiceRepository } from "~/services/services";
 import { RootState } from '~/store/store';
-import { WorkflowResource } from '~/models/workflow';
-import { getFormValues } from 'redux-form';
+import { WorkflowResource, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
+import { getFormValues, initialize } from 'redux-form';
 import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from '~/views/run-process-panel/run-process-basic-form';
 import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
 import { WorkflowInputsData } from '~/models/workflow';
@@ -92,6 +92,16 @@ const loadPresets = (workflowUuid: string) =>
         dispatch(runProcessPanelActions.SET_WORKFLOW_PRESETS(items));
     };
 
+export const selectPreset = (preset: WorkflowResource) =>
+    (dispatch: Dispatch<any>, getState: () => RootState) => {
+        dispatch(runProcessPanelActions.SELECT_WORKFLOW_PRESET(preset));
+        const inputs = getWorkflowInputs(parseWorkflowDefinition(preset)) || [];
+        const values = inputs.reduce((values, input) => ({
+            ...values,
+            [input.id]: input.default,
+        }), {});
+        dispatch(initialize(RUN_PROCESS_INPUTS_FORM, values));
+    };
 
 export const goToStep = (step: number) =>
     (dispatch: Dispatch, getState: () => RootState) => {

commit 3fdf49aeaf054284ec59e18885e66f798777ada9
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 18:25:43 2018 +0100

    Add WorkflowPresetSelect to RunProcessSecondStepForm
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/run-process-panel/run-process-second-step.tsx b/src/views/run-process-panel/run-process-second-step.tsx
index 0b85638..eb3615f 100644
--- a/src/views/run-process-panel/run-process-second-step.tsx
+++ b/src/views/run-process-panel/run-process-second-step.tsx
@@ -6,24 +6,39 @@ import * as React from 'react';
 import { Grid, Button } from '@material-ui/core';
 import { RunProcessBasicForm, RUN_PROCESS_BASIC_FORM } from './run-process-basic-form';
 import { RunProcessInputsForm } from '~/views/run-process-panel/run-process-inputs-form';
-import { CommandInputParameter } from '~/models/workflow';
+import { CommandInputParameter, WorkflowResource } from '~/models/workflow';
 import { connect } from 'react-redux';
 import { RootState } from '~/store/store';
 import { isValid } from 'redux-form';
 import { RUN_PROCESS_INPUTS_FORM } from './run-process-inputs-form';
 import { RunProcessAdvancedForm } from './run-process-advanced-form';
 import { createSelector, createStructuredSelector } from 'reselect';
+import { WorkflowPresetSelect } from '~/views/run-process-panel/workflow-preset-select';
+import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
 
 export interface RunProcessSecondStepFormDataProps {
     inputs: CommandInputParameter[];
+    workflow?: WorkflowResource;
+    presets?: WorkflowResource[];
+    selectedPreset?: WorkflowResource;
     valid: boolean;
 }
 
 export interface RunProcessSecondStepFormActionProps {
     goBack: () => void;
     runProcess: () => void;
+    onPresetChange: (preset: WorkflowResource) => void;
 }
 
+const selectedWorkflowSelector = (state: RootState) =>
+    state.runProcessPanel.selectedWorkflow;
+
+const presetsSelector = (state: RootState) =>
+    state.runProcessPanel.presets;
+
+const selectedPresetSelector = (state: RootState) =>
+    state.runProcessPanel.selectedPreset;
+
 const inputsSelector = (state: RootState) =>
     state.runProcessPanel.inputs;
 
@@ -33,13 +48,22 @@ const validSelector = (state: RootState) =>
 const mapStateToProps = createStructuredSelector({
     inputs: inputsSelector,
     valid: validSelector,
+    workflow: selectedWorkflowSelector,
+    presets: presetsSelector,
+    selectedPreset: selectedPresetSelector,
 });
 
 export type RunProcessSecondStepFormProps = RunProcessSecondStepFormDataProps & RunProcessSecondStepFormActionProps;
-export const RunProcessSecondStepForm = connect(mapStateToProps)(
-    ({ inputs, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
+export const RunProcessSecondStepForm = connect(mapStateToProps, { onPresetChange: runProcessPanelActions.SELECT_WORKFLOW_PRESET })(
+    ({ inputs, workflow, selectedPreset, presets, onPresetChange, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
         <Grid container spacing={16}>
             <Grid item xs={12}>
+                <Grid item xs={6}>
+                    {workflow && selectedPreset && presets &&
+                        < WorkflowPresetSelect
+                            {...{ workflow, selectedPreset, presets, onChange: onPresetChange }} />
+                    }
+                </Grid>
                 <RunProcessBasicForm />
                 <RunProcessInputsForm inputs={inputs} />
                 <RunProcessAdvancedForm />

commit b8e9a146d964192cc2f0bdc95100644fa53f7ca6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 18:24:51 2018 +0100

    Create WorkflowPresetSelect
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/run-process-panel/workflow-preset-select.tsx b/src/views/run-process-panel/workflow-preset-select.tsx
new file mode 100644
index 0000000..46bdecd
--- /dev/null
+++ b/src/views/run-process-panel/workflow-preset-select.tsx
@@ -0,0 +1,70 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { Select, FormControl, InputLabel, MenuItem, Tooltip, Grid, withStyles, WithStyles } from '@material-ui/core';
+import { WorkflowResource } from '~/models/workflow';
+import { DetailsIcon } from '~/components/icon/icon';
+
+export interface WorkflowPresetSelectProps {
+    workflow: WorkflowResource;
+    selectedPreset: WorkflowResource;
+    presets: WorkflowResource[];
+    onChange: (preset: WorkflowResource) => void;
+}
+
+export class WorkflowPresetSelect extends React.Component<WorkflowPresetSelectProps> {
+
+    render() {
+
+        const { selectedPreset, workflow, presets } = this.props;
+
+        return (
+            <Grid container wrap='nowrap' spacing={32}>
+                <Grid item xs container>
+                    <Grid item xs>
+                        <FormControl fullWidth>
+                            <InputLabel htmlFor="age-simple">Preset</InputLabel>
+                            <Select
+                                value={selectedPreset.uuid}
+                                onChange={this.handleChange}>
+                                <MenuItem value={workflow.uuid}>
+                                    <em>Default</em>
+                                </MenuItem>
+                                {presets.map(
+                                    ({ uuid, name }) => <MenuItem key={uuid} value={uuid}>{name}</MenuItem>
+                                )}
+                            </Select>
+                        </FormControl>
+                    </Grid>
+                    <WorkflowPresetSelectInfo />
+                </Grid>
+            </Grid>
+        );
+    }
+
+    handleChange = ({ target }: React.ChangeEvent<HTMLSelectElement>) => {
+
+        const { workflow, presets, onChange } = this.props;
+
+        const selectedPreset = [workflow, ...presets]
+            .find(({ uuid }) => uuid === target.value);
+
+        if (selectedPreset) {
+            onChange(selectedPreset);
+        }
+    }
+}
+
+const WorkflowPresetSelectInfo = withStyles<'icon'>(theme => ({
+    icon: {
+        marginTop: 18,
+        marginLeft: 8,
+    },
+}))(
+    ({ classes }: WithStyles<'icon'>) =>
+        <Tooltip title='List of already defined set of inputs to run a workflow'>
+            <DetailsIcon className={classes.icon} />
+        </Tooltip>
+);

commit bf1d33cba4c15502866dda0ba4385d746033e773
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 18:00:04 2018 +0100

    Handle SELECT_WORKFLOW_PRESET action in reducer
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/run-process-panel/run-process-panel-reducer.ts b/src/store/run-process-panel/run-process-panel-reducer.ts
index 609816a..12c8988 100644
--- a/src/store/run-process-panel/run-process-panel-reducer.ts
+++ b/src/store/run-process-panel/run-process-panel-reducer.ts
@@ -13,6 +13,7 @@ interface RunProcessPanel {
     searchWorkflows: WorkflowResource[];
     selectedWorkflow: WorkflowResource | undefined;
     presets?: WorkflowResource[];
+    selectedPreset?: WorkflowResource;
     inputs: CommandInputParameter[];
 }
 
@@ -35,12 +36,17 @@ export const runProcessPanelReducer = (state = initialState, action: RunProcessP
             ...state,
             selectedWorkflow,
             presets: undefined,
+            selectedPreset: selectedWorkflow,
             inputs: getWorkflowInputs(parseWorkflowDefinition(selectedWorkflow)) || [],
         }),
         SET_WORKFLOW_PRESETS: presets => ({
             ...state,
             presets,
         }),
+        SELECT_WORKFLOW_PRESET: selectedPreset => ({
+            ...state,
+            selectedPreset,
+        }),
         SET_WORKFLOWS: workflows => ({ ...state, workflows, searchWorkflows: workflows }),
         SEARCH_WORKFLOWS: term => {
             const termRegex = new RegExp(term, 'i');

commit 6aadd480a93c6b1332cba0d3924362af11412e02
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 17:59:46 2018 +0100

    Create SELECT_WORKFLOW_PRESET action
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/run-process-panel/run-process-panel-actions.ts b/src/store/run-process-panel/run-process-panel-actions.ts
index 786deda..80094ca 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -26,6 +26,7 @@ export const runProcessPanelActions = unionize({
     SET_WORKFLOWS: ofType<WorkflowResource[]>(),
     SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
     SET_WORKFLOW_PRESETS: ofType<WorkflowResource[]>(),
+    SELECT_WORKFLOW_PRESET: ofType<WorkflowResource>(),
     SEARCH_WORKFLOWS: ofType<string>(),
     RESET_RUN_PROCESS_PANEL: ofType<{}>(),
 });
@@ -81,6 +82,7 @@ export const setWorkflow = (workflow: WorkflowResource, isWorkflowChanged = true
         }
         if (!isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
+            dispatch<any>(loadPresets(workflow.uuid));
         }
     };
 

commit 6f071fa34ec74d0ba035eb57e102307763d99496
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 16:23:39 2018 +0100

    Handle workflow presets loading in run-process-panel reducer
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/run-process-panel/run-process-panel-reducer.ts b/src/store/run-process-panel/run-process-panel-reducer.ts
index cb272de..609816a 100644
--- a/src/store/run-process-panel/run-process-panel-reducer.ts
+++ b/src/store/run-process-panel/run-process-panel-reducer.ts
@@ -12,6 +12,7 @@ interface RunProcessPanel {
     workflows: WorkflowResource[];
     searchWorkflows: WorkflowResource[];
     selectedWorkflow: WorkflowResource | undefined;
+    presets?: WorkflowResource[];
     inputs: CommandInputParameter[];
 }
 
@@ -33,8 +34,13 @@ export const runProcessPanelReducer = (state = initialState, action: RunProcessP
         SET_SELECTED_WORKFLOW: selectedWorkflow => ({
             ...state,
             selectedWorkflow,
+            presets: undefined,
             inputs: getWorkflowInputs(parseWorkflowDefinition(selectedWorkflow)) || [],
         }),
+        SET_WORKFLOW_PRESETS: presets => ({
+            ...state,
+            presets,
+        }),
         SET_WORKFLOWS: workflows => ({ ...state, workflows, searchWorkflows: workflows }),
         SEARCH_WORKFLOWS: term => {
             const termRegex = new RegExp(term, 'i');

commit f96eb4f60a314f2e5b0a21afd1ab836598d6c91f
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 16:23:10 2018 +0100

    Add presets actions to run-process-panel
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/run-process-panel/run-process-panel-actions.ts b/src/store/run-process-panel/run-process-panel-actions.ts
index f1d2d2f..786deda 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -25,6 +25,7 @@ export const runProcessPanelActions = unionize({
     SET_STEP_CHANGED: ofType<boolean>(),
     SET_WORKFLOWS: ofType<WorkflowResource[]>(),
     SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
+    SET_WORKFLOW_PRESETS: ofType<WorkflowResource[]>(),
     SEARCH_WORKFLOWS: ofType<string>(),
     RESET_RUN_PROCESS_PANEL: ofType<{}>(),
 });
@@ -76,12 +77,20 @@ export const setWorkflow = (workflow: WorkflowResource, isWorkflowChanged = true
         if (isStepChanged && isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_STEP_CHANGED(false));
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
+            dispatch<any>(loadPresets(workflow.uuid));
         }
         if (!isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
         }
     };
 
+const loadPresets = (workflowUuid: string) =>
+    async (dispatch: Dispatch<any>, _: () => RootState, { workflowService }: ServiceRepository) => {
+        const { items } = await workflowService.presets(workflowUuid);
+        dispatch(runProcessPanelActions.SET_WORKFLOW_PRESETS(items));
+    };
+
+
 export const goToStep = (step: number) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         if (step === 1) {

commit d366e025618106edb2419941a041cd0f4214b245
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Dec 7 15:27:43 2018 +0100

    Add presets method to WorkflowService
    
    Feature #14490
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/models/link.ts b/src/models/link.ts
index baaff65..c9e085b 100644
--- a/src/models/link.ts
+++ b/src/models/link.ts
@@ -17,4 +17,5 @@ export enum LinkClass {
     STAR = 'star',
     TAG = 'tag',
     PERMISSION = 'permission',
+    PRESET = 'preset',
 }
\ No newline at end of file
diff --git a/src/services/workflow-service/workflow-service.ts b/src/services/workflow-service/workflow-service.ts
index 57ad5fa..49fa4be 100644
--- a/src/services/workflow-service/workflow-service.ts
+++ b/src/services/workflow-service/workflow-service.ts
@@ -6,9 +6,39 @@ import { AxiosInstance } from "axios";
 import { CommonResourceService } from "~/services/common-service/common-resource-service";
 import { WorkflowResource } from '~/models/workflow';
 import { ApiActions } from '~/services/api/api-actions';
+import { LinkService } from '~/services/link-service/link-service';
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { LinkClass } from '~/models/link';
 
 export class WorkflowService extends CommonResourceService<WorkflowResource> {
+
+    private linksService = new LinkService(this.serverApi, this.actions);
+
     constructor(serverApi: AxiosInstance, actions: ApiActions) {
         super(serverApi, "workflows", actions);
     }
+
+    async presets(workflowUuid: string) {
+
+        const { items: presetLinks } = await this.linksService.list({
+
+            filters: new FilterBuilder()
+                .addEqual('tailUuid', workflowUuid)
+                .addEqual('linkClass', LinkClass.PRESET)
+                .getFilters()
+
+        });
+
+        const presetUuids = presetLinks.map(link => link.headUuid);
+
+        return this.list({
+
+            filters: new FilterBuilder()
+                .addIn('uuid', presetUuids)
+                .getFilters()
+
+        });
+
+    }
+
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list