Merge pull request 'fix: Force size value truncation for digital ocean, change query url' (#368) from digital-ocean-volume into master
continuous-integration/drone/push Build is passing Details

Reviewed-on: #368
Reviewed-by: Inex Code <inex.code@selfprivacy.org>
pull/362/head^2
NaiJi ✨ 2023-10-02 20:11:03 +03:00
commit 0cb2f2082a
3 changed files with 9 additions and 8 deletions

View File

@ -455,8 +455,8 @@ class DigitalOceanApi extends RestApiMap {
}
Future<GenericResult<bool>> resizeVolume(
final String name,
final DiskSize size,
final String uuid,
final int gb,
) async {
bool success = false;
@ -464,11 +464,10 @@ class DigitalOceanApi extends RestApiMap {
final Dio client = await getClient();
try {
resizeVolumeResponse = await client.post(
'/volumes/actions',
'/volumes/$uuid/actions',
data: {
'type': 'resize',
'volume_name': name,
'size_gigabytes': size.gibibyte,
'size_gigabytes': gb,
'region': region,
},
);

View File

@ -698,8 +698,8 @@ class DigitalOceanServerProvider extends ServerProvider {
final DiskSize size,
) async =>
_adapter.api().resizeVolume(
volume.name,
size,
volume.uuid!,
size.gibibyte.toInt(),
);
@override

View File

@ -157,7 +157,9 @@ class _ExtendingVolumePageState extends State<ExtendingVolumePage> {
: () {
context.read<ApiProviderVolumeCubit>().resizeVolume(
widget.diskVolumeToResize,
DiskSize.fromGibibyte(_currentSliderGbValue),
DiskSize.fromGibibyte(
_currentSliderGbValue.truncate().toDouble(),
),
context.read<ApiServerVolumeCubit>().reload,
);
context.router.popUntilRoot();