Don't display a value for `Disable After` for disabled users

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This commit is contained in:
Phillip Rak 2024-05-20 14:22:24 -07:00
parent a47c7ea7aa
commit c746601593
2 changed files with 10 additions and 2 deletions

View File

@ -416,7 +416,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',

View File

@ -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'),