From 5bf7df94165a780a123a239ede4a0e0c5f75c145 Mon Sep 17 00:00:00 2001 From: sambokar Date: Fri, 18 Oct 2024 15:01:53 -0400 Subject: [PATCH] applying linter changes --- frontend/CHANGELOG.md | 69 +++++++++---------- frontend/README.md | 48 ++++++------- .../applications/viewfulltabledatagrid.tsx | 4 +- frontend/documentation/Logging into App.md | 6 +- .../topics/Adding-New-Information.md | 16 ++--- .../Database-Setup-and-CTFSWeb-Integration.md | 8 +-- .../documentation/topics/Getting-Started.md | 4 +- .../topics/Understanding-the-Dashboard.md | 54 +++++++-------- frontend/styles/customtablesettings.css | 8 +-- frontend/styles/dropzone.css | 10 +-- frontend/styles/validationtable.css | 46 ++++++------- frontend/tsconfig.json | 31 ++------- 12 files changed, 142 insertions(+), 162 deletions(-) diff --git a/frontend/CHANGELOG.md b/frontend/CHANGELOG.md index 63f4382e..c04d7c05 100644 --- a/frontend/CHANGELOG.md +++ b/frontend/CHANGELOG.md @@ -118,11 +118,11 @@ 1. FixedData cases' queries updated to correctly work with updated schemas 2. New tables/cases added: - 1. `personnelrole` - 2. `sitespecificvalidations` - 3. `roles` - 4. `measurementssummary` - 5. `viewfulltable` + 1. `personnelrole` + 2. `sitespecificvalidations` + 3. `roles` + 4. `measurementssummary` + 5. `viewfulltable` ###### POST @@ -142,18 +142,18 @@ 1. Postvalidation summary statistics calculation endpoint 2. Statistics queries: - 1. `number of records by quadrat` - 2. `all stem records by quadrat (count only)` - 3. `live stem records by quadrat (count only)` - 4. `tree records by quadrat (count only)` - 5. `number of dead or missing stems by census` - 6. `trees outside of plot limits` - 7. `stems with largest DBH/HOM measurements by species` - 8. `all trees that were recorded in last census that are NOT in current census` - 9. `number of new stems per quadrat per census` - 10. `quadrats with most and least new stems per census` - 11. `number of dead stems per quadrat per census` - 12. `number of dead stems per species per census` + 1. `number of records by quadrat` + 2. `all stem records by quadrat (count only)` + 3. `live stem records by quadrat (count only)` + 4. `tree records by quadrat (count only)` + 5. `number of dead or missing stems by census` + 6. `trees outside of plot limits` + 7. `stems with largest DBH/HOM measurements by species` + 8. `all trees that were recorded in last census that are NOT in current census` + 9. `number of new stems per quadrat per census` + 10. `quadrats with most and least new stems per census` + 11. `number of dead stems per quadrat per census` + 12. `number of dead stems per species per census` #### frontend/app/api/refreshviews/[view]/[schema]/route.ts @@ -220,7 +220,7 @@ 3. customized cell and edit cell rendering added 4. some exceptions exist -- for instances where specific additional handling is needed, column states are directly defined in the datagrid components themselves. - 1. `alltaxonomiesview` -- specieslimits column customized addition + 1. `alltaxonomiesview` -- specieslimits column customized addition #### GitHub Feedback Modal @@ -250,18 +250,18 @@ 1. The DataGridCommons generic datagrid instance has been replaced by the IsolatedDataGridCommons instance, which isolates as much information as possible to the generic instance rather than the existing DataGridCommons, which requires parameter drilling of all MUI X DataGrid parameters. Current datagrids using this new implementation are: - - `alltaxonomiesview` - - `attributes` - - `personnel` - - `quadratpersonnel` - - `quadrats` - - `roles` - - `stemtaxonomiesview` + - `alltaxonomiesview` + - `attributes` + - `personnel` + - `quadratpersonnel` + - `quadrats` + - `roles` + - `stemtaxonomiesview` 2. found that attempting to use typescript runtime utilities to create "default" initial states for each RDS type was causing cascading failures. Due to the way that runtime utility functions work, no data was actually reaching the datagrids importing those initial states - 1. replaced with manual definition of initial states -- planning on centralizing this to another place, similar to - the `datagridcolumns.tsx` file + 1. replaced with manual definition of initial states -- planning on centralizing this to another place, similar to + the `datagridcolumns.tsx` file 3. `measurementssummaryview` datagrid instance added as a replacement to the previously defined summary page #### Re-Entry Data Modal @@ -307,20 +307,19 @@ 7. materialized view reload has been adjusted to be optional. user should be able to continue the process even if one or more of the views fails. ---- +--- ### SQL Updates 1. Schema has been been updated -- new tables added: - 1. `roles` - outlines user roles - 2. `specieslimits` - allows setting min/max bounds on measurements - 3. `specimens` - recording specimen data (added on request by ForestGEO) - 4. `unifiedchangelog` - partitioned table that tracks all changes to all tables in schema. All tables have triggers - that automatically update the `unifiedchangelog` on every change - 5. `sitespecificvalidations` - for specific validations applicable only to the host site + 1. `roles` - outlines user roles + 2. `specieslimits` - allows setting min/max bounds on measurements + 3. `specimens` - recording specimen data (added on request by ForestGEO) + 4. `unifiedchangelog` - partitioned table that tracks all changes to all tables in schema. All tables have triggers + that automatically update the `unifiedchangelog` on every change + 5. `sitespecificvalidations` - for specific validations applicable only to the host site 2. validation stored procedures have been deprecated and removed, replaced with `validationprocedures` and `sitespecificvalidations` tables 3. migration script set has been completed and tested 4. trigger definitions have been recorded 5. view implementations have been updated - diff --git a/frontend/README.md b/frontend/README.md index cc35aeb2..bafe24a1 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -32,12 +32,12 @@ documentation [here](https://github.com/ForestGeoHack/ForestGEO/wiki/ForestGEO-A 1. Before running the project, you must create an `.env.local` file in the overhead directory with the following values: - - `AZURE_AD_CLIENT_ID` - - `AZURE_AD_CLIENT_SECRET` - - `AZURE_AD_TENANT_ID` - - `NEXTAUTH_SECRET` - - `NEXTAUTH_URL` - - all `AZURE_` values must be created/populated from Azure's App Registration portal + - `AZURE_AD_CLIENT_ID` + - `AZURE_AD_CLIENT_SECRET` + - `AZURE_AD_TENANT_ID` + - `NEXTAUTH_SECRET` + - `NEXTAUTH_URL` + - all `AZURE_` values must be created/populated from Azure's App Registration portal 2. Once `.env.local` is made, run `npm install` from the overhead directory to install dependencies 3. Run `npm run build` to compile/optimize the application for running 4. Run `npm run dev` to create a dev instance of the application locally on your machine @@ -65,12 +65,12 @@ In order from left to right, please note the following points of interest: - `[plotKey]`: this is the first required variable when accessing this endpoint -- you will have to add some string `plotKey` to the end of the URL: `.../browse/[your plot key]` in order to successfully view the page. - - wrapping a folder in `[]` will designate that folder as a **required** dynamic parameter - - wrapping in `[...folderName]` designates `folderName` as a catch-all route. All following - values after `folderName` (i.e., `.../a/b` will return `folderName = [a, b]` ) - - wrapping in `[[...folderName]]` designates `folderName` as an _optional_ catch-all route. As - expected, all values for/after `folderName` will be returned as part of the dynamic route, - but `undefined` will also be returned if no value is entered at all (instead of a 404 error) + - wrapping a folder in `[]` will designate that folder as a **required** dynamic parameter + - wrapping in `[...folderName]` designates `folderName` as a catch-all route. All following + values after `folderName` (i.e., `.../a/b` will return `folderName = [a, b]` ) + - wrapping in `[[...folderName]]` designates `folderName` as an _optional_ catch-all route. As + expected, all values for/after `folderName` will be returned as part of the dynamic route, + but `undefined` will also be returned if no value is entered at all (instead of a 404 error) - `[plotNum]`: second required variable when accessing this endpoint - your resulting endpoint will look like (example) `http://localhost:3000/browse/plotKey/plotNum`. @@ -79,21 +79,21 @@ In order from left to right, please note the following points of interest: ### Release Notes (v0.1.0): - endpoints have been added and routed to require a plot key/number combination for access - - initial state has been converted to new `Plot {key: 'none', num: 0}` instead of `''` + - initial state has been converted to new `Plot {key: 'none', num: 0}` instead of `''` - MUI JoyUI has been partially implemented as a replacement for MaterialUI. However, due to time limitations, MaterialUI has still been incorporated into converted sections from ForestGeoHack - - The current plan is to solely implement either NextUI or ChakraUI instead of either of these - options, and future updates will include this information. + - The current plan is to solely implement either NextUI or ChakraUI instead of either of these + options, and future updates will include this information. - `SelectPlotProps` has been removed and replaced with NextJS dynamic routing (each endpoint will dynamically retrieve plot information). Endpoints have been updated to reflect dynamic param-based retrieval - - The navigation bar has been updated to use useEffect to push live endpoint updates when the - plot is changed (if you are at an endpoint and the plot is changed, the page will be reloaded - to reflect that) + - The navigation bar has been updated to use useEffect to push live endpoint updates when the + plot is changed (if you are at an endpoint and the plot is changed, the page will be reloaded + to reflect that) - New components/moved-over information: - - `Fileuploadcomponents` --> css code has been udpated to be dark theme-friendly - - `FileList` --> moved over - - `Loginlogout` --> created component, login/logout process has been relegated to avatar icon - dropdown menu - - `Plotselection` --> partially created from SelectPlot, changed to utilize dynamic - routing/selection instead of requiring a new dropdown in each page + - `Fileuploadcomponents` --> css code has been udpated to be dark theme-friendly + - `FileList` --> moved over + - `Loginlogout` --> created component, login/logout process has been relegated to avatar icon + dropdown menu + - `Plotselection` --> partially created from SelectPlot, changed to utilize dynamic + routing/selection instead of requiring a new dropdown in each page diff --git a/frontend/components/datagrids/applications/viewfulltabledatagrid.tsx b/frontend/components/datagrids/applications/viewfulltabledatagrid.tsx index 8eed788d..d8707c68 100644 --- a/frontend/components/datagrids/applications/viewfulltabledatagrid.tsx +++ b/frontend/components/datagrids/applications/viewfulltabledatagrid.tsx @@ -147,7 +147,9 @@ export default function ViewFullTableDataGrid() { } useEffect(() => { - reloadVFT().catch(console.error).then(() => setLoading(false)); + reloadVFT() + .catch(console.error) + .then(() => setLoading(false)); }, []); return ( diff --git a/frontend/documentation/Logging into App.md b/frontend/documentation/Logging into App.md index 03f2f9ce..3d03a0ac 100644 --- a/frontend/documentation/Logging into App.md +++ b/frontend/documentation/Logging into App.md @@ -9,12 +9,12 @@ back after the #### Logging into the app requires the following: 1. You must have received and accepted an invitation to the SIOCIORC ForestGEO SI tenant - 1. An admin needs to perform this action with you over email + 1. An admin needs to perform this action with you over email 2. You'll need to set up MS Authenticator (this'll definitely take a little while, make sure you have someone to reach out to in case of issues) 3. Your email needs to be added to the Azure MySQL catalog database - 1. This is another layer of security -- your information needs to be entered and you need to be assigned a site and - admin status (if applicable) + 1. This is another layer of security -- your information needs to be entered and you need to be assigned a site and + admin status (if applicable) > [!tip] > Something of an optional step, but your site needs to be populated with information. Manual plot/site submissions or diff --git a/frontend/documentation/topics/Adding-New-Information.md b/frontend/documentation/topics/Adding-New-Information.md index 26e45ea8..29d38be8 100644 --- a/frontend/documentation/topics/Adding-New-Information.md +++ b/frontend/documentation/topics/Adding-New-Information.md @@ -14,18 +14,18 @@ respective table. There are several different ways you can interact with the vie At the top of each data view, you should see a toolbar with a variety of options: 1. Filters - 1. Allows you to filter the view by placing constraints on the columns in the view. - 2. These filters will ONLY apply to the page you're currently viewing! + 1. Allows you to filter the view by placing constraints on the columns in the view. + 2. These filters will ONLY apply to the page you're currently viewing! 2. Density - 1. Allows you to change the height of the headers + 1. Allows you to change the height of the headers 3. Export - 1. Allows you to export the current page you're viewing + 1. Allows you to export the current page you're viewing 4. Add Row - 1. Allows you to add new rows. Please see below for more guidance on how exactly that works! + 1. Allows you to add new rows. Please see below for more guidance on how exactly that works! 5. Refresh - 1. Reloads data from the table. + 1. Reloads data from the table. 6. Export Full Data - 1. Exports all data in the table to JSON + 1. Exports all data in the table to JSON > Row Actions: > @@ -85,7 +85,7 @@ data en masse by directly uploading a file (or form) of data. There are five types of forms currently accepted, along with the headers that they accept: | Form | Headers | -|----------------|--------------------------------------------------------------------------------------------------| +| -------------- | ------------------------------------------------------------------------------------------------ | | `attributes` | code, description, status | | `personnel` | firstname, lastname, role | | `species` | spcode, family, genus, species, subspecies, idlevel, authority, subspeciesauthority | diff --git a/frontend/documentation/topics/Database-Setup-and-CTFSWeb-Integration.md b/frontend/documentation/topics/Database-Setup-and-CTFSWeb-Integration.md index 6f768525..e80dff85 100644 --- a/frontend/documentation/topics/Database-Setup-and-CTFSWeb-Integration.md +++ b/frontend/documentation/topics/Database-Setup-and-CTFSWeb-Integration.md @@ -11,13 +11,13 @@ ensure your development environment is compatible with Unix systems before you p Before getting started, please ensure you have the following starting components: - A SQL flat file of an existing site - - This should be a very large (think 100s of MBs) SQL file that contains a direct SQL dump of a full site's census - history. + - This should be a very large (think 100s of MBs) SQL file that contains a direct SQL dump of a full site's census + history. - An empty data source to migrate the old schema into. - An empty data source to migrate the data into. - Time! - - A word to the wise, this takes a ridiculous amount of time, so make sure you have a couple hours to spare. I'd - - recommend making sure your machine is plugged in and has a steady internet connection. + - A word to the wise, this takes a ridiculous amount of time, so make sure you have a couple hours to spare. I'd + - recommend making sure your machine is plugged in and has a steady internet connection. --- diff --git a/frontend/documentation/topics/Getting-Started.md b/frontend/documentation/topics/Getting-Started.md index 821a66d4..e3b4b735 100644 --- a/frontend/documentation/topics/Getting-Started.md +++ b/frontend/documentation/topics/Getting-Started.md @@ -6,7 +6,7 @@ Before you're ready to start using ForestGEO, you'll need to make sure that you 1. A registered account on the SI tenant. 2. A registered account on the ForestGEO server, and: - 1. **at least one site registered to your account in-server.** + 1. **at least one site registered to your account in-server.** > Missing one of these? Please contact an administrator to request access! @@ -16,7 +16,7 @@ Once you've gotten both of these set up, you can access the ForestGEO website by two following URLs: | Production | Development | -|-----------------------------------------------------------------|------------------------------------------------------------------------------| +| --------------------------------------------------------------- | ---------------------------------------------------------------------------- | | [Production URL](https://forestgeo-livesite.azurewebsites.net/) | [Development URL](https://forestgeo-livesite-development.azurewebsites.net/) | > Which website should I use? diff --git a/frontend/documentation/topics/Understanding-the-Dashboard.md b/frontend/documentation/topics/Understanding-the-Dashboard.md index 4205e264..ca7f5d69 100644 --- a/frontend/documentation/topics/Understanding-the-Dashboard.md +++ b/frontend/documentation/topics/Understanding-the-Dashboard.md @@ -40,33 +40,33 @@ They're listed here again with some more information to better explain what they - You will need to submit supporting data before being able to submit new measurements for your census. - - Before you can submit new measurements for a census, you'll need to submit some supporting data that's needed to - make sure that your measurements are correctly correlated to the right location, plant, or time period. This - supporting data makes up the navigation links under the Stem & Plot Details navigation menu. - - - Stem Codes: - - Attribute information for a stem - - Allows you to add characteristics like 'alive', 'dead', 'missing', etc. to a stem. This becomes important - later -- it's important to make sure you don't accidentally mark a stem as dead when it's not! - - Personnel: - - Who's working on the plot? - - This data is organized on a census-by-census basis, so you can clearly see who was working on the plot at what - time. - - You can also assign a role to a person, which can include anything from 'plot supervisor' to 'field - technician' to 'volunteer'! - - Quadrats: - - This is a more granular system to subdivide the plot. Each plot can be massive, but dividing it into quadrats - can make it easier to keep track of each stem. - - Quadrats, like personnel, are also organized on a census-by-census basis, so you can get a better idea of how - the plot was divided for a particular census. - - Species List: - - Species information for all stems in the plot. - - This is a dedicated list of the different species designations assigned to stems in the plot. - - Plot-Species List: - - This is a special case! This is a list of all species listed in the plot, but filtered by stems physically - located in the plot. It's always possible that species in a plot come and go as environmental conditions - change, so this is a way to take a look at species assignments specifically at the place and time you're - working with. You shouldn't need to modify or add to this view -- it should be used for reference only! + - Before you can submit new measurements for a census, you'll need to submit some supporting data that's needed to + make sure that your measurements are correctly correlated to the right location, plant, or time period. This + supporting data makes up the navigation links under the Stem & Plot Details navigation menu. + + - Stem Codes: + - Attribute information for a stem + - Allows you to add characteristics like 'alive', 'dead', 'missing', etc. to a stem. This becomes important + later -- it's important to make sure you don't accidentally mark a stem as dead when it's not! + - Personnel: + - Who's working on the plot? + - This data is organized on a census-by-census basis, so you can clearly see who was working on the plot at what + time. + - You can also assign a role to a person, which can include anything from 'plot supervisor' to 'field + technician' to 'volunteer'! + - Quadrats: + - This is a more granular system to subdivide the plot. Each plot can be massive, but dividing it into quadrats + can make it easier to keep track of each stem. + - Quadrats, like personnel, are also organized on a census-by-census basis, so you can get a better idea of how + the plot was divided for a particular census. + - Species List: + - Species information for all stems in the plot. + - This is a dedicated list of the different species designations assigned to stems in the plot. + - Plot-Species List: + - This is a special case! This is a list of all species listed in the plot, but filtered by stems physically + located in the plot. It's always possible that species in a plot come and go as environmental conditions + change, so this is a way to take a look at species assignments specifically at the place and time you're + working with. You shouldn't need to modify or add to this view -- it should be used for reference only! ### User-Specific Information diff --git a/frontend/styles/customtablesettings.css b/frontend/styles/customtablesettings.css index 573dd9b3..289f418c 100644 --- a/frontend/styles/customtablesettings.css +++ b/frontend/styles/customtablesettings.css @@ -1,9 +1,9 @@ .header { - font-weight: bold; - font-size: 14pt; + font-weight: bold; + font-size: 14pt; } .error { - font-weight: bold; - color: red; + font-weight: bold; + color: red; } diff --git a/frontend/styles/dropzone.css b/frontend/styles/dropzone.css index eeee5843..b5978689 100644 --- a/frontend/styles/dropzone.css +++ b/frontend/styles/dropzone.css @@ -1,7 +1,7 @@ #outerBox { - justify-content: center; - width: 600px; - height: 400px; - background-color: #46424f; - border: 3px dashed; + justify-content: center; + width: 600px; + height: 400px; + background-color: #46424f; + border: 3px dashed; } diff --git a/frontend/styles/validationtable.css b/frontend/styles/validationtable.css index a0ad6424..12b9200a 100644 --- a/frontend/styles/validationtable.css +++ b/frontend/styles/validationtable.css @@ -1,37 +1,37 @@ @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap'); /** create spacing between rows */ table { - border-collapse: separate; /** border-spacing is allow only if border-collapse is separate */ - border-spacing: 0 20px; - margin-left: auto; - margin-right: auto; - width: auto; + border-collapse: separate; /** border-spacing is allow only if border-collapse is separate */ + border-spacing: 0 20px; + margin-left: auto; + margin-right: auto; + width: auto; } .tablecontainer { - border-collapse: separate; /** border-spacing is allow only if border-collapse is separate */ - border-spacing: 0 20px; - margin-left: auto; - margin-right: auto; - width: auto; + border-collapse: separate; /** border-spacing is allow only if border-collapse is separate */ + border-spacing: 0 20px; + margin-left: auto; + margin-right: auto; + width: auto; } th, td { - border: 1px solid #aba5a5; - display: inline-block; /* no line break // elements can be close together */ - width: auto; - height: auto; - overflow: auto; - text-align: justify; - padding: 8px 5px; - font-family: 'Roboto', sans-serif; + border: 1px solid #aba5a5; + display: inline-block; /* no line break // elements can be close together */ + width: auto; + height: auto; + overflow: auto; + text-align: justify; + padding: 8px 5px; + font-family: 'Roboto', sans-serif; } .errorMessage { - color: red; - font-family: 'Roboto', sans-serif; - border: none; - padding: 0; - width: auto; + color: red; + font-family: 'Roboto', sans-serif; + border: none; + padding: 0; + width: auto; } diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index a61af3d2..d97e18e1 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -3,12 +3,7 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "target": "es2017", - "lib": [ - "dom", - "dom.iterable", - "esnext", - "es2015" - ], + "lib": ["dom", "dom.iterable", "esnext", "es2015"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -27,26 +22,10 @@ } ], "paths": { - "@/*": [ - "./*" - ] + "@/*": ["./*"] }, - "types": [ - "vitest/globals", - "node" - ] + "types": ["vitest/globals", "node"] }, - "include": [ - "types/next-auth.d.ts", - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - "build/types/**/*.ts", - "./vitest.setup.ts", - "**/*.sql" - ], - "exclude": [ - "node_modules" - ] + "include": ["types/next-auth.d.ts", "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "build/types/**/*.ts", "./vitest.setup.ts", "**/*.sql"], + "exclude": ["node_modules"] }