[ARVADOS-WORKBENCH2] updated: 1.1.4-485-g919738c

Git user git at public.curoverse.com
Tue Aug 7 03:25:57 EDT 2018


Summary of changes:
 .../details-attribute/details-attribute.tsx        |  9 +++++---
 .../collection-panel/collection-panel-action.ts    | 18 +++++++++++++++-
 .../collection-panel/collection-panel-reducer.ts   |  5 +++--
 src/views/collection-panel/collection-panel.tsx    | 25 ++++++++++++++--------
 4 files changed, 42 insertions(+), 15 deletions(-)

       via  919738cdda7a99c61164ccac5754fe939c25fb6b (commit)
      from  1bdd1dfe632195c85e4dbda768dd342811a468b0 (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 919738cdda7a99c61164ccac5754fe939c25fb6b
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Tue Aug 7 09:25:50 2018 +0200

    add delete tag, improve detail attributes and modify collection panel
    
    Feature #13854
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/components/details-attribute/details-attribute.tsx b/src/components/details-attribute/details-attribute.tsx
index 56da6c1..f9a5b05 100644
--- a/src/components/details-attribute/details-attribute.tsx
+++ b/src/components/details-attribute/details-attribute.tsx
@@ -6,6 +6,7 @@ import * as React from 'react';
 import Typography from '@material-ui/core/Typography';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '../../common/custom-theme';
+import * as classnames from "classnames";
 
 type CssRules = 'attribute' | 'label' | 'value' | 'link';
 
@@ -35,19 +36,21 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 interface DetailsAttributeDataProps {
     label: string;
+    classLabel?: string;
     value?: string | number;
+    classValue?: string;
     link?: string;
     children?: React.ReactNode;
 }
 
 type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles<CssRules>;
 
-export const DetailsAttribute = withStyles(styles)(({ label, link, value, children, classes }: DetailsAttributeProps) =>
+export const DetailsAttribute = withStyles(styles)(({ label, link, value, children, classes, classLabel, classValue }: DetailsAttributeProps) =>
     <Typography component="div" className={classes.attribute}>
-        <Typography component="span" className={classes.label}>{label}</Typography>
+        <Typography component="span" className={classnames([classes.label, classLabel])}>{label}</Typography>
         { link
             ? <a href={link} className={classes.link} target='_blank'>{value}</a>
-            : <Typography component="span" className={classes.value}>
+            : <Typography component="span" className={classnames([classes.value, classValue])}>
                 {value}
                 {children}
             </Typography> }
diff --git a/src/store/collection-panel/collection-panel-action.ts b/src/store/collection-panel/collection-panel-action.ts
index f389dc4..f9994d7 100644
--- a/src/store/collection-panel/collection-panel-action.ts
+++ b/src/store/collection-panel/collection-panel-action.ts
@@ -17,7 +17,9 @@ export const collectionPanelActions = unionize({
     LOAD_COLLECTION_TAGS: ofType<{ uuid: string }>(),
     LOAD_COLLECTION_TAGS_SUCCESS: ofType<{ tags: TagResource[] }>(),
     CREATE_COLLECTION_TAG: ofType<{ data: any }>(),
-    CREATE_COLLECTION_TAG_SUCCESS: ofType<{ tag: TagResource }>()
+    CREATE_COLLECTION_TAG_SUCCESS: ofType<{ tag: TagResource }>(),
+    DELETE_COLLECTION_TAG: ofType<{ uuid: string }>(),
+    DELETE_COLLECTION_TAG_SUCCESS: ofType<{ uuid: string }>()
 }, { tag: 'type', value: 'payload' });
 
 export type CollectionPanelAction = UnionOf<typeof collectionPanelActions>;
@@ -60,3 +62,17 @@ export const createCollectionTag = (data: TagProperty) =>
                 }));
             });
     };
