[ARVADOS-WORKBENCH2] updated: 2.1.0-56-g6528692d

Git user git at public.arvados.org
Tue Nov 10 15:59:14 UTC 2020


Summary of changes:
 .licenseignore                                     |   1 +
 cypress/integration/collection-panel.spec.js       | 154 +++++++++++-----
 cypress/integration/favorites.js                   |   2 +-
 cypress/integration/login.spec.js                  |   6 +-
 cypress/integration/search.spec.js                 |  83 +++++++++
 cypress/support/commands.js                        |  18 ++
 src/common/formatters.ts                           |   2 +-
 src/common/webdav.ts                               |   2 +-
 src/common/xml.ts                                  |  13 +-
 .../details-attribute/details-attribute.tsx        |  27 +--
 src/components/file-tree/file-tree-item.tsx        |   6 +-
 src/components/form-dialog/form-dialog.tsx         |   1 +
 src/components/icon/icon.tsx                       |  11 ++
 src/index.tsx                                      |   2 -
 .../context-menu/context-menu-actions.test.ts      |   4 +-
 src/store/context-menu/context-menu-actions.ts     |  20 ++-
 .../open-in-new-tab/open-in-new-tab.actions.ts     |   5 +-
 .../action-sets/collection-action-set.ts           |   2 +-
 .../action-sets/collection-admin-action-set.ts     |  16 +-
 .../action-sets/collection-resource-action-set.ts  |  83 ---------
 .../collection-copy-to-clipboard-action.tsx        |   8 +-
 .../actions/collection-file-viewer-action.tsx      |   8 +-
 .../actions/copy-to-clipboard-action.tsx           |   2 +-
 .../actions/download-collection-file-action.tsx    |   4 +-
 src/views-components/context-menu/context-menu.tsx |   1 -
 .../details-panel/collection-details.tsx           |  18 +-
 .../search-bar/search-bar-view.tsx                 |   1 +
 src/views/collection-panel/collection-panel.tsx    | 196 ++++++++++++++-------
 .../search-results-panel-view.tsx                  |   4 +-
 tools/arvados_config.yml                           |   2 +
 30 files changed, 430 insertions(+), 272 deletions(-)
 create mode 100644 cypress/integration/search.spec.js
 delete mode 100644 src/views-components/context-menu/action-sets/collection-resource-action-set.ts

       via  6528692d3b49adaa03934fd059b8fec52c0bd0b1 (commit)
       via  90786154d588ebb341fc9e3cc8d4954a3c6f8794 (commit)
       via  df5bb74b46652b2e0a73a0e9ef2c09a63314e409 (commit)
       via  04721847d0d2d5607999df598aed355d3ae6c6bc (commit)
       via  9ee35a64c605f116aec71f78c65b54730d6e1076 (commit)
       via  7776b799eed223b9318443c1e319e01957a8fb45 (commit)
       via  5a835b3ba8d8db2cd1893f0e8278b31b670c3735 (commit)
       via  df575b1d4e26282571b25c1b362501cae62168ff (commit)
       via  3726a0a6797342beab45835c75c9840e64cf12ea (commit)
       via  8095c4a7852131043b682b809ed78ca65386dd30 (commit)
       via  bcb55ad2005ab4dc8c97624c1f56d410c36d15c2 (commit)
       via  fd44760652570645bb40ff9445bb5b9305a7fa1c (commit)
       via  fbaa1cdd31a8066e81a1114be2237ffdfdcbe910 (commit)
       via  d9b30910f8a81ab1c9c860a00ea6c3d580d42051 (commit)
       via  a9f2ce9838cf6a215cbc108073d033bc3811bdf5 (commit)
       via  b5c368012c8719fb1b5493dfed2443c4974d4f91 (commit)
       via  8df7e312b38b8e01bfac8c719b0f883cf866c2c8 (commit)
       via  8a5f805a21c44cd47b0b8b6d0b55e3f752f00a21 (commit)
       via  feeed01f85f60a8989b32ca463b7191d0ad9bb75 (commit)
       via  96626db04a7dcb11b21d92203a6ddd81577191bf (commit)
       via  8516425bd1c541476dc2d5cb00a762691cd753e1 (commit)
       via  7710b036f9a53ad87273b8b760ced5ee98a304fe (commit)
      from  3af60f74e1bb43c779d660bda187d780b677188e (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 6528692d3b49adaa03934fd059b8fec52c0bd0b1
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Nov 10 12:58:15 2020 -0300

    15685: Fixes file name encoding/decoding handling on webdav.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/common/webdav.ts b/src/common/webdav.ts
index b51cff30..c4d8acae 100644
--- a/src/common/webdav.ts
+++ b/src/common/webdav.ts
@@ -75,7 +75,7 @@ export class WebDAV {
             r.open(config.method,
                 `${this.defaults.baseURL
                     ? this.defaults.baseURL+'/'
-                    : ''}${config.url}`);
+                    : ''}${encodeURI(config.url)}`);
             const headers = { ...this.defaults.headers, ...config.headers };
             Object
                 .keys(headers)
diff --git a/src/common/xml.ts b/src/common/xml.ts
index 098f2781..3c6feb5d 100644
--- a/src/common/xml.ts
+++ b/src/common/xml.ts
@@ -4,5 +4,16 @@
 
 export const getTagValue = (document: Document | Element, tagName: string, defaultValue: string) => {
     const [el] = Array.from(document.getElementsByTagName(tagName));
-    return decodeURI(el ? el.innerHTML : defaultValue);
+    return decodeURI(el ? htmlDecode(el.innerHTML) : defaultValue);
+};
+
+const htmlDecode = (input: string) => {
+    const out = input.split(' ').map((i) => {
+        const doc = new DOMParser().parseFromString(i, "text/html");
+        if (doc.documentElement !== null) {
+            return doc.documentElement.textContent || '';
+        }
+        return '';
+    });
+    return out.join(' ');
 };

commit 90786154d588ebb341fc9e3cc8d4954a3c6f8794
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Nov 10 12:57:28 2020 -0300

    15685: Expands file renaming tests exposing some edge cases.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index 466d7433..f0c53f3c 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -128,7 +128,7 @@ describe('Collection panel tests', function() {
         })
     })
 
-    it('renames a file', function() {
+    it('renames a file using valid names', function() {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
         cy.createCollection(adminUser.token, {
@@ -138,24 +138,34 @@ describe('Collection panel tests', function() {
         .as('testCollection').then(function() {
             cy.loginAs(activeUser);
             cy.visit(`/collections/${this.testCollection.uuid}`);
-            cy.get('[data-cy=collection-files-panel]')
-                .contains('bar').rightclick();
-            cy.get('[data-cy=context-menu]')
-                .contains('Rename')
-                .click();
-            cy.get('[data-cy=form-dialog]')
-                .should('contain', 'Rename')
-                .within(() => {
-                    cy.get('input').type('{backspace}{backspace}{backspace}foo');
-                });
-            cy.get('[data-cy=form-submit-btn]').click();
-            cy.get('[data-cy=collection-files-panel]')
-                .should('not.contain', 'bar')
-                .and('contain', 'foo');
+            const nameTransitions = [
+                ['bar', '&'],
+                ['&', 'foo'],
+                ['foo', '&'],
+                ['&', 'I ❤️ ⛵️'],
+                ['I ❤️ ⛵️', ' baz'],
+                [' baz', ' '] // Must be the last case as cy.contains(' ') doesn't work
+            ];
+            nameTransitions.forEach(([from, to]) => {
+                cy.get('[data-cy=collection-files-panel]')
+                    .contains(`${from}`).rightclick();
+                cy.get('[data-cy=context-menu]')
+                    .contains('Rename')
+                    .click();
+                cy.get('[data-cy=form-dialog]')
+                    .should('contain', 'Rename')
+                    .within(() => {
+                        cy.get('input').type(`{selectall}{backspace}${to}`);
+                    });
+                cy.get('[data-cy=form-submit-btn]').click();
+                cy.get('[data-cy=collection-files-panel]')
+                    .should('not.contain', `${from}`)
+                    .and('contain', `${to}`);
+            })
         });
     });
 
-    it('tries to rename a file with an illegal name', function() {
+    it('tries to rename a file with an illegal names', function() {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
         cy.createCollection(adminUser.token, {
@@ -165,22 +175,26 @@ describe('Collection panel tests', function() {
         .as('testCollection').then(function() {
             cy.loginAs(activeUser);
             cy.visit(`/collections/${this.testCollection.uuid}`);
-            cy.get('[data-cy=collection-files-panel]')
-                .contains('bar').rightclick();
-            cy.get('[data-cy=context-menu]')
-                .contains('Rename')
-                .click();
-            cy.get('[data-cy=form-dialog]')
-                .should('contain', 'Rename')
-                .within(() => {
-                    cy.get('input').type('{backspace}{backspace}{backspace}');
-                });
-            cy.get('[data-cy=form-submit-btn]').click();
-            cy.get('[data-cy=form-dialog]')
-                .should('contain', 'Rename')
-                .within(() => {
-                    cy.contains('Could not rename');
-                });
+            const illegalNames = ['', '.', '..'];
+            illegalNames.forEach((name) => {
+                cy.get('[data-cy=collection-files-panel]')
+                    .contains('bar').rightclick();
+                cy.get('[data-cy=context-menu]')
+                    .contains('Rename')
+                    .click();
+                cy.get('[data-cy=form-dialog]')
+                    .should('contain', 'Rename')
+                    .within(() => {
+                        cy.get('input').type(`{selectall}{backspace}${name}`);
+                    });
+                cy.get('[data-cy=form-submit-btn]').click();
+                cy.get('[data-cy=form-dialog]')
+                    .should('contain', 'Rename')
+                    .within(() => {
+                        cy.contains('Could not rename');
+                    });
+                cy.get('[data-cy=form-cancel-btn]').click();
+            })
         });
     });
 
diff --git a/src/components/form-dialog/form-dialog.tsx b/src/components/form-dialog/form-dialog.tsx
index b37ec68d..8c847ca4 100644
--- a/src/components/form-dialog/form-dialog.tsx
+++ b/src/components/form-dialog/form-dialog.tsx
@@ -63,6 +63,7 @@ export const FormDialog = withStyles(styles)((props: DialogProjectProps) =>
             </DialogContent>
             <DialogActions className={props.classes.dialogActions}>
                 <Button
+                    data-cy='form-cancel-btn'
                     onClick={props.closeDialog}
                     className={props.classes.button}
                     color="primary"

commit df5bb74b46652b2e0a73a0e9ef2c09a63314e409
Merge: 04721847 9ee35a64
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Nov 6 13:01:44 2020 -0300

    15685: Merge branch 'master' into 15685-file-renaming-empty-name
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --cc cypress/integration/collection-panel.spec.js
index 19a28c88,404d1c5b..466d7433
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@@ -118,59 -128,53 +128,109 @@@ describe('Collection panel tests', func
          })
      })
  
 +    it('renames a file', function() {
 +        // Creates the collection using the admin token so we can set up
 +        // a bogus manifest text without block signatures.
 +        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(function() {
 +            cy.loginAs(activeUser);
 +            cy.visit(`/collections/${this.testCollection.uuid}`);
 +            cy.get('[data-cy=collection-files-panel]')
 +                .contains('bar').rightclick();
 +            cy.get('[data-cy=context-menu]')
 +                .contains('Rename')
 +                .click();
 +            cy.get('[data-cy=form-dialog]')
 +                .should('contain', 'Rename')
 +                .within(() => {
 +                    cy.get('input').type('{backspace}{backspace}{backspace}foo');
 +                });
 +            cy.get('[data-cy=form-submit-btn]').click();
 +            cy.get('[data-cy=collection-files-panel]')
 +                .should('not.contain', 'bar')
 +                .and('contain', 'foo');
 +        });
 +    });
 +
 +    it('tries to rename a file with an illegal name', function() {
 +        // Creates the collection using the admin token so we can set up
 +        // a bogus manifest text without block signatures.
 +        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(function() {
 +            cy.loginAs(activeUser);
 +            cy.visit(`/collections/${this.testCollection.uuid}`);
 +            cy.get('[data-cy=collection-files-panel]')
 +                .contains('bar').rightclick();
 +            cy.get('[data-cy=context-menu]')
 +                .contains('Rename')
 +                .click();
 +            cy.get('[data-cy=form-dialog]')
 +                .should('contain', 'Rename')
 +                .within(() => {
 +                    cy.get('input').type('{backspace}{backspace}{backspace}');
 +                });
 +            cy.get('[data-cy=form-submit-btn]').click();
 +            cy.get('[data-cy=form-dialog]')
 +                .should('contain', 'Rename')
 +                .within(() => {
 +                    cy.contains('Could not rename');
 +                });
 +        });
 +    });
++
+     it('can correctly display old versions', function() {
 -        const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
++        const colName = `Versioned Collection ${Math.floor(Math.random() * 999999)}`;
+         let colUuid = '';
+         let oldVersionUuid = '';
+         // Make sure no other collections with this name exist
+         cy.doRequest('GET', '/arvados/v1/collections', null, {
+             filters: `[["name", "=", "${colName}"]]`,
+             include_old_versions: true
+         })
+         .its('body.items').as('collections')
+         .then(function() {
+             expect(this.collections).to.be.empty;
+         });
+         // Creates the collection using the admin token so we can set up
+         // a bogus manifest text without block signatures.
+         cy.createCollection(adminUser.token, {
+             name: colName,
+             owner_uuid: activeUser.user.uuid,
+             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
+         .as('originalVersion').then(function() {
+             // Change the file name to create a new version.
+             cy.updateCollection(adminUser.token, this.originalVersion.uuid, {
+                 manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n"
+             })
+             colUuid = this.originalVersion.uuid;
+         });
+         // Confirm that there are 2 versions of the collection
+         cy.doRequest('GET', '/arvados/v1/collections', null, {
+             filters: `[["name", "=", "${colName}"]]`,
+             include_old_versions: true
+         })
+         .its('body.items').as('collections')
+         .then(function() {
+             expect(this.collections).to.have.lengthOf(2);
+             this.collections.map(function(aCollection) {
+                 expect(aCollection.current_version_uuid).to.equal(colUuid);
+                 if (aCollection.uuid !== aCollection.current_version_uuid) {
+                     oldVersionUuid = aCollection.uuid;
+                 }
+             });
+             // Check the old version displays as what it is.
+             cy.loginAs(activeUser)
+             cy.visit(`/collections/${oldVersionUuid}`);
+             cy.get('[data-cy=collection-info-panel]').should('contain', 'This is an old version');
+             cy.get('[data-cy=read-only-icon]').should('exist');
+             cy.get('[data-cy=collection-info-panel]').should('contain', colName);
+             cy.get('[data-cy=collection-files-panel]').should('contain', 'bar');
+         });
+     });
  })

commit 04721847d0d2d5607999df598aed355d3ae6c6bc
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Nov 6 12:33:02 2020 -0300

    15685: Fixes unneeded Math.floor() calls on some tests that need random numbers.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index 21b52686..19a28c88 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -122,7 +122,7 @@ describe('Collection panel tests', function() {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
         cy.createCollection(adminUser.token, {
-            name: `Test collection ${Math.floor(Math.random() * Math.floor(999999))}`,
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
             owner_uuid: activeUser.user.uuid,
             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
         .as('testCollection').then(function() {
@@ -149,7 +149,7 @@ describe('Collection panel tests', function() {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
         cy.createCollection(adminUser.token, {
-            name: `Test collection ${Math.floor(Math.random() * Math.floor(999999))}`,
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
             owner_uuid: activeUser.user.uuid,
             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
         .as('testCollection').then(function() {
diff --git a/cypress/integration/login.spec.js b/cypress/integration/login.spec.js
index d88c7a6c..7a6f7160 100644
--- a/cypress/integration/login.spec.js
+++ b/cypress/integration/login.spec.js
@@ -28,7 +28,7 @@ describe('Login tests', function() {
                 inactiveUser = this.inactiveUser;
             }
         );
-        randomUser.username = `randomuser${Math.floor(Math.random() * Math.floor(999999))}`;
+        randomUser.username = `randomuser${Math.floor(Math.random() * 999999)}`;
         randomUser.password = {
             crypt: 'zpAReoZzPnwmQ',
             clear: 'topsecret',
@@ -89,7 +89,7 @@ describe('Login tests', function() {
         cy.doRequest('PUT', `/arvados/v1/api_client_authorizations/${tokenUuid}`, {
             id: tokenUuid,
             api_client_authorization: JSON.stringify({
-                api_token: `randomToken${Math.floor(Math.random() * Math.floor(999999))}`
+                api_token: `randomToken${Math.floor(Math.random() * 999999)}`
             })
         }, null, activeUser.token, true);
         // Should log the user out.

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list