Fixed user last login query

- Added frontend logic for first login
- Added table index for user_logins table
- Updated statistics rest endpoint
This commit is contained in:
2024-06-02 23:13:31 +02:00
parent 348bf8050c
commit 9ebbcc00ea
8 changed files with 29 additions and 57 deletions

View File

@ -38,7 +38,8 @@
<div class="shadow stats bg-white">
<div class="stat">
<div class="stat-title">Last Admin Login</div>
<div class="stat-value">{{ statistics.lastUserLogin | relativeTime }}</div>
<div *ngIf="statistics.lastUserLogin" class="stat-value">{{ statistics.lastUserLogin.loginTime | relativeTime }}</div>
<div *ngIf="!statistics.lastUserLogin" class="stat-value">First login...</div>
<div class="stat-desc">Most recent login</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
import {DatePipe, DecimalPipe, NgForOf} from "@angular/common";
import {DatePipe, DecimalPipe, NgForOf, NgIf} from "@angular/common";
import axios from "axios";
import {firstValueFrom} from "rxjs";
import {DevelopmentStore} from "../../store/DevelopmentStore";
@ -22,7 +22,8 @@ import {EdituserComponent} from "./edituser/edituser.component";
DurationPipe,
RelativeTimePipe,
FormsModule,
EdituserComponent
EdituserComponent,
NgIf
],
templateUrl: './adminui.component.html',
styleUrl: './adminui.component.scss'
@ -35,7 +36,7 @@ export class AdminuiComponent {
expiredFileUploads: any[] = [];
totalFileSizeOnDisk: number = 0;
totalFileDownloads = 0;
statistics: any = {};
statistics: any = "";
username: string = "";
constructor(private developmentStore: DevelopmentStore, private authStore: AuthStore, private router: Router) {