Merge branch '19690-roject-column-options' closes #19690 Arvados-DCO-1.1-Signed-off...
authorLisa Knox <lisaknox83@gmail.com>
Tue, 13 Dec 2022 23:31:37 +0000 (18:31 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Wed, 14 Dec 2022 19:07:33 +0000 (14:07 -0500)
1  2 
src/common/config.ts
src/services/groups-service/groups-service.ts

index 65ee687c0d64b73109f2de477db6dc09945b80e5,724fb79542352482984667114cffa76c58a5142b..9319736784b81676c6c15fe931e5136b806d985a
@@@ -13,96 -14,95 +14,96 @@@ interface WorkbenchConfig 
  }
  
  export interface ClusterConfigJSON {
 -  API: {
 -    UnfreezeProjectRequiresAdmin: boolean;
 -  };
 -  ClusterID: string;
 -  RemoteClusters: {
 -    [key: string]: {
 -      ActivateUsers: boolean;
 -      Host: string;
 -      Insecure: boolean;
 -      Proxy: boolean;
 -      Scheme: string;
 +    API: {
 +        UnfreezeProjectRequiresAdmin: boolean
 +        MaxItemsPerResponse: number
 +    },
 +    ClusterID: string;
 +    RemoteClusters: {
 +        [key: string]: {
 +            ActivateUsers: boolean
 +            Host: string
 +            Insecure: boolean
 +            Proxy: boolean
 +            Scheme: string
 +        }
      };
-     Mail?: {
-         SupportEmailAddress: string;
 -  };
+   Mail?: {
+     SupportEmailAddress: string;
+   };
+   Services: {
+     Controller: {
+       ExternalURL: string;
      };
-     Services: {
-         Controller: {
-             ExternalURL: string
-         }
-         Workbench1: {
-             ExternalURL: string
-         }
-         Workbench2: {
-             ExternalURL: string
-         }
-         Websocket: {
-             ExternalURL: string
-         }
-         WebDAV: {
-             ExternalURL: string
-         },
-         WebDAVDownload: {
-             ExternalURL: string
-         },
-         WebShell: {
-             ExternalURL: string
-         }
+     Workbench1: {
+       ExternalURL: string;
      };
-     Workbench: {
-         DisableSharingURLsUI: boolean;
-         ArvadosDocsite: string;
-         FileViewersConfigURL: string;
-         WelcomePageHTML: string;
-         InactivePageHTML: string;
-         SSHHelpPageHTML: string;
-         SSHHelpHostSuffix: string;
-         SiteName: string;
-         IdleTimeout: string;
+     Workbench2: {
+       ExternalURL: string;
      };
-     Login: {
-         LoginCluster: string;
-         Google: {
-             Enable: boolean;
-         }
-         LDAP: {
-             Enable: boolean;
-         }
-         OpenIDConnect: {
-             Enable: boolean;
-         }
-         PAM: {
-             Enable: boolean;
-         }
-         SSO: {
-             Enable: boolean;
-         }
-         Test: {
-             Enable: boolean;
-         }
+     Websocket: {
+       ExternalURL: string;
      };
-     Collections: {
-         ForwardSlashNameSubstitution: string;
-         ManagedProperties?: {
-             [key: string]: {
-                 Function: string,
-                 Value: string,
-                 Protected?: boolean,
-             }
-         },
-         TrustAllContent: boolean
+     WebDAV: {
+       ExternalURL: string;
      };
-     Volumes: {
-         [key: string]: {
-             StorageClasses: {
-                 [key: string]: boolean;
-             }
-         }
+     WebDAVDownload: {
+       ExternalURL: string;
+     };
+     WebShell: {
+       ExternalURL: string;
+     };
+   };
+   Workbench: {
+     DisableSharingURLsUI: boolean;
+     ArvadosDocsite: string;
+     FileViewersConfigURL: string;
+     WelcomePageHTML: string;
+     InactivePageHTML: string;
+     SSHHelpPageHTML: string;
+     SSHHelpHostSuffix: string;
+     SiteName: string;
+     IdleTimeout: string;
+   };
+   Login: {
+     LoginCluster: string;
+     Google: {
+       Enable: boolean;
+     };
+     LDAP: {
+       Enable: boolean;
+     };
+     OpenIDConnect: {
+       Enable: boolean;
+     };
+     PAM: {
+       Enable: boolean;
      };
+     SSO: {
+       Enable: boolean;
+     };
+     Test: {
+       Enable: boolean;
+     };
+   };
+   Collections: {
+     ForwardSlashNameSubstitution: string;
+     ManagedProperties?: {
+       [key: string]: {
+         Function: string;
+         Value: string;
+         Protected?: boolean;
+       };
+     };
+     TrustAllContent: boolean;
+   };
+   Volumes: {
+     [key: string]: {
+       StorageClasses: {
+         [key: string]: boolean;
+       };
+     };
+   };
  }
  
  export class Config {
@@@ -219,66 -239,72 +240,73 @@@ remove the entire ${varName} entry fro
  };
  
  // Maps remote cluster hosts and removes the default RemoteCluster entry
- export const mapRemoteHosts = (clusterConfigJSON: ClusterConfigJSON, config: Config) => {
-     config.remoteHosts = {};
-     Object.keys(clusterConfigJSON.RemoteClusters).forEach(k => { config.remoteHosts[k] = clusterConfigJSON.RemoteClusters[k].Host; });
-     delete config.remoteHosts["*"];
+ export const mapRemoteHosts = (
+   clusterConfigJSON: ClusterConfigJSON,
+   config: Config
+ ) => {
+   config.remoteHosts = {};
+   Object.keys(clusterConfigJSON.RemoteClusters).forEach((k) => {
+     config.remoteHosts[k] = clusterConfigJSON.RemoteClusters[k].Host;
+   });
+   delete config.remoteHosts['*'];
  };
  
- export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): ClusterConfigJSON => ({
-     API: {
-         UnfreezeProjectRequiresAdmin: false,
-         MaxItemsPerResponse: 1000,
+ export const mockClusterConfigJSON = (
+   config: Partial<ClusterConfigJSON>
+ ): ClusterConfigJSON => ({
+   API: {
+     UnfreezeProjectRequiresAdmin: false,
++    MaxItemsPerResponse: 1000,
+   },
+   ClusterID: '',
+   RemoteClusters: {},
+   Services: {
+     Controller: { ExternalURL: '' },
+     Workbench1: { ExternalURL: '' },
+     Workbench2: { ExternalURL: '' },
+     Websocket: { ExternalURL: '' },
+     WebDAV: { ExternalURL: '' },
+     WebDAVDownload: { ExternalURL: '' },
+     WebShell: { ExternalURL: '' },
+   },
+   Workbench: {
+     DisableSharingURLsUI: false,
+     ArvadosDocsite: '',
+     FileViewersConfigURL: '',
+     WelcomePageHTML: '',
+     InactivePageHTML: '',
+     SSHHelpPageHTML: '',
+     SSHHelpHostSuffix: '',
+     SiteName: '',
+     IdleTimeout: '0s',
+   },
+   Login: {
+     LoginCluster: '',
+     Google: {
+       Enable: false,
      },
-     ClusterID: "",
-     RemoteClusters: {},
-     Services: {
-         Controller: { ExternalURL: "" },
-         Workbench1: { ExternalURL: "" },
-         Workbench2: { ExternalURL: "" },
-         Websocket: { ExternalURL: "" },
-         WebDAV: { ExternalURL: "" },
-         WebDAVDownload: { ExternalURL: "" },
-         WebShell: { ExternalURL: "" },
+     LDAP: {
+       Enable: false,
      },
-     Workbench: {
-         DisableSharingURLsUI: false,
-         ArvadosDocsite: "",
-         FileViewersConfigURL: "",
-         WelcomePageHTML: "",
-         InactivePageHTML: "",
-         SSHHelpPageHTML: "",
-         SSHHelpHostSuffix: "",
-         SiteName: "",
-         IdleTimeout: "0s",
+     OpenIDConnect: {
+       Enable: false,
      },
-     Login: {
-         LoginCluster: "",
-         Google: {
-             Enable: false,
-         },
-         LDAP: {
-             Enable: false,
-         },
-         OpenIDConnect: {
-             Enable: false,
-         },
-         PAM: {
-             Enable: false,
-         },
-         SSO: {
-             Enable: false,
-         },
-         Test: {
-             Enable: false,
-         },
+     PAM: {
+       Enable: false,
      },
-     Collections: {
-         ForwardSlashNameSubstitution: "",
-         TrustAllContent: false,
+     SSO: {
+       Enable: false,
      },
-     Volumes: {},
-     ...config
+     Test: {
+       Enable: false,
+     },
+   },
+   Collections: {
+     ForwardSlashNameSubstitution: '',
+     TrustAllContent: false,
+   },
+   Volumes: {},
+   ...config,
  });
  
  export const mockConfig = (config: Partial<Config>): Config => ({
index b69483cb3b2a45e6f74d6b2e0befcfc6753537e4,1e9078d9382ecb508c36100a2c7246a0396f74d3..025314eb77aac8b261da58dcef4c061700c8da1b
@@@ -2,28 -2,30 +2,31 @@@
  //
  // SPDX-License-Identifier: AGPL-3.0
  
 -import { snakeCase, camelCase } from 'lodash';
 +import { CancelToken } from 'axios';
 +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 {
  }
  
  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, cancelToken?: CancelToken): 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 };
-         }
-         if (cancelToken) {
-             cfg.cancelToken = cancelToken;
-         }
 -  async contents(
 -    uuid: string,
 -    args: ContentsArguments = {},
 -    session?: Session
 -  ): Promise<ListResults<GroupContentsResource>> {
++async contents(uuid: string, args: ContentsArguments = {}, session?: Session, cancelToken?: CancelToken): Promise<ListResults<GroupContentsResource>> {
+     const { filters, order, ...other } = args;
+     const params = {
 -      ...other,
 -      filters: filters ? `[${filters}]` : undefined,
 -      order: order ? order : undefined,
++        ...other,
++        filters: filters ? `[${filters}]` : undefined,
++        order: order ? order : undefined
+     };
+     const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
 -
+     const cfg: AxiosRequestConfig = {
+       params: CommonResourceService.mapKeys(snakeCase)(params),
+     };
 +
-         const response = await CommonResourceService.defaultResponse(
-             this.serverApi.get(this.resourceType + pathUrl, cfg), this.actions, false
-         );
-         return { ...TrashableResourceService.mapKeys(camelCase)(response), clusterId: session && session.clusterId };
+     if (session) {
+       cfg.baseURL = session.baseUrl;
+       cfg.headers = { Authorization: 'Bearer ' + session.token };
      }
  
-     shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
-         return CommonResourceService.defaultResponse(
-             this.serverApi
-                 .get(this.resourceType + '/shared', { params }),
-             this.actions
-         );
++    if (cancelToken) {
++      cfg.cancelToken = cancelToken;
 +    }
++    
+     const response = await CommonResourceService.defaultResponse(
+       this.serverApi.get(this.resourceType + pathUrl, cfg),
+       this.actions,
+       false
+     );
+     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
+     );
+   }
  }
  
  export enum GroupContentsResourcePrefix {