Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/WG-401-Add-Asset-to-Feature-Hook #308

Merged
merged 6 commits into from
Jan 30, 2025

Conversation

sophia-massie
Copy link
Contributor

Overview:

Adds hook with hardcoded values to add an asset to a feature

PR Status:

  • Ready.
  • Work in Progress.
  • Hold.

Related Jira tickets:

Summary of Changes:

Testing Steps:

  1. On local staging env, open a map you've created with an existing geojson with no associated assets. It should look something like this
    Screenshot 2025-01-27 at 4 52 27 PM
  2. If you don't have a map of your own that you can edit with a geojson, go to deployed Hazmapper staging, open your map, and add a geojson from PROJ-4185 GEOAPI - Test project data (DO NO EDIT) to your separate map. Note - don't edit PROJ-4185 itself, import the feature to your own map.

Screenshot 2025-01-27 at 4 54 21 PM

  1. Back on local staging, navigate to your map and select that geojson from Assets.
  2. Click add Add Asset from DesignSafe
  3. The button show show loading state then be disabled
  4. Refresh the page as is (keeping the &selectedFeature param) and make sure that asset now has a picture of a beagle and the name in the Asset Panel now reflects the name of the image. (This will be a hardcoded asset to add to the feature).
    /TODO Replace with passed in values from FileBrowserModal. These are hardcoded to test./

UI Photos:

Final Result

Screenshot 2025-01-27 at 4 58 31 PM

Notes:

  • Implement FileBrowserModal to get system_id and path to import.
  • Create tests
  • On successful submit, refresh AssetDetail panel to show new associated asset.

type="primary"
onClick={handleSubmit}
isLoading={isImporting}
disabled={isImportingSuccess}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of isSuccess to disable the button is a good idea 💯. but needs to be specific to a particular feature (i.e. projecteId + featureId) and then the mutation's isSuccess is also tricky as it is not cached. 🤔 Let's just make a mental note and revisit this in February.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. I will note to build out the hook state and button handling to be more robust when I'm using the modal to handle the submit.

@nathanfranklin
Copy link
Collaborator

LGTM 👍 🦖

@sophia-massie sophia-massie merged commit ecebf3b into main Jan 30, 2025
5 checks passed
@sophia-massie sophia-massie deleted the task/WG-401-Add-Asset-to-Feature branch January 30, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants