[ARVADOS-WORKBENCH2] updated: 1.2.0-1013-g8eb3dc9

Git user git at public.curoverse.com
Tue Nov 27 17:59:14 EST 2018


Summary of changes:
 .../project-properties-form.tsx                    |  96 ++-----------------
 .../property-key-field.tsx                         |   6 +-
 .../property-value-field.tsx                       |  13 ++-
 .../resource-properties-form.tsx                   |  29 ++++++
 src/views/collection-panel/collection-tag-form.tsx | 105 ++-------------------
 5 files changed, 59 insertions(+), 190 deletions(-)
 create mode 100644 src/views-components/resource-properties-form/resource-properties-form.tsx

       via  8eb3dc9fe8b8ed991b439885f874d5cb5dc1ecd1 (commit)
       via  e039a6f51ca398dae75a76cf2817b3f91bc0c1a6 (commit)
       via  6fbf6c43b2f7e1f8770cbcd245cbffc7ce0715be (commit)
       via  366a714c6d51fae8905c50d960555b4707305f42 (commit)
       via  6453a6063ff9745b4d78552ecc083f38c8fde2a4 (commit)
       via  850f82dacf3797236f8242cc50dddd250b904d2d (commit)
       via  4aaaf7498df9cbcef8a8123db8a234b741a8745f (commit)
      from  81546d30cd19cd98939e56e1b01b5c9684941f98 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 8eb3dc9fe8b8ed991b439885f874d5cb5dc1ecd1
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:56:53 2018 +0100

    Unwrap ResourcePropertiesForm
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/resource-properties-form/resource-properties-form.tsx b/src/views-components/resource-properties-form/resource-properties-form.tsx
index 2f3e0cd..df9ff84 100644
--- a/src/views-components/resource-properties-form/resource-properties-form.tsx
+++ b/src/views-components/resource-properties-form/resource-properties-form.tsx
@@ -13,18 +13,17 @@ export interface ResourcePropertiesFormData {
     [PROPERTY_VALUE_FIELD_NAME]: string;
 }
 
-export const ResourcePropertiesForm = reduxForm({ form: 'rpform' })(
-    ({ handleSubmit }: InjectedFormProps) =>
-        <form onSubmit={handleSubmit}>
-            <Grid container spacing={16}>
-                <Grid item xs>
-                    <PropertyKeyField />
-                </Grid>
-                <Grid item xs>
-                    <PropertyValueField />
-                </Grid>
-                <Grid item xs>
-                    <Button variant='contained'>Add</Button>
-                </Grid>
+export const ResourcePropertiesForm = ({ handleSubmit }: InjectedFormProps<ResourcePropertiesFormData>) =>
+    <form onSubmit={handleSubmit}>
+        <Grid container spacing={16}>
+            <Grid item xs>
+                <PropertyKeyField />
             </Grid>
-        </form>);
+            <Grid item xs>
+                <PropertyValueField />
+            </Grid>
+            <Grid item xs>
+                <Button variant='contained' type='submit'>Add</Button>
+            </Grid>
+        </Grid>
+    </form>;

commit e039a6f51ca398dae75a76cf2817b3f91bc0c1a6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:56:03 2018 +0100

    Reuse ResourcePropertiesForm as ProjectPropertiesForm
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/project-properties-dialog/project-properties-form.tsx b/src/views-components/project-properties-dialog/project-properties-form.tsx
index 82ae040..bd72bcf 100644
--- a/src/views-components/project-properties-dialog/project-properties-form.tsx
+++ b/src/views-components/project-properties-dialog/project-properties-form.tsx
@@ -2,94 +2,14 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { reduxForm, Field, reset } from 'redux-form';
-import { compose, Dispatch } from 'redux';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress } from '@material-ui/core';
-import { TagProperty } from '~/models/tag';
-import { TextField } from '~/components/text-field/text-field';
-import { TAG_VALUE_VALIDATION, TAG_KEY_VALIDATION } from '~/validators/validators';
+import { reduxForm, reset } from 'redux-form';
 import { PROJECT_PROPERTIES_FORM_NAME, createProjectProperty } from '~/store/details-panel/details-panel-action';
+import { ResourcePropertiesForm, ResourcePropertiesFormData } from '~/views-components/resource-properties-form/resource-properties-form';
 
-type CssRules = 'root' | 'keyField' | 'valueField' | 'buttonWrapper' | 'saveButton' | 'circularProgress';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {
-        width: '100%',
-        display: 'flex'
-    },
-    keyField: {
-        width: '40%',
-        marginRight: theme.spacing.unit * 3
-    },
-    valueField: {
-        width: '40%',
-        marginRight: theme.spacing.unit * 3
-    },
-    buttonWrapper: {
-        paddingTop: '14px',
-        position: 'relative',
-    },
-    saveButton: {
-        boxShadow: 'none'
-    },
-    circularProgress: {
-        position: 'absolute',
-        top: -9,
-        bottom: 0,
-        left: 0,
-        right: 0,
-        margin: 'auto'
+export const ProjectPropertiesForm = reduxForm<ResourcePropertiesFormData>({
+    form: PROJECT_PROPERTIES_FORM_NAME,
+    onSubmit: (data, dispatch) => {
+        dispatch<any>(createProjectProperty(data));
+        dispatch(reset(PROJECT_PROPERTIES_FORM_NAME));
     }
-});
-
-interface ProjectPropertiesFormDataProps {
-    submitting: boolean;
-    invalid: boolean;
-    pristine: boolean;
-}
-
-interface ProjectPropertiesFormActionProps {
-    handleSubmit: any;
-}
-
-type ProjectPropertiesFormProps = ProjectPropertiesFormDataProps & ProjectPropertiesFormActionProps & WithStyles<CssRules>;
-
-export const ProjectPropertiesForm = compose(
-    reduxForm({
-        form: PROJECT_PROPERTIES_FORM_NAME,
-        onSubmit: (data: TagProperty, dispatch: Dispatch) => {
-            dispatch<any>(createProjectProperty(data));
-            dispatch(reset(PROJECT_PROPERTIES_FORM_NAME));
-        }
-    }),
-    withStyles(styles))(
-        ({ classes, submitting, pristine, invalid, handleSubmit }: ProjectPropertiesFormProps) => 
-            <form onSubmit={handleSubmit} className={classes.root}>
-                <div className={classes.keyField}>
-                    <Field name="key"
-                        disabled={submitting}
-                        component={TextField}
-                        validate={TAG_KEY_VALIDATION}
-                        label="Key" />
-                </div>
-                <div className={classes.valueField}>
-                    <Field name="value"
-                        disabled={submitting}
-                        component={TextField}
-                        validate={TAG_VALUE_VALIDATION}
-                        label="Value" />
-                </div>
-                <div className={classes.buttonWrapper}>
-                    <Button type="submit" className={classes.saveButton}
-                        color="primary"
-                        size='small'
-                        disabled={invalid || submitting || pristine}
-                        variant="contained">
-                        ADD
-                    </Button>
-                    {submitting && <CircularProgress size={20} className={classes.circularProgress} />}
-                </div>
-            </form>
-        );
+})(ResourcePropertiesForm);

