[arvados-workbench2] updated: 2.4.0-356-g7f697d53

git repository hosting git at public.arvados.org
Tue Nov 29 22:38:23 UTC 2022


Summary of changes:
 src/common/formatters.ts                         |   9 --
 src/models/container-request.ts                  |  64 +++++------
 src/services/groups-service/groups-service.ts    | 130 +++++++++++++----------
 src/views-components/data-explorer/renderers.tsx |  35 +++---
 src/views/project-panel/project-panel.tsx        |  19 +++-
 5 files changed, 141 insertions(+), 116 deletions(-)

       via  7f697d536ed03c19844677e027bbab17e9b5e5f6 (commit)
      from  39abd28010044c94c47d4ad5fdf39a352eef6cff (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 7f697d536ed03c19844677e027bbab17e9b5e5f6
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Tue Nov 29 17:32:28 2022 -0500

    Container req state up & properties removed
    
    Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/common/formatters.ts b/src/common/formatters.ts
index c03bf04b..b4b9bc41 100644
--- a/src/common/formatters.ts
+++ b/src/common/formatters.ts
@@ -129,12 +129,3 @@ export const formatContainerCost = (cost: number): string => {
     return `$${rounded}`;
   }
 };
-
-export const formatObjectProperties = (untypedObj: Object) => {
-  type kVPair = [string, string];
-  let formattedObject: Array<kVPair> = [];
-  for (const key in untypedObj) {
-    formattedObject.push([key, untypedObj[key]]);
-  }
-  return formattedObject;
-};
diff --git a/src/models/container-request.ts b/src/models/container-request.ts
index dc6bd84f..90e7dea9 100644
--- a/src/models/container-request.ts
+++ b/src/models/container-request.ts
@@ -2,41 +2,43 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Resource, ResourceKind, ResourceWithProperties } from "./resource";
-import { MountType } from "models/mount-types";
+import { Resource, ResourceKind, ResourceWithProperties } from './resource';
+import { MountType } from 'models/mount-types';
 import { RuntimeConstraints } from './runtime-constraints';
 import { SchedulingParameters } from './scheduling-parameters';
 
 export enum ContainerRequestState {
-    UNCOMMITTED = "Uncommitted",
-    COMMITTED = "Committed",
-    FINAL = "Final"
+  UNCOMMITTED = 'Uncommitted',
+  COMMITTED = 'Committed',
+  FINAL = 'Final',
 }
 
