-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Show manual frequency in connection table and use intl for frequency values #13621
Conversation
Add getFrequencyConfig utility to correctly find frequency configuration
{ | ||
id: `frequency.${ | ||
item.config.timeUnit === "hours" && item.config.units === 1 ? "hour" : item.config.timeUnit | ||
}`, |
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.
I see that you have some logic for singular/plural in the en.json... are the "hour" entry and this logic needed with the singular/plural logic you have for "hours"?
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.
Sometimes we want to display "Every hour" (in the replication settings) but in other cases we display "1 hour" (in the connections table). Maybe I should replace the "frequency.hour" key to be more clear?
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.
Could we maybe replace the form.every with two different keys we're using here instead for form.every.hours and form.every.minutes. that way we could use the pluralization inside en.json to take care of this, which imho would read a bit nicer (and would make it easier for translators later).
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.
@timroes I was thinking the same thing because it made this a little too convoluted.
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.
Tested locally. Just had one question about what seems like repeated logic in the code, not blocking.
@tealjulia There was one more thing I needed to fix in regards to showing "Manual" as the frequency in the Replication settings. It was a very small fix so I included it as part of this change since it also fixes the issue where "Manual" was not showing. |
Signed-off-by: Edmundo Ruiz Ghanem <[email protected]>
8821e15
to
6291021
Compare
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.
Have not tested locally (since Teal already did), reviewed code LGTM!
What
When the connection frequency is set to manual, it now shows in the connection table:
And when the replication settings, except for when it's a new connection:
![Screen Shot 2022-06-09 at 15 17 54](https://user-images.githubusercontent.com/168664/172926746-c7a1ff5a-c814-461f-a7c4-4afd65c9e5e0.png)
The frequency values were not part of intl so they were also moved there.
How
The reason why it wasn't showing before was a missed comparison between
undefined
andnull
. This comparison is now made when getting the frequency with the newgetFrequencyConfig
util, which is mostly used to track events.This issue may have been introduced with #12071 because some of the types changed there and what was once set to
null
may now be set toundefined
, andnull !=== undefined
For the actual display of the frequency now it's using strings from the
en.json
file instead of what was hard-coded in the config. In order to avoid confusion, thetext
property in the config was renamed totype
.Recommended reading order
Top to bottom