Make the expiration controls on the API tokens config page nicer.

Review Request #12670 — Created Oct. 5, 2022 and submitted

Information

Review Board
release-5.0.x

Reviewers

This change offers several improvements to the expiration controls on the
API tokens config page:
- Users can edit the expiration of expired tokens.
- Users can set the specific time of the expiration.
- Users can set the expiration to a past date/time.

With this, the API tokens config page offers the same flexibility for editing
expiration dates as the API.

This change also resets the expired_notification_sent flag in a token's
extra_data field whenever a token's expiration is updated, so that users can
get notified again if they set a new expiration date on already expired tokens.

  • Ran JS unit tests.
  • Ran ./reviewboard/webapi/tests/test_api_token.py
  • Manually tested the expiration controls with various combinations of
    starting states, ending states, and with the other controls on the page.
Summary ID
Improve expiration date and time controls on the API tokens config page.
2856e1c74e0a25cd93dc0069a30a72d7da6123a9

Description From Last Updated

Can you update the description to talk about the changes to the browser compatibility list?

chipx86chipx86

Let's put an Oxford Comma after description and change that to "expiration date and time".

chipx86chipx86

For chaining, the preferred format would be: this._$datePicker = $(dedent` ... `) .prepend(this.options.descriptorText); Though if we're looking to build this …

chipx86chipx86

We probably don't need to worry about changes here. This is important for transpiling code, but the usage of datetime-local …

chipx86chipx86

I think what Christian meant was: this._$datePicker = $( '<span class="rb-c-date-inline-editor__picker">' ) We also don't need the closing </span> here.

daviddavid

No need for dedent here, since there's only one line. You can simply have a string on the next line.

chipx86chipx86

This will be 5.0.2 now.

chipx86chipx86

Same here.

daviddavid

No need for dedent here.

chipx86chipx86

For repeat index lookups, let's assign to a variable. Helps group together related assertions, and reduces visual noise.

chipx86chipx86
chipx86
  1. 
      
  2. Show all issues

    Can you update the description to talk about the changes to the browser compatibility list?

  3. Show all issues

    Let's put an Oxford Comma after description and change that to "expiration date and time".

  4. reviewboard/static/rb/js/ui/views/inlineEditorView.es6.js (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    For chaining, the preferred format would be:

    this._$datePicker =
        $(dedent`
            ...
        `)
        .prepend(this.options.descriptorText);
    

    Though if we're looking to build this and put something in it at the same time, we should probably just use a template, or build the DOM elements incrementally (since we have to find the input, we might as well do the latter).

  5. 
      
maubin
david
  1. Ship It!
  2. 
      
maubin
maubin
david
  1. Ship It!
  2. 
      
chipx86
  1. Looks really good! These changes are small.

  2. .browserslistrc (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    We probably don't need to worry about changes here. This is important for transpiling code, but the usage of datetime-local doesn't really impact that. It's true that datetime-local may not work on older browsers, but that's probably okay. People who need to be on older browsers that need to edit this can put in a date manually, if needed.

  3. Show all issues

    No need for dedent here, since there's only one line. You can simply have a string on the next line.

  4. Show all issues

    This will be 5.0.2 now.

  5. Show all issues

    No need for dedent here.

  6. Show all issues

    For repeat index lookups, let's assign to a variable. Helps group together related assertions, and reduces visual noise.

  7. 
      
maubin
david
  1. 
      
  2. Show all issues

    I think what Christian meant was:

    this._$datePicker = $(
        '<span class="rb-c-date-inline-editor__picker">'
    )
    

    We also don't need the closing </span> here.

  3. Show all issues

    Same here.

  4. 
      
maubin
chipx86
  1. Ship It!
  2. 
      
maubin
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (bab0401)
Loading...