fix: add expiration date information to service users keys (#7497)

* feat: add ExpirationDate to MachineKey JSON detail

* fix: include time in expiration date column for machine keys table

* fix: show expiration date in ShowKeyDialog if available

* fix: add machine key expiration date note

---------

Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
This commit is contained in:
Miguel Cabrerizo
2024-03-13 19:21:19 +01:00
committed by GitHub
parent 30a1f4b39e
commit dff5984f7d
6 changed files with 53 additions and 34 deletions

View File

@@ -61,7 +61,7 @@
<ng-container matColumnDef="expirationDate">
<th mat-header-cell *matHeaderCellDef>{{ 'USER.MACHINE.EXPIRATIONDATE' | translate }}</th>
<td mat-cell *matCellDef="let key">
{{ key.expirationDate | timestampToDate | localizedDate: 'fromNow' }}
{{ key.expirationDate | timestampToDate | localizedDate: 'EEE dd. MMM YYYY, HH:mm' }}
</td>
</ng-container>

View File

@@ -17,6 +17,13 @@
</p>
</div>
<div class="row" *ngIf="expirationDate">
<p class="left cnsl-secondary-text">{{ 'USER.MACHINE.EXPIRATIONDATE' | translate }}</p>
<p class="right">
{{ expirationDate | localizedDate: 'EEE dd. MMM YYYY, HH:mm' }}
</p>
</div>
<button class="download-button" mat-stroked-button color="primary" (click)="saveFile()">Download</button>
</ng-container>
</div>

View File

@@ -11,6 +11,7 @@ import { InfoSectionType } from '../info-section/info-section.component';
})
export class ShowKeyDialogComponent {
public keyResponse!: AddMachineKeyResponse.AsObject | AddAppKeyResponse.AsObject;
public expirationDate: string = '';
public InfoSectionType: any = InfoSectionType;
constructor(
@@ -18,6 +19,10 @@ export class ShowKeyDialogComponent {
@Inject(MAT_DIALOG_DATA) public data: any,
) {
this.keyResponse = data.key;
if (this.keyResponse.keyDetails) {
const keyDetails: { expirationDate: string } = JSON.parse(atob(this.keyResponse.keyDetails.toString()));
this.expirationDate = keyDetails.expirationDate;
}
}
public saveFile(): void {