[arvados-workbench2] updated: 2.5.0-110-g0fdae1ff

git repository hosting git at public.arvados.org
Tue Apr 4 19:03:48 UTC 2023


Summary of changes:
 cypress/integration/group-manage.spec.js           |  2 +-
 cypress/integration/sharing.spec.js                | 12 ++--
 src/services/common-service/common-service.ts      |  6 +-
 src/store/sharing-dialog/sharing-dialog-actions.ts | 18 ++++--
 .../sharing-dialog-component.test.tsx              |  7 ++-
 .../sharing-dialog/sharing-dialog-component.tsx    |  2 +-
 .../sharing-invitation-form-component.tsx          | 17 +++---
 .../sharing-public-access-form-component.tsx       |  2 +-
 .../sharing-dialog/sharing-urls-component.tsx      | 68 +++++++++++-----------
 .../sharing-dialog/visibility-level-select.tsx     |  8 +--
 10 files changed, 78 insertions(+), 64 deletions(-)

       via  0fdae1ff782d3ca3b98038b54c1147f3aca3bca1 (commit)
       via  3d4f1fd8ce62ed2cd35af23231062a95b70c500b (commit)
      from  09d4c8fd20d63b93cf4d14acf3de500e26a73b9b (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 0fdae1ff782d3ca3b98038b54c1147f3aca3bca1
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue Apr 4 15:03:37 2023 -0400

    20085: Fix tests
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/cypress/integration/group-manage.spec.js b/cypress/integration/group-manage.spec.js
index 1fd9e416..c4731bb3 100644
--- a/cypress/integration/group-manage.spec.js
+++ b/cypress/integration/group-manage.spec.js
@@ -77,7 +77,7 @@ describe('Group manage tests', function() {
                 cy.get('[data-cy=invite-people-field] input').type("admin");
             });
         cy.get('[role=tooltip]').click();
-        cy.get('.sharing-dialog').contains('Save').click();
+        cy.get('.sharing-dialog').get('[data-cy=add-invited-people]').click();
         cy.get('.sharing-dialog').contains('Close').click();
 
         // Check that both users are present with appropriate permissions
diff --git a/cypress/integration/sharing.spec.js b/cypress/integration/sharing.spec.js
index c64f57fd..5fbf5692 100644
--- a/cypress/integration/sharing.spec.js
+++ b/cypress/integration/sharing.spec.js
@@ -77,7 +77,7 @@ describe('Sharing tests', function () {
             cy.get('[data-cy=invite-people-field]').find('input').type(activeUser.user.email);
             cy.get('[role=tooltip]').click();
             cy.get('@sharingDialog').within(() => {
-                cy.contains('Save changes').click();
+                cy.get('[data-cy=add-invited-people]').click();
                 cy.contains('Close').click();
             });
         });
@@ -95,7 +95,7 @@ describe('Sharing tests', function () {
             cy.get('[data-cy=invite-people-field]').find('input').type(activeUser.user.email);
             cy.get('[role=tooltip]').click();
             cy.get('@sharingDialog').within(() => {
-                cy.contains('Save changes').click();
+                cy.get('[data-cy=add-invited-people]').click();
                 cy.contains('Close').click();
             });
         });
@@ -153,12 +153,12 @@ describe('Sharing tests', function () {
                 cy.loginAs(adminUser);
                 cy.get('[data-cy=project-panel]').contains(collName).rightclick();
                 cy.get('[data-cy=context-menu]').contains('Share').click();
-                cy.get('button').contains('Save changes').parent().should('be.disabled');
+                cy.get('button').get('[data-cy=add-invited-people]').should('be.disabled');
                 cy.get('[data-cy=invite-people-field] input').type('Anonymous');
                 cy.get('div[role=tooltip]').contains('anonymous').click();
-                cy.get('button').contains('Save changes').parent().should('not.be.disabled');
+                cy.get('button').get('[data-cy=add-invited-people]').should('not.be.disabled');
                 cy.get('[data-cy=invite-people-field] div[role=button]').contains('anonymous').parent().find('svg').click();
-                cy.get('button').contains('Save changes').parent().should('be.disabled');
+                cy.get('button').get('[data-cy=add-invited-people]').should('be.disabled');
             });
     });
