feat(webportal): Add export to Web Portal function#7994
feat(webportal): Add export to Web Portal function#7994grantfitzsimmons wants to merge 47 commits into
Conversation
also adds support for attachments and removes the `web_asset_store.xml` component of the asset server URL
adds some small comments here as well
lexiclevenger
left a comment
There was a problem hiding this comment.
- Confirm the new Export to Web Portal button appears in the query export controls (when you have permission).
- Confirm the new Export to Web Portal button does not appear in the query export controls if you do not have permission to that tool (
Querybuilder → Query → Export To Web Portal). - Start the export and wait for the completion notification.
- Use the notification or download link to retrieve the generated ZIP package.
- Open the ZIP and confirm it contains:
PortalFiles/PortalData.csvPortalFiles/flds.jsonPortalFiles/PortalInstanceSetting.jsonPortalFiles/SolrFldSchema.xml
- Inspect
PortalFiles/flds.jsonand verify:- the
spidandimgrows are present - attachment metadata is emitted correctly (if there are attachments)
- attachment
Titleis derived fromattachment.titlewhen available
- the
- Verify existing query export behavior still works for normal CSV exports.
- Confirm tree-related query validation still passes after the new tree parsing validation changes.
Looks good to me! Tested using 'Vanessa Mapping 2' query on sbmnhiz_2025_12_12. The files appear as expected, and the existing query and csv export features don't seem to have been impacted.
There was a problem hiding this comment.
- Confirm the new Export to Web Portal button appears in the query export controls (when you have permission).
- Confirm the new Export to Web Portal button does not appear in the query export controls if you do not have permission to that tool (
Querybuilder → Query → Export To Web Portal). - Start the export and wait for the completion notification.
- Use the notification or download link to retrieve the generated ZIP package.
- Open the ZIP and confirm it contains:
PortalFiles/PortalData.csvPortalFiles/flds.jsonPortalFiles/PortalInstanceSetting.jsonPortalFiles/SolrFldSchema.xml
- Inspect
PortalFiles/flds.jsonand verify:- the
spidandimgrows are present - attachment metadata is emitted correctly (if there are attachments)
- attachment
Titleis derived fromattachment.titlewhen available
- the
- Verify existing query export behavior still works for normal CSV exports.
- Confirm tree-related query validation still passes after the new tree parsing validation changes.
Dev Additions:
Thank you @melton-jason For quickly helping me set this up on a MacOS through a docker container. It was very useful and this should be considered as an addition to the web portal it can be deployed easily on other local machines besides linux distros
Another Note: whenever importing through docker there is an issue caused by the spaces within the ZIP file's names when building the container. The zip name format should be reconsidered at least for MacOS.
-
Import the ZIP into a Specify Web Portal instance to confirm the package can be ingested.
-
Verify that the rows in the query are the same count as the rows in the portal
-
Verify that all visible fields (within the 7 query itself) are searchable in the portal when using 'advanced' search
-
Verify that all attachments marked as public (via
attachment.ispublic) are visible in the portal -
Verify that the asset server URL and collection are set correctly (based on the docker environment for the Specify installation)
-
Verify that the map plots all points (as long as
longitude1,latitude1,longitude2, orlatitude2are present, but keep specify/webportal-installer#64 in mind), and make sure they are clickable (so a dialog appears) -
following 2 have been Skipped for now, I did not include any attachments to any CO in my query and its. a freshly rebuilt database. Finally, I have never seen console logs for an sp6 export data set, So far I have monitored the logs to my terminal and nothing seems out of the ordinary.
-
Check that the attachment 'Title' is shown in the dialog header when viewing an attachment
-
Verify that no unexpected console errors are logged in the web portal (no more than before, comparing against a standard Specify 6-exported data set in the portal)
overall functionality is great!. just ran into a couple of hiccups when setting up the web portal locally. besides that core functional of exporting and importing are running great!
|
@copilot resolve the merge conflicts in this pull request |
|
Warning One or more dependencies are approaching or past End-of-Life. |
Triggered by 4832a3f on branch refs/heads/issue-7606
| from django.apps import apps | ||
| from django.conf import settings | ||
|
|
||
| from specifyweb.backend.context.schema_localization import get_schema_localization |
| from specifyweb.backend.context.schema_localization import get_schema_localization | ||
| from specifyweb.specify.datamodel import datamodel, Field | ||
| from specifyweb.specify.models_utils.models_by_table_id import get_model_by_table_id | ||
| from specifyweb.specify.utils.uiformatters import CNNField, get_catalognumber_format |
| from specifyweb.specify.utils.uiformatters import CNNField, get_catalognumber_format | ||
|
|
||
| if TYPE_CHECKING: | ||
| from specifyweb.backend.stored_queries.queryfield import QueryField |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Fixes #7606
This PR adds support for exporting query results as a Web Portal package (ZIP) for import into the Specify Web Portal. It introduces backend endpoints and logic for generating the export, updates frontend components to allow users to trigger and download the export, and adds appropriate permission checks and notifications. It even includes tests and validation improvements for tree-related queries.
At this time, exports using this tool require no changes on the Web Portal side of things.
Web Portal Export Feature:
exportwebportal/), including a newquery_to_web_portal_zipfunction and integration with the export workflow.Testing and Validation:
Error Reporting
This also adds handling for error reporting if an export (either CSV, KML, or Web Portal) fails.
exampleWebPortalfailure.txt
exampleCSVfailure.txt
exampleKMLfailure.txt
Example
Specify Query
Portal
Attachments
Map
Uniqueness Check
Checklist
self-explanatory (or properly documented)
Testing instructions
Querybuilder → Query → Export To Web Portal).PortalFiles/PortalData.csvPortalFiles/flds.jsonPortalFiles/PortalInstanceSetting.jsonPortalFiles/SolrFldSchema.xmlPortalFiles/flds.jsonand verify:spidandimgrows are presentTitleis derived fromattachment.titlewhen availableDEVELOPERS: To really make sure this works, we need to import this into the Web Portal. To really make sure it is an adequate replacement for the Specify 6 exporter, it is a good idea to test the same export query in both versions. All KU databases have a mapping setup in them, which can be compared easily.
attachment.ispublic) are visible in the portallongitude1,latitude1,longitude2, orlatitude2are present, but keep If second set of coordinates fields are present, they are required for Geo Coords webportal-installer#64 in mind), and make sure they are clickable (so a dialog appears)Summary by CodeRabbit
New Features
Bug Fixes
Tests
Localization