Skip to content

Commit

Permalink
App Overhaul & Stabilization (#175)
Browse files Browse the repository at this point in the history
* Add or update the Azure App Service build and deployment workflow config

* live site testing

* trying to see if I can force system to look in frontend dir for package.json

* fixing build errors. live site deployment testing

* adding missing .pem file

* attempting to add .env file

* adding environment reference -- secrets. not referencing correctly

* just added development slot and updated publish profile reference. removing .next from gitignore

* attempting to update workflow by pushing zip file to azure instead of unzipped file

* removing storybook usage and setup. trimming contents of package.json to more efficiently set up continuous deployment. applying zip -9 compression to reduce the upload/download time as much as possible.

* not sure why, but compression -9 causes errors in Azure deployment. removing that label and trying again.

* removing caching command to simplify things

* adding .next to gitignore. updating zipper system to unzip files before deploying

* trying to manually create env vars instead of just creating a .env doesn't seem to be working. reverting back to just creating a .env and populating.

* specifying package in workflow -- realizing that the system is porting over the zip file AND the unzipped contents.

* trying to deploy to prod slot instead of custom dev slot

* adding standalone export statement.

* correcting next start command to use node standalone server JS file -- maybe this'll help?

* reverting package spec to azure deployment to . instead of frontend/

* found tutorial online. applying changes noted there

* forgot to remove unnecessary upload stage from workflow

* changes to the workflow should trigger a new build

* Add or update the Azure App Service build and deployment workflow config

* port specification

* not sure why generated env file is not being recognized

* welp forgot to set environment in workflow

* specifying frontend directory for packaging in workflow

* reworking system start/app login flow. changes made ot the workflow.

* continuing full system updates. reworking validation system to operate by retrieving full coremeasurement row inserted (to get plot/quadrat/personnel info) instead of using user-provided data. Because some of the validations use plot/quadrat, etc., when those validations fail the user-provided data will not provide info about it.

* trying to see if changing the port statement here will change there

* attempting to change port in build to get the azure container to connect. seeing if i can add next build caching.

* attempting to change ecosystem.config.js file to see if that will allow port editing

* removing next build cache statement

* testing restructuring as part of build process

* trying something new

* messed up build instructions

* trying to move frontend into main dir failed. trying this again with updated tutorial flow

* live site is online, but nextauth callback url is still referencing localhost:3000. attempting to manually set nextauth_url environment variable.

* checking to see if resetting port to 3000 in ecosystem file will keep things running. nextauth callback is failing for some reason

* not sure why, but API calls to the fetchall endpoints are failing for some reason

* forgot to make sure that the .pem signin file is also added to the standalone package

* clerical error

* saving progress. Currently, the error validation display is incomplete -- the CMError type has been updated, but its usage in uploadvalidationerrordisplay has not been fully updated.

* saving changes -- live site update

* updated view implementation done. test error rows checkbox implemented.

* build failure -- forgot to add missing parameter to deprecated page

* live site's downloadallfiles route is failing? tracing error back seems to show that AZURE_STORAGE_CONNECTION_STRING is throwing undefined and failing the process env check in getContainerClient. Added an exclamation point there and redefined the secret in Github with quotation marks just in case that makes a difference.

* receiving the following error: TypeError: Expected signal to be an instanceof AbortSignal. Attempting to debug this error

* after research, it seems that a now-default setting to next's serverMinification experimental setting may be causing the error. manually setting this var to false to see if the error continues

* missing column headers and data from viewuploadedfiles table

* saving progress. email-based authentication is still incomplete

* full-scale changes. Added the following changes:
1. global indicator file implemented
2. middleware file updated to handle system redirection and post-authentication flow
3. all contexts updated to correctly utilize the enhanced dispatch setup
4. hashing system implemented to reduce data load when first opening app. If data found in IDB matches database, database call will not occur.
5. within sidebar -- session resume dialog implemented. system will check IDB to see if previously selected plot and census exist. if yes, user will be prompted via dialog to resume session. contexts will be updated once session is resumed or user opts to reset session.
6. redefined system load functions' connection to react dispatches completed
7. after seeing error with usage of nextUrl.searchParams, all API routes reworked to move searchParams calls outside of try-catch.
8. crypto-js package added and implemented in hash generation in place of node:crypto, which doesn't seem to work quite right with NextJS v14
9. NextJS updated to v14.1.3 and system implemented updated to correctly work with new updates
10. deprecated coremeasurements page removed.
11. updateContextsFromIDB reworked to correctly work with 1) enhanced dispatches and 2) IDB storage.
12. upload system reworked to reduce number of user-required button presses. system will now trigger 5-second countdown timers before continuing to the next stage.
13. viewuploadedfiles --> table display reworked to work correctly with new implementation of UploadedFile.
14. upload system --> acceptedFiles state variable re-centralized to uploadparent. upload system will now automatically parse inbound files as part of Dropzone logic instead of requiring manual button press to parse.

* full-scale changes and code reformatting.

* forgot to update UploadFireAzure component reference in uploadparent.tsx

* removing throw new error statement here

* saving changes -- datagridcommons testing is ongoing. Integration of quadratpersonnel junction table into quadrats datagrid instance is still in progress, but broad-scale reformatting and changes made across the board.

* QuadratPersonnel junction table has been successfully integrated into quadrats data grid! separate set of API endpoints has been created to handle this -- still need to go through and remove any unnecessary code that hasn't yet been pulled, but otherwise functionality is sound

