1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-10 23:22:22 +02:00

feat(web): improved server stats (#1870)

* feat(web): improved server stats

* fix(web): don't log unauthorized errors

* Revert "fix(web): don't log unauthorized errors"

This reverts commit 7fc2987a77.
This commit is contained in:
Michel Heusschen
2023-02-26 20:57:34 +01:00
committed by GitHub
parent 7d45ae68a6
commit 368142e79b
25 changed files with 199 additions and 260 deletions

View File

@@ -8,11 +8,9 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**photos** | **int** | |
**videos** | **int** | |
**objects** | **int** | |
**usageRaw** | **int** | |
**usage** | **String** | |
**photos** | **int** | | [default to 0]
**videos** | **int** | | [default to 0]
**usage** | **int** | | [default to 0]
**usageByUser** | [**List<UsageByUserDto>**](UsageByUserDto.md) | | [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -9,10 +9,11 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**userId** | **String** | |
**videos** | **int** | |
**userFirstName** | **String** | |
**userLastName** | **String** | |
**photos** | **int** | |
**usageRaw** | **int** | |
**usage** | **String** | |
**videos** | **int** | |
**usage** | **int** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -13,11 +13,9 @@ part of openapi.api;
class ServerStatsResponseDto {
/// Returns a new [ServerStatsResponseDto] instance.
ServerStatsResponseDto({
required this.photos,
required this.videos,
required this.objects,
required this.usageRaw,
required this.usage,
this.photos = 0,
this.videos = 0,
this.usage = 0,
this.usageByUser = const [],
});
@@ -25,11 +23,7 @@ class ServerStatsResponseDto {
int videos;
int objects;
int usageRaw;
String usage;
int usage;
List<UsageByUserDto> usageByUser;
@@ -37,8 +31,6 @@ class ServerStatsResponseDto {
bool operator ==(Object other) => identical(this, other) || other is ServerStatsResponseDto &&
other.photos == photos &&
other.videos == videos &&
other.objects == objects &&
other.usageRaw == usageRaw &&
other.usage == usage &&
other.usageByUser == usageByUser;
@@ -47,20 +39,16 @@ class ServerStatsResponseDto {
// ignore: unnecessary_parenthesis
(photos.hashCode) +
(videos.hashCode) +
(objects.hashCode) +
(usageRaw.hashCode) +
(usage.hashCode) +
(usageByUser.hashCode);
@override
String toString() => 'ServerStatsResponseDto[photos=$photos, videos=$videos, objects=$objects, usageRaw=$usageRaw, usage=$usage, usageByUser=$usageByUser]';
String toString() => 'ServerStatsResponseDto[photos=$photos, videos=$videos, usage=$usage, usageByUser=$usageByUser]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'photos'] = this.photos;
json[r'videos'] = this.videos;
json[r'objects'] = this.objects;
json[r'usageRaw'] = this.usageRaw;
json[r'usage'] = this.usage;
json[r'usageByUser'] = this.usageByUser;
return json;
@@ -87,9 +75,7 @@ class ServerStatsResponseDto {
return ServerStatsResponseDto(
photos: mapValueOfType<int>(json, r'photos')!,
videos: mapValueOfType<int>(json, r'videos')!,
objects: mapValueOfType<int>(json, r'objects')!,
usageRaw: mapValueOfType<int>(json, r'usageRaw')!,
usage: mapValueOfType<String>(json, r'usage')!,
usage: mapValueOfType<int>(json, r'usage')!,
usageByUser: UsageByUserDto.listFromJson(json[r'usageByUser'])!,
);
}
@@ -142,8 +128,6 @@ class ServerStatsResponseDto {
static const requiredKeys = <String>{
'photos',
'videos',
'objects',
'usageRaw',
'usage',
'usageByUser',
};

View File

@@ -14,48 +14,54 @@ class UsageByUserDto {
/// Returns a new [UsageByUserDto] instance.
UsageByUserDto({
required this.userId,
required this.videos,
required this.userFirstName,
required this.userLastName,
required this.photos,
required this.usageRaw,
required this.videos,
required this.usage,
});
String userId;
int videos;
String userFirstName;
String userLastName;
int photos;
int usageRaw;
int videos;
String usage;
int usage;
@override
bool operator ==(Object other) => identical(this, other) || other is UsageByUserDto &&
other.userId == userId &&
other.videos == videos &&
other.userFirstName == userFirstName &&
other.userLastName == userLastName &&
other.photos == photos &&
other.usageRaw == usageRaw &&
other.videos == videos &&
other.usage == usage;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(userId.hashCode) +
(videos.hashCode) +
(userFirstName.hashCode) +
(userLastName.hashCode) +
(photos.hashCode) +
(usageRaw.hashCode) +
(videos.hashCode) +
(usage.hashCode);
@override
String toString() => 'UsageByUserDto[userId=$userId, videos=$videos, photos=$photos, usageRaw=$usageRaw, usage=$usage]';
String toString() => 'UsageByUserDto[userId=$userId, userFirstName=$userFirstName, userLastName=$userLastName, photos=$photos, videos=$videos, usage=$usage]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'userId'] = this.userId;
json[r'videos'] = this.videos;
json[r'userFirstName'] = this.userFirstName;
json[r'userLastName'] = this.userLastName;
json[r'photos'] = this.photos;
json[r'usageRaw'] = this.usageRaw;
json[r'videos'] = this.videos;
json[r'usage'] = this.usage;
return json;
}
@@ -80,10 +86,11 @@ class UsageByUserDto {
return UsageByUserDto(
userId: mapValueOfType<String>(json, r'userId')!,
videos: mapValueOfType<int>(json, r'videos')!,
userFirstName: mapValueOfType<String>(json, r'userFirstName')!,
userLastName: mapValueOfType<String>(json, r'userLastName')!,
photos: mapValueOfType<int>(json, r'photos')!,
usageRaw: mapValueOfType<int>(json, r'usageRaw')!,
usage: mapValueOfType<String>(json, r'usage')!,
videos: mapValueOfType<int>(json, r'videos')!,
usage: mapValueOfType<int>(json, r'usage')!,
);
}
return null;
@@ -134,9 +141,10 @@ class UsageByUserDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'userId',
'videos',
'userFirstName',
'userLastName',
'photos',
'usageRaw',
'videos',
'usage',
};
}

View File

@@ -16,27 +16,17 @@ void main() {
// final instance = ServerStatsResponseDto();
group('test ServerStatsResponseDto', () {
// int photos
// int photos (default value: 0)
test('to test the property `photos`', () async {
// TODO
});
// int videos
// int videos (default value: 0)
test('to test the property `videos`', () async {
// TODO
});
// int objects
test('to test the property `objects`', () async {
// TODO
});
// int usageRaw
test('to test the property `usageRaw`', () async {
// TODO
});
// String usage
// int usage (default value: 0)
test('to test the property `usage`', () async {
// TODO
});

View File

@@ -21,8 +21,13 @@ void main() {
// TODO
});
// int videos
test('to test the property `videos`', () async {
// String userFirstName
test('to test the property `userFirstName`', () async {
// TODO
});
// String userLastName
test('to test the property `userLastName`', () async {
// TODO
});
@@ -31,12 +36,12 @@ void main() {
// TODO
});
// int usageRaw
test('to test the property `usageRaw`', () async {
// int videos
test('to test the property `videos`', () async {
// TODO
});
// String usage
// int usage
test('to test the property `usage`', () async {
// TODO
});