commit 6fbf6c43b2f7e1f8770cbcd245cbffc7ce0715be
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:54:45 2018 +0100

    Reuse ResourcePropertiesForm as CollectionTagForm
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/collection-panel/collection-tag-form.tsx b/src/views/collection-panel/collection-tag-form.tsx
index 9aa8812..04e37f2 100644
--- a/src/views/collection-panel/collection-tag-form.tsx
+++ b/src/views/collection-panel/collection-tag-form.tsx
@@ -2,103 +2,14 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { reduxForm, Field, reset } from 'redux-form';
-import { compose, Dispatch } from 'redux';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress, Grid, Typography } from '@material-ui/core';
-import { TagProperty } from '~/models/tag';
-import { TextField } from '~/components/text-field/text-field';
+import { reduxForm, reset } from 'redux-form';
 import { createCollectionTag, COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
-import { TAG_VALUE_VALIDATION, TAG_KEY_VALIDATION } from '~/validators/validators';
+import { ResourcePropertiesForm, ResourcePropertiesFormData } from '~/views-components/resource-properties-form/resource-properties-form';
 
-type CssRules = 'root' | 'keyField' | 'valueField' | 'buttonWrapper' | 'saveButton' | 'circularProgress';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {
-        width: '100%',
-        display: 'flex'
-    },
-    keyField: {
-        width: '25%',
-        marginRight: theme.spacing.unit * 3
-    },
-    valueField: {
-        width: '40%',
-        marginRight: theme.spacing.unit * 3
-    },
-    buttonWrapper: {
-        paddingTop: '14px',
-        position: 'relative',
-    },
-    saveButton: {
-        boxShadow: 'none'
-    },
-    circularProgress: {
-        position: 'absolute',
-        top: -9,
-        bottom: 0,
-        left: 0,
-        right: 0,
-        margin: 'auto'
+export const CollectionTagForm = reduxForm<ResourcePropertiesFormData>({
+    form: COLLECTION_TAG_FORM_NAME,
+    onSubmit: (data, dispatch) => {
+        dispatch<any>(createCollectionTag(data));
+        dispatch(reset(COLLECTION_TAG_FORM_NAME));
     }
-});
-
-interface CollectionTagFormDataProps {
-    submitting: boolean;
-    invalid: boolean;
-    pristine: boolean;
-}
-
-interface CollectionTagFormActionProps {
-    handleSubmit: any;
-}
-
-type CollectionTagFormProps = CollectionTagFormDataProps & CollectionTagFormActionProps & WithStyles<CssRules>;
-
-export const CollectionTagForm = compose(
-    reduxForm({
-        form: COLLECTION_TAG_FORM_NAME,
-        onSubmit: (data: TagProperty, dispatch: Dispatch) => {
-            dispatch<any>(createCollectionTag(data));
-            dispatch(reset(COLLECTION_TAG_FORM_NAME));
-        }
-    }),
-    withStyles(styles))(
-
-        class CollectionTagForm extends React.Component<CollectionTagFormProps> {
-
-            render() {
-                const { classes, submitting, pristine, invalid, handleSubmit } = this.props;
-                return (
-                    <form onSubmit={handleSubmit} className={classes.root}>
-                        <div className={classes.keyField}>
-                            <Field name="key"
-                                disabled={submitting}
-                                component={TextField}
-                                validate={TAG_KEY_VALIDATION}
-                                label="Key" />
-                        </div>
-                        <div className={classes.valueField}>
-                            <Field name="value"
-                                disabled={submitting}
-                                component={TextField}
-                                validate={TAG_VALUE_VALIDATION}
-                                label="Value" />
-                        </div>
-                        <div className={classes.buttonWrapper}>
-                            <Button type="submit" className={classes.saveButton}
-                                color="primary"
-                                size='small'
-                                disabled={invalid || submitting || pristine}
-                                variant="contained">
-                                ADD
-                            </Button>
-                            {submitting && <CircularProgress size={20} className={classes.circularProgress} />}
-                        </div>
-                    </form>
-                );
-            }
-        }
-
-    );
+})(ResourcePropertiesForm);

commit 366a714c6d51fae8905c50d960555b4707305f42
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:27:32 2018 +0100

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

diff --git a/src/views-components/resource-properties-form/resource-properties-form.tsx b/src/views-components/resource-properties-form/resource-properties-form.tsx
new file mode 100644
index 0000000..2f3e0cd
--- /dev/null
+++ b/src/views-components/resource-properties-form/resource-properties-form.tsx
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { InjectedFormProps, reduxForm } from 'redux-form';
+import { Grid, Button } from '@material-ui/core';
+import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME } from './property-key-field';
+import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME } from './property-value-field';
+
+export interface ResourcePropertiesFormData {
+    [PROPERTY_KEY_FIELD_NAME]: string;
+    [PROPERTY_VALUE_FIELD_NAME]: string;
+}
+
+export const ResourcePropertiesForm = reduxForm({ form: 'rpform' })(
+    ({ handleSubmit }: InjectedFormProps) =>
+        <form onSubmit={handleSubmit}>
+            <Grid container spacing={16}>
+                <Grid item xs>
+                    <PropertyKeyField />
+                </Grid>
+                <Grid item xs>
+                    <PropertyValueField />
+                </Grid>
+                <Grid item xs>
+                    <Button variant='contained'>Add</Button>
+                </Grid>
+            </Grid>
+        </form>);

commit 6453a6063ff9745b4d78552ecc083f38c8fde2a4
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:19:52 2018 +0100

    Extract PROPERTY_VALUE_FIELD_NAME
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/resource-properties-form/property-value-field.tsx b/src/views-components/resource-properties-form/property-value-field.tsx
index e73c66b..a9edc80 100644
--- a/src/views-components/resource-properties-form/property-value-field.tsx
+++ b/src/views-components/resource-properties-form/property-value-field.tsx
@@ -28,13 +28,15 @@ const mapStateToProps = (state: RootState): VocabularyProp => ({
     vocabulary: getVocabulary(state.properties),
 });
 
