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

Add ablum feature to web (#352)

* Added album page

* Refactor sidebar

* Added album assets count info

* Added album viewer page

* Refactor album sorting

* Fixed incorrectly showing selected asset in album selection

* Improve fetching speed with prefetch

* Refactor to use ImmichThubmnail component for all

* Update to the latest version of Svelte

* Implement fixed app bar in album viewer

* Added shared user avatar

* Correctly get all owned albums, including shared
This commit is contained in:
Alex
2022-07-15 23:18:17 -05:00
committed by GitHub
parent 1887b5a860
commit 7134f93eb8
62 changed files with 2572 additions and 991 deletions

View File

@ -37,6 +37,7 @@ doc/ServerPingResponse.md
doc/ServerVersionReponseDto.md
doc/SignUpDto.md
doc/SmartInfoResponseDto.md
doc/ThumbnailFormat.md
doc/UpdateAlbumDto.md
doc/UpdateDeviceInfoDto.md
doc/UpdateUserDto.md
@ -90,6 +91,7 @@ lib/model/server_ping_response.dart
lib/model/server_version_reponse_dto.dart
lib/model/sign_up_dto.dart
lib/model/smart_info_response_dto.dart
lib/model/thumbnail_format.dart
lib/model/update_album_dto.dart
lib/model/update_device_info_dto.dart
lib/model/update_user_dto.dart
@ -97,4 +99,4 @@ lib/model/user_count_response_dto.dart
lib/model/user_response_dto.dart
lib/model/validate_access_token_response_dto.dart
pubspec.yaml
test/validate_access_token_response_dto_test.dart
test/thumbnail_format_test.dart

View File

@ -136,6 +136,7 @@ Class | Method | HTTP request | Description
- [ServerVersionReponseDto](doc//ServerVersionReponseDto.md)
- [SignUpDto](doc//SignUpDto.md)
- [SmartInfoResponseDto](doc//SmartInfoResponseDto.md)
- [ThumbnailFormat](doc//ThumbnailFormat.md)
- [UpdateAlbumDto](doc//UpdateAlbumDto.md)
- [UpdateDeviceInfoDto](doc//UpdateDeviceInfoDto.md)
- [UpdateUserDto](doc//UpdateUserDto.md)

View File

@ -311,7 +311,7 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getAssetThumbnail**
> Object getAssetThumbnail(assetId)
> Object getAssetThumbnail(assetId, format)
@ -327,9 +327,10 @@ import 'package:openapi/api.dart';
final api_instance = AssetApi();
final assetId = assetId_example; // String |
final format = ; // ThumbnailFormat |
try {
final result = api_instance.getAssetThumbnail(assetId);
final result = api_instance.getAssetThumbnail(assetId, format);
print(result);
} catch (e) {
print('Exception when calling AssetApi->getAssetThumbnail: $e\n');
@ -341,6 +342,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**assetId** | **String**| |
**format** | [**ThumbnailFormat**](.md)| | [optional]
### Return type

View File

@ -0,0 +1,14 @@
# openapi.model.ThumbnailFormat
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[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

@ -64,6 +64,7 @@ part 'model/server_ping_response.dart';
part 'model/server_version_reponse_dto.dart';
part 'model/sign_up_dto.dart';
part 'model/smart_info_response_dto.dart';
part 'model/thumbnail_format.dart';
part 'model/update_album_dto.dart';
part 'model/update_device_info_dto.dart';
part 'model/update_user_dto.dart';

View File

@ -346,7 +346,9 @@ class AssetApi {
/// Parameters:
///
/// * [String] assetId (required):
Future<Response> getAssetThumbnailWithHttpInfo(String assetId,) async {
///
/// * [ThumbnailFormat] format:
Future<Response> getAssetThumbnailWithHttpInfo(String assetId, { ThumbnailFormat? format, }) async {
// ignore: prefer_const_declarations
final path = r'/asset/thumbnail/{assetId}'
.replaceAll('{assetId}', assetId);
@ -358,6 +360,10 @@ class AssetApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (format != null) {
queryParams.addAll(_queryParams('', 'format', format));
}
const contentTypes = <String>[];
@ -375,8 +381,10 @@ class AssetApi {
/// Parameters:
///
/// * [String] assetId (required):
Future<Object?> getAssetThumbnail(String assetId,) async {
final response = await getAssetThumbnailWithHttpInfo(assetId,);
///
/// * [ThumbnailFormat] format:
Future<Object?> getAssetThumbnail(String assetId, { ThumbnailFormat? format, }) async {
final response = await getAssetThumbnailWithHttpInfo(assetId, format: format, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@ -252,6 +252,8 @@ class ApiClient {
return SignUpDto.fromJson(value);
case 'SmartInfoResponseDto':
return SmartInfoResponseDto.fromJson(value);
case 'ThumbnailFormat':
return ThumbnailFormatTypeTransformer().decode(value);
case 'UpdateAlbumDto':
return UpdateAlbumDto.fromJson(value);
case 'UpdateDeviceInfoDto':

View File

@ -64,6 +64,9 @@ String parameterToString(dynamic value) {
if (value is DeviceTypeEnum) {
return DeviceTypeEnumTypeTransformer().encode(value).toString();
}
if (value is ThumbnailFormat) {
return ThumbnailFormatTypeTransformer().encode(value).toString();
}
return value.toString();
}

View File

@ -0,0 +1,85 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class ThumbnailFormat {
/// Instantiate a new enum with the provided [value].
const ThumbnailFormat._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const JPEG = ThumbnailFormat._(r'JPEG');
static const WEBP = ThumbnailFormat._(r'WEBP');
/// List of all possible values in this [enum][ThumbnailFormat].
static const values = <ThumbnailFormat>[
JPEG,
WEBP,
];
static ThumbnailFormat? fromJson(dynamic value) => ThumbnailFormatTypeTransformer().decode(value);
static List<ThumbnailFormat>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <ThumbnailFormat>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = ThumbnailFormat.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [ThumbnailFormat] to String,
/// and [decode] dynamic data back to [ThumbnailFormat].
class ThumbnailFormatTypeTransformer {
factory ThumbnailFormatTypeTransformer() => _instance ??= const ThumbnailFormatTypeTransformer._();
const ThumbnailFormatTypeTransformer._();
String encode(ThumbnailFormat data) => data.value;
/// Decodes a [dynamic value][data] to a ThumbnailFormat.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
ThumbnailFormat? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'JPEG': return ThumbnailFormat.JPEG;
case r'WEBP': return ThumbnailFormat.WEBP;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [ThumbnailFormatTypeTransformer] instance.
static ThumbnailFormatTypeTransformer? _instance;
}

View File

@ -0,0 +1,21 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for ThumbnailFormat
void main() {
group('test ThumbnailFormat', () {
});
}