fix: Force size value truncation for digital ocean, change query url

- Resolve #367
pull/368/head
NaiJi ✨ 2023-09-30 21:02:53 -03:00
parent 0537ebcfb2
commit fbacb5969d
3 changed files with 7 additions and 6 deletions

View File

@ -455,7 +455,7 @@ class DigitalOceanApi extends RestApiMap {
}
Future<GenericResult<bool>> resizeVolume(
final String name,
final String uuid,
final DiskSize size,
) 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': size.gibibyte.toInt(),
'region': region,
},
);

View File

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

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();