-export interface ContainerRequestResource extends Resource, ResourceWithProperties {
-    kind: ResourceKind.CONTAINER_REQUEST;
-    name: string;
-    description: string;
-    state: ContainerRequestState;
-    requestingContainerUuid: string | null;
-    cumulativeCost: number;
-    containerUuid: string | null;
-    containerCountMax: number;
-    mounts: {[path: string]: MountType};
-    runtimeConstraints: RuntimeConstraints;
-    schedulingParameters: SchedulingParameters;
-    containerImage: string;
-    environment: any;
-    cwd: string;
-    command: string[];
-    outputPath: string;
-    outputName: string;
-    outputTtl: number;
-    priority: number | null;
-    expiresAt: string;
-    useExisting: boolean;
-    logUuid: string | null;
-    outputUuid: string | null;
-    filters: string;
-    containerCount: number;
+export interface ContainerRequestResource
+  extends Resource,
+    ResourceWithProperties {
+  kind: ResourceKind.CONTAINER_REQUEST;
+  name: string;
+  description: string;
+  state: ContainerRequestState;
+  requestingContainerUuid: string | null;
+  cumulativeCost: number;
+  containerUuid: string | null;
+  containerCountMax: number;
+  mounts: { [path: string]: MountType };
+  runtimeConstraints: RuntimeConstraints;
+  schedulingParameters: SchedulingParameters;
+  containerImage: string;
+  environment: any;
+  cwd: string;
+  command: string[];
+  outputPath: string;
+  outputName: string;
+  outputTtl: number;
+  priority: number | null;
+  expiresAt: string;
+  useExisting: boolean;
+  logUuid: string | null;
+  outputUuid: string | null;
+  filters: string;
+  containerCount: number;
 }
diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index dc6a798c..1e9078d9 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -2,79 +2,95 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { snakeCase, camelCase } from "lodash";
+import { snakeCase, camelCase } from 'lodash';
 import { CommonResourceService } from 'services/common-service/common-resource-service';
-import { ListResults, ListArguments } from 'services/common-service/common-service';
-import { AxiosInstance, AxiosRequestConfig } from "axios";
-import { CollectionResource } from "models/collection";
-import { ProjectResource } from "models/project";
-import { ProcessResource } from "models/process";
-import { WorkflowResource } from "models/workflow";
-import { TrashableResourceService } from "services/common-service/trashable-resource-service";
-import { ApiActions } from "services/api/api-actions";
-import { GroupResource } from "models/group";
-import { Session } from "models/session";
+import {
+  ListResults,
+  ListArguments,
+} from 'services/common-service/common-service';
+import { AxiosInstance, AxiosRequestConfig } from 'axios';
+import { CollectionResource } from 'models/collection';
+import { ProjectResource } from 'models/project';
+import { ProcessResource } from 'models/process';
+import { WorkflowResource } from 'models/workflow';
+import { TrashableResourceService } from 'services/common-service/trashable-resource-service';
+import { ApiActions } from 'services/api/api-actions';
+import { GroupResource } from 'models/group';
+import { Session } from 'models/session';
 
 export interface ContentsArguments {
-    limit?: number;
-    offset?: number;
-    order?: string;
-    filters?: string;
-    recursive?: boolean;
-    includeTrash?: boolean;
-    excludeHomeProject?: boolean;
+  limit?: number;
+  offset?: number;
+  order?: string;
+  filters?: string;
+  recursive?: boolean;
+  includeTrash?: boolean;
+  excludeHomeProject?: boolean;
 }
 
 export interface SharedArguments extends ListArguments {
-    include?: string;
+  include?: string;
 }
 
 export type GroupContentsResource =
-    CollectionResource |
-    ProjectResource |
-    ProcessResource |
-    WorkflowResource;
+  | CollectionResource
+  | ProjectResource
+  | ProcessResource
+  | WorkflowResource;
 
-export class GroupsService<T extends GroupResource = GroupResource> extends TrashableResourceService<T> {
+export class GroupsService<
+  T extends GroupResource = GroupResource
+> extends TrashableResourceService<T> {
+  constructor(serverApi: AxiosInstance, actions: ApiActions) {
+    super(serverApi, 'groups', actions);
+  }
 
-    constructor(serverApi: AxiosInstance, actions: ApiActions) {
-        super(serverApi, "groups", actions);
-    }
+  async contents(
+    uuid: string,
+    args: ContentsArguments = {},
+    session?: Session
+  ): Promise<ListResults<GroupContentsResource>> {
+    const { filters, order, ...other } = args;
+    const params = {
+      ...other,
+      filters: filters ? `[${filters}]` : undefined,
+      order: order ? order : undefined,
+    };
+    const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
 
-    async contents(uuid: string, args: ContentsArguments = {}, session?: Session): Promise<ListResults<GroupContentsResource>> {
-        const { filters, order, ...other } = args;
-        const params = {
-            ...other,
-            filters: filters ? `[${filters}]` : undefined,
-            order: order ? order : undefined
-        };
-        const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
+    const cfg: AxiosRequestConfig = {
+      params: CommonResourceService.mapKeys(snakeCase)(params),
+    };
+    if (session) {
+      cfg.baseURL = session.baseUrl;
+      cfg.headers = { Authorization: 'Bearer ' + session.token };
+    }
 
-        const cfg: AxiosRequestConfig = { params: CommonResourceService.mapKeys(snakeCase)(params) };
-        if (session) {
-            cfg.baseURL = session.baseUrl;
-            cfg.headers = { 'Authorization': 'Bearer ' + session.token };
-        }
+    const response = await CommonResourceService.defaultResponse(
+      this.serverApi.get(this.resourceType + pathUrl, cfg),
+      this.actions,
+      false
+    );
 
-        const response = await CommonResourceService.defaultResponse(
-            this.serverApi.get(this.resourceType + pathUrl, cfg), this.actions, false
-        );
+    return {
+      ...TrashableResourceService.mapKeys(camelCase)(response),
+      clusterId: session && session.clusterId,
+    };
+  }
 
-        return { ...TrashableResourceService.mapKeys(camelCase)(response), clusterId: session && session.clusterId };
-    }
-
-    shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .get(this.resourceType + '/shared', { params }),
-            this.actions
-        );
-    }
+  shared(
+    params: SharedArguments = {}
+  ): Promise<ListResults<GroupContentsResource>> {
+    return CommonResourceService.defaultResponse(
+      this.serverApi.get(this.resourceType + '/shared', { params }),
+      this.actions
+    );
+  }
 }
 
 export enum GroupContentsResourcePrefix {
-    COLLECTION = "collections",
-    PROJECT = "groups",
-    PROCESS = "container_requests",
-    WORKFLOW = "workflows"
+  COLLECTION = 'collections',
+  PROJECT = 'groups',
+  PROCESS = 'container_requests',
+  WORKFLOW = 'workflows',
 }
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 1623f176..17bd3f2a 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -30,7 +30,7 @@ import {
     SetupIcon,
     InactiveIcon,
 } from 'components/icon/icon';
