mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-07 00:24:18 +00:00
Merge pull request 'feat: Implement confirmation modal for volume resizing' (#372) from volume-resize-modal into master
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/372 Reviewed-by: Inex Code <inex.code@selfprivacy.org>
This commit is contained in:
commit
a9edf44752
|
@ -304,6 +304,7 @@
|
||||||
"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_modal_description": "Upgrade to {} for {} plan per month.",
|
||||||
"size": "Size",
|
"size": "Size",
|
||||||
"price": "Price",
|
"price": "Price",
|
||||||
"data_migration_title": "Data migration",
|
"data_migration_title": "Data migration",
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||||
import 'package:selfprivacy/logic/models/price.dart';
|
import 'package:selfprivacy/logic/models/price.dart';
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/info_box/info_box.dart';
|
import 'package:selfprivacy/ui/components/info_box/info_box.dart';
|
||||||
|
import 'package:selfprivacy/ui/helpers/modals.dart';
|
||||||
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
||||||
import 'package:selfprivacy/logic/models/disk_status.dart';
|
import 'package:selfprivacy/logic/models/disk_status.dart';
|
||||||
|
|
||||||
|
@ -46,7 +47,6 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
|
||||||
late double _currentSliderGbValue;
|
late double _currentSliderGbValue;
|
||||||
double _pricePerGb = 1.0;
|
double _pricePerGb = 1.0;
|
||||||
|
|
||||||
// TODO: Wtfff hardcode?!?!?
|
|
||||||
final DiskSize maxSize = const DiskSize(byte: 500000000000);
|
final DiskSize maxSize = const DiskSize(byte: 500000000000);
|
||||||
late DiskSize minSize;
|
late DiskSize minSize;
|
||||||
|
|
||||||
|
@ -155,14 +155,24 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
|
||||||
onPressed: _isError || isAlreadyResizing
|
onPressed: _isError || isAlreadyResizing
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
context.read<ApiProviderVolumeCubit>().resizeVolume(
|
showPopUpAlert(
|
||||||
widget.diskVolumeToResize,
|
alertTitle: 'storage.extending_volume_title'.tr(),
|
||||||
DiskSize.fromGibibyte(
|
description:
|
||||||
_currentSliderGbValue.truncate().toDouble(),
|
'storage.extending_volume_modal_description'.tr(
|
||||||
),
|
args: [_sizeController.text, _priceController.text],
|
||||||
context.read<ApiServerVolumeCubit>().reload,
|
),
|
||||||
);
|
actionButtonTitle: 'basis.continue'.tr(),
|
||||||
context.router.popUntilRoot();
|
actionButtonOnPressed: () {
|
||||||
|
context.read<ApiProviderVolumeCubit>().resizeVolume(
|
||||||
|
widget.diskVolumeToResize,
|
||||||
|
DiskSize.fromGibibyte(
|
||||||
|
_currentSliderGbValue.truncate().toDouble(),
|
||||||
|
),
|
||||||
|
context.read<ApiServerVolumeCubit>().reload,
|
||||||
|
);
|
||||||
|
context.router.popUntilRoot();
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Text('storage.extend_volume_button.title'.tr()),
|
child: Text('storage.extend_volume_button.title'.tr()),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue