visualizer-on-tabs 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,9 @@ Example: https://github.com/cheminfo/cheminfo-server-setup/blob/master/doc/on-ta
16
16
  const config = {
17
17
  // Title of the single page app
18
18
  title: 'My app',
19
+ // Key used to store open tabs and other information in localStorage.
20
+ // If you have multiple instances of visualizer-on-tabs on the same domain, use this to have separate namespaces in local storage.
21
+ storageNamespace: 'prefix-key',
19
22
  // Roc login configuration. Don't set or set to false to disable login
20
23
  rocLogin: {
21
24
  // URL of the rest-on-couch server
@@ -56,6 +59,7 @@ const config = {
56
59
  // See https://github.com/cheminfo/react-visualizer
57
60
  visualizer: {
58
61
  loadversion: 'exact',
62
+ queryType: 'query', // 'fragment' or 'query'
59
63
  fallbackVersion: 'latest',
60
64
  cdn: 'https://www.lactame.com/visualizer',
61
65
  // Can be a URL string or an object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visualizer-on-tabs",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "visualizer-on-tabs webpack builder",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "@babel/core": "^7.29.0",
32
32
  "@babel/preset-env": "^7.29.0",
33
33
  "@babel/preset-react": "^7.28.5",
34
- "babel-loader": "^10.0.0",
34
+ "babel-loader": "^10.1.1",
35
35
  "bootstrap": "^5.3.8",
36
36
  "iframe-bridge": "^3.0.2",
37
37
  "lockr": "^0.8.5",
@@ -39,8 +39,8 @@
39
39
  "react": "^18.3.1",
40
40
  "react-bootstrap": "^3.0.0-beta.3",
41
41
  "react-dom": "^18.3.1",
42
- "react-visualizer": "^5.3.0",
43
- "webpack": "^5.105.2"
42
+ "react-visualizer": "^5.4.0",
43
+ "webpack": "^5.105.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "eslint": "^9.39.2",
@@ -6,8 +6,7 @@ import Tab from 'react-bootstrap/Tab';
6
6
  import BTabs from 'react-bootstrap/Tabs';
7
7
  import { Visualizer } from 'react-visualizer';
8
8
 
9
- import { getConfig } from '../config/config.js';
10
- import customConfig from '../config/custom.json' with { type: 'json' };
9
+ import config from '../config/config.js';
11
10
  import Tabs from '../main/Tabs.js';
12
11
  import iframeMessageHandler from '../main/iframeMessageHandler.js';
13
12
  import * as tabStorage from '../main/tabStorage.js';
@@ -16,7 +15,6 @@ import { rewriteURL } from '../util.js';
16
15
  import Login from './Login.js';
17
16
  import TabTitle from './TabTitle.js';
18
17
 
19
- const config = getConfig(customConfig);
20
18
  let tabInit = Promise.resolve();
21
19
  let currentIframe;
22
20
 
@@ -323,6 +321,8 @@ class App extends React.Component {
323
321
  <Visualizer
324
322
  url="visualizer.html"
325
323
  viewURL={view.rewrittenUrl || view.url}
324
+ // The query type passed here should be the same as the one passed to makeVisualizerPage
325
+ queryType={config.visualizer?.queryType}
326
326
  style={iframeStyle}
327
327
  />
328
328
  );
@@ -1,16 +1,16 @@
1
+ import customConfig from './custom.json' with { type: 'json' };
1
2
  import defaultVisualizerConfig from './visualizer.js';
2
3
 
3
- export function getConfig(customConfig) {
4
- const config = {
5
- ...customConfig,
6
- visualizer: {
7
- ...defaultVisualizerConfig,
8
- ...customConfig?.visualizer,
9
- },
10
- };
11
- if (config.rocLogin && config.rocLogin.url) {
12
- // Remove trailing slash
13
- config.rocLogin.url = config.rocLogin.url.replace(/\/$/, '');
14
- }
15
- return config;
4
+ const config = {
5
+ ...customConfig,
6
+ visualizer: {
7
+ ...defaultVisualizerConfig,
8
+ ...customConfig?.visualizer,
9
+ },
10
+ };
11
+ if (config.rocLogin && config.rocLogin.url) {
12
+ // Remove trailing slash
13
+ config.rocLogin.url = config.rocLogin.url.replace(/\/$/, '');
16
14
  }
15
+
16
+ export default config;
@@ -1,10 +1,15 @@
1
1
  import lockr from 'lockr';
2
2
 
3
+ import config from '../config/config.js';
4
+
3
5
  import { version } from './constants.js';
4
6
 
5
- const LOCAL_STORAGE_TAB_DATA = 'vweb-';
6
- const LOCAL_STORAGE_TAB_IDS = 'vweb1-tab-ids';
7
- const LOCAL_STORAGE_LAST_TAB = 'vweb1-selected-tab';
7
+ const storageNamespace = config.storageNamespace
8
+ ? `${config.storageNamespace}/`
9
+ : '';
10
+ const LOCAL_STORAGE_TAB_DATA = `${storageNamespace}vweb-`;
11
+ const LOCAL_STORAGE_TAB_IDS = `${storageNamespace}vweb1-tab-ids`;
12
+ const LOCAL_STORAGE_LAST_TAB = `${storageNamespace}vweb1-selected-tab`;
8
13
 
9
14
  const storage = {};
10
15