improve token

This commit is contained in:
_Bastler 2023-12-15 08:29:42 +01:00
parent fb4d130c1b
commit f8b6d173bc
3 changed files with 11 additions and 6 deletions

View File

@ -21,13 +21,15 @@
</a> </a>
<div class="flex column" *ngIf="!auth.authenticated"> <div class="flex column" *ngIf="!auth.authenticated">
<p>{{'tokens.register' | i18n}}</p> <p *ngIf="canRegister()">{{'tokens.register' | i18n}}</p>
<a routerLink="/register" mat-raised-button color="accent" *ngIf="canRegister()"> <a routerLink="/register" mat-raised-button color="accent" *ngIf="canRegister()">
<mat-icon>how_to_reg</mat-icon> {{'register' | i18n}} <mat-icon>how_to_reg</mat-icon> {{'register' | i18n}}
</a> </a>
<p>{{'tokens.login' | i18n}}</p> <p *ngIf="canRegister()">{{'tokens.login' | i18n}}</p>
<p *ngIf="!canRegister()">{{'tokens.loginRequired' | i18n}}</p>
<a routerLink="/login" [queryParams]="{ target:'/tokens' }" mat-raised-button color="primary"> <a routerLink="/login" [queryParams]="{ target:'/tokens' }" mat-raised-button color="primary">
<mat-icon>login</mat-icon> {{'login' | i18n}} <mat-icon>login</mat-icon> {{'login' | i18n}}
@ -44,7 +46,7 @@
<div *ngIf="permissions && permissions[0]"> <div *ngIf="permissions && permissions[0]">
<h3>{{'permissions' | i18n}}</h3> <h3>{{'permissions' | i18n}}</h3>
<app-permissions [permissions]="permissions"></app-permissions> <app-permissions [permissions]="permissions" [startsVisible]="canRegister()" [expiresVisible]="canRegister()"></app-permissions>
</div> </div>
<div *ngIf="quotas && quotas[0]"> <div *ngIf="quotas && quotas[0]">
<h3>{{'quotas' | i18n}}</h3> <h3>{{'quotas' | i18n}}</h3>

View File

@ -13,12 +13,13 @@
<ng-container matColumnDef="starts"> <ng-container matColumnDef="starts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="starts"> {{'permissions.starts' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="starts"> {{'permissions.starts' | i18n}} </th>
<td mat-cell *matCellDef="let permission">{{permission.starts | datef:datetimeformat}}</td> <td mat-cell *matCellDef="let permission">{{ startsVisible ? (permission.starts | datef:datetimeformat) : '-'}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="expires"> <ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'permissions.expires' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'permissions.expires' | i18n}} </th>
<td mat-cell *matCellDef="let permission">{{permission.expires | datef:datetimeformat}}</td> <td mat-cell *matCellDef="let permission">{{ expiresVisible ? (permission.expires | datef:datetimeformat) : '-'}}
</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="permissionColumns"></tr> <tr mat-header-row *matHeaderRowDef="permissionColumns"></tr>

View File

@ -11,6 +11,8 @@ export class PermissionsComponent implements OnInit, OnChanges {
datetimeformat: String; datetimeformat: String;
@Input() permissions; @Input() permissions;
@Input() startsVisible: boolean = true;
@Input() expiresVisible: boolean = true;
permissionColumns = ["name", "starts", "expires"]; permissionColumns = ["name", "starts", "expires"];
constructor(private i18n: I18nService) {} constructor(private i18n: I18nService) {}