Merge branch '16655-Upload-speed-indicator-shows-wrong-information' into main
[arvados-workbench2.git] / src / common / config.ts
index f3d06840497968eba7388a523d05621038d07ff8..56f7c4884b19542ee057b937b5ff420809477a9e 100644 (file)
@@ -89,6 +89,14 @@ export interface ClusterConfigJSON {
                 Value: string,
                 Protected?: boolean,
             }
+        },
+        TrustAllContent: boolean
+    };
+    Volumes: {
+        [key: string]: {
+            StorageClasses: {
+                [key: string]: boolean;
+            }
         }
     };
 }
@@ -130,6 +138,19 @@ export const buildConfig = (clusterConfig: ClusterConfigJSON): Config => {
     return config;
 };
 
+export const getStorageClasses = (config: Config): string[] => {
+    const classes: Set<string> = new Set(['default']);
+    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<any>(`${apiUrl}/${DISCOVERY_DOC_PATH}`)).data;
@@ -251,7 +272,9 @@ export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): Clust
     },
     Collections: {
         ForwardSlashNameSubstitution: "",
+        TrustAllContent: false,
     },
+    Volumes: {},
     ...config
 });