refactor: remove ProviderVolumes cubit
parent
3b9d616045
commit
6914b01d2a
|
@ -305,6 +305,10 @@
|
||||||
"extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.",
|
"extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.",
|
||||||
"extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.",
|
"extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.",
|
||||||
"extending_volume_error": "Couldn't initialize volume extending.",
|
"extending_volume_error": "Couldn't initialize volume extending.",
|
||||||
|
"extending_volume_started": "Volume extending started",
|
||||||
|
"extending_volume_provider_waiting": "Provider volume resized, waiting 10 seconds…",
|
||||||
|
"extending_volume_server_waiting": "Server volume resized, waiting 20 seconds…",
|
||||||
|
"extending_volume_rebooting": "Rebooting server…",
|
||||||
"extending_volume_modal_description": "Upgrade to {} for {} plan per month.",
|
"extending_volume_modal_description": "Upgrade to {} for {} plan per month.",
|
||||||
"size": "Size",
|
"size": "Size",
|
||||||
"price": "Price",
|
"price": "Price",
|
||||||
|
@ -634,4 +638,4 @@
|
||||||
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
||||||
"cubit_statuses": "Cubit loading statuses"
|
"cubit_statuses": "Cubit loading statuses"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/connection_status/connection_status_bloc.dart';
|
import 'package:selfprivacy/logic/cubit/connection_status/connection_status_bloc.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
|
|
||||||
import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
|
@ -34,7 +33,6 @@ class BlocAndProviderConfigState extends State<BlocAndProviderConfig> {
|
||||||
late final DnsRecordsCubit dnsRecordsCubit;
|
late final DnsRecordsCubit dnsRecordsCubit;
|
||||||
late final RecoveryKeyCubit recoveryKeyCubit;
|
late final RecoveryKeyCubit recoveryKeyCubit;
|
||||||
late final ApiDevicesCubit apiDevicesCubit;
|
late final ApiDevicesCubit apiDevicesCubit;
|
||||||
late final ProviderVolumeCubit apiVolumesCubit;
|
|
||||||
late final ServerJobsBloc serverJobsBloc;
|
late final ServerJobsBloc serverJobsBloc;
|
||||||
late final ConnectionStatusBloc connectionStatusBloc;
|
late final ConnectionStatusBloc connectionStatusBloc;
|
||||||
late final ServerDetailsCubit serverDetailsCubit;
|
late final ServerDetailsCubit serverDetailsCubit;
|
||||||
|
@ -51,7 +49,6 @@ class BlocAndProviderConfigState extends State<BlocAndProviderConfig> {
|
||||||
dnsRecordsCubit = DnsRecordsCubit();
|
dnsRecordsCubit = DnsRecordsCubit();
|
||||||
recoveryKeyCubit = RecoveryKeyCubit();
|
recoveryKeyCubit = RecoveryKeyCubit();
|
||||||
apiDevicesCubit = ApiDevicesCubit();
|
apiDevicesCubit = ApiDevicesCubit();
|
||||||
apiVolumesCubit = ProviderVolumeCubit();
|
|
||||||
serverJobsBloc = ServerJobsBloc();
|
serverJobsBloc = ServerJobsBloc();
|
||||||
connectionStatusBloc = ConnectionStatusBloc();
|
connectionStatusBloc = ConnectionStatusBloc();
|
||||||
serverDetailsCubit = ServerDetailsCubit();
|
serverDetailsCubit = ServerDetailsCubit();
|
||||||
|
@ -98,9 +95,6 @@ class BlocAndProviderConfigState extends State<BlocAndProviderConfig> {
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (final _) => apiDevicesCubit,
|
create: (final _) => apiDevicesCubit,
|
||||||
),
|
),
|
||||||
BlocProvider(
|
|
||||||
create: (final _) => apiVolumesCubit,
|
|
||||||
),
|
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (final _) => serverJobsBloc,
|
create: (final _) => serverJobsBloc,
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
|
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||||
import 'package:selfprivacy/logic/models/disk_status.dart';
|
import 'package:selfprivacy/logic/models/disk_status.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
||||||
import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
||||||
|
@ -28,6 +29,10 @@ class VolumesBloc extends Bloc<VolumesEvent, VolumesState> {
|
||||||
_updateState,
|
_updateState,
|
||||||
transformer: droppable(),
|
transformer: droppable(),
|
||||||
);
|
);
|
||||||
|
on<VolumeResize>(
|
||||||
|
_resizeVolume,
|
||||||
|
transformer: droppable(),
|
||||||
|
);
|
||||||
|
|
||||||
final connectionRepository = getIt<ApiConnectionRepository>();
|
final connectionRepository = getIt<ApiConnectionRepository>();
|
||||||
|
|
||||||
|
@ -149,8 +154,21 @@ class VolumesBloc extends Bloc<VolumesEvent, VolumesState> {
|
||||||
) async {
|
) async {
|
||||||
final serverVolumes = event.volumes;
|
final serverVolumes = event.volumes;
|
||||||
final providerVolumes = state.providerVolumes;
|
final providerVolumes = state.providerVolumes;
|
||||||
|
if (state is VolumesLoading) {
|
||||||
|
emit(
|
||||||
|
VolumesLoaded(
|
||||||
|
diskStatus: DiskStatus.fromVolumes(
|
||||||
|
serverVolumes,
|
||||||
|
providerVolumes,
|
||||||
|
),
|
||||||
|
providerVolumes: providerVolumes,
|
||||||
|
serverVolumesHashCode: Object.hashAll(serverVolumes),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
emit(
|
emit(
|
||||||
VolumesLoaded(
|
state.copyWith(
|
||||||
diskStatus: DiskStatus.fromVolumes(
|
diskStatus: DiskStatus.fromVolumes(
|
||||||
serverVolumes,
|
serverVolumes,
|
||||||
providerVolumes,
|
providerVolumes,
|
||||||
|
@ -160,4 +178,69 @@ class VolumesBloc extends Bloc<VolumesEvent, VolumesState> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _resizeVolume(
|
||||||
|
final VolumeResize event,
|
||||||
|
final Emitter<VolumesState> emit,
|
||||||
|
) async {
|
||||||
|
if (state is! VolumesLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getIt<NavigationService>().showSnackBar(
|
||||||
|
'storage.extending_volume_started'.tr(),
|
||||||
|
);
|
||||||
|
emit(
|
||||||
|
VolumesResizing(
|
||||||
|
serverVolumesHashCode: state._serverVolumesHashCode,
|
||||||
|
diskStatus: state.diskStatus,
|
||||||
|
providerVolumes: state.providerVolumes,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final resizedResult =
|
||||||
|
await ProvidersController.currentServerProvider!.resizeVolume(
|
||||||
|
event.volume.providerVolume!,
|
||||||
|
event.newSize,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!resizedResult.success || !resizedResult.data) {
|
||||||
|
getIt<NavigationService>().showSnackBar(
|
||||||
|
'storage.extending_volume_error'.tr(),
|
||||||
|
);
|
||||||
|
emit(
|
||||||
|
VolumesLoaded(
|
||||||
|
serverVolumesHashCode: state._serverVolumesHashCode,
|
||||||
|
diskStatus: state.diskStatus,
|
||||||
|
providerVolumes: state.providerVolumes,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getIt<NavigationService>().showSnackBar(
|
||||||
|
'storage.extending_volume_waiting'.tr(),
|
||||||
|
);
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 10));
|
||||||
|
|
||||||
|
await getIt<ApiConnectionRepository>().api.resizeVolume(event.volume.name);
|
||||||
|
getIt<NavigationService>().showSnackBar(
|
||||||
|
'storage.extending_volume_server_waiting'.tr(),
|
||||||
|
);
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 20));
|
||||||
|
getIt<NavigationService>().showSnackBar(
|
||||||
|
'storage.extending_volume_rebooting'.tr(),
|
||||||
|
);
|
||||||
|
|
||||||
|
emit(
|
||||||
|
VolumesLoaded(
|
||||||
|
serverVolumesHashCode: state._serverVolumesHashCode,
|
||||||
|
diskStatus: state.diskStatus,
|
||||||
|
providerVolumes: state.providerVolumes,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await getIt<ApiConnectionRepository>().api.reboot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,3 +28,16 @@ class VolumesServerStateChanged extends VolumesEvent {
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [volumes];
|
List<Object> get props => [volumes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VolumeResize extends VolumesEvent {
|
||||||
|
const VolumeResize(
|
||||||
|
this.volume,
|
||||||
|
this.newSize,
|
||||||
|
);
|
||||||
|
|
||||||
|
final DiskVolume volume;
|
||||||
|
final DiskSize newSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [volume, newSize];
|
||||||
|
}
|
||||||
|
|
|
@ -95,3 +95,28 @@ class VolumesLoaded extends VolumesState {
|
||||||
serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!,
|
serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VolumesResizing extends VolumesState {
|
||||||
|
const VolumesResizing({
|
||||||
|
required super.serverVolumesHashCode,
|
||||||
|
required super.diskStatus,
|
||||||
|
final List<ServerProviderVolume>? providerVolumes,
|
||||||
|
}) : super(
|
||||||
|
providerVolumes: providerVolumes ?? const [],
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [providerVolumes, _serverVolumesHashCode];
|
||||||
|
|
||||||
|
@override
|
||||||
|
VolumesResizing copyWith({
|
||||||
|
final DiskStatus? diskStatus,
|
||||||
|
final List<ServerProviderVolume>? providerVolumes,
|
||||||
|
final int? serverVolumesHashCode,
|
||||||
|
}) =>
|
||||||
|
VolumesResizing(
|
||||||
|
diskStatus: diskStatus ?? this.diskStatus,
|
||||||
|
providerVolumes: providerVolumes ?? this.providerVolumes,
|
||||||
|
serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
|
||||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart';
|
|
||||||
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
|
||||||
import 'package:selfprivacy/logic/cubit/server_connection_dependent/server_connection_dependent_cubit.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/disk_status.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/price.dart';
|
|
||||||
import 'package:selfprivacy/logic/providers/providers_controller.dart';
|
|
||||||
|
|
||||||
part 'provider_volume_state.dart';
|
|
||||||
|
|
||||||
class ProviderVolumeCubit
|
|
||||||
extends ServerConnectionDependentCubit<ProviderVolumeState> {
|
|
||||||
ProviderVolumeCubit() : super(const ProviderVolumeState.initial());
|
|
||||||
final ServerApi serverApi = ServerApi();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> load() async {
|
|
||||||
unawaited(_refetch());
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Price?> getPricePerGb() async {
|
|
||||||
Price? price;
|
|
||||||
final pricingResult =
|
|
||||||
await ProvidersController.currentServerProvider!.getAdditionalPricing();
|
|
||||||
if (pricingResult.data == null || !pricingResult.success) {
|
|
||||||
getIt<NavigationService>().showSnackBar('server.pricing_error'.tr());
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
price = pricingResult.data!.perVolumeGb;
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> refresh() async {
|
|
||||||
emit(const ProviderVolumeState([], LoadingStatus.refreshing, false));
|
|
||||||
unawaited(_refetch());
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _refetch() async {
|
|
||||||
if (ProvidersController.currentServerProvider == null) {
|
|
||||||
return emit(const ProviderVolumeState([], LoadingStatus.error, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
final volumesResult =
|
|
||||||
await ProvidersController.currentServerProvider!.getVolumes();
|
|
||||||
|
|
||||||
if (!volumesResult.success || volumesResult.data.isEmpty) {
|
|
||||||
return emit(const ProviderVolumeState([], LoadingStatus.error, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
emit(
|
|
||||||
ProviderVolumeState(
|
|
||||||
volumesResult.data,
|
|
||||||
LoadingStatus.success,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Future<void> attachVolume(final DiskVolume volume) async {
|
|
||||||
// final ServerHostingDetails server = getIt<ApiConfigModel>().serverDetails!;
|
|
||||||
// await ProvidersController.currentServerProvider!
|
|
||||||
// .attachVolume(volume.providerVolume!, server.id);
|
|
||||||
// unawaited(refresh());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> detachVolume(final DiskVolume volume) async {
|
|
||||||
// await ProvidersController.currentServerProvider!
|
|
||||||
// .detachVolume(volume.providerVolume!);
|
|
||||||
// unawaited(refresh());
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<bool> resizeVolume(
|
|
||||||
final DiskVolume volume,
|
|
||||||
final DiskSize newSize,
|
|
||||||
final Function() callback,
|
|
||||||
) async {
|
|
||||||
getIt<NavigationService>().showSnackBar(
|
|
||||||
'Starting resize',
|
|
||||||
);
|
|
||||||
emit(state.copyWith(isResizing: true));
|
|
||||||
final resizedResult =
|
|
||||||
await ProvidersController.currentServerProvider!.resizeVolume(
|
|
||||||
volume.providerVolume!,
|
|
||||||
newSize,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!resizedResult.success || !resizedResult.data) {
|
|
||||||
getIt<NavigationService>().showSnackBar(
|
|
||||||
'storage.extending_volume_error'.tr(),
|
|
||||||
);
|
|
||||||
emit(state.copyWith(isResizing: false));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
getIt<NavigationService>().showSnackBar(
|
|
||||||
'Provider volume resized, waiting 10 seconds',
|
|
||||||
);
|
|
||||||
await Future.delayed(const Duration(seconds: 10));
|
|
||||||
|
|
||||||
await ServerApi().resizeVolume(volume.name);
|
|
||||||
getIt<NavigationService>().showSnackBar(
|
|
||||||
'Server volume resized, waiting 20 seconds',
|
|
||||||
);
|
|
||||||
|
|
||||||
await Future.delayed(const Duration(seconds: 20));
|
|
||||||
getIt<NavigationService>().showSnackBar(
|
|
||||||
'Restarting server',
|
|
||||||
);
|
|
||||||
|
|
||||||
await refresh();
|
|
||||||
emit(state.copyWith(isResizing: false));
|
|
||||||
await callback();
|
|
||||||
await serverApi.reboot();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Future<void> createVolume(final DiskSize size) async {
|
|
||||||
// final ServerProviderVolume? volume = (await ProvidersController
|
|
||||||
// .currentServerProvider!
|
|
||||||
// .createVolume(size.gibibyte.toInt()))
|
|
||||||
// .data;
|
|
||||||
//
|
|
||||||
// final diskVolume = DiskVolume(providerVolume: volume);
|
|
||||||
// await attachVolume(diskVolume);
|
|
||||||
//
|
|
||||||
// await Future.delayed(const Duration(seconds: 10));
|
|
||||||
//
|
|
||||||
// await ServerApi().mountVolume(volume!.name);
|
|
||||||
// unawaited(refresh());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> deleteVolume(final DiskVolume volume) async {
|
|
||||||
// await ProvidersController.currentServerProvider!
|
|
||||||
// .deleteVolume(volume.providerVolume!);
|
|
||||||
// unawaited(refresh());
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
|
||||||
void clear() {
|
|
||||||
emit(const ProviderVolumeState.initial());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
part of 'provider_volume_cubit.dart';
|
|
||||||
|
|
||||||
class ProviderVolumeState extends ServerInstallationDependendState {
|
|
||||||
const ProviderVolumeState(this._volumes, this.status, this.isResizing);
|
|
||||||
|
|
||||||
const ProviderVolumeState.initial()
|
|
||||||
: this(const [], LoadingStatus.uninitialized, false);
|
|
||||||
final List<ServerProviderVolume> _volumes;
|
|
||||||
final LoadingStatus status;
|
|
||||||
final bool isResizing;
|
|
||||||
|
|
||||||
List<ServerProviderVolume> get volumes => _volumes;
|
|
||||||
|
|
||||||
ProviderVolumeState copyWith({
|
|
||||||
final List<ServerProviderVolume>? volumes,
|
|
||||||
final LoadingStatus? status,
|
|
||||||
final bool? isResizing,
|
|
||||||
}) =>
|
|
||||||
ProviderVolumeState(
|
|
||||||
volumes ?? _volumes,
|
|
||||||
status ?? this.status,
|
|
||||||
isResizing ?? this.isResizing,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [_volumes, status, isResizing];
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart';
|
import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||||
import 'package:selfprivacy/logic/models/disk_status.dart';
|
import 'package:selfprivacy/logic/models/disk_status.dart';
|
||||||
import 'package:selfprivacy/logic/models/price.dart';
|
import 'package:selfprivacy/logic/models/price.dart';
|
||||||
|
@ -59,7 +58,7 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => FutureBuilder(
|
Widget build(final BuildContext context) => FutureBuilder(
|
||||||
future: context.read<ProviderVolumeCubit>().getPricePerGb(),
|
future: context.read<VolumesBloc>().getPricePerGb(),
|
||||||
builder: (
|
builder: (
|
||||||
final BuildContext context,
|
final BuildContext context,
|
||||||
final AsyncSnapshot<void> snapshot,
|
final AsyncSnapshot<void> snapshot,
|
||||||
|
@ -92,7 +91,7 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final isAlreadyResizing =
|
final isAlreadyResizing =
|
||||||
context.watch<ProviderVolumeCubit>().state.isResizing;
|
context.watch<VolumesBloc>().state is VolumesResizing;
|
||||||
|
|
||||||
return BrandHeroScreen(
|
return BrandHeroScreen(
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
|
@ -163,12 +162,15 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
|
||||||
),
|
),
|
||||||
actionButtonTitle: 'basis.continue'.tr(),
|
actionButtonTitle: 'basis.continue'.tr(),
|
||||||
actionButtonOnPressed: () {
|
actionButtonOnPressed: () {
|
||||||
context.read<ProviderVolumeCubit>().resizeVolume(
|
context.read<VolumesBloc>().add(
|
||||||
widget.diskVolumeToResize,
|
VolumeResize(
|
||||||
DiskSize.fromGibibyte(
|
widget.diskVolumeToResize,
|
||||||
_currentSliderGbValue.truncate().toDouble(),
|
DiskSize.fromGibibyte(
|
||||||
|
_currentSliderGbValue
|
||||||
|
.truncate()
|
||||||
|
.toDouble(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
context.read<VolumesBloc>().invalidateCache,
|
|
||||||
);
|
);
|
||||||
context.router.popUntilRoot();
|
context.router.popUntilRoot();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue