Skip to content

Commit

Permalink
[feature] show statistick mock page with graphs instead of a table
Browse files Browse the repository at this point in the history
  • Loading branch information
shellyear committed May 16, 2024
1 parent 94098ac commit 416b327
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
10 changes: 10 additions & 0 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 @@ -123,6 +132,7 @@ class MainView extends React.Component {
<NavItem>
<NavLink
className="nav-link"
onClick={() => this.showStatistics()}
isActive={() => path.startsWith(Routes.statistics.path)}
to={Routes.statistics.path}
>
Expand Down
8 changes: 8 additions & 0 deletions src/components/statistics/StatisticsMock.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import StatisticsHtml from "../../../deploy/shared/nginx/statistics.html";

const StatisticsMock = () => {
return <div dangerouslySetInnerHTML={{ __html: StatisticsHtml }} />;
};

export default StatisticsMock;
4 changes: 2 additions & 2 deletions src/utils/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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 StatisticsMock from "../components/statistics/StatisticsMock";
import InstitutionsController from "../components/institution/InstitutionsController";
import InstitutionController from "../components/institution/InstitutionController";
import RecordsController from "../components/record/RecordsController";
Expand All @@ -35,7 +35,7 @@ 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.statistics.path} component={requireAuth(StatisticsMock)} />
<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
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default defineConfig({
cache: false,
}),
],
assetsInclude: ["**/*.html"],
build: {
sourcemap: true,
emptyOutDir: true,
Expand Down

0 comments on commit 416b327

Please sign in to comment.