-});
\ No newline at end of file
+});
diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.test.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.test.tsx
index 36447a8d..2fc4d01a 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.test.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.test.tsx
@@ -27,6 +27,11 @@ describe("<SharingDialogComponent />", () => {
             config: {
                 keepWebServiceUrl: 'http://example.com/',
                 keepWebInlineServiceUrl: 'http://*.collections.example.com/',
+                clusterConfig: {
+                    Users: {
+                        AnonymousUserToken: ""
+                    }
+                }
             }
         }
         store = createStore(combineReducers({
@@ -68,4 +73,4 @@ describe("<SharingDialogComponent />", () => {
         let wrapper = mount(<Provider store={store}><SharingDialogComponent {...props} /></Provider>);
         expect(wrapper.html()).not.toContain('Sharing URLs');
     });
-});
\ No newline at end of file
+});
diff --git a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
index 3ff98b0a..871ea503 100644
--- a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
@@ -53,7 +53,8 @@ const StyledSharingInvitationFormComponent = withStyles(styles)(
                     root: classes.addButtonRoot,
                     colorPrimary: classes.addButtonPrimary,
                     disabled: classes.addButtonDisabled
-                }}>
+                }}
+                    data-cy='add-invited-people'>
                     <Tooltip title="Add authorization">
                         <AddIcon />
                     </Tooltip>

commit 3d4f1fd8ce62ed2cd35af23231062a95b70c500b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue Apr 4 13:37:36 2023 -0400

    20085: Fix quirky behavior when removing share with public/all users row
    
    Fix some runtime warnings
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/services/common-service/common-service.ts b/src/services/common-service/common-service.ts
index 4b857edd..8e9fe631 100644
--- a/src/services/common-service/common-service.ts
+++ b/src/services/common-service/common-service.ts
@@ -107,12 +107,14 @@ export class CommonService<T> {
         );
     }
 