* confirmation dialogs added to generic datagrid functions before saving or deleting, and confirmation dialog added to personnelautocompletemultiselect component to ensure that user has to confirm before adding or deleting personnel

* Adding function to clarify dialog text when personnel are being added/removed

* package versions updated. Had to do some reworking to make sure that code is compliant with updated versions

* promise.all seems to be breaking things. Removing and trying again.

* removing hash access. seems to be breaking (throwing 500)

* forgot to add azure catalog schema to github environmental variable. adding jump loop to make sure that user is redirected to dashboard if trying to access login page while already logged in.

* hashing was breaking because catalog environmental schema reference was not added to github

* never mind hashing still doesn't work

* adding secret to new env being generated in live site

* fixing breakage in live site

* the changes to the yml file were not actually included because I was in the frontend/ dir, not ForestGEO/

* params null check added

* I think I've worked the problem with the census datagrid

* continuing tinkering with the census grid columns -- changing system to just show current date instead of null or invalid date

* reverting this change super fast -- restoring null formatting

* removing excess columns n stuff from utilized grid columns, accidentally disabled pool monitor export so restoring that super quick

* formatting. adding null startdate formatting b/c mpala census selection bugs out the app (census 1 has a null start date)

* forgot extra condition in login system. adding some extra filtering to ensure that attributes, which delete via string code values, are correctly accounted for when interacting with the datagrid

* saving changes. Opening PR here shortly.

* addressing feedback from testers. Adding broad-spec formatting to remove unused imports, etc.

* debugging validation scripts -- seeing date conversions not being processed properly from parsing to upload, so adding additional user information panels and custom handling to account for that.

* 1. removing date parsing from processcensus.tsx -- parsing has been moved to file upload stage
2. Measurements Summary Grid Columns' measurementDate column updated to type string. Moment-based date check added and conversion to date and then to datestring added.
3. date-fns typescript package added
4. upload parent compartmentalized into new separate modal component. All datagrid views updated to use this in place of existing manual modal creation
5. uploadparentmodal enhanced to restrict users from exiting modal by any means other than pressing the X button.
6. uploadstart stage updated to simplify and reduce complexity. components moved to center and back/finalize button adjusted to be more visually appealing.

* 1. restructuring upload system -- added segments subfolder to highlight active parts of the upload system and separate them from the administrative parent component uploadparent.tsx
2. added modal system to compartmentalize upload parent system into dedicated state-managed variable system

* beginning Jest test unit test process -- some implementations complete

* partial test cases added for generic datagrid and macros

* reorganizing file structure to increase visibility and adding API route and datagridhelpers.ts handling to show validation history (future-proofing, not currently in use)

* saving changes. Will resume dev shortly

* updated .gitignore pulled in from main

* manually implemented validation routes replaced with dynamic routes with slug type

* deprecated API routes removed

* running cleanup command on codebase -- removing unused imports, reorganizing formatting, etc

* adding tests and formatting

* Bug fixes:
1. datagridcommons (and validation procedures) -- multiple rows with validation errors were not being highlighted (only one at a time).
After investigating, it was determined that the bug was in the structuring of the validation procedures, which was overwriting or removing
past validation errors for a given coremeasurementID. It seems to be working now.
2. sidebar -- sidebar-independent scrolling implemented to ensure that main page stretching does not occur.
3. login -- automated slideshow of background images was only running once. interval system and reset implemented to ensure that it runs continuously
when the login page is open.
4. measurementssummary -- API route updated to remove duplicate validation error querying, which was also causing issues with the row error display.
Output was also not being parsed correctly, leading to problems with pagination, now corrected.
5. styleddatagrid -- border outlining was not rendering properly, corrected

New features/functionality:
1. stemtreedetails -- page created in measurementshub, custom view and route implemented, and configuration added to generic datagrid.
helper functions added as needed, and RDS macros implemented.
2. dynamic routing system implemented for validation procedures -- all manual routes have been collapsed into one route
3. default limits -- species table updated to include default max/min DBH & HOM values that are now queried in place of using hardcoded values.
4. subspecies -- page created in properties hub. Currently unpopulated, but CRUD system will need testing to ensure correct function.

* reformatting to ensure that existing datagrids work while adding restructuring for stemTreeDetails

* 1. removing default dialog prompt
2. removing azure storage container text
3. removing endless login page slide loop (set to 30s)
4. removing endless icon loop (set to 30s)

* printing system fixed. css bug in rainbow icon resolved. context references added directly to datagridcommons instead of passing it in via parameter.

* next version

* beginning process of integrating new subquadrats table into system. as part of this, refactoring all config macros into dedicated files and functions to reduce complexity of each file.

* removing data files

* I thought I'd removed  sample data and stuff already but it's been added back now for some reason. removing it again

* Project-wide changes:
1. Documentation application Writerside added and populated with table definitions to use as reference point for RDS type updates later on.
2. Extraneous /fetchall API endpoints removed to reduce clutter
3. File-specific API endpoints centralized into new /filehandlers folder
4. CoreMeasurements API endpoint moved into /fixeddata folder. References updated.
5. Plot and Census contexts were previously being drilled via props into upload segments. Drilling replaced with direct calls to the context instead.
6. Formatting applied across frontend/ directory.
7. RDSDefinitions folder fully populated with respective RDS type definitions and GridColDef datagrid column fields.
8. NPM module critical warning fixed with npm audit fix --force.

