[ARVADOS-WORKBENCH2] created: 1.2.0-493-g7bc4d3a

Git user git at public.curoverse.com
Tue Oct 2 05:18:52 EDT 2018


        at  7bc4d3ab2214ba252a8fdcfb64008ecc1cf50cfe (commit)


commit 7bc4d3ab2214ba252a8fdcfb64008ecc1cf50cfe
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Tue Oct 2 11:18:40 2018 +0200

    init search facility
    
    Feature #14271
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki 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 de18e70..3a3f6b0 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -12,6 +12,7 @@ export const runProcessPanelActions = unionize({
     SET_CURRENT_STEP: ofType<number>(),
     SET_WORKFLOWS: ofType<WorkflowResource[]>(),
     SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
+    SEARCH_WORKFLOWS: ofType<string>()
 });
 
 export interface RunProcessSecondStepDataFormProps {
@@ -38,4 +39,6 @@ export const setWorkflow = (workflow: WorkflowResource) =>
         dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
     };
 
-export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);
\ No newline at end of file
+export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);
+
+export const searchWorkflows = (term: string) => runProcessPanelActions.SEARCH_WORKFLOWS(term);
\ No newline at end of file
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 d51eeb1..10cdaeb 100644
--- a/src/store/run-process-panel/run-process-panel-reducer.ts
+++ b/src/store/run-process-panel/run-process-panel-reducer.ts
@@ -8,19 +8,22 @@ import { WorkflowResource } from '~/models/workflow';
 interface RunProcessPanel {
     currentStep: number;
     workflows: WorkflowResource[];
+    searchWorkflows: WorkflowResource[];
     selectedWorkflow: WorkflowResource | undefined;
 }
 
 const initialState: RunProcessPanel = {
     currentStep: 0,
     workflows: [],
+    searchWorkflows: [],
     selectedWorkflow: undefined
 };
 
 export const runProcessPanelReducer = (state = initialState, action: RunProcessPanelAction): RunProcessPanel =>
     runProcessPanelActions.match(action, {
         SET_CURRENT_STEP: currentStep => ({ ...state, currentStep }),
-        SET_WORKFLOWS: workflows => ({ ...state, workflows }), 
+        SET_WORKFLOWS: workflows => ({ ...state, workflows, searchWorkflows: workflows }), 
         SET_SELECTED_WORKFLOW: selectedWorkflow => ({ ...state, selectedWorkflow }),
+        SEARCH_WORKFLOWS: term => ({ ...state, searchWorkflows: state.workflows.filter(workflow => workflow.name.includes(term)) }),
         default: () => state
     });
\ No newline at end of file
diff --git a/src/views/run-process-panel/run-process-first-step.tsx b/src/views/run-process-panel/run-process-first-step.tsx
index ff7b2c3..fe93ef8 100644
--- a/src/views/run-process-panel/run-process-first-step.tsx
+++ b/src/views/run-process-panel/run-process-first-step.tsx
@@ -8,11 +8,18 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { WorkflowResource } from '~/models/workflow';
 import { WorkflowIcon } from '~/components/icon/icon';
 import { WorkflowDetailsCard } from '../workflow-panel/workflow-description-card';
+import { SearchInput } from '~/components/search-input/search-input';
 
