Update the API Tokens UI for setting token expiration dates.

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

Information

Review Board
release-5.0.x

Reviewers

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.

Changes between revision 9 and 10

orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Commits

Summary ID Author
Add UI for setting token expiration dates.
fc727909011d591baf6be378682d119d2b381839 Michelle Aubin
Add UI for setting token expiration dates.
b3f3a7d518ddd58f15c615a5f3e5ccc16264c23a Michelle Aubin
reviewboard/static/rb/js/accountPrefsPage/views/apiTokensView.es6.js
reviewboard/static/rb/js/ui/views/inlineEditorView.es6.js
reviewboard/webapi/tests/test_api_token.py
Loading...