From: Daniel Kutyła Date: Thu, 19 May 2022 15:36:17 +0000 (+0200) Subject: 19052: fixed wrong owner being displayed added test X-Git-Tag: 2.4.1~1^2^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/6cba13dd33c09ab8255b847aa4a614d3cf6eee8a 19052: fixed wrong owner being displayed added test Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- 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;