-type CssRules = 'rightGrid' | 'list' | 'listItem' | 'itemSelected' | 'listItemText' | 'listItemIcon';
+type CssRules = 'root' | 'searchGrid' | 'workflowDetailsGrid' | 'list' | 'listItem' | 'itemSelected' | 'listItemText' | 'listItemIcon';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    rightGrid: {
+    root: {
+        alignSelf: 'flex-start'
+    },
+    searchGrid: {
+        marginBottom: theme.spacing.unit * 2
+    },
+    workflowDetailsGrid: {
         borderLeft: `1px solid ${theme.palette.grey["300"]}`
     },
     list: {
@@ -40,6 +47,7 @@ export interface RunProcessFirstStepDataProps {
 }
 
 export interface RunProcessFirstStepActionProps {
+    onSearch: (term: string) => void;
     onSetStep: (step: number) => void;
     onSetWorkflow: (workflow: WorkflowResource) => void;
 }
@@ -47,11 +55,11 @@ export interface RunProcessFirstStepActionProps {
 type RunProcessFirstStepProps = RunProcessFirstStepDataProps & RunProcessFirstStepActionProps & WithStyles<CssRules>;
 
 export const RunProcessFirstStep = withStyles(styles)(
-    ({ onSetStep, onSetWorkflow, workflows, selectedWorkflow, classes }: RunProcessFirstStepProps) =>
+    ({ onSearch, onSetStep, onSetWorkflow, workflows, selectedWorkflow, classes }: RunProcessFirstStepProps) =>
         <Grid container spacing={16}>
-            <Grid container item xs={6}>
-                <Grid item xs={12}>
-                    {/* TODO: add filters */}
+            <Grid container item xs={6} className={classes.root}>
+                <Grid item xs={12} className={classes.searchGrid}>
+                    <SearchInput value='' onSearch={onSearch} />
                 </Grid>
                 <Grid item xs={12}>
                     <List className={classes.list}>
@@ -69,7 +77,7 @@ export const RunProcessFirstStep = withStyles(styles)(
                     </List>
                 </Grid>
             </Grid>
-            <Grid item xs={6} className={classes.rightGrid}>
+            <Grid item xs={6} className={classes.workflowDetailsGrid}>
                 <WorkflowDetailsCard workflow={selectedWorkflow}/>
             </Grid>
             <Grid item xs={12}>
diff --git a/src/views/run-process-panel/run-process-panel-root.tsx b/src/views/run-process-panel/run-process-panel-root.tsx
index f399d96..b656ba1 100644
--- a/src/views/run-process-panel/run-process-panel-root.tsx
+++ b/src/views/run-process-panel/run-process-panel-root.tsx
@@ -15,7 +15,7 @@ export type RunProcessPanelRootActionProps = RunProcessFirstStepActionProps & Ru
 
 type RunProcessPanelRootProps = RunProcessPanelRootDataProps & RunProcessPanelRootActionProps;
 
-export const RunProcessPanelRoot = ({ currentStep, onSetStep, onRunProcess, onSetWorkflow, workflows, selectedWorkflow }: RunProcessPanelRootProps) =>
+export const RunProcessPanelRoot = ({ currentStep, onSearch, onSetStep, onRunProcess, onSetWorkflow, workflows, selectedWorkflow }: RunProcessPanelRootProps) =>
     <Stepper activeStep={currentStep} orientation="vertical" elevation={2}>
         <Step>
             <StepLabel>Choose a workflow</StepLabel>
@@ -23,6 +23,7 @@ export const RunProcessPanelRoot = ({ currentStep, onSetStep, onRunProcess, onSe
                 <RunProcessFirstStep 
                     workflows={workflows}
                     selectedWorkflow={selectedWorkflow}
+                    onSearch={onSearch}
                     onSetStep={onSetStep} 
                     onSetWorkflow={onSetWorkflow} />
             </StepContent>
diff --git a/src/views/run-process-panel/run-process-panel.tsx b/src/views/run-process-panel/run-process-panel.tsx
index f284ac7..1f43e05 100644
--- a/src/views/run-process-panel/run-process-panel.tsx
+++ b/src/views/run-process-panel/run-process-panel.tsx
@@ -6,12 +6,12 @@ import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
 import { RootState } from '~/store/store';
 import { RunProcessPanelRootDataProps, RunProcessPanelRootActionProps, RunProcessPanelRoot } from '~/views/run-process-panel/run-process-panel-root';
-import { goToStep, setWorkflow } from '~/store/run-process-panel/run-process-panel-actions';
+import { goToStep, setWorkflow, searchWorkflows } from '~/store/run-process-panel/run-process-panel-actions';
 import { WorkflowResource } from '~/models/workflow';
 
 const mapStateToProps = ({ runProcessPanel }: RootState): RunProcessPanelRootDataProps => {
     return {
-        workflows: runProcessPanel.workflows,
+        workflows: runProcessPanel.searchWorkflows,
         currentStep: runProcessPanel.currentStep,
         selectedWorkflow: runProcessPanel.selectedWorkflow
     };
@@ -26,6 +26,9 @@ const mapDispatchToProps = (dispatch: Dispatch): RunProcessPanelRootActionProps
     },
     onRunProcess: () => {
         
+    },
+    onSearch: (term: string) => {
+        dispatch<any>(searchWorkflows(term));
     }
 });
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list