Skip to content

fix: countryCode property in Input type phone number#7684

Closed
vicky-primathon wants to merge 8 commits intoreleasefrom
fix/selected-phone-number-country-code
Closed

fix: countryCode property in Input type phone number#7684
vicky-primathon wants to merge 8 commits intoreleasefrom
fix/selected-phone-number-country-code

Conversation

@vicky-primathon
Copy link
Contributor

@vicky-primathon vicky-primathon commented Sep 21, 2021

Description

Fix countryCode property in Input type phone number

Fixes #7475

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test coverage results 🧪

🟢 Total coverage has increased
// Code coverage diff between base branch:release and head branch: fix/selected-phone-number-country-code 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 54.81 (0.03) 36.68 (0.07) 33.54 (0.02) 55.34 (0.02)
🟢 app/client/src/utils/DSLMigrations.ts 73.78 (0.16) 65.09 (-0.05) 70.21 (0) 73.59 (0.16)
🟢 app/client/src/utils/autocomplete/TernServer.ts 52.26 (0.22) 41.25 (0.83) 34.48 (0) 56.22 (0.26)
✨ 🆕 app/client/src/utils/migrations/InputWidget.ts 80 80 75 79.17
🟢 app/client/src/widgets/InputWidget/widget/index.tsx 64.52 (2.76) 43.75 (2.08) 68.18 (0) 67.05 (3.13)

@github-actions github-actions bot added the Bug Something isn't working label Sep 21, 2021
@vicky-primathon vicky-primathon requested review from riodeuno and removed request for akash-codemonk September 22, 2021 06:37
@riodeuno
Copy link
Contributor

@somangshu I don't think this completely solve the issue here. When I try to bind the Input1.text I don't get the country code. There is also no other property which has the country code. Not sure, if this was a part of the original issue. Please review the deploy preview.

@riodeuno riodeuno requested a review from somangshu September 23, 2021 06:50
@somangshu
Copy link
Contributor

@riodeuno I can see that for the type phone number the {{input.countryCode}} works and returns the short code, This however should return the int code and not the short code.

@vicky-primathon I see that this does not function well in case of the currency as well. We need to fix the issue.

Copy link
Contributor

@somangshu somangshu left a comment

Choose a reason for hiding this comment

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

Change as mentioned above

@vicky-primathon
Copy link
Contributor Author

@riodeuno I can see that for the type phone number the {{input.countryCode}} works and returns the short code, This however should return the int code and not the short code.

@vicky-primathon I see that this does not function well in case of the currency as well. We need to fix the issue.

@somangshu in case of currency, selected country code can be accessed as {{input.currencyCountryCode}}
Should we expose single api i.e {{input.countryCode}} for both phone number and currency selected country code.

@somangshu
Copy link
Contributor

@somangshu in case of currency, selected country code can be accessed as {{input.currencyCountryCode}}
Should we expose single api i.e {{input.countryCode}} for both phone number and currency selected country code.

@vicky-primathon when I check:

  • currencyCountryCode does not return anything. It should return the ISO code Screenshot 2021-09-23 at 4 02 14 PM
  • currencyCountryCode should be changed to currencyCode.
  • The countryCode should return the phone extension ex: +91

Let me know if you have any doubts

somangshu
somangshu previously approved these changes Sep 23, 2021
Copy link
Contributor

@somangshu somangshu left a comment

Choose a reason for hiding this comment

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

Deploy preview looks good to me, All changes as requested are updated.

@riodeuno can you please verify the code changes

label: `${item.name} (${item.dial_code})`,
value: item.code,
id: item.dial_code,
value: item.dial_code,
Copy link
Contributor

Choose a reason for hiding this comment

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

@vicky-primathon Will these changes effect existing users? How do we verify this in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will have to write migrations to update default selected code value from country code to dial_code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@riodeuno added migrations for this

Copy link
Contributor

Choose a reason for hiding this comment

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

@vivekverma2312 We will need to verify the migrations during QA. The approach would be open a bound input widget in this deploy preview, which was created in release.

riodeuno
riodeuno previously approved these changes Oct 4, 2021
@riodeuno
Copy link
Contributor

riodeuno commented Oct 4, 2021

Note for QA: We need a regression test for these types of input widgets.
cc @YogeshJayaseelan @vivekverma2312

