[ARVADOS-WORKBENCH2] updated: 1.2.0-442-g4cddd6b

Git user git at public.curoverse.com
Thu Sep 27 10:06:01 EDT 2018


Summary of changes:
 src/components/data-explorer/data-explorer.tsx     |   7 +-
 src/index.tsx                                      |   2 +
 src/store/workbench/workbench-actions.ts           |   2 +-
 .../workflow-panel/workflow-middleware-service.ts  |   2 +-
 src/store/workflow-panel/workflow-panel-actions.ts |  12 +-
 .../current-token-dialog/current-token-dialog.tsx  |   1 -
 src/views-components/data-explorer/renderers.tsx   |  35 +++--
 ...{workflow-panel.tsx => workflow-panel-view.tsx} |  55 +++-----
 src/views/workflow-panel/workflow-panel.tsx        | 145 ++-------------------
 9 files changed, 74 insertions(+), 187 deletions(-)
 copy src/views/workflow-panel/{workflow-panel.tsx => workflow-panel-view.tsx} (68%)

       via  4cddd6be7314d0ab3c387b5dcc909780a468410c (commit)
      from  a37c2265b5f60351bc1f50c22e74650a79110319 (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 4cddd6be7314d0ab3c387b5dcc909780a468410c
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Thu Sep 27 16:05:40 2018 +0200

    cr chagnes
    
    Feature #13857
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 59f4dbe..d7abde7 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -12,7 +12,7 @@ import { DataTableFilterItem } from '../data-table-filters/data-table-filters';
 import { SearchInput } from '../search-input/search-input';
 import { ArvadosTheme } from "~/common/custom-theme";
 
-type CssRules = 'searchBox' | "toolbar";
+type CssRules = 'searchBox' | "toolbar" | "root";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     searchBox: {
@@ -21,6 +21,9 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     toolbar: {
         paddingTop: theme.spacing.unit * 2
     },
+    root: {
+        height: '100%'
+    }
 });
 
 interface DataExplorerDataProps<T> {
@@ -66,7 +69,7 @@ export const DataExplorer = withStyles(styles)(
                 items, itemsAvailable, onRowClick, onRowDoubleClick, classes,
                 dataTableDefaultView
             } = this.props;
-            return <Paper>
+            return <Paper className={classes.root}>
                 <Toolbar className={classes.toolbar}>
                     <Grid container justify="space-between" wrap="nowrap" alignItems="center">
                         <div className={classes.searchBox}>
diff --git a/src/index.tsx b/src/index.tsx
index f456c99..f81e9da 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -38,6 +38,7 @@ import { addRouteChangeHandlers } from './routes/route-change-handlers';
 import { setCurrentTokenDialogApiHost } from '~/store/current-token-dialog/current-token-dialog-actions';
 import { processResourceActionSet } from './views-components/context-menu/action-sets/process-resource-action-set';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
+import { setUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions';
 
 const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
 const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
@@ -76,6 +77,7 @@ fetchConfig()
         store.subscribe(initListener(history, store, services, config));
         store.dispatch(initAuth());
         store.dispatch(setCurrentTokenDialogApiHost(apiHost));
+        store.dispatch(setUuidPrefix(config.uuidPrefix));
 
         const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props} />;
         const MainPanelComponent = (props: any) => <MainPanel buildInfo={buildInfo} {...props} />;
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index 5440fc9..01b5b92 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -40,7 +40,7 @@ import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-wi
 import { loadSharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel-actions';
 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
-import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel';
+import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { getProgressIndicator } from '../progress-indicator/progress-indicator-reducer';
 
diff --git a/src/store/workflow-panel/workflow-middleware-service.ts b/src/store/workflow-panel/workflow-middleware-service.ts
index 7fa2dd4..d9ff6ad 100644
--- a/src/store/workflow-panel/workflow-middleware-service.ts
+++ b/src/store/workflow-panel/workflow-middleware-service.ts
@@ -11,7 +11,7 @@ import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explor
 import { updateResources } from '~/store/resources/resources-actions';
 import { FilterBuilder } from '~/services/api/filter-builder';
 import { SortDirection } from '~/components/data-table/data-column';
-import { WorkflowPanelColumnNames } from '~/views/workflow-panel/workflow-panel';
+import { WorkflowPanelColumnNames } from '~/views/workflow-panel/workflow-panel-view';
 import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
 import { WorkflowResource } from '~/models/workflow';
 import { ListResults } from '~/services/common-service/common-resource-service';
diff --git a/src/store/workflow-panel/workflow-panel-actions.ts b/src/store/workflow-panel/workflow-panel-actions.ts
index 733fab1..aa79347 100644
--- a/src/store/workflow-panel/workflow-panel-actions.ts
+++ b/src/store/workflow-panel/workflow-panel-actions.ts
@@ -6,11 +6,21 @@ import { Dispatch } from 'redux';
 import { RootState } from '~/store/store';
 import { ServiceRepository } from '~/services/services';
 import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
+import { propertiesActions } from '~/store/properties/properties-actions';
 
 export const WORKFLOW_PANEL_ID = "workflowPanel";
+const UUID_PREFIX_PROPERTY_NAME = 'uuidPrefix';
+
 export const workflowPanelActions = bindDataExplorerActions(WORKFLOW_PANEL_ID);
 
 export const loadWorkflowPanel = () =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(workflowPanelActions.REQUEST_ITEMS());
-    };
\ No newline at end of file
+    };
+
+export const setUuidPrefix = (uuidPrefix: string) =>
+    propertiesActions.SET_PROPERTY({ key: UUID_PREFIX_PROPERTY_NAME, value: uuidPrefix });
+
+export const getUuidPrefix = (state: RootState) =>{
+    return state.properties.uuidPrefix;
+};
\ No newline at end of file
diff --git a/src/views-components/current-token-dialog/current-token-dialog.tsx b/src/views-components/current-token-dialog/current-token-dialog.tsx
index ba6c325..d2acccb 100644
--- a/src/views-components/current-token-dialog/current-token-dialog.tsx
+++ b/src/views-components/current-token-dialog/current-token-dialog.tsx
@@ -10,7 +10,6 @@ import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { compose } from 'redux';
 import { connect } from 'react-redux';
 import { CurrentTokenDialogData, getCurrentTokenDialogData } from '~/store/current-token-dialog/current-token-dialog-actions';
