From 6cba13dd33c09ab8255b847aa4a614d3cf6eee8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kuty=C5=82a?= Date: Thu, 19 May 2022 17:36:17 +0200 Subject: [PATCH] 19052: fixed wrong owner being displayed added test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- cypress/integration/search.spec.js | 22 +++++++++++++++++++ .../data-explorer/renderers.tsx | 11 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cypress/integration/search.spec.js b/cypress/integration/search.spec.js index 491292be..5434ca24 100644 --- a/cypress/integration/search.spec.js +++ b/cypress/integration/search.spec.js @@ -104,4 +104,26 @@ describe('Search tests', function() { cy.get('[data-cy=element-path]').should('contain', `/ Projects / ${colName}`); }); }); + + it('can display owner of the item', function() { + const colName = `Collection ${Math.floor(Math.random() * Math.floor(999999))}`; + + cy.createCollection(adminUser.token, { + name: colName, + owner_uuid: activeUser.user.uuid, + preserve_version: true, + manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" + }).then(function() { + cy.loginAs(activeUser); + + cy.doSearch(colName); + + cy.get('[data-cy=search-results]').should('contain', colName); + + cy.get('[data-cy=search-results]').contains(colName).closest('tr') + .within(() => { + cy.get('p').contains(activeUser.user.uuid).should('contain', activeUser.user.full_name); + }); + }); + }); }); \ No newline at end of file diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index cd9f972e..3edce4f8 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -713,9 +713,18 @@ const userFromID = return { uuid: props.uuid, userFullname }; }); +const ownerFromResourceId = + compose( + connect((state: RootState, props: { uuid: string }) => { + const childResource = getResource(props.uuid)(state.resources); + return { uuid: childResource ? (childResource as Resource).ownerUuid : '' }; + }), + userFromID + ); + export const ResourceOwnerWithName = compose( - userFromID, + ownerFromResourceId, withStyles({}, { withTheme: true })) ((props: { uuid: string, userFullname: string, dispatch: Dispatch, theme: ArvadosTheme }) => { const { uuid, userFullname, dispatch, theme } = props; -- 2.30.2