Create file viewer config schema
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Dec 2018 16:20:42 +0000 (17:20 +0100)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 12 Dec 2018 16:20:42 +0000 (17:20 +0100)
Feature #13540

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

src/common/file-viewers-config.ts [new file with mode: 0644]

diff --git a/src/common/file-viewers-config.ts b/src/common/file-viewers-config.ts
new file mode 100644 (file)
index 0000000..5c23dd4
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export type FileViewerList = FileViewer[];
+
+export interface FileViewer {
+    /**
+     * Name is used as a label in file's context menu
+     */
+    name: string;
+
+    /**
+     * Limits files for which viewer is enabled
+     * If not given, viewer will be enabled for all files
+     * Viewer is enabled if file name ends with an extension.
+     * 
+     * Example: `['.zip', '.tar.gz', 'bam']`
+     */
+    extensions?: string[];
+
+    /**
+     * Determines whether a viewer is enabled for collections.
+     */
+    collections?: boolean;
+
+    /**
+     * URL that redirects to a viewer 
+     * Example: `https://bam-viewer.com`
+     */
+    url: string;
+
+    /**
+     * Name of a search param that will be used to send file's path to a viewer
+     * Example: 
+     * 
+     * `{ filePathParam: 'filePath' }`
+     * 
+     * `https://bam-viewer.com?filePath=/path/to/file`
+     */
+    filePathParam: string;
+}