Skip to content

Julia - Integrate the Frontend with Backend for Material Graph#4344

Merged
one-community merged 5 commits intodevelopmentfrom
julia-integrate-frontend-with-backend-for-material-graph
Nov 27, 2025
Merged

Julia - Integrate the Frontend with Backend for Material Graph#4344
one-community merged 5 commits intodevelopmentfrom
julia-integrate-frontend-with-backend-for-material-graph

Conversation

@JuliaHa0902
Copy link
Copy Markdown
Contributor

@JuliaHa0902 JuliaHa0902 commented Nov 7, 2025

Description

Screenshot 2025-11-06 184408

Related PRS (if any):

This frontend PR is related to the #1888 backend PR.
To test this frontend PR you need to checkout the #1888 backend PR.

Main changes explained:

  • Implement the backend, add endpoint http://localhost:4500/api/material-costs
    GET http://localhost:4500/api/material-costs
    => Return a list of project Id and totalCostK
    GET http://localhost:4500/api/material-costs?projectId={projectId}
    GET http://localhost:4500/api/material-costs?projectId={projectId1,projectId2,projectId3}
    Return the cost of all the project ids in the parameter
  • Update the frontend to get the projects from bm/projects endpoint and get the cost from /material-cost endpoint
  • Fix some responsive errors

How to test:

** This PR uses Node v 20

  1. Change REACT_APP_APIENDPOINT value in .env file of the frontend to:
    REACT_APP_APIENDPOINT="http://localhost:4500/api"
    so the app can use the localhost api
  2. check into this current front end branch and backend branch julia-create-backend-for-material-cost-graph
  3. do npm install and ... to run this PR locally
  4. Open Postman
  5. Send POST request with email and password to http://localhost:4500/api/login to get access token
  6. Paste access token to the Header
  7. Send GET request to http://localhost:4500/api/material-costs and confirm that it returns a list of project and totalCostK
  8. Send GET request to http://localhost:4500/api/material-costs?projectId={projectId} and confirm that it returns the cost of projectId
  9. Open browser, nagivate to Dashboard → Reports → Total Construction Summary
    or http://localhost:3000/bmdashboard/totalconstructionsummary
  10. Open the tab Material Consumption
  11. Verify that the Total Material Cost Per Project shows the data from the material-cost API

Screenshots or videos of changes:

PR.review.mp4

Note:

Include the information the reviewers need to know.

@JuliaHa0902 JuliaHa0902 added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Nov 7, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 7, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit e1add6a
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69277e1881bd98000802a176
😎 Deploy Preview https://deploy-preview-4344--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Sriamshreddy000
Copy link
Copy Markdown
Contributor

Hi Julia,
I tested this PR along with the related backend [PR #1888]. Changed REACT_APP_APIENDPOINT value in .env file, Tested the API endpoint GET http://localhost:4500/api/material-costs in Thunder Client with a valid token, it returned a 404 Not Found response, "Cannot GET /api/material-costs." This suggests that the endpoint might not be active or properly registered in the backend branch, And when log in as admin and navigate to Dashboard → Reports → Total Construction Summary → Material Consumption, I can see the UI loads correctly and the charts appear. However, the banner “Using mock data as fallback” is displayed. The filters on the frontend appear functional, but the data is not being fetched from the backend and is instead using mock data for display.

I’m attaching screenshots from both Thunder Client and the frontend view for reference.
Screenshot 2025-11-12 at 6 00 47 PM
Screenshot 2025-11-12 at 5 54 16 PM

Anusha-Gali
Anusha-Gali previously approved these changes Nov 20, 2025
Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Julia,

I have reviewed your PR locally and the graph does work as intended.
Screenshot 2025-11-20 at 5 11 58 PM

@sonarqubecloud
Copy link
Copy Markdown

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit 497d4aa into development Nov 27, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants