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

Duration frontend implementation #1350

Merged
merged 14 commits into from
May 6, 2022
Merged

Duration frontend implementation #1350

merged 14 commits into from
May 6, 2022

Conversation

pavish
Copy link
Member

@pavish pavish commented May 5, 2022

Fixes #261 , Fixes #1337 , Fixes #1108

Screenshot 2022-05-05 at 6 24 56 AM

Screen.Recording.2022-05-05.at.6.27.28.AM.mov

Note:

  • Fractional values for each unit is allowed.
    • User may save duration in mm:ss and then change format to hh. In this case, the hour value will be fractional.
    • Fractional values are rounded off to 3 decimal places.
  • show_units display option is removed for the sake of faster completion.
    • Several UX considerations need to be taken into account to allow user to edit a duration field with unit strings.
    • It is very different from number where the user need not enter the grouping separators.
  • dayjs is installed inorder to be used with duration and for date & time types. The main consideration was the library size and dayjs is a lot smaller than the other options. Since we not require heavy date time operations on the frontend, this seems like the best choice.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@pavish pavish requested review from a team and seancolsen and removed request for a team May 5, 2022 01:10
@pavish pavish added the pr-status: review A PR awaiting review label May 5, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 5, 2022

Codecov Report

Merging #1350 (187357c) into master (a9533a5) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1350   +/-   ##
=======================================
  Coverage   93.58%   93.58%           
=======================================
  Files         115      115           
  Lines        4598     4598           
=======================================
  Hits         4303     4303           
  Misses        295      295           
Flag Coverage Δ
pytest-backend 93.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9533a5...187357c. Read the comment docs.

Copy link
Contributor

@seancolsen seancolsen 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 very cool!

  • I played with the functionality a bit and didn't find any bugs. Very nice! I like that the UI prevents "Max Time Unit" from being less than "Min Time Unit".

  • I support the choice of day.js. I looked through the formatting options for day.js vs those for date-fns. Day.js is definitely more limited. For example, I can't format values like May 5th, 2022 or 12:00 noon with it, whereas I can obtain those formatted results using date-fns. But all-in-all, these limitations seem acceptable. Users will definitely be able to format their date/time data in a manner that looks good and properly conveys the underlying values -- even if they can't tweak it for display exactly as they might want, were they to render the data in some other context like a document.

  • I have noted one small change request which I hope is agreeable and easy enough to implement that we can handle it before merging.

mathesar_ui/src/api/tables/columns.ts Outdated Show resolved Hide resolved
@seancolsen seancolsen assigned pavish and unassigned seancolsen May 5, 2022
@seancolsen seancolsen added pr-status: revision A PR awaiting follow-up work from its author after review and removed pr-status: review A PR awaiting review labels May 5, 2022
@pavish pavish added pr-status: review A PR awaiting review and removed pr-status: revision A PR awaiting follow-up work from its author after review labels May 6, 2022
@pavish pavish assigned seancolsen and unassigned pavish May 6, 2022
@pavish pavish requested a review from seancolsen May 6, 2022 06:58
@seancolsen seancolsen enabled auto-merge May 6, 2022 10:25
@seancolsen
Copy link
Contributor

@pavish I've just looked over the diff of your most recent changes on my phone and they look good. I think I have properly enabled Auto merge and merged Master into this branch, but it's a little hard to tell on my phone. I might not be at work today, so please feel free to do whatever else is necessary to go PR merged yourself.

@pavish
Copy link
Member Author

pavish commented May 6, 2022

Since @seancolsen has given his approval via comment, I'm going to dismiss the previous review inorder to get this PR merged.

@seancolsen seancolsen merged commit 00c0ef9 into master May 6, 2022
@seancolsen seancolsen deleted the duration_261 branch May 6, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
3 participants