fix: Don't let start service migration if the same volume was picked
parent
5eadbd9e6b
commit
91dce222cc
|
@ -55,6 +55,20 @@ class _ServicesMigrationPageState extends State<ServicesMigrationPage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isTherePendingChange {
|
||||||
|
bool isChangeFound = false;
|
||||||
|
for (final Service service in widget.services) {
|
||||||
|
for (final String serviceId in serviceToDisk.keys) {
|
||||||
|
if (serviceId == service.id &&
|
||||||
|
serviceToDisk[serviceId] != service.storageUsage.volume!) {
|
||||||
|
isChangeFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isChangeFound;
|
||||||
|
}
|
||||||
|
|
||||||
/// Check the services and if a service is moved (in a serviceToDisk entry)
|
/// Check the services and if a service is moved (in a serviceToDisk entry)
|
||||||
/// subtract the used storage from the old volume and add it to the new volume.
|
/// subtract the used storage from the old volume and add it to the new volume.
|
||||||
/// The old volume is the volume the service is currently on, shown in services list.
|
/// The old volume is the volume the service is currently on, shown in services list.
|
||||||
|
@ -157,6 +171,8 @@ class _ServicesMigrationPageState extends State<ServicesMigrationPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
if (widget.isMigration ||
|
||||||
|
(!widget.isMigration && isTherePendingChange))
|
||||||
BrandButton.filled(
|
BrandButton.filled(
|
||||||
child: Text('storage.start_migration_button'.tr()),
|
child: Text('storage.start_migration_button'.tr()),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
Loading…
Reference in New Issue