From 6f1adc27e627fc75412cb1fa4532f9a5866551d8 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 25 Mar 2024 13:44:40 -0700 Subject: [PATCH 01/14] Add Last Login to users table Signed-off-by: Phillip Rak --- shell/config/product/explorer.js | 3 ++- shell/config/table-headers.js | 8 ++++++++ shell/models/management.cattle.io.user.js | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/shell/config/product/explorer.js b/shell/config/product/explorer.js index d141ff2515a..da34dc51777 100644 --- a/shell/config/product/explorer.js +++ b/shell/config/product/explorer.js @@ -14,7 +14,7 @@ import { STATE, NAME as NAME_COL, NAMESPACE as NAMESPACE_COL, AGE, KEYS, INGRESS_DEFAULT_BACKEND, INGRESS_TARGET, INGRESS_CLASS, SPEC_TYPE, TARGET_PORT, SELECTOR, NODE as NODE_COL, TYPE, WORKLOAD_IMAGES, POD_IMAGES, - USER_ID, USERNAME, USER_DISPLAY_NAME, USER_PROVIDER, WORKLOAD_ENDPOINTS, STORAGE_CLASS_DEFAULT, + USER_ID, USERNAME, USER_DISPLAY_NAME, USER_PROVIDER, USER_LAST_LOGIN, 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, @@ -259,6 +259,7 @@ export function init(store) { USER_DISPLAY_NAME, USER_PROVIDER, USERNAME, + USER_LAST_LOGIN, AGE ]); diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index 50927e57317..d5ea2f5376f 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -398,6 +398,14 @@ export const USER_PROVIDER = { sort: 'providerDisplay', }; +export const USER_LAST_LOGIN = { + name: 'user-last-login', + label: 'Last Login', + value: 'userLastLogin', + formatter: 'LiveDate', + sort: 'user-last-login', +}; + export const USER_ID = { name: 'user-id', labelKey: 'tableHeaders.userId', diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index 10d67ea9e3e..0e18b4bb7be 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -99,6 +99,14 @@ export default class User extends HybridModel { return this.$rootGetters['i18n/withFallback'](`model.authConfig.provider."${ this.provider }"`, null, this.provider); } + /** + * Gets the last-login label in milliseconds + * @returns {number} + */ + get userLastLogin() { + return this.metadata?.labels?.['cattle.io/last-login'] * 1000; + } + get state() { if ( this.enabled === false ) { return 'inactive'; From b501dc6c12b6822c39fdd1435ce48ca8240a91dc Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 25 Mar 2024 13:44:09 -0700 Subject: [PATCH 02/14] Add User Disabled In & Deleted In columns Signed-off-by: Phillip Rak --- shell/config/product/explorer.js | 4 +++- shell/config/table-headers.js | 16 ++++++++++++++++ shell/models/management.cattle.io.user.js | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/shell/config/product/explorer.js b/shell/config/product/explorer.js index da34dc51777..750775b3407 100644 --- a/shell/config/product/explorer.js +++ b/shell/config/product/explorer.js @@ -14,7 +14,7 @@ import { STATE, NAME as NAME_COL, NAMESPACE as NAMESPACE_COL, AGE, KEYS, INGRESS_DEFAULT_BACKEND, INGRESS_TARGET, INGRESS_CLASS, SPEC_TYPE, TARGET_PORT, SELECTOR, NODE as NODE_COL, TYPE, WORKLOAD_IMAGES, POD_IMAGES, - USER_ID, USERNAME, USER_DISPLAY_NAME, USER_PROVIDER, USER_LAST_LOGIN, WORKLOAD_ENDPOINTS, STORAGE_CLASS_DEFAULT, + 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, @@ -260,6 +260,8 @@ export function init(store) { USER_PROVIDER, USERNAME, USER_LAST_LOGIN, + USER_DISABLED_IN, + USER_DELETED_IN, AGE ]); diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index d5ea2f5376f..a09e8f1410e 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -406,6 +406,22 @@ export const USER_LAST_LOGIN = { sort: 'user-last-login', }; +export const USER_DISABLED_IN = { + name: 'user-disabled-in', + label: 'Disabled In', + value: 'userDisabledIn', + formatter: 'LiveDate', + sort: 'user-disabled-in', +}; + +export const USER_DELETED_IN = { + name: 'user-deleted-in', + label: 'Deleted In', + value: 'userDeletedIn', + formatter: 'LiveDate', + sort: 'user-deleted-in', +}; + export const USER_ID = { name: 'user-id', labelKey: 'tableHeaders.userId', diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index 0e18b4bb7be..e12c2943924 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -107,6 +107,22 @@ export default class User extends HybridModel { return this.metadata?.labels?.['cattle.io/last-login'] * 1000; } + /** + * Gets the disabled-after label in milliseconds + * @returns {number} + */ + get userDisabledIn() { + return this.metadata?.labels?.['cattle.io/disable-after'] * 1000; + } + + /** + * Gets the delete-after label in milliseconds + * @returns {number} + */ + get userDeletedIn() { + return this.metadata?.labels?.['cattle.io/delete-after'] * 1000; + } + get state() { if ( this.enabled === false ) { return 'inactive'; From 95fa0dc45d2696396d74d978eec74f7230d95426 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 25 Mar 2024 13:38:54 -0700 Subject: [PATCH 03/14] Add translation strings for new user fields Signed-off-by: Phillip Rak --- shell/assets/translations/en-us.yaml | 3 +++ shell/config/table-headers.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index d4f350e39a0..819068c7e2c 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -5541,6 +5541,9 @@ tableHeaders: users: Users userDisplayName: Display Name userId: ID + userDeletedIn: Deleted In + userDisabledIn: Disabled In + userLastLogin: Last Login userStatus: Status username: Local Username value: Value diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index a09e8f1410e..b2f9607d8d6 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -400,7 +400,7 @@ export const USER_PROVIDER = { export const USER_LAST_LOGIN = { name: 'user-last-login', - label: 'Last Login', + labelKey: 'tableHeaders.userLastLogin', value: 'userLastLogin', formatter: 'LiveDate', sort: 'user-last-login', @@ -408,7 +408,7 @@ export const USER_LAST_LOGIN = { export const USER_DISABLED_IN = { name: 'user-disabled-in', - label: 'Disabled In', + labelKey: 'tableHeaders.userDisabledIn', value: 'userDisabledIn', formatter: 'LiveDate', sort: 'user-disabled-in', @@ -416,7 +416,7 @@ export const USER_DISABLED_IN = { export const USER_DELETED_IN = { name: 'user-deleted-in', - label: 'Deleted In', + labelKey: 'tableHeaders.userDeletedIn', value: 'userDeletedIn', formatter: 'LiveDate', sort: 'user-deleted-in', From 15341145f11a751880b587cb2cf41d505476832f Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Tue, 16 Apr 2024 08:30:04 -0700 Subject: [PATCH 04/14] Sort by raw value instead of string value Signed-off-by: Phillip Rak --- shell/config/table-headers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index b2f9607d8d6..fadbb6b4041 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -403,7 +403,7 @@ export const USER_LAST_LOGIN = { labelKey: 'tableHeaders.userLastLogin', value: 'userLastLogin', formatter: 'LiveDate', - sort: 'user-last-login', + sort: 'userLastLogin', }; export const USER_DISABLED_IN = { @@ -411,7 +411,7 @@ export const USER_DISABLED_IN = { labelKey: 'tableHeaders.userDisabledIn', value: 'userDisabledIn', formatter: 'LiveDate', - sort: 'user-disabled-in', + sort: 'userDisabledIn', }; export const USER_DELETED_IN = { @@ -419,7 +419,7 @@ export const USER_DELETED_IN = { labelKey: 'tableHeaders.userDeletedIn', value: 'userDeletedIn', formatter: 'LiveDate', - sort: 'user-deleted-in', + sort: 'userDeletedIn', }; export const USER_ID = { From a54aebed8e7af938554bb078463c3b7e8550c377 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Tue, 16 Apr 2024 14:21:04 -0700 Subject: [PATCH 05/14] Add new fields to user details getter Signed-off-by: Phillip Rak --- shell/models/management.cattle.io.user.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index e12c2943924..56979ba2fc5 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -235,6 +235,21 @@ export default class User extends HybridModel { formatter: 'CopyToClipboard', content: this.username }, + { + label: this.t('tableHeaders.userLastLogin'), + formatter: 'LiveDate', + content: this.userLastLogin, + }, + { + label: this.t('tableHeaders.userDisabledIn'), + formatter: 'LiveDate', + content: this.userDisabledIn, + }, + { + label: this.t('tableHeaders.userDeletedIn'), + formatter: 'LiveDate', + content: this.userDeletedIn, + }, ...this._details ]; } From 56163e9e9d6fbc6012f9e59de788d6336be39e3e Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Fri, 19 Apr 2024 13:23:40 -0700 Subject: [PATCH 06/14] Customize suffix for `userLastLogin` Signed-off-by: Phillip Rak --- shell/assets/translations/en-us.yaml | 1 + shell/models/management.cattle.io.user.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 819068c7e2c..be306406685 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -240,6 +240,7 @@ suffix: ib: iB mib: MiB gb: GB + ago: ago revisions: |- {count, plural, =1 { Revision } diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index 56979ba2fc5..17859d3e87a 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -1,5 +1,6 @@ import { NORMAN } from '@shell/config/types'; import HybridModel, { cleanHybridResources } from '@shell/plugins/steve/hybrid-class'; +import day from 'dayjs'; export default class User extends HybridModel { // Preserve description @@ -235,10 +236,12 @@ export default class User extends HybridModel { formatter: 'CopyToClipboard', content: this.username }, + { separator: true }, { - label: this.t('tableHeaders.userLastLogin'), - formatter: 'LiveDate', - content: this.userLastLogin, + label: this.t('tableHeaders.userLastLogin'), + formatter: 'LiveDate', + formatterOpts: { addSuffix: true, suffix: `${ this.t('suffix.ago') } (${ day(this.userLastLogin) })` }, + content: this.userLastLogin, }, { label: this.t('tableHeaders.userDisabledIn'), From 40dd936a48bdb1c878cccbc21ed8df477b212623 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Tue, 7 May 2024 09:22:20 -0700 Subject: [PATCH 07/14] Resolve issues with failing e2e tests Signed-off-by: Phillip Rak --- cypress/e2e/po/components/list-row.po.ts | 2 +- cypress/e2e/po/lists/management.cattle.io.user.po.ts | 5 ++++- cypress/e2e/tests/pages/users-and-auth/users.spec.ts | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/po/components/list-row.po.ts b/cypress/e2e/po/components/list-row.po.ts index ccd84c9a7d2..365cc794e87 100644 --- a/cypress/e2e/po/components/list-row.po.ts +++ b/cypress/e2e/po/components/list-row.po.ts @@ -2,6 +2,6 @@ import ComponentPo from '@/cypress/e2e/po/components/component.po'; export default class ListRowPo extends ComponentPo { column(index: number) { - return this.self().find('td').eq(index); + return this.self().find('td').eq(index).scrollIntoView(); } } diff --git a/cypress/e2e/po/lists/management.cattle.io.user.po.ts b/cypress/e2e/po/lists/management.cattle.io.user.po.ts index 05878f15d72..78222821206 100644 --- a/cypress/e2e/po/lists/management.cattle.io.user.po.ts +++ b/cypress/e2e/po/lists/management.cattle.io.user.po.ts @@ -46,7 +46,10 @@ export default class MgmtUsersListPo extends BaseResourceList { } clickRowActionMenuItem(name: string, itemLabel:string) { - return this.resourceTable().sortableTable().rowActionMenuOpen(name, 7).getMenuItem(itemLabel) + return this.resourceTable() + .sortableTable() + .rowActionMenuOpen(name, 10) + .getMenuItem(itemLabel) .click(); } } diff --git a/cypress/e2e/tests/pages/users-and-auth/users.spec.ts b/cypress/e2e/tests/pages/users-and-auth/users.spec.ts index e910d401a9f..88194a020a2 100644 --- a/cypress/e2e/tests/pages/users-and-auth/users.spec.ts +++ b/cypress/e2e/tests/pages/users-and-auth/users.spec.ts @@ -66,7 +66,7 @@ describe('Users', { tags: '@adminUser' }, () => { // usersPo.goTo(); usersPo.waitForPage(); - usersPo.list().elementWithName(userBaseUsername).should('be.visible'); + usersPo.list().elementWithName(userBaseUsername).should('exist'); }); it('can create Standard User and view their details', () => { @@ -84,7 +84,7 @@ describe('Users', { tags: '@adminUser' }, () => { userId = res.response?.body.userId; usersPo.waitForPage(); - usersPo.list().elementWithName(standardUsername).should('be.visible'); + usersPo.list().elementWithName(standardUsername).should('exist'); // view user's details usersPo.list().details(standardUsername, 2).find('a').click(); From 2ebc40acdf08f6c5c2893187c9974ec2e16bcef8 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Wed, 8 May 2024 15:00:46 -0700 Subject: [PATCH 08/14] Update user Deleted/Disabled labels Signed-off-by: Phillip Rak --- shell/assets/translations/en-us.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index be306406685..7a5670ad435 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -5542,8 +5542,8 @@ tableHeaders: users: Users userDisplayName: Display Name userId: ID - userDeletedIn: Deleted In - userDisabledIn: Disabled In + userDeletedIn: Delete After + userDisabledIn: Disable After userLastLogin: Last Login userStatus: Status username: Local Username From 15ace8c03aa2c66fcfcf42343f3711c9b3eadb8d Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 20 May 2024 13:09:43 -0700 Subject: [PATCH 09/14] Stop displaying relative time when date has lapsed Signed-off-by: Phillip Rak --- shell/components/formatter/LiveDate.vue | 16 ++++++++++++++++ shell/config/table-headers.js | 22 ++++++++++++---------- shell/models/management.cattle.io.user.js | 14 ++++++++------ 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/shell/components/formatter/LiveDate.vue b/shell/components/formatter/LiveDate.vue index 9a5666701f6..a7e28b1cd29 100644 --- a/shell/components/formatter/LiveDate.vue +++ b/shell/components/formatter/LiveDate.vue @@ -34,6 +34,16 @@ export default { showTooltip: { type: Boolean, default: true + }, + + /** + * Determines if the live date should behave like a countdown by comparing + * the provided value and the current date. When the countdown reaches 0, a + * "-" is rendered. + */ + isCountdown: { + type: Boolean, + default: false, } }, @@ -104,6 +114,12 @@ export default { return 300; } + if (this.isCountdown && now.valueOf() > this.dayValue?.valueOf()) { + this.label = '-'; + + return 300; + } + const diff = diffFrom(this.dayValue, now); const prefix = (diff.diff < 0 || !this.addPrefix ? '' : '-'); diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index fadbb6b4041..d5be31c3521 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -407,19 +407,21 @@ export const USER_LAST_LOGIN = { }; export const USER_DISABLED_IN = { - name: 'user-disabled-in', - labelKey: 'tableHeaders.userDisabledIn', - value: 'userDisabledIn', - formatter: 'LiveDate', - sort: 'userDisabledIn', + name: 'user-disabled-in', + labelKey: 'tableHeaders.userDisabledIn', + value: 'userDisabledIn', + formatter: 'LiveDate', + formatterOpts: { isCountdown: true }, + sort: 'userDisabledIn', }; export const USER_DELETED_IN = { - name: 'user-deleted-in', - labelKey: 'tableHeaders.userDeletedIn', - value: 'userDeletedIn', - formatter: 'LiveDate', - sort: 'userDeletedIn', + name: 'user-deleted-in', + labelKey: 'tableHeaders.userDeletedIn', + value: 'userDeletedIn', + formatter: 'LiveDate', + formatterOpts: { isCountdown: true }, + sort: 'userDeletedIn', }; export const USER_ID = { diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index 17859d3e87a..6c7f00845ac 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -244,14 +244,16 @@ export default class User extends HybridModel { content: this.userLastLogin, }, { - label: this.t('tableHeaders.userDisabledIn'), - formatter: 'LiveDate', - content: this.userDisabledIn, + label: this.t('tableHeaders.userDisabledIn'), + formatter: 'LiveDate', + formatterOpts: { isCountdown: true }, + content: this.userDisabledIn, }, { - label: this.t('tableHeaders.userDeletedIn'), - formatter: 'LiveDate', - content: this.userDeletedIn, + label: this.t('tableHeaders.userDeletedIn'), + formatter: 'LiveDate', + formatterOpts: { isCountdown: true }, + content: this.userDeletedIn, }, ...this._details ]; From 2648ac6d6471f11b5ce131422fec5360e834a811 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 20 May 2024 13:50:23 -0700 Subject: [PATCH 10/14] Update user state display labels Signed-off-by: Phillip Rak --- shell/assets/translations/en-us.yaml | 4 ++++ shell/models/management.cattle.io.user.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 7a5670ad435..e467f9bd3a5 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -5565,6 +5565,10 @@ target: placeholder: Select a version user: + state: + active: 'Enabled' + inactive: 'Disabled' + unknown: 'Unknown' detail: username: Username globalPermissions: diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index 6c7f00845ac..f2141196d8a 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -132,6 +132,19 @@ export default class User extends HybridModel { return this.metadata?.state?.name || 'unknown'; } + get stateDisplay() { + switch (this.state) { + case 'inactive': + return this.t('user.state.inactive'); + case 'active': + return this.t('user.state.active'); + case 'unknown': + return this.t('user.state.unknown'); + default: + return this.state; + } + } + get description() { return this._description; } From 8f46b59427ed597543bffb4df91603671423ce6b Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Mon, 20 May 2024 14:22:24 -0700 Subject: [PATCH 11/14] Don't display a value for `Disable After` for disabled users Signed-off-by: Phillip Rak --- shell/config/table-headers.js | 2 +- shell/models/management.cattle.io.user.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index d5be31c3521..103084a95ca 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -409,7 +409,7 @@ export const USER_LAST_LOGIN = { export const USER_DISABLED_IN = { name: 'user-disabled-in', labelKey: 'tableHeaders.userDisabledIn', - value: 'userDisabledIn', + value: 'userDisabledInDisplay', formatter: 'LiveDate', formatterOpts: { isCountdown: true }, sort: 'userDisabledIn', diff --git a/shell/models/management.cattle.io.user.js b/shell/models/management.cattle.io.user.js index f2141196d8a..505e4656d90 100644 --- a/shell/models/management.cattle.io.user.js +++ b/shell/models/management.cattle.io.user.js @@ -116,6 +116,14 @@ export default class User extends HybridModel { return this.metadata?.labels?.['cattle.io/disable-after'] * 1000; } + /** + * Provides a display value for the userDisabledIn date based on the user + * state. + */ + get userDisabledInDisplay() { + return this.state === 'inactive' ? null : this.userDisabledIn; + } + /** * Gets the delete-after label in milliseconds * @returns {number} @@ -260,7 +268,7 @@ export default class User extends HybridModel { label: this.t('tableHeaders.userDisabledIn'), formatter: 'LiveDate', formatterOpts: { isCountdown: true }, - content: this.userDisabledIn, + content: this.userDisabledInDisplay, }, { label: this.t('tableHeaders.userDeletedIn'), From 031b21a7e919448e2594ee416d72ffde111df137 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Tue, 21 May 2024 09:16:57 -0700 Subject: [PATCH 12/14] Add a suffix to Last Login Signed-off-by: Phillip Rak --- shell/config/table-headers.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index 103084a95ca..8faaf4a6fa0 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -399,11 +399,12 @@ export const USER_PROVIDER = { }; export const USER_LAST_LOGIN = { - name: 'user-last-login', - labelKey: 'tableHeaders.userLastLogin', - value: 'userLastLogin', - formatter: 'LiveDate', - sort: 'userLastLogin', + name: 'user-last-login', + labelKey: 'tableHeaders.userLastLogin', + value: 'userLastLogin', + formatter: 'LiveDate', + formatterOpts: { addSuffix: true }, + sort: 'userLastLogin', }; export const USER_DISABLED_IN = { From be6f3c8379d47a7bbdab277e40c9d03a994d8d41 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Tue, 21 May 2024 15:05:35 -0700 Subject: [PATCH 13/14] Update e2e tests to reflect state label changes Signed-off-by: Phillip Rak --- cypress/e2e/tests/pages/users-and-auth/users.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/tests/pages/users-and-auth/users.spec.ts b/cypress/e2e/tests/pages/users-and-auth/users.spec.ts index 88194a020a2..5d8642ac4d5 100644 --- a/cypress/e2e/tests/pages/users-and-auth/users.spec.ts +++ b/cypress/e2e/tests/pages/users-and-auth/users.spec.ts @@ -109,11 +109,11 @@ describe('Users', { tags: '@adminUser' }, () => { // Deactivate user and check state is Inactive usersPo.goTo(); usersPo.list().clickRowActionMenuItem(standardUsername, 'Deactivate'); - usersPo.list().details(standardUsername, 1).should('include.text', 'Inactive'); + usersPo.list().details(standardUsername, 1).should('include.text', 'Disabled'); // Activate user and check state is Active usersPo.list().clickRowActionMenuItem(standardUsername, 'Activate'); - usersPo.list().details(standardUsername, 1).should('include.text', 'Active'); + usersPo.list().details(standardUsername, 1).should('include.text', 'Enabled'); }); it('can Refresh Group Memberships', () => { @@ -192,14 +192,14 @@ describe('Users', { tags: '@adminUser' }, () => { usersPo.list().selectAll().set(); usersPo.list().deactivate().click(); cy.wait('@updateUsers'); - cy.contains('Inactive'); - usersPo.list().details('admin', 1).should('include.text', 'Active'); - usersPo.list().details(userBaseUsername, 1).should('include.text', 'Inactive'); + cy.contains('Disabled'); + usersPo.list().details('admin', 1).should('include.text', 'Enabled'); + usersPo.list().details(userBaseUsername, 1).should('include.text', 'Disabled'); // Activate user and check state is Active usersPo.list().activate().click(); cy.wait('@updateUsers'); - usersPo.list().details(userBaseUsername, 1).should('include.text', 'Active'); + usersPo.list().details(userBaseUsername, 1).should('include.text', 'Enabled'); }); it('can Download YAML', () => { From 723efe9f736b3deb02162a79cdfc8aeb29cda3c8 Mon Sep 17 00:00:00 2001 From: Sean-McQ <37550899+Sean-McQ@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:04:08 -0600 Subject: [PATCH 14/14] enableRowActions looking at the wrong schema (#9759) --- shell/list/management.cattle.io.feature.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/list/management.cattle.io.feature.vue b/shell/list/management.cattle.io.feature.vue index a371ea065c0..6a6cf663778 100644 --- a/shell/list/management.cattle.io.feature.vue +++ b/shell/list/management.cattle.io.feature.vue @@ -82,7 +82,7 @@ export default { }, enableRowActions() { - const schema = this.$store.getters[`management/schemaFor`](MANAGEMENT.SETTING); + const schema = this.$store.getters[`management/schemaFor`](MANAGEMENT.FEATURE); return schema?.resourceMethods?.includes('PUT'); },