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

Add last used column for API tokens #12114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nwmac
Copy link
Member

@nwmac nwmac commented Oct 3, 2024

Summary

Fixes #11870

Occurred changes and/or fixed issues

The PR adds the 'Last Used' information for API tokens, as implemented by this backend PR: rancher/rancher#45732

Technical notes summary

Fairly simple - we define a new column and add it to the API Keys/Tokens table. Added translation as aell.

Areas or cases that should be tested

  • Go to the API Keys from the user preference menu (top right avatar)
  • Verify that the tokens table included a 'Last Used' column
  • Check the column sorting works correctly
  • Hover over one of the Last Used cells and check that a tooltip appears, showing the absolute date/time

Screenshot/Video

New 'Last Used' column:
image

Hover on last used shows absolute date/time:
image

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@nwmac nwmac self-assigned this Oct 3, 2024
@nwmac nwmac requested a review from richard-cox October 3, 2024 14:51
@rancher-ui-project-bot rancher-ui-project-bot bot added this to the v2.10.0 milestone Oct 3, 2024
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added question in comment. I couldn't see this working either using latest head

align: 'left',
sort: ['lastUsedAt'],
width: 200,
formatter: 'LiveExpiryDate'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky one. Do existing tokens get updated on upgrade? when lastUsedAt is empty we'll show Never, which is a bit inaccurate.

image

Could add something like formatterOpts: { missingKey: 'generic.unknown' }, and plumb that into LifeExpiryDate via the prop below?

missingKey: {
     type:    String,
     default: `generic.never`,
   },

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take a look - agreed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. although for a newly created token, I think it is empty, so showing Never is accurate, since it's never been used... will check on a fresh system by creating a token then upgrading Rancher.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good point. maybe just leaving empty would be the best option?

@nwmac nwmac requested review from mantis-toboggan-md and removed request for mantis-toboggan-md October 4, 2024 16:18
@nwmac
Copy link
Member Author

nwmac commented Oct 4, 2024

@richard-cox Backend is not merge - I tested with a locally built Rancher from the backend PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] Expose LastUsed time for tokens
2 participants