riodeuno
riodeuno previously approved these changes Oct 7, 2021
@vivekverma2312
Copy link

@vicky-primathon

  1. If input field is empty then {{Input1.countryCode}} - {{Input1.text}} is showing undefined in text box.

Screenshot 2021-10-11 at 3 48 20 PM

  1. During migration {{Input2.currencyCountryCode}}{{Input2.text}} is not migrating to {{Input2.currencyCode}} {{Input2.text}}. Due to this changing currency in Input widget do not change the currency in text widget.

@somangshu somangshu added the Widgets Product This label groups issues related to widgets label Oct 15, 2021
@vicky-primathon vicky-primathon force-pushed the fix/selected-phone-number-country-code branch from 5f32380 to 51c2f21 Compare October 26, 2021 08:18
@vicky-primathon
Copy link
Contributor Author

/ok-to-test sha=51c2f21

@vicky-primathon
Copy link
Contributor Author

@vicky-primathon
Copy link
Contributor Author

/ok-to-test sha=51c2f21

@vicky-primathon
Copy link
Contributor Author

@vicky-primathon
Copy link
Contributor Author

/ok-to-test sha=51c2f21

@vicky-primathon
Copy link
Contributor Author

for (const key in child) {
if (
typeof child[key] === "string" &&
child[key].includes(".currencyCountryCode")
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see that we're migrating bindings in the DSLs. However, I was wondering about the case where the bindings are in the actions? This seems like in those scenarios the applications might fail.
So, I was wondering if this was possible to be bound so far? From the looks of it, this feature wasn't functional so far, and we might be able to get away with only migrating DSLs.
@somangshu @vivekverma2312 @vicky-primathon

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be right, Since the feature has just been released we could expect minimum usage of this. However if a user complains what would be our response? Is there a way we can check migrations for the action as well? Since we just need to replace all occurrence, logically this is straightforward

Copy link
Contributor

@riodeuno riodeuno Oct 27, 2021

Choose a reason for hiding this comment

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

Migrating actions on the client will be tricky. We will need to implement a migration strategy for actions as well. Before we can get into this, we need to check with the backend to see if there are established mechanisms to deal with this. @sharat87

Copy link
Contributor

Choose a reason for hiding this comment

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

Meanwhile, @vicky-primathon can you find out when this commit was merged into release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@riodeuno
Copy link
Contributor

One comment. The rest looks good.

@vicky-primathon vicky-primathon force-pushed the fix/selected-phone-number-country-code branch from 51c2f21 to 75aad2b Compare October 28, 2021 09:42
@vicky-primathon
Copy link
Contributor Author

/ok-to-test sha=75aad2b

@vicky-primathon
Copy link
Contributor Author

@vicky-primathon vicky-primathon force-pushed the fix/selected-phone-number-country-code branch from 75aad2b to bcb1c96 Compare November 8, 2021 17:25
@vicky-primathon vicky-primathon force-pushed the fix/selected-phone-number-country-code branch 3 times, most recently from 83cd5d1 to c28b203 Compare November 9, 2021 08:57
@vicky-primathon vicky-primathon force-pushed the fix/selected-phone-number-country-code branch from c28b203 to cc7c48b Compare November 9, 2021 09:02
@somangshu
Copy link
Contributor

@vicky-primathon @riodeuno I disagree to CountryCode changing to DialCode, this is not the generic convention.

cc @Nikhil-Nandagopal

Also since this is blocked by the backend migration, should we close this or draft it until unblocked

@riodeuno
Copy link
Contributor

riodeuno commented Nov 9, 2021

@somangshu I don't have strong opinions on this. countryCode works.
@vicky-primathon Let's make this into a draft for now.

@vicky-primathon vicky-primathon marked this pull request as draft November 9, 2021 11:37
@somangshu
Copy link
Contributor

@riodeuno I said that because the name used in the first release used countryCode and if we continue with it we will not need any migrations.

@sbalaji1192
Copy link
Contributor

@vicky-primathon Lets close this PR since we're gonna introduce a v2 of input widget. We will do these changes on the v2.

@mohanarpit mohanarpit deleted the fix/selected-phone-number-country-code branch December 12, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Widgets Product This label groups issues related to widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Input type phone number, Country code is not accessible

5 participants