+
+export const deleteCollectionTag = (uuid: string) => 
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(collectionPanelActions.DELETE_COLLECTION_TAG({ uuid }));
+        return services.linkService
+            .delete(uuid)
+            .then(tag => {
+                dispatch(collectionPanelActions.DELETE_COLLECTION_TAG_SUCCESS({ uuid: tag.uuid }));
+                dispatch(snackbarActions.OPEN_SNACKBAR({
+                    message: "Tag has been successfully deleted.",
+                    hideDuration: 2000
+                }));
+            });
+    };
\ No newline at end of file
diff --git a/src/store/collection-panel/collection-panel-reducer.ts b/src/store/collection-panel/collection-panel-reducer.ts
index ac07ae3..44b7789 100644
--- a/src/store/collection-panel/collection-panel-reducer.ts
+++ b/src/store/collection-panel/collection-panel-reducer.ts
@@ -20,6 +20,7 @@ export const collectionPanelReducer = (state: CollectionPanelState = initialStat
     collectionPanelActions.match(action, {
         default: () => state,
         LOAD_COLLECTION_SUCCESS: ({ item }) => ({ ...state, item }),
-        LOAD_COLLECTION_TAGS_SUCCESS: ({ tags }) => ({...state, tags}),
-        CREATE_COLLECTION_TAG_SUCCESS: ({ tag }) => ({...state, tags: [...state.tags, tag] })
+        LOAD_COLLECTION_TAGS_SUCCESS: ({ tags }) => ({...state, tags }),
+        CREATE_COLLECTION_TAG_SUCCESS: ({ tag }) => ({...state, tags: [...state.tags, tag] }),
+        DELETE_COLLECTION_TAG_SUCCESS: ({ uuid }) => ({...state, tags: state.tags.filter(tag => tag.uuid !== uuid) })
     });
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index c6554f9..aac5661 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -17,12 +17,13 @@ import { CollectionResource } from '../../models/collection';
 import * as CopyToClipboard from 'react-copy-to-clipboard';
 import { TagResource } from '../../models/tag';
 import { CollectionTagForm } from './collection-tag-form';
+import { deleteCollectionTag } from '../../store/collection-panel/collection-panel-action';
 
-type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon';
+type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'value';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     card: {
-        marginBottom: '20px'
+        marginBottom: theme.spacing.unit * 2
     },
     iconHeader: {
         fontSize: '1.875rem',
@@ -37,6 +38,9 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         fontSize: '1.125rem',
         color: theme.palette.grey["500"],
         cursor: 'pointer'
+    },
+    value: {
+        textTransform: 'none'
     }
 });
 
@@ -79,13 +83,16 @@ export const CollectionPanel = withStyles(styles)(
                             <CardContent>
                                 <Grid container direction="column">
                                     <Grid item xs={6}>
-                                    <DetailsAttribute label='Collection UUID' value={item && item.uuid}>
+                                    <DetailsAttribute classValue={classes.value} 
+                                            label='Collection UUID' 
+                                            value={item && item.uuid}>
                                         <CopyToClipboard text={item && item.uuid}>
                                             <CopyIcon className={classes.copyIcon} />
                                         </CopyToClipboard>
                                     </DetailsAttribute>
+                                    <DetailsAttribute label='Number of files' value='14' />
                                     <DetailsAttribute label='Content size' value='54 MB' />
-                                    <DetailsAttribute label='Owner' value={item && item.ownerUuid} />
+                                    <DetailsAttribute classValue={classes.value} label='Owner' value={item && item.ownerUuid} />
                                     </Grid>
                                 </Grid>
                             </CardContent>
@@ -100,7 +107,7 @@ export const CollectionPanel = withStyles(styles)(
                                         {
                                             tags.map(tag => {
                                                 return <Chip key={tag.etag} className={classes.tag}
-                                                    onDelete={handleDelete}
+                                                    onDelete={this.handleDelete(tag.uuid)}
                                                     label={renderTagLabel(tag)}  />;
                                             })
                                         }
@@ -122,6 +129,10 @@ export const CollectionPanel = withStyles(styles)(
                     </div>;
             }
 
+            handleDelete = (uuid: string) => () => {
+                this.props.dispatch<any>(deleteCollectionTag(uuid));
+            }
+
             componentWillReceiveProps({ match, item, onItemRouteChange }: CollectionPanelProps) {
                 if (!item || match.params.id !== item.uuid) {
                     onItemRouteChange(match.params.id);
@@ -135,8 +146,4 @@ export const CollectionPanel = withStyles(styles)(
 const renderTagLabel = (tag: TagResource) => {
     const { properties } = tag;
     return `${properties.key}: ${properties.value}`;
-};
-
-const handleDelete = () => {
-    alert('tag has been deleted');
 };
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list