From 3556e5483957f8479c5747e36c626e91a655cc21 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 8 Jul 2021 19:18:06 -0300 Subject: [PATCH] 17573: Adds Volumes config support. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/common/config.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/common/config.ts b/src/common/config.ts index f3d06840..8a85ae00 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -91,6 +91,13 @@ export interface ClusterConfigJSON { } } }; + Volumes: { + [key: string]: { + StorageClasses: { + [key: string]: boolean; + } + } + }; } export class Config { @@ -130,6 +137,19 @@ export const buildConfig = (clusterConfig: ClusterConfigJSON): Config => { return config; }; +export const getStorageClasses = (config: Config): string[] => { + const classes: Set = new Set(); + const volumes = config.clusterConfig.Volumes; + Object.keys(volumes).forEach(v => { + Object.keys(volumes[v].StorageClasses).forEach(sc => { + if (volumes[v].StorageClasses[sc]) { + classes.add(sc); + } + }); + }); + return Array.from(classes); +}; + const getApiRevision = async (apiUrl: string) => { try { const dd = (await Axios.get(`${apiUrl}/${DISCOVERY_DOC_PATH}`)).data; @@ -252,6 +272,7 @@ export const mockClusterConfigJSON = (config: Partial): Clust Collections: { ForwardSlashNameSubstitution: "", }, + Volumes: {}, ...config }); -- 2.30.2