Extend main config with FILE_VIEWERS_CONFIG_URL
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Dec 2018 16:44:29 +0000 (17:44 +0100)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Dec 2018 16:44:29 +0000 (17:44 +0100)
Feature #13540

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

README.md
public/file-viewers-example.json [new file with mode: 0644]
src/common/config.ts

index e8d77701107179a6ef88fcfb68cd47d857a321a9..425d1787848e5b9dad4e077eed23b2f73aea47ea 100644 (file)
--- a/README.md
+++ b/README.md
@@ -41,7 +41,8 @@ Currently this configuration schema is supported:
 ```
 {
     "API_HOST": "string",
 ```
 {
     "API_HOST": "string",
-    "VOCABULARY_URL": "string"
+    "VOCABULARY_URL": "string",
+    "FILE_VIEWERS_CONFIG_URL": "string",
 }
 ```
 
 }
 ```
 
@@ -49,6 +50,13 @@ Currently this configuration schema is supported:
 Local path, or any URL that allows cross-origin requests. See 
 [Vocabulary JSON file example](public/vocabulary-example.json).
 
 Local path, or any URL that allows cross-origin requests. See 
 [Vocabulary JSON file example](public/vocabulary-example.json).
 
+### FILE_VIEWERS_CONFIG_URL
+Local path, or any URL that allows cross-origin requests. See:
+
+[File viewers config file example](public/file-viewers-example.json)
+
+[File viewers config scheme](src/models/file-viewers-config.ts)
+
 ### Licensing
 
 Arvados is Free Software. See COPYING for information about Arvados Free
 ### Licensing
 
 Arvados is Free Software. See COPYING for information about Arvados Free
diff --git a/public/file-viewers-example.json b/public/file-viewers-example.json
new file mode 100644 (file)
index 0000000..7c8aefc
--- /dev/null
@@ -0,0 +1,24 @@
+[
+    {
+        "name": "File browser",
+        "extensions": [
+            ".txt",
+            ".zip"
+        ],
+        "url": "https://doc.arvados.org",
+        "filePathParam": "filePath"
+    },
+    {
+        "name": "Collection browser",
+        "extensions": [],
+        "collections": true,
+        "url": "https://doc.arvados.org",
+        "filePathParam": "collectionPath"
+    },
+    {
+        "name": "Universal browser",
+        "collections": true,
+        "url": "https://doc.arvados.org",
+        "filePathParam": "filePath"
+    }
+]
\ No newline at end of file
index b7b89bd9e4930100188725b7f117f67abf076587..4d96bbbf2ea3029681529fda4941028a8a07ecd5 100644 (file)
@@ -50,6 +50,7 @@ export interface Config {
     websocketUrl: string;
     workbenchUrl: string;
     vocabularyUrl: string;
     websocketUrl: string;
     workbenchUrl: string;
     vocabularyUrl: string;
+    fileViewersConfigUrl: string;
 }
 
 export const fetchConfig = () => {
 }
 
 export const fetchConfig = () => {
@@ -111,17 +112,20 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     websocketUrl: '',
     workbenchUrl: '',
     vocabularyUrl: '',
     websocketUrl: '',
     workbenchUrl: '',
     vocabularyUrl: '',
+    fileViewersConfigUrl: '',
     ...config
 });
 
 interface ConfigJSON {
     API_HOST: string;
     VOCABULARY_URL: string;
     ...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: "",
 }
 
 const getDefaultConfig = (): ConfigJSON => ({
     API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "",
     VOCABULARY_URL: "",
+    FILE_VIEWERS_CONFIG_URL: "",
 });
 
 const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`;
 });
 
 const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`;