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

Dev ata #1439

Closed
wants to merge 7 commits into from
Closed

Dev ata #1439

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
35 changes: 27 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
FROM node:20-alpine as builder
#FROM node:20-alpine as builder

WORKDIR /app
#WORKDIR /app

COPY package.json package-lock.json* ./
#COPY package.json package-lock.json* ./

# Install build dependencies for native modules and project dependencies
RUN apk add --no-cache make gcc g++ python3 && \
npm i -f && \
npm cache clean --force
#RUN apk add --no-cache make gcc g++ python3 && \
# npm i -f && \
# npm cache clean --force

#COPY . .

#EXPOSE 3000

#CMD ["npm", "run", "start"]


FROM node:20 as build-image
WORKDIR /app
COPY package*.json ./
RUN export NODE_OPTIONS=--max-old-space-size=4096
RUN npm install --force
COPY . .

EXPOSE 3000
RUN npm run build

# copy static files and run nginx server
FROM nginx:alpine

COPY --from=build-image /app/build /usr/share/nginx/html

EXPOSE 80

CMD ["npm", "run", "start"]
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Overview
## Overview :
• The agricultural sector is a diverse ecosystem involving numerous organizations. • These organizations collaborate with farmers to implement a wide array of projects.
• Key players include government and non-government entities, NGOs, not-for profit organizations, researchers, and for-profit companies.
• During project implementation, valuable data is collected that could improve agricultural practices and outcomes for farmers.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"validator": "^13.7.0"
},
"scripts": {
"start": "cross-env NODE_OPTIONS=--max-old-space-size=6144 react-scripts start",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=6144 react-scripts build",
"start": "env-cmd -f .env cross-env NODE_OPTIONS=--max-old-space-size=6144 react-scripts start",
"build": "env-cmd -f .env cross-env NODE_OPTIONS=--max-old-space-size=6144 react-scripts build",
"start:default": "cross-env REACT_APP_INSTANCE=DEFAULT REACT_APP_BASEURL=https://dev.platform.farmer.chat/be/ REACT_APP_BASEURL_without_slash=https://dev.platform.farmer.chat/be NODE_OPTIONS=--max-old-space-size=6144 react-scripts start",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import featureRoutes from "features/routes";
import { Helmet } from "react-helmet";
import { getMetaData } from "common/utils/MetaData";
const MainComponent = lazy(() => Promise.resolve({ default: featureRoutes }));
const instance = process.env.REACT_APP_INSTANCE;
const instance =
window?.ENV_VARS?.REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;

function App() {
const { title, description, faviconImage } = getMetaData(instance);
console.log(window?.ENV_VARS);
console.log(process.env);
return (
<React.Fragment>
<Helmet>
Expand Down
6 changes: 3 additions & 3 deletions src/common/constants/UrlConstants.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const UrlConstant = {
base_url:
Window?.ENV_VARS?.REACT_APP_BASEURL || process.env.REACT_APP_BASEURL,
window?.ENV_VARS?.REACT_APP_BASEURL || process.env.REACT_APP_BASEURL,
base_url_without_slash:
Window?.ENV_VARS?.REACT_APP_BASEURL_without_slash ||
window?.ENV_VARS?.REACT_APP_BASEURL_without_slash ||
process.env.REACT_APP_BASEURL_without_slash,
view_data_connector:
Window?.ENV_VARS?.REACT_APP_BASEURL_without_slash_view_data ||
window?.ENV_VARS?.REACT_APP_BASEURL_without_slash_view_data ||
process.env.REACT_APP_BASEURL_without_slash_view_data,

login: "accounts/login/",
Expand Down
4 changes: 2 additions & 2 deletions src/common/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,12 @@ export function findType() {

export function checkProjectFor(name) {
console.log(
Window?.ENV_VARS?.REACT_APP_PROJECT_FOR,
window?.ENV_VARS?.REACT_APP_PROJECT_FOR,
process.env.REACT_APP_PROJECT_FOR,
name
);
if (
(Window?.ENV_VARS?.REACT_APP_PROJECT_FOR ||
(window?.ENV_VARS?.REACT_APP_PROJECT_FOR === name ||
process.env.REACT_APP_PROJECT_FOR) === name
) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import MuiPhoneNumber from "material-ui-phone-number";
import { isPhoneValid } from "../../NewOnboarding/utils";
import { getCountryData, getDefaultCountryCode } from "common/utils/utils";
const ParticipantFormNew = (props) => {
const instance = process.env.REACT_APP_INSTANCE;
const instance =
window?.ENV_VARS?.REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
const { callToast, callLoader } = useContext(FarmStackContext);

const { title, isEditModeOn, userType } = props;
Expand Down
18 changes: 8 additions & 10 deletions src/features/default/src/Components/DatasetCard/DatasetCard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import location from '../../Assets/Img/location.svg';
import category from '../../Assets/Img/category.svg';
import apartment from '../../Assets/Img/apartment.svg';
import globe_img from '../../Assets/Img/globe_img.svg';
import location from "../../Assets/Img/location.svg";
import category_icon from "../../Assets/Img/category.svg";
import apartment from "../../Assets/Img/apartment.svg";
import globe_img from "../../Assets/Img/globe_img.svg";
import { Card, Typography, useMediaQuery, useTheme } from "@mui/material";
import React from "react";
import LocalStyle from "./DatasetCard.module.css";
Expand All @@ -26,7 +26,7 @@ const DatasetCart = (props) => {
className={mobile ? LocalStyle.cardContainerSm : LocalStyle.cardContainer}
>
<div className="published">
<img src={globe_img} />
<img src={globe_img} />
<span className="published_text">
Published on:{" "}
{publishDate?.split("T")[0]
Expand All @@ -36,16 +36,14 @@ const DatasetCart = (props) => {
</div>
<div className="d_content_title">{title}</div>
<div className={"organisation"}>
{orgnisationName && (
<img src={apartment} />
)}
{orgnisationName && <img src={apartment} />}
{orgnisationName && (
<span className="organisation_text">{orgnisationName}</span>
)}
</div>
<div className="d_content_text">
<div className="category">
<img src={category} alt="category" />
<img src={category_icon} alt="category" />
<span className="category_text">
{Object.keys(category).length
? category?.length > 1
Expand All @@ -55,7 +53,7 @@ const DatasetCart = (props) => {
</span>
</div>
<div className="location">
<img src={location} alt="location" />
<img src={location} alt="location" />
<span className="location_text">
{geography?.country?.name
? geography?.country?.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function TabPanel(props) {
}

const AddDataSet = (props) => {
const instance = process.env.REACT_APP_INSTANCE;
const instance =
window?.ENV_VARS?.REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
const history = useHistory();
const { callLoader, callToast } = useContext(FarmStackContext);
const theme = useTheme();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ const cardSx = {
};
const DataSets = (props) => {
const { user, breadcrumbFromRoute } = props;
const instance = process.env.REACT_APP_INSTANCE;
const instance =
window?.ENV_VARS?.REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;

const { callLoader, callToast } = useContext(FarmStackContext);
const history = useHistory();
Expand Down
25 changes: 15 additions & 10 deletions src/features/default/src/Layout/Datahub.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ function Datahub(props) {
{globalConfig?.navBar === "DEFAULT" ? (
<DefaultNavbar loginType={"admin"} />
) : null}
{(globalConfig?.navBar === "EADP" || globalConfig?.navBar === "ETH_MOA") && (
<EadpNavbar loginType={"admin"} />
)}
{(globalConfig?.navBar === "EADP" ||
globalConfig?.navBar === "ETH_MOA") && (
<EadpNavbar loginType={"admin"} />
)}
{globalConfig?.navBar === "VISTAAR" && (
<VistaarNavbar loginType={"admin"} />
)}
Expand Down Expand Up @@ -242,7 +243,8 @@ function Datahub(props) {
component={ParticipantsAndCoStewardDetailsNew}
/>
)}
{process.env.REACT_APP_INSTANCE !== "KADP" &&
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") &&
isCoStewardsEnabled && (
<Route
exact
Expand All @@ -257,7 +259,8 @@ function Datahub(props) {
component={EditParticipantsNew}
/>
)}
{process.env.REACT_APP_INSTANCE !== "KADP" &&
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") &&
isCoStewardsEnabled && (
<Route
exact
Expand All @@ -272,7 +275,8 @@ function Datahub(props) {
component={ParticipantApproveNew}
/>
)}
{process.env.REACT_APP_INSTANCE !== "KADP" &&
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") &&
isCoStewardsEnabled && (
<Route
exact
Expand Down Expand Up @@ -465,7 +469,8 @@ function Datahub(props) {
component={ParticipantsAndCoStewardNew}
/>
)}
{process.env.REACT_APP_INSTANCE !== "KADP" &&
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") &&
isCoStewardsEnabled && (
<Route
exact
Expand Down Expand Up @@ -604,9 +609,9 @@ function Datahub(props) {
{globalConfig?.footer === "DEFAULT" && (
<DefaultFooter loginType={"admin"} />
)}
{(globalConfig?.footer === "EADP" || globalConfig?.footer === "ETH_MOA") && !footerMatch && (
<EadpFooter loginType={"admin"} />
)}
{(globalConfig?.footer === "EADP" ||
globalConfig?.footer === "ETH_MOA") &&
!footerMatch && <EadpFooter loginType={"admin"} />}
{globalConfig?.footer === "KADP" && (
<KadpFooter loginType={"admin"} />
)}
Expand Down
12 changes: 8 additions & 4 deletions src/features/default/src/Layout/GuestRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ const GuestRoutes = () => {
}
/>
) : null}
{(globalConfig?.navBar === "EADP" || globalConfig?.navBar === "ETH_MOA") && (
{(globalConfig?.navBar === "EADP" ||
globalConfig?.navBar === "ETH_MOA") && (
<EadpNavbar
loginType={
isLoggedInUserAdmin() || (isLoggedInUserCoSteward() && isVerified)
Expand Down Expand Up @@ -196,14 +197,16 @@ const GuestRoutes = () => {
path="/home/participants/view/:id"
component={GuestUserParticipantsDetails}
/>
{process.env.REACT_APP_INSTANCE !== "KADP" && (
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") && (
<Route
exact
path="/home/costeward"
component={GuestUserCoStewardNew}
/>
)}
{process.env.REACT_APP_INSTANCE !== "KADP" && (
{(window?.ENV_VARS?.REACT_APP_INSTANCE !== "KADP" ||
process.env.REACT_APP_INSTANCE !== "KADP") && (
<Route
exact
path="/home/costeward/view/:id"
Expand Down Expand Up @@ -255,7 +258,8 @@ const GuestRoutes = () => {
}
/>
)}
{(globalConfig?.footer === "EADP" || globalConfig?.footer === "ETH_MOA") && (
{(globalConfig?.footer === "EADP" ||
globalConfig?.footer === "ETH_MOA") && (
<EadpFooter
loginType={
isLoggedInUserAdmin() || (isLoggedInUserCoSteward() && isVerified)
Expand Down
11 changes: 6 additions & 5 deletions src/features/default/src/Views/Dashboard/DashboardNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ function DashboardNew() {
} else if (item === "da_registry_dashboard") {
path =
isLoggedInUserAdmin() || isLoggedInUserCoSteward()
? `/datahub/dashboards/da_registry_dashboard`
: isLoggedInUserParticipant()
? `/participant/dashboards/da_registry_dashboard`
: "/home";
? `/datahub/dashboards/da_registry_dashboard`
: isLoggedInUserParticipant()
? `/participant/dashboards/da_registry_dashboard`
: "/home";
} else {
path =
isLoggedInUserAdmin() || isLoggedInUserCoSteward()
Expand Down Expand Up @@ -302,7 +302,8 @@ function DashboardNew() {
Track and optimize network activities effortlessly. Gain valuable
insights for efficient operations.
</div>
{process.env.REACT_APP_INSTANCE === "ETH_MOA" && (
{(window?.ENV_VARS?.REACT_APP_INSTANCE === "ETH_MOA" ||
process.env.REACT_APP_INSTANCE === "ETH_MOA") && (
<Button
variant="contained"
sx={{ marginTop: "25px" }}
Expand Down
16 changes: 10 additions & 6 deletions src/features/default/src/Views/GuestUser/GuestUserHomeNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import DefaultFirstSection from "../../common/sections/first/default/FirstSectio
import EadpFirstSection from "../../common/sections/first/eadp/FirstSection";
import KadpFirstSection from "../../common/sections/first/kadp/FirstSection";
import VistaarFirstSection from "../../common/sections/first/vistaar/FirstSection";
import ETHMoAFirstSection from "../../common/sections/first/ethmoa/FirstSection"
import ETHfourth_image from "../../../../../features/default/src/Assets/Img/ethmoa/MoA_3.jpg"
import ETHMoAFirstSection from "../../common/sections/first/ethmoa/FirstSection";
import ETHfourth_image from "../../../../../features/default/src/Assets/Img/ethmoa/MoA_3.jpg";

import globalConfig from "globalConfig";
import SecondSection from "../../common/sections/second/Section";
Expand Down Expand Up @@ -268,13 +268,17 @@ const GuestUserHome = () => {
largeDesktop ? LocalStyle.image_for_big : LocalStyle.image
}
src={
window?.ENV_VARS?.REACT_APP_INSTANCE === "EADP" ||
process.env.REACT_APP_INSTANCE === "EADP"
? micro_4
: process.env.REACT_APP_INSTANCE === "KADP"
: window?.ENV_VARS?.REACT_APP_INSTANCE === "KADP" ||
process.env.REACT_APP_INSTANCE === "KADP"
? fourth_home
: process.env.REACT_APP_INSTANCE === "VISTAAR"
? micro3
: process.env.REACT_APP_INSTANCE === "ETH_MOA"
: window?.ENV_VARS?.REACT_APP_INSTANCE === "VISTAAR" ||
process.env.REACT_APP_INSTANCE === "VISTAAR"
? micro3
: window?.ENV_VARS?.REACT_APP_INSTANCE === "ETH_MOA" ||
process.env.REACT_APP_INSTANCE === "ETH_MOA"
? ETHfourth_image
: micro3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const ParticipantAndCoStewardDetailsNew = (props) => {
breadcrumbFromRoute,
isCostewardsParticipant,
} = props;
const instance = process.env.REACT_APP_INSTANCE;
const instance =
window?.ENV_VARS?.REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
const { callLoader, callToast } = useContext(FarmStackContext);
const theme = useTheme();
const mobile = useMediaQuery(theme.breakpoints.down("sm"));
Expand Down
Loading
Loading