Skip to main content

Dashboard

The app's landing/home page — a single-fetch snapshot of the facility's water system for a chosen day, laid out as cards. Every card is also a shortcut that deep-links into the matching monitoring page.

  • Route: /dashboardDashboardPage (libs/dashboard/src/DashboardPage.jsx)
  • Permission: LANDING_PAGE (gates the sidebar entry; the route isn't wrapped — see Permissions)
  • Library: libs/dashboard/ — standard dataSource → controller → store → components
Two variants

Users with the UWI_DASHBOARD permission get a slimmer UWI dashboard (BuildUWIDashboardPage); everyone else gets the standard one (BuildDashboardPage). UWI_DASHBOARD is excluded from the super-user auto-grant, so even super users get the standard view unless it's explicitly assigned.


One fetch, many cards

Summary: One /landingPage/userData call feeds every standard card; only the STP section fetches on its own. Data refreshes on load, on the Today/Yesterday switch, and every 5 minutes.


Cards (standard dashboard)

CardShowsAvailable whenOn click →
Water Intake / Used / RecycledThree pie-summary cards + a "View Breakup" expand toggleSOURCE_CATEGORY serviceWater (source) monitoring; a legend item opens that unit
Real-Time Water GraphLine trend — today vs. yesterday (dashed) + stock level(not a navigating card)
Water StockTank + fill %, total/capacity, Sufficient/InsufficientSTOCK_CATEGORYStock monitoring
Water Quality IndexHealth-score gauge (safe ÷ total), Good/Fair/Poor, per-unit rowsQUALITY_CATEGORYQuality monitoring
Energy ConsumptionTotal kWh, daily avg, donut of top sub-categoriesENERGY_CATEGORYEnergy monitoring (new tab)
Groundwater LevelBorewell levels (MWC)GROUND_WATER_LEVELGround-water monitoring
RainfallRain-water totalRWI permission/rwi
STPWater Treated / Energy Consumed / Energy Saved, each with a trend arrowfetched from uwms/stats/uwi/plant-view (switches context to UWMS)
Today's / Yesterday's AlertsGeneral + offline alerts for the dayOpens the alert's monitoring page + marks it read; header → /alerts
Today's InsightsSample insightsDemo only
UWI dashboard variant (with UWI_DASHBOARD)

A slimmer set from the same /landingPage/userData response, rendered conditionally: Real-Time Water Graph, a Groundwater strip, Current Water Quality, Energy Consumption, Stock, Intake, Consumption, and Alerts. Same deep-link behaviour as the standard cards.


Day selection

There's no date picker — a Today / Yesterday toggle drives params.date. Switching fires a refetch (with a mid-refresh grayscale overlay). When viewing Yesterday, a 60-second countdown auto-reverts back to Today.


APIs

ActionMethodPathTrigger
Dashboard data (all standard cards)GET/landingPage/userDataLoad, Today/Yesterday switch, and every 5 min ({ date, targetIndustryId, alertsEnabled, summaryData, type: MONTH })
STP statsGETuwms/statsThe STP section, on load / day change
Mark alert readPATCHnotification/updateReadClicking a dashboard alert
One response drives everything

All standard cards read the single /landingPage/userData response client-side (graphData = response.data.summaryData); only STP fetches separately. The 5-minute refresh runs unconditionally (unlike Water Balance, which only auto-refreshes on "today").

Analytics: PAGE_VIEW, DASHBOARD_DATE_CHANGE, DASHBOARD_CARD_CLICK, DASHBOARD_DETAILS_CLICK, DASHBOARD_ALERT_CLICK, LEAKAGE_LEARN_MORE_CLICK.


Access & per-card availability

Two independent gating mechanisms:

MechanismEffect
PermissionWrapperSplits the whole page by UWI_DASHBOARD; the Rainfall card by RWI
checkServiceExist(category)A card whose service isn't in your loginData.services renders a "Not Available — Get More Details" (contact-sales) state instead of data

Edge cases & guards

CaseHandling
LoadingFull-height loader on first load; a grayscale backdrop during mid-refresh
No / invalid dataFalls back to PageNotFound (the data source swallows fetch errors)
Empty per cardPer-card copy ("No Intake", "No Consumption", borewell "No Data Found", "No alerts found!")
Missing serviceCard shows the "Not Available" contact-sales state (see above)
STP with no dataThe STP section hides itself entirely
Yesterday viewAuto-reverts to Today after 60 s
Leakage bannerShown only when loginData.leakageEnabled (md+ screens); "Learn more" opens a dialog
ResponsiveCards stack on small screens; search renders in the header (desktop) and below (mobile)

Underlying libraries

PurposeLibrary
Energy donutrecharts
Pie summariesPieChartHover (shared, Recharts-based)
Line trendDashboardLineGraph (shared)
Stock tankWaterTank (shared)
Quality gaugehand-rolled inline SVG (no chart lib)
Dates / utilsmoment, lodash, @iconify/react

Code reference

FileRole
DashboardPage.jsxShell, provider, Today/Yesterday switch, variant split
dataSource/dashboard.js · controller/dashboardController.jsThe /landingPage/userData call + post-processing
store/DashboardStore.jsContext state (dashboardData, graphData, params, isYesterday)
components/BuildDashboardPage.jsx · BuildUWIDashboardPage.jsxStandard vs UWI layouts
components/Dashboard*Card.jsx / *Details.jsx / *Summary.jsxThe individual cards