Skip to content

Commit

Permalink
Revert react-router upgrade
Browse files Browse the repository at this point in the history
- keep using version 3
  while we do not have a way for routing to work in web UI plugins
  • Loading branch information
Enet4 committed Nov 11, 2024
1 parent 3f53c4a commit dda4b99
Show file tree
Hide file tree
Showing 6 changed files with 2,047 additions and 2,520 deletions.
4 changes: 2 additions & 2 deletions dicoogle/src/main/resources/webapp/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class App extends React.Component {
}

if (location.hash === "" || location.hash === "/") {
this.context.router.history.push("/login");
this.props.router.push("/login");
}
}

Expand All @@ -107,7 +107,7 @@ class App extends React.Component {
this.setState(data);
}

let history = this.context.router.history;
let history = this.props.router;
if (!data.isLoggedIn) {
if (!process.env.GUEST_USERNAME) {
history.replace("/login");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ export default class PluginView extends React.Component {
}

getPluginName() {
return this.props.plugin || (this.props.match?.params?.plugin);
return this.props.plugin || (this.props.params?.plugin);
}

render() {
const plugin = this.getPluginName();
console.debug("Trying to render plugin", plugin);
return (
<div className={this.props.className} style={this.props.style}>
{this.state.elements[plugin] ? (
Expand Down
6 changes: 3 additions & 3 deletions dicoogle/src/main/resources/webapp/js/components/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from "react";
import createReactClass from "create-react-class";
import * as PropTypes from "prop-types";
import { NavLink } from "react-router-dom";
import { Link } from "react-router";
import UserStore from "../stores/userStore";

const Sidebar = createReactClass({
Expand Down Expand Up @@ -49,9 +49,9 @@ const Sidebar = createReactClass({
if (!e.admin || isAdmin)
return (
<li key={e.value}>
<NavLink activeClassName="active" to={to}>
<Link activeClassName="active" to={to}>
<i className={e.icon} /> &nbsp; {e.caption}
</NavLink>
</Link>
</li>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion dicoogle/src/main/resources/webapp/js/external-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
const EXTERNAL_MODULES = {
react: require("react"),
"react-router-dom": require("react-router-dom"),
"react-router": require("react-router"),
reflux: require("reflux"),
"dicoogle-webcore": require("dicoogle-webcore"),
"dicoogle-client": require("dicoogle-client"),
Expand Down
Loading

0 comments on commit dda4b99

Please sign in to comment.