}
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 {
};
// 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 => ({
//
// 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 {