Перевёл список таблиц

This commit is contained in:
Andrew 2023-05-17 20:49:12 +07:00
parent 1eccf30c10
commit 93b599137b

View file

@ -29,7 +29,7 @@ class TablesListPanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
_tables.clear(); _tables.clear();
@ -38,18 +38,18 @@ class TablesListPanelController extends GetxController {
final respData = e.response?.data; final respData = e.response?.data;
if (respData != null) { if (respData != null) {
Get.snackbar( Get.snackbar(
"Error trying to get tables", "Ошибка получения таблиц",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to get tables", "Ошибка получения таблиц",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to get tables", "Ошибка получения таблиц",
"$e", "$e",
); );
} }
@ -70,22 +70,22 @@ class TablesListPanelController extends GetxController {
Future<void> deleteTable(TableDefinition table) async { Future<void> deleteTable(TableDefinition table) async {
final accept = await Get.dialog<bool>( final accept = await Get.dialog<bool>(
AlertDialog( AlertDialog(
title: const Text("Delete table"), title: const Text("Удалить таблицу"),
content: Text( content: Text(
"Are you sure you want to delete ${table.tableName.pascalCase}?", "Вы действительно хотите удалить таблицу ${table.tableName.pascalCase}?",
), ),
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
Get.back(result: false); Get.back(result: false);
}, },
child: const Text("Cancel"), child: const Text("Отменить"),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {
Get.back(result: true); Get.back(result: true);
}, },
child: const Text("Delete"), child: const Text("Удалить"),
), ),
], ],
), ),
@ -100,30 +100,30 @@ class TablesListPanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
Get.snackbar( Get.snackbar(
"Table deleted", "Таблица удалена",
"${table.tableName.pascalCase} was deleted", "Таблица ${table.tableName.pascalCase} была удалена",
); );
refreshData(); refreshData();
} on DioError catch (e) { } on DioError catch (e) {
final respData = e.response?.data; final respData = e.response?.data;
if (respData != null) { if (respData != null) {
Get.snackbar( Get.snackbar(
"Error trying to delete table", "Ошибка удаления таблицы",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to delete table", "Ошибка удаления таблицы",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to delete table", "Ошибка удаления таблицы",
"$e", "$e",
); );
} }
@ -226,7 +226,7 @@ class TablesListPanel extends GetView<TablesListPanelController> {
Row( Row(
children: [ children: [
Text( Text(
table.system ? "System" : "Userland", table.system ? "Системная" : "Пользовательская",
style: const TextStyle( style: const TextStyle(
fontSize: 12, fontSize: 12,
), ),
@ -236,7 +236,7 @@ class TablesListPanel extends GetView<TablesListPanelController> {
Row( Row(
children: [ children: [
Text( Text(
"${table.parsedColumns.length} column(s)", "${table.parsedColumns.length} колонок(ки)",
style: const TextStyle( style: const TextStyle(
fontSize: 11, fontSize: 11,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
@ -247,7 +247,7 @@ class TablesListPanel extends GetView<TablesListPanelController> {
if (!table.system) if (!table.system)
ElevatedButton( ElevatedButton(
onPressed: () => controller.deleteTable(table), onPressed: () => controller.deleteTable(table),
child: const Text("Delete"), child: const Text("Удалить"),
).paddingOnly(top: 8) ).paddingOnly(top: 8)
], ],
), ),