Skip to content

Commit

Permalink
First-Round Changes: Applying hotfixes found from Pilot Demo (#201)
Browse files Browse the repository at this point in the history
* post-review tinkering

* beginning hotfix application based on user feedback from pilot demonstration. Further changes will be made here and sequentially applied to dev and then prod site

* next round of hotfixes. see github issue updates for more info

* adding information about form headers to the upload system and multiline input system

* form explanation system implemented. standardized via central component to simplify application where needed. Standardization applied to grid columns to reduce footprint, and reorganized component structure to increase readability.

* removing species autocorrection. required headers have been added to the system.

* completing refit to standardize units information in plots and remove customizations from each table using units. Updated table structures and procedures to correctly work with this new system.

* baseline review changes column added. additional enhancements pending, but grid is rendering correctly and shows history.{

* adding paginationModel dependency to the validation status column render to force re-render when pagination model is updated (user moves to new page)
  • Loading branch information
siddheshraze authored Dec 17, 2024
1 parent 3fae4d8 commit 5dec1f4
Show file tree
Hide file tree
Showing 63 changed files with 1,660 additions and 1,928 deletions.
17 changes: 13 additions & 4 deletions frontend/app/(hub)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { title } from '@/config/primitives';
import { useSession } from 'next-auth/react';
import { redirect, usePathname } from 'next/navigation';
import dynamic from 'next/dynamic';
import { Box, IconButton, Stack, Typography } from '@mui/joy';
import { Box, IconButton, Stack, Typography, useTheme } from '@mui/joy';
import Divider from '@mui/joy/Divider';
import { useLoading } from '@/app/contexts/loadingprovider';
import { useOrgCensusContext, usePlotContext, useSiteContext } from '@/app/contexts/userselectionprovider';
Expand Down Expand Up @@ -287,6 +287,8 @@ export default function HubLayout({ children }: { children: React.ReactNode }) {
}
}, [session]);

const theme = useTheme();

return (
<>
<Box
Expand Down Expand Up @@ -396,10 +398,17 @@ export default function HubLayout({ children }: { children: React.ReactNode }) {
bottom: 20,
right: 20,
zIndex: 2000,
bgcolor: 'primary.main',
color: 'white',
backgroundColor: 'transparent', // Remove background color
boxShadow: 'none', // Remove shadow if present
color: theme.vars.palette.primary.solidColor, // Text/icon color
opacity: 0.5, // Initial opacity
transition: 'opacity 0.3s ease',
'&:hover': {
bgcolor: 'primary.dark'
opacity: 1,
backgroundColor: 'transparent' // Ensure no hover background
},
'&:focus-visible': {
outline: `2px solid ${theme.vars.palette.primary.solidColor}` // Add focus ring for accessibility if needed
}
}}
>
Expand Down
7 changes: 7 additions & 0 deletions frontend/app/(hub)/measurementshub/recentchanges/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client';

import IsolatedUnifiedChangelogDataGrid from '@/components/datagrids/applications/isolated/isolatedunifiedchangelogdatagrid';