-import { formatDate, formatFileSize, formatTime, formatObjectProperties} from 'common/formatters';
+import { formatDate, formatFileSize, formatTime } from 'common/formatters';
 import { resourceLabel } from 'common/labels';
 import { connect, DispatchProp } from 'react-redux';
 import { RootState } from 'store/store';
@@ -61,6 +61,7 @@ import { getUserUuid } from 'common/getuser';
 import { VirtualMachinesResource } from 'models/virtual-machines';
 import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar';
 import { ProjectResource } from 'models/project';
+import {ContainerRequestResource} from 'models/container-request'
 
 const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
 
@@ -664,6 +665,14 @@ export const ResourceWorkflowStatus = connect(
         };
     })((props: { ownerUuid?: string, uuidPrefix: string }) => renderWorkflowStatus(props.uuidPrefix, props.ownerUuid));
 
+const renderProcessState = (processState: string) => <Typography>{processState}</Typography>
+
+export const ResourceProcessState = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<ContainerRequestResource>(props.uuid)(state.resources);
+        return { state: resource?.state ? resource.state: '' };
+    })((props: { state: string }) => renderProcessState(props.state));
+
 export const ResourceCreatedAtDate = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
@@ -726,23 +735,21 @@ export const ResourceOwnerName = connect(
 export const ResourceUUID = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<CollectionResource>(props.uuid)(state.resources);
-        console.log('COLLECTION_RESOIRCE', resource)
         return { uuid: resource ? resource.uuid : '' };
     })((props: { uuid: string }) => renderUuid({uuid: props.uuid}));
-
-const renderMetadata = (metadata:any) => {
-    return <>{formatObjectProperties(metadata).map((property, i)=>
-        <Typography key={i} noWrap>{property[0]}: {property[1]}</Typography>
-    )}</>
-}
-
-export const ResourceMetadata = connect(
+    
+const renderPortableDataHash = (portableDataHash:string | null) => 
+    <Typography noWrap>
+        {portableDataHash ? <>{portableDataHash}
+        <CopyToClipboardSnackbar value={portableDataHash} /></> : '-' }
+    </Typography>
+    
+export const ResourcePortableDataHash = connect(
     (state: RootState, props: { uuid: string }) => {
         const resource = getResource<CollectionResource>(props.uuid)(state.resources);
-        const metadata = resource && Object.keys(resource.properties).length ? resource.properties : {}
-        if(resource && resource.portableDataHash) metadata['Portable Data Hash'] = resource.portableDataHash
-        return { properties: metadata };
-    })((props: { properties: string }) => renderMetadata(props.properties));
+        // console.log('COLLECTION_RESOIRCE', resource)
+        return { portableDataHash: resource ? resource.portableDataHash : '' };    
+    })((props: { portableDataHash: string }) => renderPortableDataHash(props.portableDataHash));
 
 const renderVersion = (version: number) =>{
     return <Typography>{version ?? '-'}</Typography>
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 4723e409..465178e7 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -25,7 +25,8 @@ import {
     ProcessStatus,
     ResourceType,
     ResourceUUID,
-    ResourceMetadata,
+    ResourceProcessState,
+    ResourcePortableDataHash,
     ResourceVersion,
     ResourceDescription,
     ResourceOwnerWithName
@@ -74,12 +75,13 @@ export enum ProjectPanelColumnNames {
     FILE_SIZE = "File size",
     FILE_COUNT = "File count",
     UUID = "UUID",
+    STATE = 'State',
     CREATED_AT = "Date created",
     LAST_MODIFIED = "Last modified",
     TRASH_AT = "Trash at",
     DELETE_AT = "Delete at",
     DESCRIPTION = "Description",
-    METADATA = "Metadata",
+    PORTABLE_DATA_HASH = "Portable Data Hash",
     VERSION = "Version"
 }
 
@@ -140,11 +142,18 @@ export const projectPanelColumns: DataColumns<string> = [
         render: uuid => <ResourceUUID uuid={uuid}/>
     },
     {
-        name: ProjectPanelColumnNames.METADATA,
-        selected: false,
+        name: ProjectPanelColumnNames.STATE,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceProcessState uuid={uuid}/>
+    },
+    {
+        name: ProjectPanelColumnNames.PORTABLE_DATA_HASH,
+        selected: true,
         configurable: true,
         filters: createTree(),
-        render: uuid => <ResourceMetadata uuid={uuid}/>
+        render: uuid => <ResourcePortableDataHash uuid={uuid}/>
     },
     {
         name: ProjectPanelColumnNames.CREATED_AT,

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list