Перевёл управление доступом

This commit is contained in:
Andrew 2023-05-17 20:34:21 +07:00
parent 40bb982c74
commit badbf6c986

View file

@ -47,7 +47,7 @@ class GroupACLController extends GetxController {
final respData = resp.data;
if (respData == null) {
throw Exception("No data in response");
throw Exception("В ответе нет данных");
}
_tables.clear();
@ -56,18 +56,18 @@ class GroupACLController extends GetxController {
final respData = e.response?.data;
if (respData != null) {
Get.snackbar(
"Error trying to get tables",
"Ошибка запроса таблиц",
"${respData['error']}",
);
} else {
Get.snackbar(
"Error trying to get tables",
"Ошибка запроса таблиц",
"$e",
);
}
} catch (e) {
Get.snackbar(
"Error trying to get tables",
"Ошибка запроса таблиц",
"$e",
);
}
@ -96,7 +96,7 @@ class GroupACLController extends GetxController {
final respData = resp.data;
if (respData == null) {
throw Exception("No data in response");
throw Exception("В ответе нет данных");
}
if (respData.isNotEmpty) {
@ -111,18 +111,18 @@ class GroupACLController extends GetxController {
final respData = e.response?.data;
if (respData != null) {
Get.snackbar(
"Error trying to get tables access",
"Ошибка запроса информации доступа к таблицам",
"${respData['error']}",
);
} else {
Get.snackbar(
"Error trying to get tables access",
"Ошибка запроса информации доступа к таблицам",
"$e",
);
}
} catch (e) {
Get.snackbar(
"Error trying to get tables access",
"Ошибка запроса информации доступа к таблицам",
"$e",
);
}
@ -187,7 +187,7 @@ class GroupACLController extends GetxController {
final respData = resp.data;
if (respData == null) {
throw Exception("No data in response");
throw Exception("В ответе нет данных");
}
refreshTableAccess(table);
@ -195,18 +195,18 @@ class GroupACLController extends GetxController {
final respData = e.response?.data;
if (respData != null) {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"${respData['error']}",
);
} else {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"$e",
);
}
} catch (e) {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"$e",
);
}
@ -234,7 +234,7 @@ class GroupACLController extends GetxController {
final confirm = await Get.dialog<bool>(
AlertDialog(
title: const Text("Allowed columns"),
title: const Text("Разрешённые колонки"),
content: Obx(
() => Wrap(
children: [
@ -244,7 +244,7 @@ class GroupACLController extends GetxController {
selectedColumns[column] = !selectedColumns[column]!;
}
},
child: const Text("Swap all"),
child: const Text("Перевернуть"),
),
...selectedColumns.entries.map((e) {
return CheckboxListTile(
@ -259,11 +259,11 @@ class GroupACLController extends GetxController {
actions: [
TextButton(
onPressed: () => Get.back(result: false),
child: const Text("Cancel"),
child: const Text("Отменить"),
),
TextButton(
onPressed: () => Get.back(result: true),
child: const Text("Ok"),
child: const Text("Ок"),
),
],
),
@ -274,12 +274,12 @@ class GroupACLController extends GetxController {
if (selectedColumns.values.every((e) => !e)) {
await Get.dialog(
AlertDialog(
title: const Text("Error"),
content: const Text("At least one column must be selected"),
title: const Text("Ошибка"),
content: const Text("Необходимо выбрать хотя бы одну колонку"),
actions: [
TextButton(
onPressed: () => Get.back(),
child: const Text("Ok"),
child: const Text("Ок"),
),
],
),
@ -306,7 +306,7 @@ class GroupACLController extends GetxController {
final respData = resp.data;
if (respData == null) {
throw Exception("No data in response");
throw Exception("В ответе нет данных");
}
refreshTableAccess(table);
@ -314,18 +314,18 @@ class GroupACLController extends GetxController {
final respData = e.response?.data;
if (respData != null) {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"${respData['error']}",
);
} else {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"$e",
);
}
} catch (e) {
Get.snackbar(
"Error trying to update tables access",
"Ошибка обновления информации доступа к таблицам",
"$e",
);
}
@ -338,16 +338,16 @@ class GroupACLDialog extends GetView<GroupACLController> {
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Group ACL'),
title: const Text('Доступ группы'),
content: Obx(
() => DataTable2(
columns: const [
DataColumn2(label: Text('Table'), size: ColumnSize.L),
DataColumn2(label: Text('Read'), size: ColumnSize.S),
DataColumn2(label: Text('Write'), size: ColumnSize.S),
DataColumn2(label: Text('Allowed columns'), size: ColumnSize.S),
DataColumn2(label: Text('Таблица'), size: ColumnSize.L),
DataColumn2(label: Text('Чтение'), size: ColumnSize.S),
DataColumn2(label: Text('Запись'), size: ColumnSize.S),
DataColumn2(label: Text('Колонки'), size: ColumnSize.S),
],
empty: const Text("No tables"),
empty: const Text("Нет таблиц"),
rows: controller.access.entries.map((e) {
final table = controller.tables.firstWhere(
(element) => element.tableId == e.key,
@ -390,7 +390,7 @@ class GroupACLDialog extends GetView<GroupACLController> {
onPressed: () {
Get.back();
},
child: const Text('Close'),
child: const Text("Закрыть"),
),
],
);