mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: deprecate /server-info and replace with /server-info/storage (#9645)
This commit is contained in:
parent
a341ab0050
commit
a3e7e8cc31
19 changed files with 265 additions and 99 deletions
|
|
@ -32,7 +32,7 @@ class ServerDiskInfo {
|
|||
return 'ServerDiskInfo(diskAvailable: $diskAvailable, diskSize: $diskSize, diskUse: $diskUse, diskUsagePercentage: $diskUsagePercentage)';
|
||||
}
|
||||
|
||||
ServerDiskInfo.fromDto(ServerInfoResponseDto dto)
|
||||
ServerDiskInfo.fromDto(ServerStorageResponseDto dto)
|
||||
: diskAvailable = dto.diskAvailable,
|
||||
diskSize = dto.diskSize,
|
||||
diskUse = dto.diskUse,
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
|
||||
if (state.backupProgress != BackUpProgressEnum.inBackground) {
|
||||
await _getBackupAlbumsInfo();
|
||||
await updateServerInfo();
|
||||
await updateDiskInfo();
|
||||
await _updateBackupAssetCount();
|
||||
} else {
|
||||
log.warning("cannot get backup info - background backup is in progress!");
|
||||
|
|
@ -542,7 +542,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
_updatePersistentAlbumsSelection();
|
||||
}
|
||||
|
||||
updateServerInfo();
|
||||
updateDiskInfo();
|
||||
}
|
||||
|
||||
void _onUploadProgress(int sent, int total) {
|
||||
|
|
@ -579,13 +579,13 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> updateServerInfo() async {
|
||||
final serverInfo = await _serverInfoService.getServerInfo();
|
||||
Future<void> updateDiskInfo() async {
|
||||
final diskInfo = await _serverInfoService.getDiskInfo();
|
||||
|
||||
// Update server info
|
||||
if (serverInfo != null) {
|
||||
if (diskInfo != null) {
|
||||
state = state.copyWith(
|
||||
serverInfo: serverInfo,
|
||||
serverInfo: diskInfo,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class ManualUploadNotifier extends StateNotifier<ManualUploadState> {
|
|||
bool isDuplicated,
|
||||
) {
|
||||
state = state.copyWith(successfulUploads: state.successfulUploads + 1);
|
||||
_backupProvider.updateServerInfo();
|
||||
_backupProvider.updateDiskInfo();
|
||||
}
|
||||
|
||||
void _onAssetUploadError(ErrorUploadAsset errorAssetInfo) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ class ServerInfoService {
|
|||
|
||||
ServerInfoService(this._apiService);
|
||||
|
||||
Future<ServerDiskInfo?> getServerInfo() async {
|
||||
Future<ServerDiskInfo?> getDiskInfo() async {
|
||||
try {
|
||||
final dto = await _apiService.serverInfoApi.getServerInfo();
|
||||
final dto = await _apiService.serverInfoApi.getStorage();
|
||||
if (dto != null) {
|
||||
return ServerDiskInfo.fromDto(dto);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint("Error [getServerInfo] ${e.toString()}");
|
||||
debugPrint("Error [getDiskInfo] ${e.toString()}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
|
|||
|
||||
useEffect(
|
||||
() {
|
||||
ref.read(backupProvider.notifier).updateServerInfo();
|
||||
ref.read(backupProvider.notifier).updateDiskInfo();
|
||||
ref.read(currentUserProvider.notifier).refresh();
|
||||
return null;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue