Merge branch '15166-size-between-icons-on-workflow-panel-is-too-wide'
[arvados-workbench2.git] / src / common / config.ts
index d801c5fa67b1189278daecb3df0138a7cd4dc5a8..71b7774c5fa8d765818b7ce611f6e4bfa1805c11 100644 (file)
@@ -51,8 +51,9 @@ export interface Config {
     version: string;
     websocketUrl: string;
     workbenchUrl: string;
+    workbench2Url?: string;
     vocabularyUrl: string;
-    origin: string;
+    fileViewersConfigUrl: string;
 }
 
 export const fetchConfig = () => {
@@ -64,7 +65,12 @@ export const fetchConfig = () => {
             .get<Config>(getDiscoveryURL(config.API_HOST))
             .then(response => ({
                 // TODO: After tests delete `|| '/vocabulary-example.json'`
-                config: {...response.data, vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json' },
+                // TODO: After tests delete `|| '/file-viewers-example.json'`
+                config: {
+                    ...response.data,
+                    vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json',
+                    fileViewersConfigUrl: config.FILE_VIEWERS_CONFIG_URL || '/file-viewers-example.json'
+                },
                 apiHost: config.API_HOST,
             })));
 
@@ -114,19 +120,21 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     websocketUrl: '',
     workbenchUrl: '',
     vocabularyUrl: '',
-    origin: '',
+    fileViewersConfigUrl: '',
     ...config
 });
 
 interface ConfigJSON {
     API_HOST: string;
     VOCABULARY_URL: string;
+    FILE_VIEWERS_CONFIG_URL: string;
 }
 
 const getDefaultConfig = (): ConfigJSON => ({
     API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "",
     VOCABULARY_URL: "",
+    FILE_VIEWERS_CONFIG_URL: "",
 });
 
 export const DISCOVERY_URL = 'discovery/v1/apis/arvados/v1/rest';
-const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/${DISCOVERY_URL}`;
+export const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/${DISCOVERY_URL}?nocache=${(new Date()).getTime()}`;