diff --git a/assets/translations/en.json b/assets/translations/en.json index c4d319dc..f3ec3523 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -210,10 +210,12 @@ "_comment": "Services", "title": "Your personal, private and independent services.", "service_page": { + "open_in_browser": "Open in browser", "restart": "Restart service", "disable": "Disable service", "enable": "Enable service", - "move": "Move to another volume" + "move": "Move to another volume", + "uses": "Uses {usage} on {volume}" }, "mail": { "title": "E-Mail", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index df68f75f..5072c88b 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -209,10 +209,12 @@ "_comment": "Вкладка сервисы", "title": "Ваши личные, приватные и независимые сервисы:", "service_page": { + "open_in_browser": "Открыть в браузере", "restart": "Перезапустить сервис", "disable": "Выключить сервис", "enable": "Включить сервис", - "move": "Переместить на другой диск" + "move": "Переместить на другой диск", + "uses": "Использует {usage} на {volume}" }, "mail": { "title": "Почта", diff --git a/lib/config/bloc_config.dart b/lib/config/bloc_config.dart index b80dada7..b88b21d7 100644 --- a/lib/config/bloc_config.dart +++ b/lib/config/bloc_config.dart @@ -31,7 +31,8 @@ class BlocAndProviderConfig extends StatelessWidget { final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit); final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit); final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit); - final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); + final apiServerVolumesCubit = + ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit); final serverJobsCubit = ServerJobsCubit(serverInstallationCubit); final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit); diff --git a/lib/logic/cubit/server_volumes/server_volume_cubit.dart b/lib/logic/cubit/server_volumes/server_volume_cubit.dart index f13a4b07..ca6dbb6e 100644 --- a/lib/logic/cubit/server_volumes/server_volume_cubit.dart +++ b/lib/logic/cubit/server_volumes/server_volume_cubit.dart @@ -12,7 +12,8 @@ part 'server_volume_state.dart'; class ApiServerVolumeCubit extends ServerInstallationDependendCubit { ApiServerVolumeCubit( - final ServerInstallationCubit serverInstallationCubit, this.providerVolumeCubit, + final ServerInstallationCubit serverInstallationCubit, + this.providerVolumeCubit, ) : super(serverInstallationCubit, ApiServerVolumeState.initial()) { _providerVolumeSubscription = providerVolumeCubit.stream.listen(checkProviderVolumes); diff --git a/lib/logic/cubit/server_volumes/server_volume_state.dart b/lib/logic/cubit/server_volumes/server_volume_state.dart index 1764d7fc..b2b1fce0 100644 --- a/lib/logic/cubit/server_volumes/server_volume_state.dart +++ b/lib/logic/cubit/server_volumes/server_volume_state.dart @@ -5,7 +5,7 @@ class ApiServerVolumeState extends ServerInstallationDependendState { this._volumes, this.status, this.usesBinds, - this._diskStatus, + this._diskStatus, ); ApiServerVolumeState.initial() @@ -19,7 +19,9 @@ class ApiServerVolumeState extends ServerInstallationDependendState { List get volumes => _diskStatus.diskVolumes; DiskStatus get diskStatus => _diskStatus; - DiskVolume getVolume(final String volumeName) => volumes.firstWhere((final volume) => volume.name == volumeName, orElse: () => DiskVolume()); + DiskVolume getVolume(final String volumeName) => + volumes.firstWhere((final volume) => volume.name == volumeName, + orElse: () => DiskVolume()); ApiServerVolumeState copyWith({ final List? volumes, diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 593abc28..0d1f9802 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -51,7 +51,10 @@ class MorePage extends StatelessWidget { title: 'providers.storage.start_migration_button'.tr(), iconData: Icons.drive_file_move_outline, goTo: DataMigrationPage( - diskStatus: context.watch().state.diskStatus, + diskStatus: context + .watch() + .state + .diskStatus, services: context .read() .state diff --git a/lib/ui/pages/services/service_page.dart b/lib/ui/pages/services/service_page.dart index dd5f8e86..82dde3dc 100644 --- a/lib/ui/pages/services/service_page.dart +++ b/lib/ui/pages/services/service_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart'; import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.dart'; @@ -68,7 +69,7 @@ class _ServicePageState extends State { onTap: () => _launchURL(service.url), leading: const Icon(Icons.open_in_browser), title: Text( - 'Open in browser', + 'services.service_page.open_in_browser'.tr(), style: Theme.of(context).textTheme.titleMedium, ), subtitle: Text( @@ -117,10 +118,19 @@ class _ServicePageState extends State { 'services.service_page.move'.tr(), style: Theme.of(context).textTheme.titleMedium, ), - // subtitle: Text( - // 'Uses ${service.storageUsage.used} on ${context.read().state.totalStorage}', - // style: Theme.of(context).textTheme.bodyMedium, - // ), + subtitle: Text( + 'services.service_page.uses'.tr( + namedArgs: { + 'usage': service.storageUsage.used.toString(), + 'volume': context + .read() + .state + .getVolume(service.storageUsage.volume ?? '') + .displayName + }, + ), + style: Theme.of(context).textTheme.bodyMedium, + ), ), ], );