-import { RootState } from '~/store/store';
 import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet';
 
 type CssRules = 'link' | 'paper' | 'button';
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 39fc536..12e1be7 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -17,7 +17,8 @@ import { getProcess, Process, getProcessStatus, getProcessStatusColor } from '~/
 import { ArvadosTheme } from '~/common/custom-theme';
 import { compose } from 'redux';
 import { WorkflowResource } from '~/models/workflow';
-import { ResourceStatus } from '~/views/workflow-panel/workflow-panel';
+import { ResourceStatus } from '~/views/workflow-panel/workflow-panel-view';
+import { getUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions';
 
 export const renderName = (item: { name: string; uuid: string, kind: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
@@ -61,8 +62,6 @@ export const renderDate = (date?: string) => {
     return <Typography noWrap style={{ minWidth: '100px' }}>{formatDate(date)}</Typography>;
 };
 
-export const PublicUuid = 'qr1hi-tpzed-anonymouspublic';
-
 export const renderWorkflowName = (item: { name: string; uuid: string, kind: string, ownerUuid: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
         <Grid item>
@@ -81,11 +80,15 @@ export const RosurceWorkflowName = connect(
         return resource || { name: '', uuid: '', kind: '', ownerUuid: '' };
     })(renderWorkflowName);
 
+const getPublicUuid = (uuidPrefix: string) => {
+    return `${uuidPrefix}-tpzed-anonymouspublic`;
+};
+
 // do share onClick
-export const resourceShare = (props: { ownerUuid: string }) => {
+export const resourceShare = (uuidPrefix: string, ownerUuid?: string) => {
     return <Tooltip title="Share">
         <IconButton onClick={() => undefined}>
-            {props.ownerUuid === PublicUuid ? <ShareIcon /> : null}
+            {ownerUuid === getPublicUuid(uuidPrefix) ? <ShareIcon /> : null}
         </IconButton>
     </Tooltip>;
 };
@@ -93,11 +96,15 @@ export const resourceShare = (props: { ownerUuid: string }) => {
 export const ResourceShare = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<WorkflowResource>(props.uuid)(state.resources);
-        return resource || { ownerUuid: '' };
-    })(resourceShare);
-
-export const renderWorkflowStatus = (ownerUuid?: string) => {
-    if (ownerUuid === PublicUuid) {
+        const uuidPrefix = getUuidPrefix(state);
+        return {
+            ownerUuid: resource ? resource.ownerUuid : '',
+            uuidPrefix
+        };
+    })((props: { ownerUuid?: string, uuidPrefix: string }) => resourceShare(props.uuidPrefix, props.ownerUuid));
+
+export const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => {
+    if (ownerUuid === getPublicUuid(uuidPrefix)) {
         return renderStatus(ResourceStatus.PUBLIC);
     } else {
         return renderStatus(ResourceStatus.PRIVATE);
@@ -110,8 +117,12 @@ const renderStatus = (status: string) =>
 export const ResourceWorkflowStatus = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<WorkflowResource>(props.uuid)(state.resources);
-        return { ownerUuid: resource ? resource.ownerUuid : '' };
-    })((props: { ownerUuid?: string }) => renderWorkflowStatus(props.ownerUuid));
+        const uuidPrefix = getUuidPrefix(state);
+        return {
+            ownerUuid: resource ? resource.ownerUuid : '',
+            uuidPrefix
+        };
+    })((props: { ownerUuid?: string, uuidPrefix: string }) => renderWorkflowStatus(props.uuidPrefix, props.ownerUuid));
 
 export const ResourceLastModifiedDate = connect(
     (state: RootState, props: { uuid: string }) => {
diff --git a/src/views/workflow-panel/workflow-panel.tsx b/src/views/workflow-panel/workflow-panel-view.tsx
similarity index 68%
copy from src/views/workflow-panel/workflow-panel.tsx
copy to src/views/workflow-panel/workflow-panel-view.tsx
index 3d15d4f..8a29cb7 100644
--- a/src/views/workflow-panel/workflow-panel.tsx
+++ b/src/views/workflow-panel/workflow-panel-view.tsx
@@ -4,10 +4,7 @@
 
 import * as React from 'react';
 import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { connect, DispatchProp } from 'react-redux';
-import { RootState } from '~/store/store';
 import { WorkflowIcon } from '~/components/icon/icon';
-import { ResourcesState } from '~/store/resources/resources';
 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
 import { WORKFLOW_PANEL_ID } from '~/store/workflow-panel/workflow-panel-actions';
 import {
@@ -21,8 +18,6 @@ import { DataColumns } from '~/components/data-table/data-table';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
 import { Grid } from '@material-ui/core';
 import { WorkflowDetailsCard } from './workflow-description-card';
-import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
-import { navigateTo } from '~/store/navigation/navigation-action';
 
 export enum WorkflowPanelColumnNames {
     NAME = "Name",
@@ -36,7 +31,8 @@ export interface WorkflowPanelFilter extends DataTableFilterItem {
 }
 
 interface WorkflowPanelDataProps {
-    resources: ResourcesState;
+    handleRowDoubleClick: any;
+    handleRowClick: any;
 }
 
 export enum ResourceStatus {
@@ -107,35 +103,18 @@ export const workflowPanelColumns: DataColumns<string, WorkflowPanelFilter> = [
     }
 ];
 
-type WorkflowPanelProps = WorkflowPanelDataProps & DispatchProp;
-
-export const WorkflowPanel = connect((state: RootState) => ({
-    resources: state.resources
-}))(
-    class extends React.Component<WorkflowPanelProps> {
-        render() {
-            return <Grid container spacing={16}>
-                <Grid item xs={6}>
-                    <DataExplorer
-                        id={WORKFLOW_PANEL_ID}
-                        onRowClick={this.handleRowClick}
-                        onRowDoubleClick={this.handleRowDoubleClick}
-                        contextMenuColumn={false}
-                        dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
-                </Grid>
-                <Grid item xs={6}>
-                    <WorkflowDetailsCard />
-                </Grid>
-            </Grid>;
-        }
-
-
-        handleRowDoubleClick = (uuid: string) => {
-            this.props.dispatch<any>(navigateTo(uuid));
-        }
-
-        handleRowClick = (uuid: string) => {
-            this.props.dispatch(loadDetailsPanel(uuid));
-        }
-    }
-);
\ No newline at end of file
+export const WorkflowPanelView = ({...props}) => {
+    return <Grid container spacing={16}>
+        <Grid item xs={6}>
+            <DataExplorer
+                id={WORKFLOW_PANEL_ID}
+                onRowClick={props.handleRowClick}
+                onRowDoubleClick={props.handleRowDoubleClick}
+                contextMenuColumn={false}
+                dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
+        </Grid>
+        <Grid item xs={6}>
+            <WorkflowDetailsCard />
+        </Grid>
+    </Grid>;
+};
\ No newline at end of file
diff --git a/src/views/workflow-panel/workflow-panel.tsx b/src/views/workflow-panel/workflow-panel.tsx
index 3d15d4f..279097d 100644
--- a/src/views/workflow-panel/workflow-panel.tsx
+++ b/src/views/workflow-panel/workflow-panel.tsx
@@ -2,140 +2,23 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { connect, DispatchProp } from 'react-redux';
-import { RootState } from '~/store/store';
-import { WorkflowIcon } from '~/components/icon/icon';
-import { ResourcesState } from '~/store/resources/resources';
-import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
-import { WORKFLOW_PANEL_ID } from '~/store/workflow-panel/workflow-panel-actions';
-import {
-    ResourceLastModifiedDate,
-    RosurceWorkflowName,
-    ResourceWorkflowStatus,
-    ResourceShare
-} from "~/views-components/data-explorer/renderers";
-import { SortDirection } from '~/components/data-table/data-column';
-import { DataColumns } from '~/components/data-table/data-table';
-import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
-import { Grid } from '@material-ui/core';
-import { WorkflowDetailsCard } from './workflow-description-card';
-import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
+import * as React from "react";
+import { Dispatch } from "redux";
+import { connect } from "react-redux";
 import { navigateTo } from '~/store/navigation/navigation-action';
+import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
+import { WorkflowPanelView } from '~/views/workflow-panel/workflow-panel-view';
 
-export enum WorkflowPanelColumnNames {
-    NAME = "Name",
-    AUTHORISATION = "Authorisation",
-    LAST_MODIFIED = "Last modified",
-    SHARE = 'Share'
-}
-
-export interface WorkflowPanelFilter extends DataTableFilterItem {
-    type: ResourceStatus;
-}
-
-interface WorkflowPanelDataProps {
-    resources: ResourcesState;
-}
-
-export enum ResourceStatus {
-    PUBLIC = "Public",
-    PRIVATE = "Private",
-    SHARED = "Shared"
-}
-
-const resourceStatus = (type: string) => {
-    switch (type) {
-        case ResourceStatus.PUBLIC:
-            return "Public";
-        case ResourceStatus.PRIVATE:
-            return "Private";
-        case ResourceStatus.SHARED:
-            return "Shared";
-        default:
-            return "Unknown";
-    }
-};
+const mapDispatchToProps = (dispatch: Dispatch) => ({
 
-export const workflowPanelColumns: DataColumns<string, WorkflowPanelFilter> = [
-    {
-        name: WorkflowPanelColumnNames.NAME,
-        selected: true,
-        configurable: true,
-        sortDirection: SortDirection.ASC,
-        filters: [],
-        render: (uuid: string) => <RosurceWorkflowName uuid={uuid} />
+    handleRowDoubleClick: (uuid: string) => {
+        dispatch<any>(navigateTo(uuid));
     },
-    {
-        name: WorkflowPanelColumnNames.AUTHORISATION,
-        selected: true,
-        configurable: true,
-        filters: [
-            {
-                name: resourceStatus(ResourceStatus.PUBLIC),
-                selected: true,
-                type: ResourceStatus.PUBLIC
-            },
-            {
-                name: resourceStatus(ResourceStatus.PRIVATE),
-                selected: true,
-                type: ResourceStatus.PRIVATE
-            },
-            {
-                name: resourceStatus(ResourceStatus.SHARED),
-                selected: true,
-                type: ResourceStatus.SHARED
-            }
-        ],
-        render: (uuid: string) => <ResourceWorkflowStatus uuid={uuid} />,
-    },
-    {
-        name: WorkflowPanelColumnNames.LAST_MODIFIED,
-        selected: true,
-        configurable: true,
-        sortDirection: SortDirection.NONE,
-        filters: [],
-        render: (uuid: string) => <ResourceLastModifiedDate uuid={uuid} />
-    },
-    {
-        name: '',
-        selected: true,
-        configurable: false,
-        filters: [],
-        render: (uuid: string) => <ResourceShare uuid={uuid} />
+    
+    handleRowClick: (uuid: string) => {
+        dispatch(loadDetailsPanel(uuid));
     }
-];
-
-type WorkflowPanelProps = WorkflowPanelDataProps & DispatchProp;
-
-export const WorkflowPanel = connect((state: RootState) => ({
-    resources: state.resources
-}))(
-    class extends React.Component<WorkflowPanelProps> {
-        render() {
-            return <Grid container spacing={16}>
-                <Grid item xs={6}>
-                    <DataExplorer
-                        id={WORKFLOW_PANEL_ID}
-                        onRowClick={this.handleRowClick}
-                        onRowDoubleClick={this.handleRowDoubleClick}
-                        contextMenuColumn={false}
-                        dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
-                </Grid>
-                <Grid item xs={6}>
-                    <WorkflowDetailsCard />
-                </Grid>
-            </Grid>;
-        }
+});
 
-
-        handleRowDoubleClick = (uuid: string) => {
-            this.props.dispatch<any>(navigateTo(uuid));
-        }
-
-        handleRowClick = (uuid: string) => {
-            this.props.dispatch(loadDetailsPanel(uuid));
-        }
-    }
-);
\ No newline at end of file
+export const WorkflowPanel= connect(undefined, mapDispatchToProps)(
+    (props) => <WorkflowPanelView {...props}/>);
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list