[arvados-workbench2] updated: 2.4.0-197-g59171e2c

git repository hosting git at public.arvados.org
Tue Aug 30 15:22:39 UTC 2022


Summary of changes:
 cypress/integration/collection.spec.js                     |  2 +-
 .../collection-panel-files/collection-panel-files.tsx      |  2 +-
 src/store/snackbar/snackbar-actions.ts                     |  2 +-
 src/store/snackbar/snackbar-reducer.ts                     |  4 ++--
 src/views-components/snackbar/snackbar.tsx                 | 14 +++++++-------
 5 files changed, 12 insertions(+), 12 deletions(-)

       via  59171e2cf2ce2740825be7b19d580a2bfa0081f5 (commit)
      from  13bd71d79228da81b056690bd4eb815943d3376b (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 59171e2cf2ce2740825be7b19d580a2bfa0081f5
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Tue Aug 30 17:20:54 2022 +0200

    18692: Changed logic for snackbar
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js
index 28454a90..f26328ab 100644
--- a/cypress/integration/collection.spec.js
+++ b/cypress/integration/collection.spec.js
@@ -192,7 +192,7 @@ describe('Collection panel tests', function () {
             });
     });
 
-    it('shows collection by URL', function () {
+    it.only('shows collection by URL', function () {
         cy.loginAs(activeUser);
         [true, false].map(function (isWritable) {
             // Using different file names to avoid test flakyness: the second iteration
diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx
index 06b3c507..4b631a6a 100644
--- a/src/components/collection-panel-files/collection-panel-files.tsx
+++ b/src/components/collection-panel-files/collection-panel-files.tsx
@@ -539,7 +539,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
                     : <div className={classes.rowEmpty}>No directories available</div>
                     }}
                 </AutoSizer>
-                : <div className={classes.row}><CircularProgress className={classes.loader} size={30} /></div> }
+                : <div data-cy="collection-loader" className={classes.row}><CircularProgress className={classes.loader} size={30} /></div> }
                 </div>
             </div>
             <div className={classes.rightPanel} data-cy="collection-files-right-panel">
diff --git a/src/store/snackbar/snackbar-actions.ts b/src/store/snackbar/snackbar-actions.ts
index c0437154..7b6f2efd 100644
--- a/src/store/snackbar/snackbar-actions.ts
+++ b/src/store/snackbar/snackbar-actions.ts
@@ -20,7 +20,7 @@ export enum SnackbarKind {
 
 export const snackbarActions = unionize({
     OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number, kind?: SnackbarKind, link?: string}>(),
-    CLOSE_SNACKBAR: ofType<{}>(),
+    CLOSE_SNACKBAR: ofType<{}|null>(),
     SHIFT_MESSAGES: ofType<{}>()
 });
 
diff --git a/src/store/snackbar/snackbar-reducer.ts b/src/store/snackbar/snackbar-reducer.ts
index e367ac5f..c3fcfb07 100644
--- a/src/store/snackbar/snackbar-reducer.ts
+++ b/src/store/snackbar/snackbar-reducer.ts
@@ -32,10 +32,10 @@ export const snackbarReducer = (state = initialState, action: SnackbarAction) =>
         CLOSE_SNACKBAR: (payload) => {
             let newMessages: any = [...state.messages];// state.messages.filter(({ message }) => message !== payload);
 
-            if (JSON.stringify(payload) === '{}') {
+            if (payload === undefined || JSON.stringify(payload) === '{}') {
                 newMessages.pop();
             } else {
-                newMessages = state.messages.filter(({ message }) => message !== payload);
+                newMessages = state.messages.filter((message, index) => index !== payload);
             }
 
             return {
diff --git a/src/views-components/snackbar/snackbar.tsx b/src/views-components/snackbar/snackbar.tsx
index 2aa60709..f3d3368b 100644
--- a/src/views-components/snackbar/snackbar.tsx
+++ b/src/views-components/snackbar/snackbar.tsx
@@ -43,9 +43,9 @@ const mapStateToProps = (state: RootState): SnackbarDataProps => {
 };
 
 const mapDispatchToProps = (dispatch: Dispatch): SnackbarEventProps => ({
-    onClose: (event: any, reason: string, message: '') => {
+    onClose: (event: any, reason: string, id: undefined) => {
         if (reason !== "clickaway") {
-            dispatch(snackbarActions.CLOSE_SNACKBAR(message));
+            dispatch(snackbarActions.CLOSE_SNACKBAR(id));
         }
     },
     onExited: () => {
@@ -112,11 +112,11 @@ export const Snackbar = withStyles(styles)(connect(mapStateToProps, mapDispatchT
                 autoHideDuration={props.autoHideDuration}>
                 <div data-cy="snackbar">
                     {
-                         props.messages.map(message => {
+                         props.messages.map((message, index) => {
                             const [Icon, cssClass] = variants[message.kind];
 
                             return <SnackbarContent
-                                key={message.message}
+                                key={`${index}-${message.message}`}
                                 className={classNames(cssClass, classes.snackbarContent)}
                                 aria-describedby="client-snackbar"
                                 message={
@@ -125,7 +125,7 @@ export const Snackbar = withStyles(styles)(connect(mapStateToProps, mapDispatchT
                                         {message.message}
                                     </span>
                                 }
-                                action={actions(message, props.onClick, props.onClose, classes)}
+                                action={actions(message, props.onClick, props.onClose, classes, index)}
                             />
                          })
                     }
@@ -135,13 +135,13 @@ export const Snackbar = withStyles(styles)(connect(mapStateToProps, mapDispatchT
     }
 ));
 
-const actions = (props: SnackbarMessage, onClick, onClose, classes) => {
+const actions = (props: SnackbarMessage, onClick, onClose, classes, index) => {
     const actions = [
         <IconButton
             key="close"
             aria-label="Close"
             color="inherit"
-            onClick={e => onClose && onClose(e, '', props.message)}>
+            onClick={e => onClose && onClose(e, '', index)}>
             <CloseIcon className={classes.icon} />
         </IconButton>
     ];

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list