Update the API Tokens UI for setting token expiration dates.

Review Request #12597 — Created Sept. 15, 2022 and submitted — Latest diff uploaded


Review Board


This change allows people to set token expiration dates from the API tokens
config page through a date picker. Consequently, expiration dates can also be
updated through the API. We create a RB.DateInlineEditorView to handle the
UI for the date editing.

This also updates the page to show the invalidated/expired text in
in red so that they stand out against valid tokens.

While running the JS unit tests it was discovered that the
RB.InlineEditorView would not disconnect from a window resize event that
it was handling, which caused problems with other JS tests when running the
full suite. This change adds a RB.InlineEditorView.remove() method to
handle this and disconnect from any events.

  • Created new unit tests for setting the expiration date via the API
    and ran all tests in reviewboard.webapi.tests.test_api_token.py.
  • Manually tested the API tokens page, setting various expiration dates and
    making sure they were displayed and saved to the database properly.
  • Created DateInlineEditorView JS tests and ran all JS tests.
  • Manually tested resizing my browser that had the new review request page
    open on it and saw that any inline editors that I was using on the page
    would resize accordingly.