* applying eslint changes across project. Replaced fetchall endpoints with dynamic routing. Added subquadrat processing to fixeddata API set and finished integrating subquadrat retrieval into layout and context files.

* removing package-lock.json and forcing update to latest versions universally

* fixing validation bug, adding subquadrat ID row to measurements, fixing measurements upload system. Beginning integration of subquadrats into quadrats page instead of having a dedicated subquadrats page (will reduce confusion, since subquadrats are not technically needed for SI server upload)

* full-scope changes. Beginning dynamic API routing system construction. Saving changes before removing existing/outdated APIs and moving their function to the dynamic system. New system will only require 1 API route, which will vastly improve project readability.

* slug api routing system seems to be somewhat stable now. It's been modified to be compatible with all data types so far. Plot creation interface has been added as well and tested to confirm that creation works properly.

* Large-scale changes:
1. Created and implemented vitest unit tests. Vitest was selected on account of its higher efficiency than Jest, and compatibility with NextJS's newer versions (current version is set to 14.2). However, end-to-end testing still needs to be implemented. Testing showed Cypress is not compatible with NextJS v12+ yet, and Playwright proved to be a little too complicated to execute within the scope of the current development window. This will need to be phased in down the road, I think.
2. Upload system was updated to integrate with the updated version schema. Systemwide changes were required due to the degree of differentiation between the prior schema and the current version, focusing particularly on the processcensus.tsx file and its supporting functions.
3. Sidebar received large function shift -- was lifted to allow users to create, edit, or remove plots. Additional confirmation dialog added for deletion system. Form setup used for plot addition or editing was enhanced and customized with individual validations -- coordinate and dimension values are now required to be > 0, and area measurements are now automatically calculated, with the field being disabled to user input accordingly. Sidebar was also lifted to enhance the function of the census selection modal. Additional dialogs and button functions incorporated to allow users to "open", "reopen", or "close" a census directly from the sidebar. Census closure dialog was enhanced to require users to submit a date after the listed start date in order to successfully close the census. Census deletion was added, but summarily deleted, with an alert to inform the user that census deletion is not available added.
4. IDB integration was updated to resolve issues with implementation of manual reset. System will now dynamically upgrade DB version to automatically clear stored browser cookies. Please note that this does not affect function in any way and is a pseudo-upgrade solely to clear the browser's cache.
5. Datagrid was repaired following testing that showed that modification of the attributes datagrid was not working correctly, and integration of the dynamic fixeddata routing handler was not correctly performed. Deep-scope changes added to facilitate this.
6. Measurements Summary View page was strongly enhanced to add features to 1) highlight rows that are pending validation but have not failed any validations, 2) enhance the function of the measurements upload systemn as follows: previously, it was possible to directly upload measurements files without uploading requisite fixed data (quadrats, personnel, species, etc). This has been removed and replaced with a detailed dialog that polls each of these fixed data tables and returns a detailed message to the user using progress bars and tooltips to inform them of which tables are missing population.
7. Site navigation system was reworked to incorproate new icons and adapted to the new website structure. Stemtreedetails view page was removed and replaced with the other new views.

* rework continued. Saving changes before attempting integration of a collapsible sidebar element.

* attempting full-scope breakdown of sidebar file into interlocking subcomponents -- hoping to reduce this file size since it's crossed 1500 lines and also retrieve functionality I can reuse elsewhere.

* never mind, lift has been scheduled for future release due to LOE time constraints

* okay, large-scale changes seem to be working. quadratpersonnel datagrid has been separated into its own datagrid. Data validity checks have been automated and incorporated. Queries have been updated and repaired as needed. Insertion/deletion test has been done for quadrats, personnel, quadratpersonnel. Need to get the others done.

* removing progress dialog's independent API calls and replacing with connection to existing Context data validity

* 1. upload system updated integrated into new schema
2. view system integrated into query system
3. data validity checks confirmed and usage expanded throughout application
4. datagrid systems expanded into independent functions
5. quadratpersonnel datagrid completed
6. subquadrats datagrid completed
7. upload system enhanced to perform NULL insertion when insertion value exceeds table column limit
8. upload system enhanced to perform species division into genus and species when a two-word species is inserted and no genus is inserted. upload system-customized datagrid has been updated to provide clear instruction on this.
9. container client bug corrected -- turns out it doesn't like capitalized letters
10. alltaxonomiesview connected in place of species and upload reworked
11. views moved to fixeddatainput folder
12. basic joyride (incomplete) implemented and integrated into layout, sidebar, and contexts
13. validationerrordisplay bug corrected
14. PENDING -- need to implement species limit datagrid view

* Documentation changes -- other changes still pending, but removed deprecated documentation and integrated complete instructions on handling migration from ctfsweb flat file to new forestgeo schema.

