[ARVADOS-WORKBENCH2] updated: 1.4.1-206-gbee25d31

Git user git at public.arvados.org
Fri Jan 10 20:26:20 UTC 2020


Summary of changes:
 .../project-panel-middleware-service.ts            |  4 +-
 src/views-components/data-explorer/renderers.tsx   | 47 ++++++++++++++++++----
 src/websocket/websocket.ts                         |  6 ++-
 3 files changed, 47 insertions(+), 10 deletions(-)

       via  bee25d314ff25acbcdccc5a8ec56c93377e2cde1 (commit)
      from  fd5e5f64dd771aef39c6fe48f6e28e4b1470024f (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 bee25d314ff25acbcdccc5a8ec56c93377e2cde1
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Jan 10 15:25:17 2020 -0500

    15672: Update container runtime every 5 seconds
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index 3a42d07e..d4b2416e 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -17,7 +17,7 @@ import { OrderBuilder, OrderDirection } from "~/services/api/order-builder";
 import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
 import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/groups-service/groups-service";
 import { updateFavorites } from "~/store/favorites/favorites-actions";
-import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED, projectPanelActions } from '~/store/project-panel/project-panel-action';
+import { IS_PROJECT_PANEL_TRASHED, projectPanelActions, getProjectPanelCurrentUuid } from '~/store/project-panel/project-panel-action';
 import { Dispatch, MiddlewareAPI } from "redux";
 import { ProjectResource } from "~/models/project";
 import { updateResources } from "~/store/resources/resources-actions";
@@ -40,7 +40,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
     async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
         const state = api.getState();
         const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
-        const projectUuid = getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
+        const projectUuid = getProjectPanelCurrentUuid(state);
         const isProjectTrashed = getProperty<string>(IS_PROJECT_PANEL_TRASHED)(state.properties);
         if (!projectUuid) {
             api.dispatch(projectPanelCurrentUuidIsNotSet());
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 7680f338..c118017d 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -35,9 +35,9 @@ const renderName = (dispatch: Dispatch, item: { name: string; uuid: string, kind
         </Grid>
         <Grid item>
             <Typography color="primary" style={{ width: 'auto', cursor: 'pointer' }} onClick={() => dispatch<any>(navigateTo(item.uuid))}>
-                { item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
+                {item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
                     ? <IllegalNamingWarning name={item.name} />
-                    : null }
+                    : null}
                 {item.name}
             </Typography>
         </Grid>
@@ -461,8 +461,41 @@ export const renderRunTime = (time: number) =>
         {formatTime(time, true)}
     </Typography>;
 
-export const ContainerRunTime = connect(
-    (state: RootState, props: { uuid: string }) => {
-        const process = getProcess(props.uuid)(state.resources);
-        return { time: process ? getProcessRuntime(process) : 0 };
-    })((props: { time: number }) => renderRunTime(props.time));
\ No newline at end of file
+interface ContainerRunTimeProps {
+    process: Process;
+}
+
+interface ContainerRunTimeState {
+    runtime: number;
+}
+
+export const ContainerRunTime = connect((state: RootState, props: { uuid: string }) => {
+    return { process: getProcess(props.uuid)(state.resources) };
+})(class extends React.Component<ContainerRunTimeProps, ContainerRunTimeState> {
+    private timer: any;
+
+    constructor(props: ContainerRunTimeProps) {
+        super(props);
+        this.state = { runtime: this.getRuntime() };
+    }
+
+    getRuntime() {
+        return this.props.process ? getProcessRuntime(this.props.process) : 0;
+    }
+
+    updateRuntime() {
+        this.setState({ runtime: this.getRuntime() });
+    }
+
+    componentDidMount() {
+        this.timer = setInterval(this.updateRuntime.bind(this), 5000);
+    }
+
+    componentWillUnmount() {
+        clearInterval(this.timer);
+    }
+
+    render() {
+        return renderRunTime(this.state.runtime);
+    }
+});
diff --git a/src/websocket/websocket.ts b/src/websocket/websocket.ts
index e367dba3..3e740256 100644
--- a/src/websocket/websocket.ts
+++ b/src/websocket/websocket.ts
@@ -15,6 +15,7 @@ import { addProcessLogsPanelItem } from '../store/process-logs-panel/process-log
 // import { FilterBuilder } from "~/services/api/filter-builder";
 import { subprocessPanelActions } from "~/store/subprocess-panel/subprocess-panel-actions";
 import { projectPanelActions } from "~/store/project-panel/project-panel-action";
+import { getProjectPanelCurrentUuid } from '~/store/project-panel/project-panel-action';
 
 export const initWebSocket = (config: Config, authService: AuthService, store: RootStore) => {
     if (config.websocketUrl) {
@@ -33,9 +34,12 @@ const messageListener = (store: RootStore) => (message: ResourceEventMessage) =>
                 if (store.getState().processPanel.containerRequestUuid === message.objectUuid) {
                     store.dispatch(loadProcess(message.objectUuid));
                 }
+            // fall through, this will happen for container requests as well.
             case ResourceKind.CONTAINER:
                 store.dispatch(subprocessPanelActions.REQUEST_ITEMS());
-                store.dispatch(projectPanelActions.REQUEST_ITEMS());
+                if (message.objectOwnerUuid === getProjectPanelCurrentUuid(store.getState())) {
+                    store.dispatch(projectPanelActions.REQUEST_ITEMS());
+                }
                 return;
             default:
                 return;

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list