[arvados-workbench2] created: 2.4.0-120-g6c42bd0c

git repository hosting git at public.arvados.org
Mon Jun 13 19:45:30 UTC 2022


        at  6c42bd0ca04911ece6403af74852a1e34d483c8f (commit)


commit 6c42bd0ca04911ece6403af74852a1e34d483c8f
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Mon Jun 13 21:43:26 2022 +0200

    18203: Added test for multiple properties creation
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js
index 0017e416..7371ed06 100644
--- a/cypress/integration/project.spec.js
+++ b/cypress/integration/project.spec.js
@@ -28,7 +28,7 @@ describe('Project tests', function() {
         cy.clearLocalStorage();
     });
 
-    it('creates a new project with properties', function() {
+    it('creates a new project with multiple properties', function() {
         const projName = `Test project (${Math.floor(999999 * Math.random())})`;
         cy.loginAs(activeUser);
         cy.get('[data-cy=side-panel-button]').click();
@@ -51,9 +51,26 @@ describe('Project tests', function() {
                 cy.get('input').type('Magenta');
             });
             cy.root().submit();
+            cy.get('[data-cy=property-field-value]').within(() => {
+                cy.get('input').type('Pink');
+            });
+            cy.root().submit();
+            cy.get('[data-cy=property-field-value]').within(() => {
+                cy.get('input').type('Yellow');
+            });
+            cy.root().submit();
         });
         // Confirm proper vocabulary labels are displayed on the UI.
         cy.get('[data-cy=form-dialog]').should('contain', 'Color: Magenta');
+        cy.get('[data-cy=form-dialog]').should('contain', 'Color: Pink');
+        cy.get('[data-cy=form-dialog]').should('contain', 'Color: Yellow');
+
+        cy.get('[data-cy=resource-properties-form]').within(() => {
+            cy.get('[data-cy=property-field-key]').within(() => {
+                cy.get('input').focus();
+            });
+            cy.get('[data-cy=property-field-key]').should('not.contain', 'Color');
+        });
 
         // Create project and confirm the properties' real values.
         cy.get('[data-cy=form-submit-btn]').click();

commit 4c0099ec3509061ca3f507658689bf3bba77e5ea
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Mon Jun 13 20:41:19 2022 +0200

    18203: added support for adding multi properties at once
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js
index 0b06e53e..384b789f 100644
--- a/cypress/integration/collection.spec.js
+++ b/cypress/integration/collection.spec.js
@@ -418,6 +418,20 @@ describe('Collection panel tests', function () {
             });
     });
 
+    it('shows collection owner', () => {
+        cy.createCollection(adminUser.token, {
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+            owner_uuid: activeUser.user.uuid,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        })
+            .as('testCollection').then((testCollection) => {
+                cy.loginAs(activeUser);
+                cy.goToPath(`/collections/${testCollection.uuid}`);
+                cy.wait(5000);
+                cy.get('[data-cy=collection-info-panel]').contains(`Collection User`);
+            });
+    });
+
     it('tries to rename a file with illegal names', function () {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
diff --git a/src/views-components/collection-properties/create-collection-properties-form.tsx b/src/views-components/collection-properties/create-collection-properties-form.tsx
index 3f19e158..fb18bb1a 100644
--- a/src/views-components/collection-properties/create-collection-properties-form.tsx
+++ b/src/views-components/collection-properties/create-collection-properties-form.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { reduxForm, reset } from 'redux-form';
+import { reduxForm, change } from 'redux-form';
 import { withStyles } from '@material-ui/core';
 import {
     COLLECTION_CREATE_PROPERTIES_FORM_NAME,
@@ -13,6 +13,7 @@ import {
     ResourcePropertiesFormData
 } from 'views-components/resource-properties-form/resource-properties-form';
 import { addPropertyToResourceForm } from 'store/resources/resources-actions';
+import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
 
 const Form = withStyles(
     ({ spacing }) => (
@@ -27,6 +28,6 @@ export const CreateCollectionPropertiesForm = reduxForm<ResourcePropertiesFormDa
     form: COLLECTION_CREATE_PROPERTIES_FORM_NAME,
     onSubmit: (data, dispatch) => {
         dispatch(addPropertyToResourceForm(data, COLLECTION_CREATE_FORM_NAME));
-        dispatch(reset(COLLECTION_CREATE_PROPERTIES_FORM_NAME));
+        dispatch(change(COLLECTION_CREATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
     }
 })(Form);
\ No newline at end of file
diff --git a/src/views-components/collection-properties/update-collection-properties-form.tsx b/src/views-components/collection-properties/update-collection-properties-form.tsx
index 9092c7cc..3ab425f1 100644
--- a/src/views-components/collection-properties/update-collection-properties-form.tsx
+++ b/src/views-components/collection-properties/update-collection-properties-form.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { reduxForm, reset } from 'redux-form';
+import { reduxForm, change } from 'redux-form';
 import { withStyles } from '@material-ui/core';
 import {
     COLLECTION_UPDATE_FORM_NAME,
@@ -13,6 +13,7 @@ import {
     ResourcePropertiesFormData
 } from 'views-components/resource-properties-form/resource-properties-form';
 import { addPropertyToResourceForm } from 'store/resources/resources-actions';
+import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
 
 const Form = withStyles(
     ({ spacing }) => (
@@ -27,6 +28,6 @@ export const UpdateCollectionPropertiesForm = reduxForm<ResourcePropertiesFormDa
     form: COLLECTION_UPDATE_PROPERTIES_FORM_NAME,
     onSubmit: (data, dispatch) => {
         dispatch(addPropertyToResourceForm(data, COLLECTION_UPDATE_FORM_NAME));
-        dispatch(reset(COLLECTION_UPDATE_PROPERTIES_FORM_NAME));
+        dispatch(change(COLLECTION_UPDATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
     }
 })(Form);
\ No newline at end of file
diff --git a/src/views-components/project-properties/create-project-properties-form.tsx b/src/views-components/project-properties/create-project-properties-form.tsx
index 8c26523e..5a6d9df6 100644
--- a/src/views-components/project-properties/create-project-properties-form.tsx
+++ b/src/views-components/project-properties/create-project-properties-form.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { reduxForm, reset } from 'redux-form';
+import { reduxForm, change } from 'redux-form';
 import { withStyles } from '@material-ui/core';
 import {
     PROJECT_CREATE_PROPERTIES_FORM_NAME,
@@ -13,6 +13,7 @@ import {
     ResourcePropertiesFormData
 } from 'views-components/resource-properties-form/resource-properties-form';
 import { addPropertyToResourceForm } from 'store/resources/resources-actions';
+import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
 
 const Form = withStyles(
     ({ spacing }) => (
@@ -27,6 +28,6 @@ export const CreateProjectPropertiesForm = reduxForm<ResourcePropertiesFormData>
     form: PROJECT_CREATE_PROPERTIES_FORM_NAME,
     onSubmit: (data, dispatch) => {
         dispatch(addPropertyToResourceForm(data, PROJECT_CREATE_FORM_NAME));
-        dispatch(reset(PROJECT_CREATE_PROPERTIES_FORM_NAME));
+        dispatch(change(PROJECT_CREATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
     }
 })(Form);
\ No newline at end of file
diff --git a/src/views-components/project-properties/update-project-properties-form.tsx b/src/views-components/project-properties/update-project-properties-form.tsx
index 0b5554bc..9bce50ab 100644
--- a/src/views-components/project-properties/update-project-properties-form.tsx
+++ b/src/views-components/project-properties/update-project-properties-form.tsx
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { reduxForm, reset } from 'redux-form';
+import { reduxForm, change } from 'redux-form';
 import { withStyles } from '@material-ui/core';
 import {
     PROJECT_UPDATE_PROPERTIES_FORM_NAME,
@@ -13,6 +13,7 @@ import {
     ResourcePropertiesFormData
 } from 'views-components/resource-properties-form/resource-properties-form';
 import { addPropertyToResourceForm } from 'store/resources/resources-actions';
+import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
 
 const Form = withStyles(
     ({ spacing }) => (
@@ -27,6 +28,6 @@ export const UpdateProjectPropertiesForm = reduxForm<ResourcePropertiesFormData>
     form: PROJECT_UPDATE_PROPERTIES_FORM_NAME,
     onSubmit: (data, dispatch) => {
         dispatch(addPropertyToResourceForm(data, PROJECT_UPDATE_FORM_NAME));
-        dispatch(reset(PROJECT_UPDATE_PROPERTIES_FORM_NAME));
+        dispatch(change(PROJECT_UPDATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
     }
 })(Form);
\ No newline at end of file
diff --git a/src/views-components/resource-properties-form/property-field-common.tsx b/src/views-components/resource-properties-form/property-field-common.tsx
index c4dc494b..dad17284 100644
--- a/src/views-components/resource-properties-form/property-field-common.tsx
+++ b/src/views-components/resource-properties-form/property-field-common.tsx
@@ -14,6 +14,7 @@ export interface VocabularyProp {
 
 export interface ValidationProp {
     skipValidation?: boolean;
+    clearPropertyKeyOnSelect?: boolean;
 }
 
 export const mapStateToProps = (state: RootState, ownProps: ValidationProp): VocabularyProp & ValidationProp => ({
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 0be4527a..0b08ad6d 100644
--- a/src/views-components/resource-properties-form/property-key-field.tsx
+++ b/src/views-components/resource-properties-form/property-key-field.tsx
@@ -30,9 +30,10 @@ export const PROPERTY_KEY_FIELD_NAME = 'key';
 export const PROPERTY_KEY_FIELD_ID = 'keyID';
 
 export const PropertyKeyField = connectVocabulary(
-    ({ vocabulary, skipValidation }: VocabularyProp & ValidationProp) =>
+    ({ vocabulary, skipValidation, clearPropertyKeyOnSelect }: VocabularyProp & ValidationProp) =>
         <span data-cy='property-field-key'>
         <Field
+            clearPropertyKeyOnSelect
             name={PROPERTY_KEY_FIELD_NAME}
             component={PropertyKeyInput}
             vocabulary={vocabulary}
@@ -40,7 +41,7 @@ export const PropertyKeyField = connectVocabulary(
         </span>
 );
 
-const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
+const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp & { clearPropertyKeyOnSelect?: boolean }) =>
     <FormName children={data => (
         <Autocomplete
             {...buildProps(props)}
@@ -51,6 +52,11 @@ const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & Vocabula
                     ? `${s.label} (${s.synonyms.join('; ')})`
                     : s.label
             }
+            onFocus={() => {
+                if (props.clearPropertyKeyOnSelect && props.input.value) {
+                    props.meta.dispatch(reset(props.meta.form));
+                }
+            }}
             onSelect={handleSelect(PROPERTY_KEY_FIELD_ID, data.form, props.input, props.meta)}
             onBlur={() => {
                 // Case-insensitive search for the key in the vocabulary
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 979d772e..25d0f2bb 100644
--- a/src/views-components/resource-properties-form/resource-properties-form.tsx
+++ b/src/views-components/resource-properties-form/resource-properties-form.tsx
@@ -16,16 +16,17 @@ export interface ResourcePropertiesFormData {
     [PROPERTY_KEY_FIELD_ID]: string;
     [PROPERTY_VALUE_FIELD_NAME]: string;
     [PROPERTY_VALUE_FIELD_ID]: string;
+    clearPropertyKeyOnSelect?: boolean;
 }
 
-export type ResourcePropertiesFormProps = {uuid: string; } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string; }> & WithStyles<GridClassKey>;
+export type ResourcePropertiesFormProps = {uuid: string; clearPropertyKeyOnSelect?: boolean } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string; }> & WithStyles<GridClassKey>;
 
-export const ResourcePropertiesForm = ({ handleSubmit, change, submitting, invalid, classes, uuid }: ResourcePropertiesFormProps ) => {
+export const ResourcePropertiesForm = ({ handleSubmit, change, submitting, invalid, classes, uuid, clearPropertyKeyOnSelect }: ResourcePropertiesFormProps ) => {
     change('uuid', uuid); // Sets the uuid field to the uuid of the resource.
     return <form data-cy='resource-properties-form' onSubmit={handleSubmit}>
         <Grid container spacing={16} classes={classes}>
             <Grid item xs>
-                <PropertyKeyField />
+                <PropertyKeyField clearPropertyKeyOnSelect />
             </Grid>
             <Grid item xs>
                 <PropertyValueField />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list