* core changes:
1. Adding more test cases and reattempting foundation API test structure.
2. Removing core data provider from app structure -- no longer useful due to size constraints
3. Reworking app's server-side, client-side, and dynamic structure. Improved speed of website somewhat now that load is not fully concentrated on client-side
4. Removed references to dayjs and replaced all with moment -- ended up being a little more useful
5. Wrapped renderSwitch() elements in Box -- found that text was being cut off at bottom edge and this seemed to fix it.
6. CORE CHANGE: Census structuring has been updated to new type OrgCensusRDS (organized). Census approach and treatment has fundamentally change, requiring app-wide reworking. Restructure based on the following determinations:
-- Censes are organized by PlotCensusNumber, not CensusID
-- censusID seems to be used purely to associate a date range to a given PlotCensusNumber
-- rows in the census table should not be directly updated or overwritten in the event that new information or corrected information needs to be inserted. In these cases, a new census row should be created based on the date range of the new changes, and the new changes should be incorporated there.
-- once closed, censuses (by censusID) should not be reopened (i.e., row w/ censusID = 1 has start date and end date defined ==> closed. censusID 1 cannot then have its end date set to NULL to indicate reopening.)
-- API calls and all pertinent references have been reworked to search along plotCensusNumber. HOWEVER, validation procedures and other quality control systems still use censusID, as each measurement is still going to be associated with a specific date range (censusID)
-- SQL-side tables' implementation of census has NOT CHANGED. Census reorganization changes are intended purely to make understanding data easier.
7. Skeletons folder deleted (unused)
8. App has been refactored to better handle subquadrats -- it seems that plots can use EITHER subquadrats or just quadrats (from a stored data perspective). With this in mind, the system has been reworked to allow users to add subquadrats information in the event that it is needed. On the admin-side, a toggle switch has been incorporated to achieve this.
9. After issues with IDB synchronization and database connectivity issues, IDB usage has been temporarily disabled. As such, the app now leans purely on SQL interactions to perform operations.
10. App has been reworked to use UNDEFINED client-side and NULL server-side. Due to issues with how typescript interprets undefined and null, it became less complicated to rework the system to use udefined. Mapping systems have been updated to utilize this.
11. QuadratPersonnel datagrid has been created. Attempted use of Autocomplete components has been deprecated and replaced with a simple dropdown selection system. The autocomplete API system was becoming increasingly convoluted and would have required building in a cache to save recently selected/updated items, which is out-of-scope currently.
12. SQL views have been integrated into app datagrid handling/processing. In line with this, all views have been updated server-side to attach all joined tables' ID columns. A standardized system has been implemented to review changes made to the view and submit UPDATE statements to the corresponding table, thus allowing for an interactive SQL view.
13. CORE CHANGE: Sidebar has been simplified drastically to remove all user selection modals and instead directly show Select components. Function has been confirmed.
14. Sidebar has been updated to add census interaction buttons at bottom of sidebar in place of a census datagrid. This allows census interaction restrictions to be preserved while also allowing censuses to be reopened/closed/new census started.
15. prevalidation system -- datavalidityprovider.tsx has been added in order to poll core tables (fixed data tables) that are required in order for new census.csv format forms to be submitted. Tooltips and alert badges have also been incorporated. QuadratPersonnel has also been restricted and will not be unlocked until at least 1 quadrat and 1 person has been added to each respective table.
 16. Date convention has been standardized to UTC across application. User warnings have been added accordingly.
 17. Census open/close/reopen modals have been updated to show most recent open/close/reopen date as a reference point to ensure that the correct date is attached.

* minor edit to ensure utc applied

* need to build out and update documentation as contract end is approaching. Will attempt to host connected Azure site for documentation alongside existing live site to better facilitate onboarding.

* saving changes -- might be removing this shortly.

* test

* resetting -- seems like this isn't going to work

* removing storybook installation -- needs to be a future development task rather than something to be done immediately

* adding missing .pem file

* resolving merge issues

* partial save -- should not be merged

* documentation changes

* workspace docs file

* resolving package.json error

* basic postvalidation route setup and added

* partial changes made, saving.

* saving changes -- need to resolve mysql connection state being set to closed, which is automatically kicking any incoming connections on live site

* Adding additional emergency settings to ensure that connection is not automatically set to closed after mysql server is exited. Further incorporating graceful shutdown mechanism to ensure that in the rare case that leftover connections remain, they are properly closed.

* Add or update the Azure App Service build and deployment workflow config

* Remove the Azure App Service build and deployment workflow config

* attempting to add development livesite job to test without needing to commit to main

* build failure -- testing

* wildcards and next cache steps added. Wildcards will ensure that all future versions will automatically build to the development website (must follow established convention)

* received failed login error -- added dedicated login step

* login step seems to be causing new issues -- commenting out and attempting build again

* accidentally deleted main build step, restoring and commenting out current nonfunctional steps for later

* accidentally using wrong publish profile reference

* not sure why, but next-auth login is not being permitted on development site for some reason

* trying more stuff to see if I can get the development-based authentication to work

* need to fix base nextauth url

* accidentally made the change backwards

* temp -- saving changes. tried updating packages and that broke everything so had to rewind it all. TESTING.md file committed to explain user testing process for future use.

* minor formatting changes, adding enhanced shortcut implementation to datagrids, fully fleshing out reentry data modal system

* adding framework for icon customization as versions change

* renaming branch

* acacia version signature incorporated. Shell folder system and icon system incorporated.

* icon updated to forestgeo-app central

* saving changes. Mostly styling updates and reworkings to reduce code complexity.

* Adding changelog and version explanation

* first-round error export function created. Pending testing -- will update as output is tested

* testing potential resolution to vitest get-stream issue

* extensive core schema changes. Triggers and changelog system implemented across the board to address need for non-duplicative update system -- users will be iteratively updating rows as they complete a census. B/c of this, makign rows immutable will cause too much duplication. In place of this, the changelog system has been implemented.

* incorporating SQL structure. Minor changes made to other authentication API and datagrids updated to correctly integrate with schema changes. Gitignore files updated accordingly.

