From c0d8d37989a36a4691d1b5f97ea69cb8b960dcad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NaiJi=20=E2=9C=A8?= Date: Mon, 10 Jul 2023 12:00:46 +0300 Subject: [PATCH] chore: Merge backups-testing to master - Remove unused breaking isHidden field - Add commentary for Hetzner Volume replicating Hetzner documentation - Update router.gr (when i ran build_runner this file changed for some reason) Co-authored-by: NaiJi Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/232 Reviewed-by: Inex Code --- .../models/json/hetzner_server_info.dart | 15 + lib/logic/models/json/server_job.dart | 1 - lib/logic/models/json/server_job.g.dart | 3 +- lib/ui/router/router.gr.dart | 660 +++++++++--------- 4 files changed, 346 insertions(+), 333 deletions(-) diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index b0706599..557f8ea7 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -137,6 +137,12 @@ class HetznerLocation { _$HetznerLocationFromJson(json); } +/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers. +/// +/// Pricing for Volumes depends on the Volume size and Location, not the actual used storage. +/// +/// Please see Hetzner Docs for more details about Volumes. +/// https://docs.hetzner.cloud/#volumes @JsonSerializable() class HetznerVolume { HetznerVolume( @@ -146,11 +152,20 @@ class HetznerVolume { this.name, this.linuxDevice, ); + + /// ID of the Resource final int id; + + /// Size in GB of the Volume final int size; + + /// ID of the Server the Volume is attached to, null if it is not attached at all final int? serverId; + + /// Name of the Resource. Is unique per Project. final String name; + /// Device path on the file system for the Volume @JsonKey(name: 'linux_device') final String? linuxDevice; diff --git a/lib/logic/models/json/server_job.dart b/lib/logic/models/json/server_job.dart index 44fb2561..70d6d103 100644 --- a/lib/logic/models/json/server_job.dart +++ b/lib/logic/models/json/server_job.dart @@ -50,7 +50,6 @@ class ServerJob { final String? result; final String? statusText; final DateTime? finishedAt; - bool isHidden = false; } enum JobStatusEnum { diff --git a/lib/logic/models/json/server_job.g.dart b/lib/logic/models/json/server_job.g.dart index 61ff259b..712c086f 100644 --- a/lib/logic/models/json/server_job.g.dart +++ b/lib/logic/models/json/server_job.g.dart @@ -21,7 +21,7 @@ ServerJob _$ServerJobFromJson(Map json) => ServerJob( finishedAt: json['finishedAt'] == null ? null : DateTime.parse(json['finishedAt'] as String), - )..isHidden = json['isHidden'] as bool; + ); Map _$ServerJobToJson(ServerJob instance) => { 'name': instance.name, @@ -36,7 +36,6 @@ Map _$ServerJobToJson(ServerJob instance) => { 'result': instance.result, 'statusText': instance.statusText, 'finishedAt': instance.finishedAt?.toIso8601String(), - 'isHidden': instance.isHidden, }; const _$JobStatusEnumEnumMap = { diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index ef06ccf6..5bbd9c47 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -15,103 +15,10 @@ abstract class _$RootRouter extends RootStackRouter { @override final Map pagesMap = { - DevicesRoute.name: (routeData) { + RootRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const DevicesScreen(), - ); - }, - DnsDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DnsDetailsPage(), - ); - }, - AppSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AppSettingsPage(), - ); - }, - DeveloperSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DeveloperSettingsPage(), - ); - }, - AboutApplicationRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AboutApplicationPage(), - ); - }, - MoreRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const MorePage(), - ); - }, - ConsoleRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ConsolePage(), - ); - }, - OnboardingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const OnboardingPage(), - ); - }, - ProvidersRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ProvidersPage(), - ); - }, - RecoveryKeyRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const RecoveryKeyPage(), - ); - }, - ServerDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ServerDetailsScreen(), - ); - }, - ServicesMigrationRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ServicesMigrationPage( - services: args.services, - diskStatus: args.diskStatus, - isMigration: args.isMigration, - key: args.key, - ), - ); - }, - ServerStorageRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ServerStoragePage( - diskStatus: args.diskStatus, - key: args.key, - ), - ); - }, - ExtendingVolumeRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ExtendingVolumePage( - diskVolumeToResize: args.diskVolumeToResize, - diskStatus: args.diskStatus, - key: args.key, - ), + child: WrappedRoute(child: const RootPage()), ); }, ServiceRoute.name: (routeData) { @@ -130,16 +37,10 @@ abstract class _$RootRouter extends RootStackRouter { child: const ServicesPage(), ); }, - InitializingRoute.name: (routeData) { + ServerDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const InitializingPage(), - ); - }, - RecoveryRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const RecoveryRouting(), + child: const ServerDetailsScreen(), ); }, UsersRoute.name: (routeData) { @@ -164,16 +65,103 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - RootRoute.name: (routeData) { + AppSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: WrappedRoute(child: const RootPage()), + child: const AppSettingsPage(), ); }, - BackupDetailsRoute.name: (routeData) { + DeveloperSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const BackupDetailsPage(), + child: const DeveloperSettingsPage(), + ); + }, + MoreRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const MorePage(), + ); + }, + AboutApplicationRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AboutApplicationPage(), + ); + }, + ConsoleRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ConsolePage(), + ); + }, + ProvidersRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ProvidersPage(), + ); + }, + RecoveryKeyRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryKeyPage(), + ); + }, + DnsDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DnsDetailsPage(), + ); + }, + RecoveryRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryRouting(), + ); + }, + InitializingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const InitializingPage(), + ); + }, + ServerStorageRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( + routeData: routeData, + child: ServerStoragePage( + diskStatus: args.diskStatus, + key: args.key, + ), + ); + }, + ExtendingVolumeRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( + routeData: routeData, + child: ExtendingVolumePage( + diskVolumeToResize: args.diskVolumeToResize, + diskStatus: args.diskStatus, + key: args.key, + ), + ); + }, + ServicesMigrationRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( + routeData: routeData, + child: ServicesMigrationPage( + services: args.services, + diskStatus: args.diskStatus, + isMigration: args.isMigration, + key: args.key, + ), + ); + }, + DevicesRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DevicesScreen(), ); }, BackupsListRoute.name: (routeData) { @@ -186,37 +174,167 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, + BackupDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const BackupDetailsPage(), + ); + }, + OnboardingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const OnboardingPage(), + ); + }, }; } /// generated route for -/// [DevicesScreen] -class DevicesRoute extends PageRouteInfo { - const DevicesRoute({List? children}) +/// [RootPage] +class RootRoute extends PageRouteInfo { + const RootRoute({List? children}) : super( - DevicesRoute.name, + RootRoute.name, initialChildren: children, ); - static const String name = 'DevicesRoute'; + static const String name = 'RootRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [DnsDetailsPage] -class DnsDetailsRoute extends PageRouteInfo { - const DnsDetailsRoute({List? children}) - : super( - DnsDetailsRoute.name, +/// [ServicePage] +class ServiceRoute extends PageRouteInfo { + ServiceRoute({ + required String serviceId, + Key? key, + List? children, + }) : super( + ServiceRoute.name, + args: ServiceRouteArgs( + serviceId: serviceId, + key: key, + ), initialChildren: children, ); - static const String name = 'DnsDetailsRoute'; + static const String name = 'ServiceRoute'; + + static const PageInfo page = + PageInfo(name); +} + +class ServiceRouteArgs { + const ServiceRouteArgs({ + required this.serviceId, + this.key, + }); + + final String serviceId; + + final Key? key; + + @override + String toString() { + return 'ServiceRouteArgs{serviceId: $serviceId, key: $key}'; + } +} + +/// generated route for +/// [ServicesPage] +class ServicesRoute extends PageRouteInfo { + const ServicesRoute({List? children}) + : super( + ServicesRoute.name, + initialChildren: children, + ); + + static const String name = 'ServicesRoute'; static const PageInfo page = PageInfo(name); } +/// generated route for +/// [ServerDetailsScreen] +class ServerDetailsRoute extends PageRouteInfo { + const ServerDetailsRoute({List? children}) + : super( + ServerDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'ServerDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [UsersPage] +class UsersRoute extends PageRouteInfo { + const UsersRoute({List? children}) + : super( + UsersRoute.name, + initialChildren: children, + ); + + static const String name = 'UsersRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [NewUserPage] +class NewUserRoute extends PageRouteInfo { + const NewUserRoute({List? children}) + : super( + NewUserRoute.name, + initialChildren: children, + ); + + static const String name = 'NewUserRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [UserDetailsPage] +class UserDetailsRoute extends PageRouteInfo { + UserDetailsRoute({ + required String login, + Key? key, + List? children, + }) : super( + UserDetailsRoute.name, + args: UserDetailsRouteArgs( + login: login, + key: key, + ), + initialChildren: children, + ); + + static const String name = 'UserDetailsRoute'; + + static const PageInfo page = + PageInfo(name); +} + +class UserDetailsRouteArgs { + const UserDetailsRouteArgs({ + required this.login, + this.key, + }); + + final String login; + + final Key? key; + + @override + String toString() { + return 'UserDetailsRouteArgs{login: $login, key: $key}'; + } +} + /// generated route for /// [AppSettingsPage] class AppSettingsRoute extends PageRouteInfo { @@ -245,20 +363,6 @@ class DeveloperSettingsRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } -/// generated route for -/// [AboutApplicationPage] -class AboutApplicationRoute extends PageRouteInfo { - const AboutApplicationRoute({List? children}) - : super( - AboutApplicationRoute.name, - initialChildren: children, - ); - - static const String name = 'AboutApplicationRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [MorePage] class MoreRoute extends PageRouteInfo { @@ -273,6 +377,20 @@ class MoreRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [AboutApplicationPage] +class AboutApplicationRoute extends PageRouteInfo { + const AboutApplicationRoute({List? children}) + : super( + AboutApplicationRoute.name, + initialChildren: children, + ); + + static const String name = 'AboutApplicationRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [ConsolePage] class ConsoleRoute extends PageRouteInfo { @@ -287,20 +405,6 @@ class ConsoleRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } -/// generated route for -/// [OnboardingPage] -class OnboardingRoute extends PageRouteInfo { - const OnboardingRoute({List? children}) - : super( - OnboardingRoute.name, - initialChildren: children, - ); - - static const String name = 'OnboardingRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [ProvidersPage] class ProvidersRoute extends PageRouteInfo { @@ -330,65 +434,45 @@ class RecoveryKeyRoute extends PageRouteInfo { } /// generated route for -/// [ServerDetailsScreen] -class ServerDetailsRoute extends PageRouteInfo { - const ServerDetailsRoute({List? children}) +/// [DnsDetailsPage] +class DnsDetailsRoute extends PageRouteInfo { + const DnsDetailsRoute({List? children}) : super( - ServerDetailsRoute.name, + DnsDetailsRoute.name, initialChildren: children, ); - static const String name = 'ServerDetailsRoute'; + static const String name = 'DnsDetailsRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [ServicesMigrationPage] -class ServicesMigrationRoute extends PageRouteInfo { - ServicesMigrationRoute({ - required List services, - required DiskStatus diskStatus, - required bool isMigration, - Key? key, - List? children, - }) : super( - ServicesMigrationRoute.name, - args: ServicesMigrationRouteArgs( - services: services, - diskStatus: diskStatus, - isMigration: isMigration, - key: key, - ), +/// [RecoveryRouting] +class RecoveryRoute extends PageRouteInfo { + const RecoveryRoute({List? children}) + : super( + RecoveryRoute.name, initialChildren: children, ); - static const String name = 'ServicesMigrationRoute'; + static const String name = 'RecoveryRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = PageInfo(name); } -class ServicesMigrationRouteArgs { - const ServicesMigrationRouteArgs({ - required this.services, - required this.diskStatus, - required this.isMigration, - this.key, - }); +/// generated route for +/// [InitializingPage] +class InitializingRoute extends PageRouteInfo { + const InitializingRoute({List? children}) + : super( + InitializingRoute.name, + initialChildren: children, + ); - final List services; + static const String name = 'InitializingRoute'; - final DiskStatus diskStatus; - - final bool isMigration; - - final Key? key; - - @override - String toString() { - return 'ServicesMigrationRouteArgs{services: $services, diskStatus: $diskStatus, isMigration: $isMigration, key: $key}'; - } + static const PageInfo page = PageInfo(name); } /// generated route for @@ -473,175 +557,63 @@ class ExtendingVolumeRouteArgs { } /// generated route for -/// [ServicePage] -class ServiceRoute extends PageRouteInfo { - ServiceRoute({ - required String serviceId, +/// [ServicesMigrationPage] +class ServicesMigrationRoute extends PageRouteInfo { + ServicesMigrationRoute({ + required List services, + required DiskStatus diskStatus, + required bool isMigration, Key? key, List? children, }) : super( - ServiceRoute.name, - args: ServiceRouteArgs( - serviceId: serviceId, + ServicesMigrationRoute.name, + args: ServicesMigrationRouteArgs( + services: services, + diskStatus: diskStatus, + isMigration: isMigration, key: key, ), initialChildren: children, ); - static const String name = 'ServiceRoute'; + static const String name = 'ServicesMigrationRoute'; - static const PageInfo page = - PageInfo(name); + static const PageInfo page = + PageInfo(name); } -class ServiceRouteArgs { - const ServiceRouteArgs({ - required this.serviceId, +class ServicesMigrationRouteArgs { + const ServicesMigrationRouteArgs({ + required this.services, + required this.diskStatus, + required this.isMigration, this.key, }); - final String serviceId; + final List services; + + final DiskStatus diskStatus; + + final bool isMigration; final Key? key; @override String toString() { - return 'ServiceRouteArgs{serviceId: $serviceId, key: $key}'; + return 'ServicesMigrationRouteArgs{services: $services, diskStatus: $diskStatus, isMigration: $isMigration, key: $key}'; } } /// generated route for -/// [ServicesPage] -class ServicesRoute extends PageRouteInfo { - const ServicesRoute({List? children}) +/// [DevicesScreen] +class DevicesRoute extends PageRouteInfo { + const DevicesRoute({List? children}) : super( - ServicesRoute.name, + DevicesRoute.name, initialChildren: children, ); - static const String name = 'ServicesRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [InitializingPage] -class InitializingRoute extends PageRouteInfo { - const InitializingRoute({List? children}) - : super( - InitializingRoute.name, - initialChildren: children, - ); - - static const String name = 'InitializingRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [RecoveryRouting] -class RecoveryRoute extends PageRouteInfo { - const RecoveryRoute({List? children}) - : super( - RecoveryRoute.name, - initialChildren: children, - ); - - static const String name = 'RecoveryRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [UsersPage] -class UsersRoute extends PageRouteInfo { - const UsersRoute({List? children}) - : super( - UsersRoute.name, - initialChildren: children, - ); - - static const String name = 'UsersRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [NewUserPage] -class NewUserRoute extends PageRouteInfo { - const NewUserRoute({List? children}) - : super( - NewUserRoute.name, - initialChildren: children, - ); - - static const String name = 'NewUserRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [UserDetailsPage] -class UserDetailsRoute extends PageRouteInfo { - UserDetailsRoute({ - required String login, - Key? key, - List? children, - }) : super( - UserDetailsRoute.name, - args: UserDetailsRouteArgs( - login: login, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'UserDetailsRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class UserDetailsRouteArgs { - const UserDetailsRouteArgs({ - required this.login, - this.key, - }); - - final String login; - - final Key? key; - - @override - String toString() { - return 'UserDetailsRouteArgs{login: $login, key: $key}'; - } -} - -/// generated route for -/// [RootPage] -class RootRoute extends PageRouteInfo { - const RootRoute({List? children}) - : super( - RootRoute.name, - initialChildren: children, - ); - - static const String name = 'RootRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [BackupDetailsPage] -class BackupDetailsRoute extends PageRouteInfo { - const BackupDetailsRoute({List? children}) - : super( - BackupDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'BackupDetailsRoute'; + static const String name = 'DevicesRoute'; static const PageInfo page = PageInfo(name); } @@ -683,3 +655,31 @@ class BackupsListRouteArgs { return 'BackupsListRouteArgs{service: $service, key: $key}'; } } + +/// generated route for +/// [BackupDetailsPage] +class BackupDetailsRoute extends PageRouteInfo { + const BackupDetailsRoute({List? children}) + : super( + BackupDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'BackupDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [OnboardingPage] +class OnboardingRoute extends PageRouteInfo { + const OnboardingRoute({List? children}) + : super( + OnboardingRoute.name, + initialChildren: children, + ); + + static const String name = 'OnboardingRoute'; + + static const PageInfo page = PageInfo(name); +}