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

267 add url test to resources #306

Merged
merged 36 commits into from
Jan 29, 2024
Merged

267 add url test to resources #306

merged 36 commits into from
Jan 29, 2024

Conversation

sorochak
Copy link
Contributor

@sorochak sorochak commented Jan 17, 2024

This PR solves issue: #267

  • added a debounce util function to debounce HTTP requests
  • validateURL was defined in more than one place - removed a definition and imported from validate.js
  • added checkURLActive firebase function
  • implemented checkURLActive call in Resources component, to notify users if URL is not active

In order to test this locally you need to run the firebase emulator. Instructions here:

### Running the Firebase emulator

Note: checkURLActive is not yet deployed to Firebase.

TO DO:

  • deploy checkURLActive when PR approved.

@sorochak sorochak self-assigned this Jan 17, 2024
@sorochak sorochak linked an issue Jan 17, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Jan 17, 2024

Visit the preview URL for this PR (updated for commit 2c97aba):

https://cioos-metadata-form--pr306-267-add-url-test-to-mo9x8ly3.web.app

(expires Sun, 25 Feb 2024 21:49:58 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 57eda2a7622dc877ccadb675a0532261c52b09fd

@fostermh
Copy link
Member

if checkURLActive is a new firebase cloud function then you can deploy it to production now, assuming it doesn't cause an error. it will only be used by the test deployments until this pr is merged into main so will not break production.

@JessyBarrette
Copy link
Collaborator

For some reasons, I can see the http/https check is working however, modifying the url to some wrong ones doesn't seem to trigger the second check.

Example: https://cioos-metadata-form--pr306-267-add-url-test-to-mo9x8ly3.web.app/#/en/pacific/hM2aN3v9MzZ6J4KGMOEW2s9gidj2/-MtLHJgz141q5Fb27oP-

If I remove some letters from the url which returns a 400 the check seems to still return valid:

https://data.cioospacific.ca/erddap/tabledap/IOS_CTD_Moorings.ht

@sorochak
Copy link
Contributor Author

@JessyBarrette if you were testing this via the preview URL and not running the firebase emulator locally, the new checkURLActive firebase cloud function wouldn't work.

As per @fostermh comment above, I have just deployed checkURLActive to the cloud, and so now it should work via the preview URL.

@JessyBarrette
Copy link
Collaborator

Oh sorry yes I can see it working now :)

I'm wondering if it would be worth to bring a message to the Submit tab whenever a link isn't working.

@Br-Johnson
Copy link
Contributor

Looks great to me.

@JessyBarrette
Copy link
Collaborator

I'm wondering if it would be worth to bring a message to the Submit tab whenever a link isn't working.

We can create a new issue for that if that is going over the present issue

@sorochak
Copy link
Contributor Author

@JessyBarrette I can add a message to the submit tab when a link isn't working

@JessyBarrette
Copy link
Collaborator

Awesome thanks @sorochak Once this is done I can approve all that :) nice work

@fostermh
Copy link
Member

when we discussed this I was thinking of a status pill that would show if the link was resolvable or not. something similar to this pr for doi status #283

Screenshot 2024-01-18 at 4 01 00 PM

It's ok if we prefer this interface but it would be nice to be consistent across the form

@sorochak
Copy link
Contributor Author

sorochak commented Jan 19, 2024

What interface do we want to be consistent with?

currently this PR displays a notice if the link is unresolvable:

Screen Shot 2024-01-18 at 4 34 32 PM

@sorochak
Copy link
Contributor Author

@JessyBarrette @timvdstap this PR is ready (again) for review.

Copy link
Collaborator

@JessyBarrette JessyBarrette left a comment

Choose a reason for hiding this comment

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

This is all looking great to me!

I guess we could eventually color code the ERROR anr WARNING sections of the submit page. But this should be an another issue first.

Well done!

@JessyBarrette
Copy link
Collaborator

JessyBarrette commented Jan 29, 2024 via email

@timvdstap
Copy link
Collaborator

I think it looks good and seems to work fine! I agree with Jessy that we could perhaps at a later stage revisit the color coding of the warning messages (i.e. even if it says "URL is not active", I think it'd be nice if this shows up in red). Something to perhaps address later :-)

@sorochak sorochak merged commit e47246d into main Jan 29, 2024
3 checks passed
@fostermh fostermh deleted the 267-add-url-test-to-resources branch April 11, 2024 03:48
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.

Add URL test to ressources
5 participants