Added confirmation before table deletion
This commit is contained in:
parent
a01a66c88d
commit
12ff1e953a
1 changed files with 25 additions and 0 deletions
|
|
@ -68,6 +68,31 @@ class TablesListPanelController extends GetxController {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteTable(TableDefinition table) async {
|
Future<void> deleteTable(TableDefinition table) async {
|
||||||
|
final accept = await Get.dialog<bool>(
|
||||||
|
AlertDialog(
|
||||||
|
title: const Text("Delete table"),
|
||||||
|
content: Text(
|
||||||
|
"Are you sure you want to delete ${table.tableName.pascalCase}?",
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back(result: false);
|
||||||
|
},
|
||||||
|
child: const Text("Cancel"),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back(result: true);
|
||||||
|
},
|
||||||
|
child: const Text("Delete"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (accept != true) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final resp = await ApiController.to.apiClient.dropTable(
|
final resp = await ApiController.to.apiClient.dropTable(
|
||||||
tableName: table.tableName,
|
tableName: table.tableName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue