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>
<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()">
<mat-icon>how_to_reg</mat-icon> {{'register' | i18n}}
</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">
<mat-icon>login</mat-icon> {{'login' | i18n}}
@ -44,7 +46,7 @@
<div *ngIf="permissions && permissions[0]">
<h3>{{'permissions' | i18n}}</h3>
<app-permissions [permissions]="permissions"></app-permissions>
<app-permissions [permissions]="permissions" [startsVisible]="canRegister()" [expiresVisible]="canRegister()"></app-permissions>
</div>
<div *ngIf="quotas && quotas[0]">
<h3>{{'quotas' | i18n}}</h3>

View File

@ -13,14 +13,15 @@
<ng-container matColumnDef="starts">
<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 matColumnDef="expires">
<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>
<tr mat-header-row *matHeaderRowDef="permissionColumns"></tr>
<tr mat-row *matRowDef="let myRowData; columns: permissionColumns"></tr>
</table>
</table>

View File

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