* PlotRDS type was updated to remove usesSubquadrats, but summary page was not updated to correctly work with this change, now repaired.

* decided to re-add the usesSubquadrats property to the PlotRDS type to avoid cascading issues. Value has been defaulted to false. Additionally updating API endpoints for Personnel table to use RoleID instead of Role

* migration script has been updated to target the sinharaja data source (no exposed data).

The connection closed state issue is persisting, despite debugging attempt. To resolve this:
1. a manual inactivity timer has been implemented to automatically close the pool after 1 hour of inactivity.
2. A new user, `deployment`, has been created to act as a dedicated user for the live site. This will ensure that my connections to the database do not cause issues for any active site users.
3. For added redundancy, the connectTimeout parameter has been added to the sqlConfig object.

* accidentally forgot to incorporate methods to handle pool reinitialization and update, resolving

* changelog:
1. added resetschema.sql function to reset testing schema
2. formatting changes and consolidating some additional data
3. datagrid column arrays are in process of being moved into separate .tsx file so that Typography formatting can be applied to headers when needed (if column names are too large, etc)
4. Updated personnel fixeddata and cmprevalidation API endpoints to correctly work with updated PersonnelRDS type/table
5. Playwright initialization added and setup. No tests currently added, but future proofing for use.
6. RolloverModal added to handle rollover process when creating a new census. Allows users to selectively choose personnel OR quadrats to rollover from one OR more past censuses (where data is present).
7. Instead of discarding testing component file, was instead converted into the RolloverStemsModal. Its function has not been enabled but has been integrated. Allows users to additionally rollover stems data if needed ONLY if quadrats data is already being rolled over. Still needs to be fully tested and repaired (assuming bugs are present)
8. area selection options macro added now that dedicated selection array for area measurements added SQL-side.

* 1. added resetschema.sql function to reset testing schema
2. formatting changes and consolidating some additional data
3. datagrid column arrays are in process of being moved into separate .tsx file so that Typography formatting can be applied to headers when needed (if column names are too large, etc)
4. Updated personnel fixeddata and cmprevalidation API endpoints to correctly work with updated PersonnelRDS type/table
5. Playwright initialization added and setup. No tests currently added, but future proofing for use.
6. RolloverModal added to handle rollover process when creating a new census. Allows users to selectively choose personnel OR quadrats to rollover from one OR more past censuses (where data is present).
7. Instead of discarding testing component file, was instead converted into the RolloverStemsModal. Its function has not been enabled but has been integrated. Allows users to additionally rollover stems data if needed ONLY if quadrats data is already being rolled over. Still needs to be fully tested and repaired (assuming bugs are present)
8. area selection options macro added now that dedicated selection array for area measurements added SQL-side.

* skipping rollovermodal unit tests -- they're not up-to-date and don't properly test the modal.

* - refactoring changes and centralizing features.
- Github feedback form 1st iteration has been incorporated, but disabled pending approval of Github PAT.
- Creating first-iteration ViewFullTable grid.
- Removing census-lock from upload functionality. Now that the census function has been deprecated it doesn't need to be active
- renamed and updated github secrets in next.config.js file

* Updating modules and fixing a small emotioncache error.

* saving changes -- pushing to dev

* re-enabling feedback form

* github feedback modal is throwing environmental errors, but only when building to dev site. Assessing.

* Found the issue -- needed to update workflow to incorporate new env variables needed to operate git API call.

* vitest bug found, determined to be thrown by potentially outdated version of execa. Manually adding latest version as dev dependency.

* Adding default error pages to all routes. Will later customize to each page. No other configuration needed, NextJS will automatically wrap all adjacent page files with the error.tsx file

* minor additions made here to clarify which error page is which

* 1. view system has been updated to use materialized views instead of existing view queries (view runtime delay exceeded acceptable limits)
2. batch processing flag system implemented and removed, replaced with app-side monitoring instead of trigger-based monitoring. After the user performs updates to dependent tables, the app will place calls to manually refresh materialized view tables behind the scenes
2a. Currently, only the API is implemented. The implementation of a background load is pending.
3. All pages in application were given default error.tsx files. NextJS automatically wraps all page.tsx files with the (same-level) error.tsx file, ensuring that error handling is managed by NextJS instead of app
4. Progress Dialog system removed from the View Data page. This is already being handled by the prevalidation system.
5. fixeddata API route adapted to include calls to the materialized view tables
6. refreshviews API route created. Accepts dynamic routing segments to specify view and schema to target
7. Datagrid columns updated:
7a. View definitions across all schemas updated. Please see sqlscripting/ files for specific updates
7b. View Data datagrid columns updated to add customized handling for DBH and HOM values. These columns, instead of sitting adjacent to their respective unit columns, have been added together.
7c. id columns added where needed -- even though they're not necessarily needed, the datagrids will not work properly if they're not provided.
7d. AllTaxonomiesView grid has been updated to remove reference table column joins. This table doesn't seem to be historically used, and can be added later if needed.
8. Partial culprit for extended VIew Data page load times was also repeated calls to fetchPaginatedData at the same time. Component was debugged to ensure that it's only called once, and debounce function was also added.
9. Full-scale RDS type updates:
9a. Instead of manual implementation of each Result type, requiring two points of update whenever schema changes are made, generic utility functions implemented to automate implementation of Result types based on RDS type definitions
9b. Manual implementation of mapping functions replaced with single generic mapper system that automates mapping to and from RDS type.
10. PoolMonitor class updated to use `chalk` module to provide more comprehensive server-side logging using colors.
11. middleware.ts file updated to use new properties link name
12. acacia version name and debug setting added to build command

