-
Notifications
You must be signed in to change notification settings - Fork 22
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
Url datatype #2646
base: master
Are you sure you want to change the base?
Url datatype #2646
Conversation
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.
It seems like you didn't test this in the app yet 😉 It didn't work for me because we forgot to register the components (see my commit now).
The component still has some issues. Test it while keeping the Developer Console open and see various errors. I think it is not "allowed" to mark a <a
with matInput, this only works for <input
as far as I know.
src/app/core/basic-datatypes/string/display-url/display-url.component.ts
Outdated
Show resolved
Hide resolved
src/app/core/basic-datatypes/string/edit-url/edit-url.component.html
Outdated
Show resolved
Hide resolved
…t.html Co-authored-by: Sebastian <sebastian@aam-digital.com>
…mponent.ts Co-authored-by: Sebastian <sebastian@aam-digital.com>
|
@sadaf895 I made some modifications to allow user clicks even when the form is disabled. I also added test cases and updated the cursor styling. Please review these changes and let me know if any functionality is missing. To enable user clicks while the form is disabled, I followed this approach(which we already following in |
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.
Code and functionality looks pretty good already 🙂
From functional testing a few suggestions to polish this further. Can you take these points up again, @sadaf895 ?
- in the list view, the link is not working and instead the details view of record is loaded. If clicking exactly on that link, I would like to instead open the external url in a new tab (@Abhinegi2 has implemented something similar only last week)
- The form field's link text should look a bit more like a clickable link. I suggest we give this an underline styling or maybe underline on hover (i.e. maybe giving this our global "clickable" css class)
- if the value is not a valid url (e.g. just some random text), this anyway opens a new tab to our app. In such a case the link should not be clickable (and not styled like a link
- if I put a URL without leading http or https it is not opened as an external link. Probably we should prefix that automatically if it is required to work as links. Maybe we can use a similar design to the screenshot below, where "https://" is always automatically prefixed and cannot be changed?
If unsure about design, do ask for feedback on our Slack
src/app/core/basic-datatypes/string/edit-url/edit-url.component.html
Outdated
Show resolved
Hide resolved
…t.html Co-authored-by: Sebastian <sebastian@aam-digital.com>
…t.html Co-authored-by: Sebastian <sebastian@aam-digital.com>
@sleidig regarding the valid URL validation point, I have two approaches in mind. Which one should we follow?
|
I think the "EditUrlComponent" should automatically bring that validation without anyone having to additionally configure a validator. To achieve that, maybe a method in the component is easier. But whatever gives the desired result is good. It may be easier also to implement a ValidatorFunction (like isUniqueId) and always add it to the formControl within the component. I am not sure how to integrate a simple method within the formControl validation process otherwise. |
* Checks if the current formControl value is a valid URL. | ||
* Returns true only if it is a properly formatted http/https URL. | ||
*/ | ||
isValidUrl(value: string | null): boolean { |
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.
unit test cases to implement for this functionality:
it("should be invalid for value that is not a complete URL"
: input value:"example"
, expected result:false
it("should be valid for empty value"
: input value:""
or input value:null
(test both), expected result:true
it("should be valid for url-like value"
: input value:"https://example.com"
, expected result:true
@george-neha Can you please check the functionality as a user's perspective and share your feedback on it? |
As a user, I will do either of the two things:
I feel adding a prefix to the website field with https:// and letting the user type in the website name would be more user-friendly. (see image below) In scenarios where a user will copy-paste the URL. Would it be possible to truncate the additional https://? What do you think @sadaf895 |
@george-neha Can you now check the functionality? Any improvement or modification is needed? |
Deployed to https://pr-2646.aam-digital.net/ |
@sadaf895 While testing, I found a UI glitch. Here’s how to reproduce it:
However, if you select(complete url) and delete the entire url at once, it works correctly. Also, I think using a fixed |
@george-neha could you test it again, and let me know if you have any suggestions |
This is not properly usable yet, unfortunately ... I think we should maybe spell out sensible behavior and test cases for these edge cases of editing:
for example, when trying to delete the first letter of the "https" in the field, it is resulting in "https://ttps://aam-digital.com" (just adding the full prefix to the front again) Clicking links seems to work very well now, however 👍 Only the cursor here should be a pointer to indicate clickability: |
Test Cases for Editing a Website URL:
|
list of issues need to be fixed
|
After discussing the problems giving users confusing results when changing the prefix, we decided the following should be the behaviour:
|
closes: #2460