16118: Changes read-only padlock icon with an explicit legend.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 11 May 2020 19:53:27 +0000 (16:53 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 11 May 2020 19:53:27 +0000 (16:53 -0300)
Also adds cypress-specific attributes to be able to get UI elements in a more
readable way.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

src/components/icon/icon.tsx
src/views/collection-panel/collection-panel.tsx

index 163010e4d4856d07b587dceb46dbb7d5aeb24a75..a5fa5ddd4cde60b64df83d7c32bfa882c1f0f74a 100644 (file)
@@ -53,7 +53,7 @@ import SettingsEthernet from '@material-ui/icons/SettingsEthernet';
 import Star from '@material-ui/icons/Star';
 import StarBorder from '@material-ui/icons/StarBorder';
 import Warning from '@material-ui/icons/Warning';
-import Visibility from '@material-ui/icons/Lock';
+import ErrorOutline from '@material-ui/icons/ErrorOutline';
 import VpnKey from '@material-ui/icons/VpnKey';
 
 export type IconType = React.SFC<{ className?: string, style?: object }>;
@@ -97,7 +97,7 @@ export const ProcessIcon: IconType = (props) => <BubbleChart {...props} />;
 export const ProjectIcon: IconType = (props) => <Folder {...props} />;
 export const ProjectsIcon: IconType = (props) => <Inbox {...props} />;
 export const ProvenanceGraphIcon: IconType = (props) => <DeviceHub {...props} />;
-export const ReadOnlyIcon: IconType = (props) => <Visibility {...props} />;
+export const ReadOnlyIcon: IconType = (props) => <ErrorOutline {...props} />;
 export const RemoveIcon: IconType = (props) => <Delete {...props} />;
 export const RemoveFavoriteIcon: IconType = (props) => <Star {...props} />;
 export const PublicFavoriteIcon: IconType = (props) => <Public {...props} />;
index 64de885fd3f94ea4b42f119cd6a8e77cb5c52088..be2afc721bf7238135522dee01f23c708fd947ac 100644 (file)
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import {
     StyleRulesCallback, WithStyles, withStyles, Card,
-    CardHeader, IconButton, CardContent, Grid, Tooltip
+    CardHeader, IconButton, CardContent, Grid, Tooltip, Chip
 } from '@material-ui/core';
 import { connect, DispatchProp } from "react-redux";
 import { RouteComponentProps } from 'react-router';
@@ -91,18 +91,14 @@ export const CollectionPanel = withStyles(styles)(
                 const { classes, item, dispatch, isWritable } = this.props;
                 return item
                     ? <>
-                        <Card className={classes.card}>
+                        <Card data-cy='collection-info-panel' className={classes.card}>
                             <CardHeader
                                 avatar={
                                     <IconButton onClick={this.openCollectionDetails}>
                                         <CollectionIcon className={classes.iconHeader} />
                                     </IconButton>
                                 }
-                                action={<div>
-                                    {isWritable === false &&
-                                    <Tooltip title="This collection is read-only">
-                                        <ReadOnlyIcon />
-                                    </Tooltip>}
+                                action={
                                     <Tooltip title="More options" disableFocusListener>
                                         <IconButton
                                             aria-label="More options"
@@ -110,8 +106,14 @@ export const CollectionPanel = withStyles(styles)(
                                             <MoreOptionsIcon />
                                         </IconButton>
                                     </Tooltip>
-                                </div>}
-                                title={<span><IllegalNamingWarning name={item.name}/>{item.name}</span>}
+                                }
+                                title={
+                                    <span>
+                                        <IllegalNamingWarning name={item.name}/>
+                                        {item.name}
+                                        {isWritable || <Chip variant="outlined" icon={<ReadOnlyIcon />} label="Read-only"/>}
+                                    </span>
+                                }
                                 titleTypographyProps={this.titleProps}
                                 subheader={item.description}
                                 subheaderTypographyProps={this.titleProps} />
@@ -171,7 +173,7 @@ export const CollectionPanel = withStyles(styles)(
                                 </Grid>
                             </CardContent>
                         </Card>
-                        <div className={classes.card}>
+                        <div className={classes.card} data-cy="collection-files-panel">
                             <CollectionPanelFiles isWritable={isWritable} />
                         </div>
                     </>