From db28e4c12074c0411d907044eb4abf4c462d11b3 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Wed, 12 Dec 2018 17:44:29 +0100 Subject: [PATCH] Extend main config with FILE_VIEWERS_CONFIG_URL Feature #13540 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- README.md | 10 +++++++++- public/file-viewers-example.json | 24 ++++++++++++++++++++++++ src/common/config.ts | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 public/file-viewers-example.json diff --git a/README.md b/README.md index e8d77701..425d1787 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ Currently this configuration schema is supported: ``` { "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). +### 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 diff --git a/public/file-viewers-example.json b/public/file-viewers-example.json new file mode 100644 index 00000000..7c8aefcb --- /dev/null +++ b/public/file-viewers-example.json @@ -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 diff --git a/src/common/config.ts b/src/common/config.ts index b7b89bd9..4d96bbbf 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -50,6 +50,7 @@ export interface Config { websocketUrl: string; workbenchUrl: string; vocabularyUrl: string; + fileViewersConfigUrl: string; } export const fetchConfig = () => { @@ -111,17 +112,20 @@ export const mockConfig = (config: Partial): Config => ({ websocketUrl: '', workbenchUrl: '', vocabularyUrl: '', + 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: "", }); const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`; -- 2.30.2