* fixing links in middleware. Attempted to upgrade next-auth to v5 but reset after cascading errors. Adding no-lint setting to next build b/c of missing support for eslint v9 (current version) and various missing type dependencies.

* minor updates through npm-check-updates

* partial commit - saving changes to ensure that resetting will not remove too much progress.

* Prettier and ESLint successfully integrated into project. Package.json command updated to add function.

* 1. Applying prettier changes.
2. Amending Tooltip function in Dashboard's Chip to disappear when the pulse animation is active.
3. Amending datagrid tooltips to disable interactivity with the text itself, ensuring that user can move from one button to the next without accidentally holding the tooltip open.

* 1. minor enhancements to the measurements-oriented datagrid to display viewfulltable.
2. global formatting and adjustments

* 1. minor enhancements to the measurements-oriented datagrid to display viewfulltable.
2. global formatting and adjustments

* saving changes. Dashboard system reconfigured and validations page added.

* Full-scale formatting. Baseline dashboard has been completed. Baseline validations view (template) has been added. summary statistics route (postvalidations) has been tentatively added, but needs refining

* Accidentally deleted validation API routes, restoring. Formatting and adding datagrid for cmverrors to the validations page.

* Saving changes. Continuing reworking of validation CRUD system and beginning application of feedback changes.

* Removing row pending/failed validations grids from validations page. minor adjustments to the dashboard page.

* missed a file for some  reason

* Accidentally messed up structuring of datamapper file (bugs introduced), resolved. Applied prettier to project.

* partial save. resolving baseline changes for validation CRUD system and preparing for further development.

* Breaking changes being saved. Partial completion of core updates to validation system and upload interaction system. Additional commits will be submitted to resolve build errors caused here.

* Broken utils functions have been corrected. Personnel upload has been confirmed in accordance with new schema structure.

* Continuing correction process to upload system to ensure it's working correctly. Working on adding a wrapper function to encase use cases for the DataGridCommons to make applying it to tables easier -- currently, implementations for the attributes, personnel, quadrats tables, etc, require an extensive amount of duplication to build out and thus make modifications and updates trickier. Continuing structural shift of validation system to be app-side and modular to better facilitate CRUD maintenance system.

* Revamping personnel datagrid to display role information along with roleID. Reworking validations functions to optimize. Structural updates to ensure that fetchall works with the roles table.

* incorporating documentation sources. Beginning refactor and integration of walkthrough system to better facilitate pilot onboarding

* Additional documentation started. Will continue expanding the full set of starting instructions.

* New documentation stack completed. Pending review and feedback

* first-attempt documentation github pages deployment

* corrections and adding test/deployment steps for safety

* separated build-and-deploy into dedicated jobs. attempted fix for docs build job

* bug fixes for test-docs step

* still breaking. trying to add fixes

* artifacts directory creation is failing.

* don't have direct permissions to touch github dir, using github_workspace env var instead

* removing test-docs job. Let's see if this works better or worse

* forgot to remove references to test-docs after deleting it

* deploy-docs is failing. Trying to implement a fix

* formatting error

* trying a new approach

* saving changes. partial updates made to validations system and processormacros

* system changes. attempting to add roles interaction interface to personnel datagrid to facilitate manual role CRUD interactions.

* restructuring. Centralizing functionality and expanding validation CRUD system. Restructuring core validation and upload process to be more modular.

* continuing restructure of upload and validation process

* saving changes. Upload structure has been confirmed and dynamic validation system is almost finished, pending next iteration of testing

* adding updated package information

* continuing to try and restructure the specieslimits system, the validations system, and the measurementssummary highlighting system.

* vitest was causing build crashes, trying repair

* vitest issues are persisting.

* login errors -- nextauth is unable to find secret for some reason??

* nextjs is still throwing a prerender pages error at all of my website endpoints. trying to see if there's something else going on.

* for some reason, login is failing. log stream is reporting SIGNIN_OAUTH_ERROR with invalid_request, app identifier is expected to be a GUID

* comment typo

* readding nextauth url endpoint. app seems to keep redirecting to localhost instead of what the correct link should be

* nextauth route had the wrong environmental variables??

* Running out of options -- system has resolved into an OAuthSignInError when trying to log in

* trying something new for a change. Maybe this'll work??

* still not sure what's going on.

* Typos are still occurring. Still trying to figure out why the oauthsignin error is persisting.

* okay, i think I managed to get the local authentication working again (in dev server). gonna start trying to see if I can get the actual github actions workflow to do it too.

* Development website seems to be properly resolved. Not sure what the core issue was there, but moving the development site to a second dedicated app service seemed to do the trick. There was some kind of intersection with the usage of the development slot in the production instance that was causing issues. YML files were divided into dedicated production and development workflows.

* full-scope changes. debounce added to layout files and selection systems. datagridcommons debugged for deep bugs found during add/editing row process. Additional stabilization steps need to be taken, but website is partially functional and testing environment has been prepared

* continuing the stabilization effort. Deeper explanation of changes will be outlined in PR

* overhaul. datagrid system revamped into a single-point interaction system that centralizes core function. Interaction testing passed attributes and personnel datagrids

* Stabilization is almost completed. Testing has been completed for all supporting grids except for species, roles, and quadratpersonnel, none of which are immediately vital.

