visualizer-on-tabs 2.0.0 → 2.0.1

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,15 @@ 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
59
  fallbackVersion: 'latest',
60
60
  cdn: 'https://www.lactame.com/visualizer',
61
-
62
- /*
63
- * Props passed to the visualizer component
64
- */
65
- // Visualizer config.json
66
- config: undefined,
61
+ // Can be a URL string or an object
62
+ // Example of config object: https://github.com/NPellet/visualizer/blob/master/src/usr/config/default.json
63
+ config: '',
67
64
  },
68
65
  };
69
66
  ```
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.1",
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.3.0",
43
43
  "webpack": "^5.105.2"
44
44
  },
45
45
  "devDependencies": {
@@ -323,7 +323,6 @@ 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}
327
326
  style={iframeStyle}
328
327
  />
329
328
  );
@@ -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
- }