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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5682,6 +5682,7 @@ tableHeaders:
lastSchedule: Last Schedule
lastSeen: Last Seen
lastSeenTooltip: The time at which the most recent occurrence of this event was recorded
lastUsed: Last Used
loggingOutputProviders: Provider
machines: Machines
machineNodeName: Node
Expand Down
3 changes: 2 additions & 1 deletion shell/config/product/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
USER_ID, USERNAME, USER_DISPLAY_NAME, USER_PROVIDER, USER_LAST_LOGIN, USER_DISABLED_IN, USER_DELETED_IN, WORKLOAD_ENDPOINTS, STORAGE_CLASS_DEFAULT,
STORAGE_CLASS_PROVISIONER, PERSISTENT_VOLUME_SOURCE,
HPA_REFERENCE, MIN_REPLICA, MAX_REPLICA, CURRENT_REPLICA,
ACCESS_KEY, DESCRIPTION, EXPIRES, EXPIRY_STATE, SUB_TYPE, AGE_NORMAN, SCOPE_NORMAN, PERSISTENT_VOLUME_CLAIM, RECLAIM_POLICY, PV_REASON, WORKLOAD_HEALTH_SCALE, POD_RESTARTS,
ACCESS_KEY, DESCRIPTION, EXPIRES, EXPIRY_STATE, LAST_USED, SUB_TYPE, AGE_NORMAN, SCOPE_NORMAN, PERSISTENT_VOLUME_CLAIM, RECLAIM_POLICY, PV_REASON, WORKLOAD_HEALTH_SCALE, POD_RESTARTS,
DURATION, MESSAGE, REASON, LAST_SEEN_TIME, EVENT_TYPE, OBJECT, ROLE, ROLES, VERSION, INTERNAL_EXTERNAL_IP, KUBE_NODE_OS, CPU, RAM, SECRET_DATA
} from '@shell/config/table-headers';

Expand Down Expand Up @@ -376,6 +376,7 @@ export function init(store) {
ACCESS_KEY,
DESCRIPTION,
SCOPE_NORMAN,
LAST_USED,
EXPIRES,
AGE_NORMAN
]);
Expand Down
10 changes: 10 additions & 0 deletions shell/config/table-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,16 @@ export const EXPIRES = {
formatter: 'LiveExpiryDate'
};

export const LAST_USED = {
name: 'lastUsed',
value: 'lastUsedAt',
labelKey: 'tableHeaders.lastUsed',
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?

};

export const RESTART = {
name: 'restart',
labelKey: 'tableHeaders.restart',
Expand Down
Loading