[arvados] updated: 2.7.0-5821-g37f7559e8d

git repository hosting git at public.arvados.org
Tue Jan 23 15:41:19 UTC 2024


Summary of changes:
 .../views/process-panel/process-io-card.test.tsx   | 32 ++++++++++++++++++----
 .../src/views/process-panel/process-io-card.tsx    |  8 ++++--
 2 files changed, 32 insertions(+), 8 deletions(-)

       via  37f7559e8d9a4df3515d78663b65b9220550457f (commit)
      from  e136acc6897312f1b82e47fe038aba806855988c (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 37f7559e8d9a4df3515d78663b65b9220550457f
Author: Stephen Smith <stephen at curii.com>
Date:   Tue Jan 23 10:40:24 2024 -0500

    21366: Display raw/JSON tab on subprocess even if empty while still guarding against undefined
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/services/workbench2/src/views/process-panel/process-io-card.test.tsx b/services/workbench2/src/views/process-panel/process-io-card.test.tsx
index a1ee7d61fa..292f6cccf7 100644
--- a/services/workbench2/src/views/process-panel/process-io-card.test.tsx
+++ b/services/workbench2/src/views/process-panel/process-io-card.test.tsx
@@ -5,11 +5,10 @@
 import React from 'react';
 import { mount, configure } from 'enzyme';
 import { combineReducers, createStore } from "redux";
-import { CircularProgress, MuiThemeProvider, Tab, TableBody, TableCell } from "@material-ui/core";
+import { CircularProgress, MuiThemeProvider, Tab, TableBody } from "@material-ui/core";
 import { CustomTheme } from 'common/custom-theme';
 import Adapter from "enzyme-adapter-react-16";
 import { Provider } from 'react-redux';
-import configureMockStore from 'redux-mock-store'
 import { ProcessIOCard, ProcessIOCardType } from './process-io-card';
 import { DefaultView } from "components/default-view/default-view";
 import { DefaultCodeSnippet } from "components/default-code-snippet/default-code-snippet";
@@ -17,8 +16,6 @@ import { ProcessOutputCollectionFiles } from './process-output-collection-files'
 import { MemoryRouter } from 'react-router-dom';
 
 
-const middlewares = [];
-const mockStore = configureMockStore(middlewares);
 jest.mock('views/process-panel/process-output-collection-files');
 configure({ adapter: new Adapter() });
 
@@ -208,7 +205,32 @@ describe('renderers', () => {
 
             // then
             expect(panel.find(CircularProgress).exists()).toBeFalsy();
-            expect(panel.find(Tab).length).toBe(1); // Empty raw is hidden in subprocesses
+            expect(panel.find(Tab).length).toBe(1); // Unloaded raw is hidden in subprocesses
+            expect(panel.find(ProcessOutputCollectionFiles).prop('currentItemUuid')).toBe(outputCollection);
+        });
+
+        it('shows empty subprocess raw', () => {
+            // when
+            const subprocess = {containerRequest: {requestingContainerUuid: 'xyz'}};
+            const outputCollection = '123456789';
+            let panel = mount(
+                <Provider store={store}>
+                    <MuiThemeProvider theme={CustomTheme}>
+                        <ProcessIOCard
+                            label={ProcessIOCardType.OUTPUT}
+                            process={subprocess} // Treat as a subprocess with outputUuid
+                            outputUuid={outputCollection}
+                            params={null}
+                            raw={{}}
+                        />
+                    </MuiThemeProvider>
+                </Provider>
+                );
+
+            // then
+            expect(panel.find(CircularProgress).exists()).toBeFalsy();
+            expect(panel.find(Tab).length).toBe(2); // Empty raw is visible in subprocesses
+            expect(panel.find(Tab).first().text()).toBe('Collection');
             expect(panel.find(ProcessOutputCollectionFiles).prop('currentItemUuid')).toBe(outputCollection);
         });
 
diff --git a/services/workbench2/src/views/process-panel/process-io-card.tsx b/services/workbench2/src/views/process-panel/process-io-card.tsx
index 393bde9667..6c745886c8 100644
--- a/services/workbench2/src/views/process-panel/process-io-card.tsx
+++ b/services/workbench2/src/views/process-panel/process-io-card.tsx
@@ -272,6 +272,8 @@ export const ProcessIOCard = withStyles(styles)(
 
             const hasRaw = !!(raw && Object.keys(raw).length > 0);
             const hasParams = !!(params && params.length > 0);
+            // isRawLoaded allows subprocess panel to display raw even if it's {}
+            const isRawLoaded = !!(raw && Object.keys(raw).length >= 0);
 
             // Subprocess
             const hasInputMounts = !!(label === ProcessIOCardType.INPUT && mounts && mounts.length);
@@ -422,7 +424,7 @@ export const ProcessIOCard = withStyles(styles)(
                                     >
                                         <CircularProgress />
                                     </Grid>
-                                ) : !subProcessLoading && (hasInputMounts || hasOutputCollecton || hasRaw) ? (
+                                ) : !subProcessLoading && (hasInputMounts || hasOutputCollecton || isRawLoaded) ? (
                                     <>
                                         <Tabs
                                             value={subProcTabState}
@@ -432,7 +434,7 @@ export const ProcessIOCard = withStyles(styles)(
                                         >
                                             {hasInputMounts && <Tab label="Collections" />}
                                             {hasOutputCollecton && <Tab label="Collection" />}
-                                            {hasRaw && <Tab label="JSON" />}
+                                            {isRawLoaded && <Tab label="JSON" />}
                                         </Tabs>
                                         <div className={classes.tableWrapper}>
                                             {subProcTabState === 0 && hasInputMounts && <ProcessInputMounts mounts={mounts || []} />}
@@ -457,7 +459,7 @@ export const ProcessIOCard = withStyles(styles)(
                                                     />
                                                 </>
                                             )}
-                                            {hasRaw && (subProcTabState === 1 || (!hasInputMounts && !hasOutputCollecton)) && (
+                                            {isRawLoaded && (subProcTabState === 1 || (!hasInputMounts && !hasOutputCollecton)) && (
                                                 <div className={classes.tableWrapper}>
                                                     <ProcessIORaw data={raw} />
                                                 </div>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list