* isolated implementation has been resolved to address all supporting data fields' manual entry

* resolving build errors.

* continuing the stabilization process. data baseline testing is confirmed and baseline validations have been confirmed to work. Additional stress testing is still needed, but for the time being it should work for piloting.

* adding plotID parameter to postvalidation. Need to still integrate it fully into a data view.

* minor visual change to enforce census date measurement rendering on different lines and keeping the sidebar from occupying half the screen

* saving changelog changes and siteconfigs updates

* adding console logging statements to debug login failures

* created access-denied page to act as an endpoint for unallowed permissions access. shifted the email verification query into the authentication function itself. migration scripts adjusted and updated to correctly work with database. JWT interface extended in place of the Token in the next-auth.d.ts

* 1. cleaning tests -- tests need to be reimplemented in full to account for new table changes.
2. postvalidation API endpoint refined into dynamic routing collection.
3. dedicated page to show post-validation statistics added to measurements hub
4. postvalidationqueries table created in schema. schema structure updated to reflect this
5. layout.tsx file updated to increase debounce (race conditions seem to be occurring). useEffects loop were restructured to ensure that on login, sites will correctly load.
6. error fallback pages received minor edits/changes

* quick update to change the package.json file

* formatting

* following feedback -- removing reentry data modal from use. Component has been retained for application to other places in future.

* adding template staging and drafting tables. updating package-lock. adding rds/result mappers for staging/draft tables

---------

Co-authored-by: Siddhesh Ambokar <sambokar@Gil-Galad-was-an-Elven-King-of-whom-the-Harpers-Sadly-Sing.local>
  • Loading branch information
siddheshraze and Siddhesh Ambokar authored Sep 26, 2024
1 parent 42ada06 commit c77aeff
Show file tree
Hide file tree
Showing 326 changed files with 50,635 additions and 26,164 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/dev-forestgeo-livesite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: ForestGEO Development Live Site Deployment Pipeline

on:
push:
branches:
- 'forestgeo-app-*'
workflow_dispatch:

jobs:
build-app-development:
if: startsWith(github.ref, 'refs/heads/forestgeo-app-')
runs-on: ubuntu-latest
environment: development

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: create env file (in frontend/ directory) -- development
id: create-env-file-dev
run: |
touch frontend/.env
echo AZURE_AD_CLIENT_SECRET=${{ secrets.AZURE_AD_CLIENT_SECRET }} >> frontend/.env
echo AZURE_AD_CLIENT_ID=${{ secrets.AZURE_AD_CLIENT_ID }} >> frontend/.env
echo AZURE_AD_TENANT_ID=${{ secrets.AZURE_AD_TENANT_ID }} >> frontend/.env
echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> frontend/.env
echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL_DEV }} >> frontend/.env
echo AZURE_SQL_USER=${{ secrets.AZURE_SQL_USER }} >> frontend/.env
echo AZURE_SQL_PASSWORD=${{ secrets.AZURE_SQL_PASSWORD }} >> frontend/.env
echo AZURE_SQL_SERVER=${{ secrets.AZURE_SQL_SERVER }} >> frontend/.env
echo AZURE_SQL_DATABASE=${{ secrets.AZURE_SQL_DATABASE }} >> frontend/.env
echo AZURE_SQL_PORT=${{ secrets.AZURE_SQL_PORT }} >> frontend/.env
echo AZURE_STORAGE_SAS_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} >> frontend/.env
echo AZURE_SQL_SCHEMA=${{ secrets.AZURE_SQL_SCHEMA }} >> frontend/.env
echo AZURE_SQL_CATALOG_SCHEMA=${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} >> frontend/.env
echo AZURE_STORAGE_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} >> frontend/.env
echo NEXTAUTH_DEBUG=true >> frontend/.env
echo NODE_ENV=development >> frontend/.env
echo PORT=3000 >> frontend/.env
echo FG_PAT=${{ secrets.FG_PAT }} >> frontend/.env
echo OWNER=${{ secrets.OWNER }} >> frontend/.env
echo REPO=${{ secrets.REPO }} >> frontend/.env
- name: Cache node modules
uses: actions/cache@v2
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Next.js build
uses: actions/cache@v2
with:
path: frontend/build/cache
key: ${{ runner.os }}-next-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/.next/cache') }}
restore-keys: |
${{ runner.os }}-next-
${{ runner.os }}-next-${{ hashFiles('**/package-lock.json') }}
- name: move into frontend --> npm install, build, and test
run: |
cd frontend/
npm install
npm run build
npm run test --if-present
- name: Move directories into build/standalone to reduce app load
run: |
mv ./frontend/build/static ./frontend/build/standalone/build
mv ./frontend/public ./frontend/build/standalone
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: app-build
path: frontend/build/standalone

deploy-app-development:
needs: build-app-development
runs-on: ubuntu-latest
environment: development

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: app-build
path: frontend/build/standalone

- name: 'Deploy to Azure Web App (development)'
id: deploy-to-webapp-dev
if: startsWith(github.ref, 'refs/heads/forestgeo-app-')
uses: azure/webapps-deploy@v2
with:
app-name: 'forestgeo-development'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_DEVELOPMENT }}
package: frontend/build/standalone
62 changes: 45 additions & 17 deletions .github/workflows/main-forestgeo-livesite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ on:
workflow_dispatch:

jobs:
build-and-deploy:
build-app-production:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: development
environment: production