+export const PROPERTY_VALUE_FIELD_NAME = 'value';
+
 export const PropertyValueField = compose(
     connect(mapStateToProps),
     formValues({ propertyKey: PROPERTY_KEY_FIELD_NAME })
 )(
     (props: PropertyValueFieldProps) =>
         <Field
-            name='value'
+            name={PROPERTY_VALUE_FIELD_NAME}
             component={PropertyValueInput}
             validate={getValidation(props)}
             {...props} />);

commit 850f82dacf3797236f8242cc50dddd250b904d2d
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:12:38 2018 +0100

    Extract PROPERTY_KEY_FIELD_NAME to keep consistency between fields
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/resource-properties-form/property-key-field.tsx b/src/views-components/resource-properties-form/property-key-field.tsx
index fdd89d0..c5e1398 100644
--- a/src/views-components/resource-properties-form/property-key-field.tsx
+++ b/src/views-components/resource-properties-form/property-key-field.tsx
@@ -20,10 +20,12 @@ const mapStateToProps = (state: RootState): VocabularyProp => ({
     vocabulary: getVocabulary(state.properties),
 });
 
+export const PROPERTY_KEY_FIELD_NAME = 'key';
+
 export const PropertyKeyField = connect(mapStateToProps)(
     ({ vocabulary }: VocabularyProp) =>
         <Field
-            name='key'
+            name={PROPERTY_KEY_FIELD_NAME}
             component={PropertyKeyInput}
             vocabulary={vocabulary}
             validate={getValidation(vocabulary)} />);
@@ -53,7 +55,7 @@ const matchTags = (vocabulary: Vocabulary) =>
             ? undefined
             : 'Incorrect key';
 
-const getSuggestions = (value: string, vocabulary: Vocabulary) => 
+const getSuggestions = (value: string, vocabulary: Vocabulary) =>
     getTagsList(vocabulary).filter(tag => tag.includes(value) && tag !== value);
 
 const getTagsList = ({ tags }: Vocabulary) =>
diff --git a/src/views-components/resource-properties-form/property-value-field.tsx b/src/views-components/resource-properties-form/property-value-field.tsx
index 8574e60..e73c66b 100644
--- a/src/views-components/resource-properties-form/property-value-field.tsx
+++ b/src/views-components/resource-properties-form/property-value-field.tsx
@@ -12,6 +12,7 @@ import { getVocabulary } from '~/store/vocabulary/vocabulary-selctors';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
 import { Vocabulary } from '~/models/vocabulary';
 import { require } from '~/validators/require';
+import { PROPERTY_KEY_FIELD_NAME } from '~/views-components/resource-properties-form/property-key-field';
 
 interface VocabularyProp {
     vocabulary: Vocabulary;
@@ -29,7 +30,7 @@ const mapStateToProps = (state: RootState): VocabularyProp => ({
 
 export const PropertyValueField = compose(
     connect(mapStateToProps),
-    formValues({ propertyKey: 'key' })
+    formValues({ propertyKey: PROPERTY_KEY_FIELD_NAME })
 )(
     (props: PropertyValueFieldProps) =>
         <Field

commit 4aaaf7498df9cbcef8a8123db8a234b741a8745f
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 23:08:43 2018 +0100

    Use formValues to access property key value
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/resource-properties-form/property-value-field.tsx b/src/views-components/resource-properties-form/property-value-field.tsx
index eed8e75..8574e60 100644
--- a/src/views-components/resource-properties-form/property-value-field.tsx
+++ b/src/views-components/resource-properties-form/property-value-field.tsx
@@ -3,9 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { WrappedFieldProps, Field } from 'redux-form';
+import { WrappedFieldProps, Field, formValues } from 'redux-form';
 import { connect } from 'react-redux';
 import { identity } from 'lodash';
+import { compose } from 'redux';
 import { RootState } from '~/store/store';
 import { getVocabulary } from '~/store/vocabulary/vocabulary-selctors';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
@@ -26,7 +27,10 @@ const mapStateToProps = (state: RootState): VocabularyProp => ({
     vocabulary: getVocabulary(state.properties),
 });
 
-export const PropertyValueField = connect(mapStateToProps)(
+export const PropertyValueField = compose(
+    connect(mapStateToProps),
+    formValues({ propertyKey: 'key' })
+)(
     (props: PropertyValueFieldProps) =>
         <Field
             name='value'

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list