-
Notifications
You must be signed in to change notification settings - Fork 0
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
Defend from error on invalid URL #6
Conversation
I'm not sure we should silently swallow this problem. An invalid URL is something that would need to be fixed, and by not showing an error we don't know that there's a problem. |
? new URL(this.project.provider.url).hostname | ||
: null; | ||
} catch (e) { | ||
this.providerHostname = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pikabanga brings a fair point. Would rather see a PrimeNG tag with the tooltip of "Invalid provider URL: {error message}" and then setting this.providerHostname = this.project.provider.url
directly.
Ex:
NAME | GROUP | PROVIDER | STATUS | ACTIONS |
---|---|---|---|---|
sample1 | default | [error] /some/invalid-url |
N/A | ... |
sample2 | default | github.com | N/A | ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I wonder if there was a misunderstanding here @fredx30. I meant an [error]
tag to the table itself, for when an invalid host name was inserted by other means, such as from an invalid importer path, instead of just hiding the invalid hostname.
Consider implementing validator (#8 (comment)) |
e382984
to
74423bc
Compare
There is still an error here regarding code duplication. As this is currently executed codeduplication is bordeline unavoidable. I think a solution to the code duplication would be to get started on dynamic forms. And then using them to describe the differences between the 3 providers using a configuration object such as the model to pass in. |
src/app/providers/provider-form/azuredevops/azuredevops.component.ts
Outdated
Show resolved
Hide resolved
src/app/providers/provider-form/azuredevops/azuredevops.component.html
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…lab and azuredevops forms
Co-authored-by: kalle (jag) <kalle.jillheden@iver.se>
Co-authored-by: kalle (jag) <kalle.jillheden@iver.se>
Co-authored-by: kalle (jag) <kalle.jillheden@iver.se>
Co-authored-by: kalle (jag) <kalle.jillheden@iver.se>
0ecc5e4
to
2027d31
Compare
Resolved conflicts on changelog with rebase. |
Created an issue (#37) on to deal with the form duplication warned about here- https://app.codacy.com/gh/iver-wharf/wharf-web/pullRequest?prid=7476842&bid=23686990 |
Bug Fix - Invalid URLs
This fixes an issue where an invlid URL set on a project produces an error.
This is solved by silencing the error that occurs when the constructor fornew URL(...)
fails.Edit:
This is solved by introducing form validation with form locking on invalid input for all the provider forms. Additionally they way URLs get processed has changed see- #6 (comment) -
Example validation failed.
![image](https://user-images.githubusercontent.com/4283527/121675215-678a3680-cab3-11eb-8726-9454c13f9dd6.png)
Example validation passed-
![image](https://user-images.githubusercontent.com/4283527/121675422-aa4c0e80-cab3-11eb-9fd7-a4156ab247e4.png)