[ARVADOS-WORKBENCH2] updated: 2.1.0-113-gd5db24f8

Git user git at public.arvados.org
Thu Jan 7 22:00:27 UTC 2021


Summary of changes:
 cypress/integration/delete-multiple-files.spec.js  | 23 +++++-----------------
 .../collection-service/collection-service.ts       | 11 ++++++++++-
 2 files changed, 15 insertions(+), 19 deletions(-)

       via  d5db24f8cfa26d546596b99e644e37c72b6b1fae (commit)
      from  a293a23fa93855c9c6e180bfd77880b794c24673 (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 d5db24f8cfa26d546596b99e644e37c72b6b1fae
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Thu Jan 7 22:34:07 2021 +0100

    17016: Code optimisation
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/delete-multiple-files.spec.js b/cypress/integration/delete-multiple-files.spec.js
index bd40a2b7..2c7f4840 100644
--- a/cypress/integration/delete-multiple-files.spec.js
+++ b/cypress/integration/delete-multiple-files.spec.js
@@ -50,29 +50,12 @@ describe('Collection panel tests', function () {
         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. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
+            manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
         })
             .as('testCollection').then(function () {
                 cy.loginAs(activeUser);
                 cy.visit(`/collections/${this.testCollection.uuid}`);
 
-                cy.get('[data-cy=collection-files-panel]')
-                    .contains('bar').rightclick({ force: true });
-
-                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}subdir/foo`);
-                    });
-                cy.get('[data-cy=form-submit-btn]').click();
-                cy.get('[data-cy=collection-files-panel]')
-                    .should('not.contain', 'bar')
-                    .and('contain', 'subdir');
-
                 cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
                 cy.get('[data-cy=collection-files-panel]')
                     .should('contain', 'foo');
@@ -83,6 +66,10 @@ describe('Collection panel tests', function () {
                 cy.get('[data-cy=collection-files-panel-options-btn]').click();
                 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
                 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
+
+                cy.get('[data-cy=collection-files-panel]')
+                    .should('not.contain', 'subdir')
+                    .and('contain', 'baz');
             });
     });
 })
diff --git a/src/services/collection-service/collection-service.ts b/src/services/collection-service/collection-service.ts
index 7e6126a0..5ae03b89 100644
--- a/src/services/collection-service/collection-service.ts
+++ b/src/services/collection-service/collection-service.ts
@@ -37,7 +37,16 @@ export class CollectionService extends TrashableResourceService<CollectionResour
 
     async deleteFiles(collectionUuid: string, filePaths: string[]) {
         const sortedUniquePaths = Array.from(new Set(filePaths))
-            .sort((a, b) => b.length - a.length);
+            .sort((a, b) => a.length - b.length)
+            .reduce((acc, currentPath) => {
+                const parentPathFound = acc.find((parentPath) => currentPath.indexOf(`${parentPath}/`) > -1);
+
+                if (!parentPathFound) {
+                    return [...acc, currentPath];
+                }
+
+                return acc;
+            }, []);
 
         for (const path of sortedUniquePaths) {
             if (path.indexOf(collectionUuid) === -1) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list