Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] show statistics mock page with graphs instead of a table #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/components/MainView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { isAdmin } from "../utils/SecurityUtils";
import Messages from "./message/Messages";
import Footer from "../Footer";
import PropTypes from "prop-types";
import { ANALYTICS_URL } from "../../config/index.js";

class MainView extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -61,6 +62,14 @@ class MainView extends React.Component {
}
}

showStatistics = () => {
if (ANALYTICS_URL === "") {
transitionTo(routes.statistics);
} else {
window.location.href = ANALYTICS_URL;
}
};

render() {
if (this.props.status === ACTION_STATUS.PENDING) {
return <LoaderMask />;
Expand Down Expand Up @@ -120,14 +129,10 @@ class MainView extends React.Component {
</NavItem>
</IfGranted>
<IfGranted expected={ROLE.ADMIN} actual={user.role}>
<NavItem>
<NavLink
className="nav-link"
isActive={() => path.startsWith(Routes.statistics.path)}
to={Routes.statistics.path}
>
<NavItem style={{ cursor: "pointer" }}>
<div className="nav-link" onClick={() => this.showStatistics()}>
{this.i18n("statistics.panel-title")}
</NavLink>
</div>
</NavItem>
</IfGranted>
<IfGranted expected={ROLE.ADMIN} actual={user.role}>
Expand Down
2 changes: 0 additions & 2 deletions src/utils/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import requireAuth from "../components/misc/hoc/RequireAuth";
import UsersController from "../components/user/UsersController";
import UserController from "../components/user/UserController";
import PasswordChangeController from "../components/user/PasswordChangeController";
import Statistics from "../components/statistics/Statistics";
import InstitutionsController from "../components/institution/InstitutionsController";
import InstitutionController from "../components/institution/InstitutionController";
import RecordsController from "../components/record/RecordsController";
Expand All @@ -35,7 +34,6 @@ export const authRoutes = (
<Route exact path={Routes.createUser.path} component={requireAuth(UserController)} />
<Route exact path={Routes.editUser.path} component={requireAuth(UserController)} />
<Route exact path={Routes.passwordChange.path} component={requireAuth(PasswordChangeController)} />
<Route exact path={Routes.statistics.path} component={requireAuth(Statistics)} />
<Route exact path={Routes.institutions.path} component={requireAuth(InstitutionsController)} />
<Route exact path={Routes.createInstitution.path} component={requireAuth(InstitutionController)} />
<Route exact path={Routes.editInstitution.path} component={requireAuth(InstitutionController)} />
Expand Down
Loading