export default function RecentChangesPage() {
return <IsolatedUnifiedChangelogDataGrid />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function GET(_request: NextRequest, { params }: { params: { dataTyp
const query = `SELECT 1 FROM ${schema}.quadrats q
JOIN ${schema}.censusquadrat cq ON cq.QuadratID = q.QuadratID
JOIN ${schema}.census c ON cq.CensusID = c.CensusID
WHERE q.PlotID = ${plotID} AND c.PlotCensusNumber = ${plotCensusNumber} LIMIT 1`;
WHERE q.PlotID = ${plotID} AND c.CensusID IN (SELECT CensusID from ${schema}.census WHERE PlotID = ${plotID} AND PlotCensusNumber = ${plotCensusNumber}) LIMIT 1`;
const results = await connection.executeQuery(query);
if (results.length === 0)
return new NextResponse(null, {
Expand All @@ -54,7 +54,7 @@ export async function GET(_request: NextRequest, { params }: { params: { dataTyp
const pvQuery = `SELECT 1 FROM ${schema}.coremeasurements cm
JOIN ${schema}.census c ON C.CensusID = cm.CensusID
JOIN ${schema}.plots p ON p.PlotID = c.PlotID
WHERE p.PlotID = ${plotID} AND c.PlotCensusNumber = ${plotCensusNumber} LIMIT 1`;
WHERE p.PlotID = ${plotID} AND c.CensusID IN (SELECT CensusID from ${schema}.census WHERE PlotID = ${plotID} AND PlotCensusNumber = ${plotCensusNumber}) LIMIT 1`;
const pvResults = await connection.executeQuery(pvQuery);
if (pvResults.length === 0)
return new NextResponse(null, {
Expand All @@ -69,7 +69,7 @@ export async function GET(_request: NextRequest, { params }: { params: { dataTyp
JOIN ${schema}.census c on cq.CensusID = c.CensusID
JOIN ${schema}.personnel p ON p.CensusID = c.CensusID
WHERE q.PlotID = ${plotID}
AND c.PlotCensusNumber = ${plotCensusNumber} LIMIT 1`;
AND c.CensusID IN (SELECT CensusID from ${schema}.census WHERE PlotID = ${plotID} AND PlotCensusNumber = ${plotCensusNumber}) LIMIT 1`;
const quadratsResults = await connection.executeQuery(quadratsQuery);
if (quadratsResults.length === 0)
return new NextResponse(null, {
Expand Down
9 changes: 9 additions & 0 deletions frontend/app/api/fixeddata/[dataType]/[[...slugs]]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ export async function GET(
paginatedQuery = `SELECT SQL_CALC_FOUND_ROWS * FROM ${schema}.${params.dataType} pdt WHERE pdt.SpeciesID = ? LIMIT ?, ?`;
queryParams.push(speciesID, page * pageSize, pageSize);
break;
case 'unifiedchangelog':
paginatedQuery = `
SELECT SQL_CALC_FOUND_ROWS * FROM ${schema}.${params.dataType} uc
JOIN ${schema}.plots p ON uc.PlotID = p.PlotID
JOIN ${schema}.census c ON uc.CensusID = c.CensusID
WHERE p.PlotID = ?
AND c.PlotCensusNumber = ? LIMIT ?, ?;`;
queryParams.push(plotID, plotCensusNumber, page * pageSize, pageSize);
break;
case 'attributes':
case 'species':
case 'stems':
Expand Down
13 changes: 13 additions & 0 deletions frontend/app/api/fixeddatafilter/[dataType]/[[...slugs]]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ export async function POST(
${searchStub || filterStub ? ` AND (${[searchStub, filterStub].filter(Boolean).join(' OR ')})` : ''}`;
queryParams.push(plotID, plotCensusNumber, page * pageSize, pageSize);
break;
case 'unifiedchangelog':
if (filterModel.quickFilterValues) searchStub = buildSearchStub(columns, filterModel.quickFilterValues);
if (filterModel.items) filterStub = buildFilterModelStub(filterModel);

paginatedQuery = `
SELECT SQL_CALC_FOUND_ROWS * FROM ${schema}.${params.dataType} uc
JOIN ${schema}.plots p ON uc.PlotID = p.PlotID
JOIN ${schema}.census c ON uc.CensusID = c.CensusID
WHERE p.PlotID = ?
AND c.PlotCensusNumber = ?
${searchStub || filterStub ? ` AND (${[searchStub, filterStub].filter(Boolean).join(' OR ')})` : ''}`;
queryParams.push(plotID, plotCensusNumber, page * pageSize, pageSize);
break;
case 'quadrats':
if (filterModel.quickFilterValues) searchStub = buildSearchStub(columns, filterModel.quickFilterValues, 'q');
if (filterModel.items) filterStub = buildFilterModelStub(filterModel, 'q');
Expand Down
12 changes: 3 additions & 9 deletions frontend/app/api/formdownload/[dataType]/[[...slugs]]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,19 @@ export async function GET(_request: NextRequest, { params }: { params: { dataTyp
quadrat: row.QuadratName,
startx: row.StartX,
starty: row.StartY,
coordinateunit: row.CoordinateUnits,
dimx: row.DimensionX,
dimy: row.DimensionY,
dimensionunit: row.DimensionUnits,
area: row.Area,
areaunit: row.AreaUnits,
quadratshape: row.QuadratShape
}));
return new NextResponse(JSON.stringify(formMappedResults), { status: HTTPResponses.OK });
case 'measurements':
query = `SELECT st.StemTag AS StemTag, t.TreeTag AS TreeTag, s.SpeciesCode AS SpeciesCode, q.QuadratName AS QuadratName,
q.StartX AS StartX, q.StartY AS StartY, q.CoordinateUnits AS CoordinateUnits, cm.MeasuredDBH AS MeasuredDBH, cm.DBHUnit AS DBHUnit,
cm.MeasuredHOM AS MeasuredHOM, cm.HOMUnit AS HOMUnit, cm.MeasurementDate AS MeasurementDate,
st.StemLocalX AS StartX, st.StemLocalY AS StartY, cm.MeasuredDBH AS MeasuredDBH, cm.MeasuredHOM AS MeasuredHOM,
cm.MeasurementDate AS MeasurementDate,
(SELECT GROUP_CONCAT(ca.Code SEPARATOR '; ')
FROM ${schema}.cmattributes ca
WHERE ca.CoreMeasurementID = cm.CoreMeasurementID) AS Codes
WHERE ca.CoreMeasurementID = cm.CoreMeasurementID) AS Codes
FROM ${schema}.coremeasurements cm
JOIN ${schema}.stems st ON st.StemID = cm.StemID
JOIN ${schema}.trees t ON t.TreeID = st.TreeID
Expand All @@ -108,11 +105,8 @@ export async function GET(_request: NextRequest, { params }: { params: { dataTyp
quadrat: row.QuadratName,
lx: row.StartX,
ly: row.StartY,
coordinateunit: row.CoordinateUnits,
dbh: row.MeasuredDBH,
dbhunit: row.DBHUnit,
hom: row.MeasuredHOM,
homunit: row.HOMUnit,
date: row.MeasurementDate,
codes: row.Codes
}));
Expand Down
Loading

0 comments on commit 5dec1f4

Please sign in to comment.