visualizer-on-tabs 2.0.0 → 2.0.2

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
@@ -22,6 +22,8 @@ const config = {
22
22
  url: 'https://demo.scipeaks.com/roc',
23
23
  // Redirect after login
24
24
  redirect: 'https://demo.scipeaks.com/',
25
+ // If true, automatically redirects to the login page if not logged in
26
+ auto: true,
25
27
  },
26
28
  // List of default views to load
27
29
  possibleViews: {
@@ -50,20 +52,16 @@ const config = {
50
52
  // When false, only the selected tab is loaded.
51
53
  loadHidden: false,
52
54
 
53
- // Options related to https://github.com/cheminfo/react-visualizer
55
+ // Options passed to makeVisualizerPage
56
+ // See https://github.com/cheminfo/react-visualizer
54
57
  visualizer: {
55
- /**
56
- * Options to generate the visualizer html page
57
- */
58
58
  loadversion: 'exact',
59
+ queryType: 'query', // 'fragment' or 'query'
59
60
  fallbackVersion: 'latest',
60
61
  cdn: 'https://www.lactame.com/visualizer',
61
-
62
- /*
63
- * Props passed to the visualizer component
64
- */
65
- // Visualizer config.json
66
- config: undefined,
62
+ // Can be a URL string or an object
63
+ // Example of config object: https://github.com/NPellet/visualizer/blob/master/src/usr/config/default.json
64
+ config: '',
67
65
  },
68
66
  };
69
67
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visualizer-on-tabs",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "visualizer-on-tabs webpack builder",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,7 @@
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.0.0",
42
+ "react-visualizer": "^5.4.0",
43
43
  "webpack": "^5.105.2"
44
44
  },
45
45
  "devDependencies": {
@@ -323,7 +323,8 @@ class App extends React.Component {
323
323
  <Visualizer
324
324
  url="visualizer.html"
325
325
  viewURL={view.rewrittenUrl || view.url}
326
- config={config.visualizer.config}
326
+ // The query type passed here should be the same as the one passed to makeVisualizerPage
327
+ queryType={config.visualizer?.queryType}
327
328
  style={iframeStyle}
328
329
  />
329
330
  );
@@ -24,16 +24,17 @@ class Login extends React.Component {
24
24
  }
25
25
 
26
26
  async session() {
27
- if (!this.props.config.rocLogin) return;
28
- const login = this.props.config.rocLogin;
29
- const response = await fetch(`${login.url}/auth/session`, {
27
+ const rocLogin = this.props.config.rocLogin;
28
+ if (!rocLogin) return;
29
+ const response = await fetch(`${rocLogin.url}/auth/session`, {
30
30
  credentials: 'include',
31
31
  });
32
32
  if (response.ok) {
33
33
  const body = await response.json();
34
34
  if (
35
- login.auto &&
36
- (!body.authenticated || (login.user && body.username !== login.user))
35
+ rocLogin.auto &&
36
+ (!body.authenticated ||
37
+ (rocLogin.user && body.username !== rocLogin.user))
37
38
  ) {
38
39
  window.location.href = this.loginUrl;
39
40
  }
@@ -1,7 +0,0 @@
1
- const config = '../config.json';
2
-
3
- const defaultConfig = {};
4
-
5
- export function getConfig() {
6
- return config.visualizerConfig || defaultConfig;
7
- }