|
@@ -37,43 +37,43 @@ struct VMConfirmActionModifier: ViewModifier {
|
|
switch action {
|
|
switch action {
|
|
case .confirmCloneVM:
|
|
case .confirmCloneVM:
|
|
if vm.isShortcut {
|
|
if vm.isShortcut {
|
|
- return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .default(Text("Yes")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .cancel(), secondaryButton: .default(Text("Yes")) {
|
|
data.busyWorkAsync {
|
|
data.busyWorkAsync {
|
|
try await data.clone(vm: vm)
|
|
try await data.clone(vm: vm)
|
|
}
|
|
}
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
- return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .default(Text("Yes")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .cancel(), secondaryButton: .default(Text("Yes")) {
|
|
data.busyWorkAsync {
|
|
data.busyWorkAsync {
|
|
try await data.clone(vm: vm)
|
|
try await data.clone(vm: vm)
|
|
}
|
|
}
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
}
|
|
}
|
|
case .confirmDeleteVM:
|
|
case .confirmDeleteVM:
|
|
- return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .destructive(Text("Delete")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Delete")) {
|
|
data.busyWorkAsync {
|
|
data.busyWorkAsync {
|
|
try await data.delete(vm: vm)
|
|
try await data.delete(vm: vm)
|
|
}
|
|
}
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
case .confirmDeleteShortcut:
|
|
case .confirmDeleteShortcut:
|
|
- return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .destructive(Text("Remove")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Remove")) {
|
|
data.busyWorkAsync {
|
|
data.busyWorkAsync {
|
|
await data.listRemove(vm: vm)
|
|
await data.listRemove(vm: vm)
|
|
}
|
|
}
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
case .confirmStopVM:
|
|
case .confirmStopVM:
|
|
- return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .destructive(Text("Stop")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Stop")) {
|
|
data.stop(vm: vm)
|
|
data.stop(vm: vm)
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
case .confirmMoveVM:
|
|
case .confirmMoveVM:
|
|
- return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .destructive(Text("Confirm")) {
|
|
|
|
|
|
+ return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Confirm")) {
|
|
onConfirm()
|
|
onConfirm()
|
|
- }, secondaryButton: .cancel())
|
|
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|