From d96c899dfde0d171502123966d3193059eba4e21 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Thu, 3 Oct 2024 14:49:29 +0100 Subject: [PATCH 1/2] Add last used column for API tokens --- shell/assets/translations/en-us.yaml | 1 + shell/config/product/explorer.js | 3 ++- shell/config/table-headers.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 057eef5c5cf..967a87af7d6 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -5761,6 +5761,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 diff --git a/shell/config/product/explorer.js b/shell/config/product/explorer.js index d5e2cece26f..e92087b93b5 100644 --- a/shell/config/product/explorer.js +++ b/shell/config/product/explorer.js @@ -19,7 +19,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'; @@ -542,6 +542,7 @@ export function init(store) { ACCESS_KEY, DESCRIPTION, SCOPE_NORMAN, + LAST_USED, EXPIRES, AGE_NORMAN ]); diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index 2d95d0fecf8..f3858d23c6b 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -960,6 +960,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' +}; + export const RESTART = { name: 'restart', labelKey: 'tableHeaders.restart', From 63ae9b515f50cfcf2a5b1774fcac3b55f7e2d535 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Mon, 20 Jan 2025 14:34:41 +0000 Subject: [PATCH 2/2] Address PR feedback --- shell/components/formatter/LiveExpiryDate.vue | 6 +++++- shell/config/table-headers.js | 15 ++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/shell/components/formatter/LiveExpiryDate.vue b/shell/components/formatter/LiveExpiryDate.vue index 551a26c0812..c962a640fc9 100644 --- a/shell/components/formatter/LiveExpiryDate.vue +++ b/shell/components/formatter/LiveExpiryDate.vue @@ -12,6 +12,10 @@ export default { type: Object, default: () => {} }, + missingKey: { + type: String, + default: 'generic.never', + } }, data() { @@ -77,7 +81,7 @@ export default { /> diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index f3858d23c6b..e06b0b74740 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -961,13 +961,14 @@ export const EXPIRES = { }; export const LAST_USED = { - name: 'lastUsed', - value: 'lastUsedAt', - labelKey: 'tableHeaders.lastUsed', - align: 'left', - sort: ['lastUsedAt'], - width: 200, - formatter: 'LiveExpiryDate' + name: 'lastUsed', + value: 'lastUsedAt', + labelKey: 'tableHeaders.lastUsed', + align: 'left', + sort: ['lastUsedAt'], + width: 200, + formatter: 'LiveExpiryDate', + formatterOpts: { missingKey: 'generic.unknown' }, }; export const RESTART = {