steps:
- uses: actions/checkout@v4
Expand All @@ -22,14 +23,14 @@ jobs:
with:
node-version: '18.x'

- name: create env file (in frontend/ directory)
- name: create env file (in frontend/ directory) -- production
id: create-env-file-prod
run: |
touch frontend/.env
echo AZURE_AD_CLIENT_SECRET=${{ secrets.AZURE_AD_CLIENT_SECRET }} >> frontend/.env
echo AZURE_AD_CLIENT_ID=${{ secrets.AZURE_AD_CLIENT_ID }} >> frontend/.env
echo AZURE_AD_TENANT_ID=${{ secrets.AZURE_AD_TENANT_ID }} >> frontend/.env
echo AZURE_AD_CLIENT_SECRET=${{ secrets.AZURE_AD_CLIENT_SECRET_PRODUCTION }} >> frontend/.env
echo AZURE_AD_CLIENT_ID=${{ secrets.AZURE_AD_CLIENT_ID_PRODUCTION }} >> frontend/.env
echo AZURE_AD_TENANT_ID=${{ secrets.AZURE_AD_TENANT_ID_PRODUCTION }} >> frontend/.env
echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> frontend/.env
echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} >> frontend/.env
echo AZURE_SQL_USER=${{ secrets.AZURE_SQL_USER }} >> frontend/.env
echo AZURE_SQL_PASSWORD=${{ secrets.AZURE_SQL_PASSWORD }} >> frontend/.env
echo AZURE_SQL_SERVER=${{ secrets.AZURE_SQL_SERVER }} >> frontend/.env
Expand All @@ -39,12 +40,12 @@ jobs:
echo AZURE_SQL_SCHEMA=${{ secrets.AZURE_SQL_SCHEMA }} >> frontend/.env
echo AZURE_SQL_CATALOG_SCHEMA=${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} >> frontend/.env
echo AZURE_STORAGE_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} >> frontend/.env
echo NODE_ENV=development >> frontend/.env
echo NEXTAUTH_DEBUG=true >> frontend/.env
echo NODE_ENV=production >> frontend/.env
echo PORT=3000 >> frontend/.env
- name: Write Certificate to File
run: |
echo "${{ secrets.CERTIFICATE }}" > frontend/DigiCertGlobalRootCA.crt.pem
echo FG_PAT=${{ secrets.FG_PAT }} >> frontend/.env
echo OWNER=${{ secrets.OWNER }} >> frontend/.env
echo REPO=${{ secrets.REPO }} >> frontend/.env
- name: Cache node modules
uses: actions/cache@v2
Expand All @@ -54,6 +55,15 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- name: Cache Next.js build
uses: actions/cache@v2
with:
path: frontend/.next/cache
key: ${{ runner.os }}-next-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/.next/cache') }}
restore-keys: |
${{ runner.os }}-next-
${{ runner.os }}-next-${{ hashFiles('**/package-lock.json') }}
- name: move into frontend --> npm install, build, and test
run: |
cd frontend/
Expand All @@ -65,13 +75,31 @@ jobs:
run: |
mv ./frontend/build/static ./frontend/build/standalone/build
mv ./frontend/public ./frontend/build/standalone
mv ./frontend/*.pem ./frontend/build/standalone/
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: app-build
path: frontend/build/standalone

deploy-app-production:
needs: build-app-production
runs-on: ubuntu-latest
environment: production

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: app-build
path: frontend/build/standalone

- name: 'Deploy to Azure Web App (main)'
id: deploy-to-webapp-main
if: github.ref == 'refs/heads/main'
uses: azure/webapps-deploy@v2
with:
app-name: 'forestgeo-livesite'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_852346BD764D45D08854E6679137F844 }}
package: ./frontend/build/standalone
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_PRODUCTION }}
package: frontend/build/standalone
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
/liquibase
/.pnp
.pnp.js
/.idea/*
Expand Down Expand Up @@ -38,10 +39,14 @@ yarn-error.log*
next-env.d.ts
/.idea
/.vscode
/.idea
/.vscode
/*.zip
.github/workflows/new-file-upload-system_forestgeo-livesite.yml
/.fleet
/frontend/sampledata
/frontend/scripts
/frontend/sqlscripting
/frontend/.vscode
/documentation/.obsidian
/documentation/.obsidian/*
frontend/liquibase/
22 changes: 22 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['next', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
settings: {
next: {
rootDir: '.'
}
},
plugins: ['@typescript-eslint', 'unused-imports', 'prettier', 'import'],
rules: {
'react-hooks/exhaustive-deps': 'off',
semi: ['error', 'always'],
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'unused-imports/no-unused-vars': 'off',
'react-hooks/rules-of-hooks': 'off',
'no-case-declarations': 'off',
'prettier/prettier': 'error'
}
};
18 changes: 0 additions & 18 deletions frontend/.eslintrc.js

This file was deleted.

14 changes: 13 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# production
/build
/sampledata
/sqlscripting
/scripts
DigiCertGlobalRootCA.crt.pem

Expand Down Expand Up @@ -49,3 +48,16 @@ yarn-error.log*
/playwright-report/
/blob-report/
/playwright/.cache/
/.fleet
/.vscode
/.idea
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

*storybook.log
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
13 changes: 13 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "preserve",
"endOfLine": "lf",
"printWidth": 160,
"tabWidth": 2,
"useTabs": false
}
Loading

0 comments on commit c77aeff

Please sign in to comment.