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

routes fixed #1414

Merged
merged 1 commit into from
Sep 12, 2024
Merged
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
13 changes: 12 additions & 1 deletion src/features/default/src/Layout/Datahub.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const EditDataset = lazy(() =>
const DashboardNew = lazy(() => import("../Views/Dashboard/DashboardNew"));
const StreamlitFrame = lazy(() => import("../Views/Pages/Dashboard/streamlit"));
const TempFile = lazy(() => import("../Views/GuestUser/TempFarmerFile"));
const DaFile = lazy(() => import("../Views/GuestUser/TempDaRegistryFile"));
const Support = lazy(() => import("../Components/Support_New/Support"));
const SupportView = lazy(() => import("../Components/Support_New/SupportView"));
const AskSupport = lazy(() => import("../Components/Support_New/SupportForm"));
Expand Down Expand Up @@ -311,7 +312,17 @@ function Datahub(props) {
<Route
exact
path="/datahub/dashboards/:name"
component={TempFile}
render={(props) => {
const { name } = props.match.params;

if (name === "farmer_registry_dashboard") {
return <TempFile />;
} else if (name === "da_registry_dashboard") {
return <DaFile />;
} else {
return <NotFound />;
}
}}
/>
{isParticipantsEnabled && (
<Route
Expand Down
7 changes: 7 additions & 0 deletions src/features/default/src/Views/Dashboard/DashboardNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ function DashboardNew() {
: isLoggedInUserParticipant()
? `/participant/dashboards/${item}`
: "/home";
} else if (item === "da_registry_dashboard") {
path =
isLoggedInUserAdmin() || isLoggedInUserCoSteward()
? `/datahub/dashboards/da_registry_dashboard`
: isLoggedInUserParticipant()
? `/participant/dashboards/da_registry_dashboard`
: "/home";
} else {
path =
isLoggedInUserAdmin() || isLoggedInUserCoSteward()
Expand Down
13 changes: 13 additions & 0 deletions src/features/default/src/Views/GuestUser/TempDaRegistryFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FarmStackContext } from "common/components/context/DefaultContext/FarmstackProvider";
import React, { useContext, useEffect, useRef } from "react";
import Dashboard from "../../../../../Da_Registry/index";

const TempDaRegistryFile = () => {
const { callToast, callLoader } = useContext(FarmStackContext);

return (
<><Dashboard /></>
);
};

export default TempDaRegistryFile;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Box, CssBaseline } from "@mui/material";
import { FarmStackContext } from "common/components/context/DefaultContext/FarmstackProvider";
import UrlConstant from "common/constants/UrlConstants";
import Dashboard from "../../../../../../../Da_Registry/index"

import React, { useContext, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -30,9 +29,8 @@ const StreamlitFrame = () => {

return (
<>
<Dashboard />
{/* <CssBaseline /> */}
{/* <Box
<CssBaseline />
<Box
sx={{
width: "100vw",
height: "100vh",
Expand All @@ -51,8 +49,8 @@ const StreamlitFrame = () => {
height="100%"
frameBorder="0"
allowFullScreen
></iframe> */}
{/* </Box> */}
></iframe>
</Box>
</>
);
};
Expand Down
Loading