-    delete(uuid: string): Promise<T> {
+    delete(uuid: string, showErrors?: boolean): Promise<T> {
         this.validateUuid(uuid);
         return CommonService.defaultResponse(
             this.serverApi
                 .delete(`/${this.resourceType}/${uuid}`),
-            this.actions
+            this.actions,
+            true, // mapKeys
+            showErrors
         );
     }
 
diff --git a/src/store/sharing-dialog/sharing-dialog-actions.ts b/src/store/sharing-dialog/sharing-dialog-actions.ts
index c998e767..fb34398e 100644
--- a/src/store/sharing-dialog/sharing-dialog-actions.ts
+++ b/src/store/sharing-dialog/sharing-dialog-actions.ts
@@ -49,8 +49,8 @@ export const connectSharingDialogProgress = withProgress(SHARING_DIALOG_NAME);
 
 export const saveSharingDialogChanges = async (dispatch: Dispatch, getState: () => RootState) => {
     dispatch(progressIndicatorActions.START_WORKING(SHARING_DIALOG_NAME));
-    await dispatch<any>(saveManagementChanges);
     await dispatch<any>(savePublicPermissionChanges);
+    await dispatch<any>(saveManagementChanges);
     await dispatch<any>(sendInvitations);
     dispatch(reset(SHARING_INVITATION_FORM_NAME));
     await dispatch<any>(loadSharingDialog);
@@ -236,7 +236,7 @@ const savePublicPermissionChanges = async (_: Dispatch, getState: () => RootStat
         // If visibility level changed, delete the previous link to public/all users.
         // On PRIVATE this link will be deleted by saveManagementChanges
         // so don't double delete (which would show an error dialog).
-        if (permissionUuid !== "" && visibility !== initialVisibility && visibility !== VisibilityLevel.PRIVATE) {
+        if (permissionUuid !== "" && visibility !== initialVisibility) {
             await permissionService.delete(permissionUuid);
         }
         if (visibility === VisibilityLevel.ALL_USERS) {
@@ -272,10 +272,16 @@ const saveManagementChanges = async (_: Dispatch, getState: () => RootState, { p
                 (a, b) => a.permissionUuid === b.permissionUuid
             );
 
-        const deletions = cancelledPermissions.map(({ permissionUuid }) =>
-            permissionService.delete(permissionUuid));
-        const updates = permissions.map(update =>
-            permissionService.update(update.permissionUuid, { name: update.permissions }));
+        const deletions = cancelledPermissions.map(async ({ permissionUuid }) => {
+            try {
+                await permissionService.delete(permissionUuid, false);
+            } catch (e) { }
+        });
+        const updates = permissions.map(async update => {
+            try {
+                await permissionService.update(update.permissionUuid, { name: update.permissions }, false);
+            } catch (e) { }
+        });
         await Promise.all([...deletions, ...updates]);
     }
 };
diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index ac1ebde1..089eee8d 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -90,7 +90,7 @@ export default (props: SharingDialogComponentProps) => {
         {...{ open, onClose }}
         className="sharing-dialog"
         fullWidth
-        maxWidth='sm'
+        maxWidth='md'
         disableBackdropClick={saveEnabled}
         disableEscapeKeyDown={saveEnabled}>
         <DialogTitle>
diff --git a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
index 17f3250a..3ff98b0a 100644
--- a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
@@ -49,15 +49,15 @@ const StyledSharingInvitationFormComponent = withStyles(styles)(
             </Grid>
             <Grid data-cy="permission-select-field" item xs={4} container wrap='nowrap'>
                 <PermissionSelectField />
-                <Tooltip title="Add authorization">
-                    <IconButton onClick={onSave} disabled={!saveEnabled} color="primary" classes={{
-                        root: classes.addButtonRoot,
-                        colorPrimary: classes.addButtonPrimary,
-                        disabled: classes.addButtonDisabled
-                    }}>
+                <IconButton onClick={onSave} disabled={!saveEnabled} color="primary" classes={{
+                    root: classes.addButtonRoot,
+                    colorPrimary: classes.addButtonPrimary,
+                    disabled: classes.addButtonDisabled
+                }}>
+                    <Tooltip title="Add authorization">
                         <AddIcon />
-                    </IconButton>
-                </Tooltip>
+                    </Tooltip>
+                </IconButton>
             </Grid>
         </Grid >);
 
diff --git a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
index a9c9d6fc..bcee8dce 100644
--- a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
@@ -60,4 +60,4 @@ const SharingPublicAccessFormComponent = ({ visibility, includePublic, onSave }:
 export default SharingPublicAccessFormComponent;
 
 const VisibilityLevelSelectComponent = ({ input, includePublic }: { includePublic: boolean } & WrappedFieldProps) =>
-    <VisibilityLevelSelect fullWidth disableUnderline {...input} includePublic={includePublic} />;
+    <VisibilityLevelSelect fullWidth disableUnderline includePublic={includePublic} {...input} />;
diff --git a/src/views-components/sharing-dialog/sharing-urls-component.tsx b/src/views-components/sharing-dialog/sharing-urls-component.tsx
index c9cbc0df..5facb2e3 100644
--- a/src/views-components/sharing-dialog/sharing-urls-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-urls-component.tsx
@@ -14,7 +14,7 @@ import {
     withStyles
 } from '@material-ui/core';
 import { ApiClientAuthorization } from 'models/api-client-authorization';
-import { CopyIcon, RemoveIcon } from 'components/icon/icon';
+import { CopyIcon, CloseIcon } from 'components/icon/icon';
 import CopyToClipboard from 'react-copy-to-clipboard';
 import { ArvadosTheme } from 'common/custom-theme';
 import moment from 'moment';
@@ -58,38 +58,38 @@ export interface SharingURLsComponentActionProps {
 export type SharingURLsComponentProps = SharingURLsComponentDataProps & SharingURLsComponentActionProps;
 
 export const SharingURLsComponent = withStyles(styles)((props: SharingURLsComponentProps & WithStyles<CssRules>) => <Grid container direction='column' spacing={24} className={props.classes.sharingUrlList}>
-    { props.sharingTokens.length > 0
-    ? props.sharingTokens
-    .sort((a, b) => (new Date(a.expiresAt).getTime() - new Date(b.expiresAt).getTime()))
-    .map(token => {
-        const url = props.sharingURLsPrefix.includes('*')
-        ? `${props.sharingURLsPrefix.replace('*', props.collectionUuid)}/t=${token.apiToken}/_/`
-        : `${props.sharingURLsPrefix}/c=${props.collectionUuid}/t=${token.apiToken}/_/`;
-        const expDate = new Date(token.expiresAt);
-        const urlLabel = !!token.expiresAt
-        ? `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})`
-        : `Token ${token.apiToken.slice(0, 8)}... with no expiration date`;
+    {props.sharingTokens.length > 0
+        ? props.sharingTokens
+            .sort((a, b) => (new Date(a.expiresAt).getTime() - new Date(b.expiresAt).getTime()))
+            .map(token => {
+                const url = props.sharingURLsPrefix.includes('*')
+                    ? `${props.sharingURLsPrefix.replace('*', props.collectionUuid)}/t=${token.apiToken}/_/`
+                    : `${props.sharingURLsPrefix}/c=${props.collectionUuid}/t=${token.apiToken}/_/`;
+                const expDate = new Date(token.expiresAt);
+                const urlLabel = !!token.expiresAt
+                    ? `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})`
+                    : `Token ${token.apiToken.slice(0, 8)}... with no expiration date`;
 
-        return <Grid container alignItems='center' key={token.uuid}  className={props.classes.sharingUrlRow}>
-            <Grid item>
-            <Link className={props.classes.sharingUrlText} href={url} target='_blank'>
-                {urlLabel}
-            </Link>
-            </Grid>
-            <Grid item xs />
-            <Grid item>
-            <span className={props.classes.sharingUrlButton}><Tooltip title='Copy to clipboard'>
-                <CopyToClipboard text={url} onCopy={() => props.onCopy('Sharing URL copied')}>
-                    <CopyIcon />
-                </CopyToClipboard>
-            </Tooltip></span>
-            <span data-cy='remove-url-btn' className={props.classes.sharingUrlButton}><Tooltip title='Remove'>
-                <IconButton onClick={() => props.onDeleteSharingToken(token.uuid)}>
-                    <RemoveIcon />
-                </IconButton>
-            </Tooltip></span>
-            </Grid>
-        </Grid>
-    })
-    : <Grid item><Typography>No sharing URLs</Typography></Grid> }
+                return <Grid container alignItems='center' key={token.uuid} className={props.classes.sharingUrlRow}>
+                    <Grid item>
+                        <Link className={props.classes.sharingUrlText} href={url} target='_blank'>
+                            {urlLabel}
+                        </Link>
+                    </Grid>
+                    <Grid item xs />
+                    <Grid item>
+                        <span className={props.classes.sharingUrlButton}><Tooltip title='Copy to clipboard'>
+                            <CopyToClipboard text={url} onCopy={() => props.onCopy('Sharing URL copied')}>
+                                <CopyIcon />
+                            </CopyToClipboard>
+                        </Tooltip></span>
+                        <span data-cy='remove-url-btn' className={props.classes.sharingUrlButton}><Tooltip title='Remove'>
+                            <IconButton onClick={() => props.onDeleteSharingToken(token.uuid)}>
+                                <CloseIcon />
+                            </IconButton>
+                        </Tooltip></span>
+                    </Grid>
+                </Grid>
+            })
+        : <Grid item><Typography>No sharing URLs</Typography></Grid>}
 </Grid>);
diff --git a/src/views-components/sharing-dialog/visibility-level-select.tsx b/src/views-components/sharing-dialog/visibility-level-select.tsx
index c869e739..4f12e3ea 100644
--- a/src/views-components/sharing-dialog/visibility-level-select.tsx
+++ b/src/views-components/sharing-dialog/visibility-level-select.tsx
@@ -13,20 +13,20 @@ import { SelectItem } from './select-item';
 import { VisibilityLevel } from 'store/sharing-dialog/sharing-dialog-types';
 
 
-type VisibilityLevelSelectClasses = 'value';
+type VisibilityLevelSelectClasses = 'root';
 
 const VisibilityLevelSelectStyles: StyleRulesCallback<VisibilityLevelSelectClasses> = theme => ({
-    value: {
+    root: {
         marginLeft: theme.spacing.unit,
     }
 });
 export const VisibilityLevelSelect = withStyles(VisibilityLevelSelectStyles)(
-    ({ classes, ...props }: { includePublic: boolean } & SelectProps & WithStyles<VisibilityLevelSelectClasses>) =>
+    ({ classes, includePublic, ...props }: { includePublic: boolean } & SelectProps & WithStyles<VisibilityLevelSelectClasses>) =>
         <Select
             {...props}
             renderValue={renderPermissionItem}
             inputProps={{ classes }}>
-            {props.includePublic && <MenuItem value={VisibilityLevel.PUBLIC}>
+            {includePublic && <MenuItem value={VisibilityLevel.PUBLIC}>
                 {renderPermissionItem(VisibilityLevel.PUBLIC)}
             </MenuItem>}
             <MenuItem value={VisibilityLevel.ALL_USERS}>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list