Merge branch '20031-collection-files-batch-operations' into main. Closes #20031
authorStephen Smith <stephen@curii.com>
Mon, 5 Jun 2023 19:06:24 +0000 (15:06 -0400)
committerStephen Smith <stephen@curii.com>
Mon, 5 Jun 2023 19:06:24 +0000 (15:06 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

1  2 
src/components/collection-panel-files/collection-panel-files.tsx
src/services/common-service/common-resource-service.ts

index ddf30364ad9c76f09f006d33035d407255d20f7b,84b37a70013e5f40337b14749aacb587b813a5bc..c9d5b65711cfe8f965731f588934fa980e062b8d
@@@ -555,38 -554,37 +555,38 @@@ export const CollectionPanelFiles = wit
                      ? <AutoSizer defaultHeight={500}>{({ height, width }) => {
                          const filtered = rightData.filter(({ name }) => name.indexOf(rightSearch) > -1);
                          return !!filtered.length
 -                        ? <FixedSizeList height={height} itemCount={filtered.length}
 -                            itemSize={35} width={width}>{ ({ index, style }) => {
 -                                const { id, type, name, size } = filtered[index];
 -
 -                                return <div style={style} data-id={id} data-item="true"
 -                                    data-type={type} data-subfolder-path={name}
 -                                    className={classes.row} key={id}>
 -                                    <Checkbox color="primary"
 -                                        className={classes.rowSelection}
 -                                        checked={collectionPanelFiles[id] ? collectionPanelFiles[id].value.selected : false}
 -                                    />&nbsp;
 -                                    {getItemIcon(type, null)}
 -                                    <div className={classes.rowName}>
 -                                        {name}
 +                            ? <FixedSizeList height={height} itemCount={filtered.length}
 +                                itemSize={35} width={width}>{({ index, style }) => {
 +                                    const { id, type, name, size } = filtered[index];
 +
 +                                    return <div style={style} data-id={id} data-item="true"
 +                                        data-type={type} data-subfolder-path={name}
 +                                        className={classes.row} key={id}>
 +                                        <Checkbox color="primary"
 +                                            className={classes.rowSelection}
 +                                            checked={collectionPanelFiles[id] ? collectionPanelFiles[id].value.selected : false}
 +                                        />&nbsp;
 +                                        {getItemIcon(type, null)}
 +                                        <div className={classes.rowName}>
 +                                            {name}
 +                                        </div>
 +                                        <span className={classes.rowName} style={{
 +                                            marginLeft: 'auto', marginRight: '1rem'
 +                                        }}>
 +                                            {formatFileSize(size)}
 +                                        </span>
 +                                        <Tooltip title="More options" disableFocusListener>
 +                                            <IconButton data-id='moreOptions'
 +                                                data-cy='file-item-options-btn'
 +                                                className={classes.moreOptionsButton}>
-                                                 <MoreOptionsIcon
++                                                <MoreHorizontalIcon
 +                                                    data-id='moreOptions'
 +                                                    className={classes.moreOptions} />
 +                                            </IconButton>
 +                                        </Tooltip>
                                      </div>
 -                                    <span className={classes.rowName} style={{
 -                                        marginLeft: 'auto', marginRight: '1rem' }}>
 -                                        { formatFileSize(size) }
 -                                    </span>
 -                                    <Tooltip title="More options" disableFocusListener>
 -                                        <IconButton data-id='moreOptions'
 -                                            data-cy='file-item-options-btn'
 -                                            className={classes.moreOptionsButton}>
 -                                            <MoreHorizontalIcon
 -                                                data-id='moreOptions'
 -                                                className={classes.moreOptions} />
 -                                        </IconButton>
 -                                    </Tooltip>
 -                                </div>
 -                            } }</FixedSizeList>
 -                        : <div className={classes.rowEmpty}>This collection is empty</div>
 +                                }}</FixedSizeList>
 +                            : <div className={classes.rowEmpty}>This collection is empty</div>
                      }}</AutoSizer>
                      : <div className={classes.row}>
                          <CircularProgress className={classes.loader} size={30} />
index 515eb6a4b9522b38a25e74c5997bfc7c673ed3d9,11bfec383bddac6e86161b68765b50fe6b75550b..624525e6aecc7d70674d1e541fb072a9584c76e5
@@@ -13,7 -13,7 +13,8 @@@ export enum CommonResourceServiceError 
      OWNERSHIP_CYCLE = 'OwnershipCycle',
      MODIFYING_CONTAINER_REQUEST_FINAL_STATE = 'ModifyingContainerRequestFinalState',
      NAME_HAS_ALREADY_BEEN_TAKEN = 'NameHasAlreadyBeenTaken',
 +    PERMISSION_ERROR_FORBIDDEN = 'PermissionErrorForbidden',
+     SOURCE_DESTINATION_CANNOT_BE_SAME = 'SourceDestinationCannotBeSame',
      UNKNOWN = 'Unknown',
      NONE = 'None'
  }
@@@ -65,8 -65,8 +66,10 @@@ export const getCommonResourceServiceEr
                  return CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE;
              case /Name has already been taken/.test(error):
                  return CommonResourceServiceError.NAME_HAS_ALREADY_BEEN_TAKEN;
 +            case /403 Forbidden/.test(error):
 +                return CommonResourceServiceError.PERMISSION_ERROR_FORBIDDEN;
+             case new RegExp(CommonResourceServiceError.SOURCE_DESTINATION_CANNOT_BE_SAME).test(error):
+                 return CommonResourceServiceError.SOURCE_DESTINATION_CANNOT_BE_SAME;
              default:
                  return CommonResourceServiceError.UNKNOWN;
          }