Перевёл создание таблиц
This commit is contained in:
parent
53320d9d0f
commit
40bb982c74
1 changed files with 29 additions and 29 deletions
|
|
@ -8,13 +8,13 @@ import 'package:tuuli_app/models/table_column_definition.dart';
|
|||
|
||||
const typeToNameMatcher = {
|
||||
SerialPrimaryColumnDefinition: "Serial ID",
|
||||
TextColumnDefinition: "Text",
|
||||
BooleanColumnDefinition: "Boolean",
|
||||
TimestampColumnDefinition: "Date/Time",
|
||||
DoubleColumnDefinition: "Double",
|
||||
IntegerColumnDefinition: "Integer",
|
||||
UserRefColumnDefinition: "User reference",
|
||||
AssetRefColumnDefinition: "Asset reference",
|
||||
TextColumnDefinition: "Текст",
|
||||
BooleanColumnDefinition: "Логическое значение",
|
||||
TimestampColumnDefinition: "Дата/Время",
|
||||
DoubleColumnDefinition: "Число с плавающей точкой",
|
||||
IntegerColumnDefinition: "Целое число",
|
||||
UserRefColumnDefinition: "Ссылка на пользователя",
|
||||
AssetRefColumnDefinition: "Ссылка на ресурс",
|
||||
};
|
||||
|
||||
class CreateTableController extends GetxController {
|
||||
|
|
@ -35,7 +35,7 @@ class CreateTableController extends GetxController {
|
|||
|
||||
final respData = resp.data;
|
||||
if (respData == null) {
|
||||
throw Exception("No data in response");
|
||||
throw Exception("В ответе нет данных");
|
||||
}
|
||||
|
||||
Get.back(result: true);
|
||||
|
|
@ -43,18 +43,18 @@ class CreateTableController 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",
|
||||
);
|
||||
}
|
||||
|
|
@ -67,14 +67,14 @@ class CreateTableController extends GetxController {
|
|||
|
||||
final confirm = await Get.dialog<bool>(
|
||||
AlertDialog(
|
||||
title: const Text("Create new column"),
|
||||
title: const Text("Создать новую колонку"),
|
||||
content: Wrap(
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
FastTextField(
|
||||
name: "ColumnName",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Column name",
|
||||
labelText: "Название",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
initialValue: columnName.value,
|
||||
|
|
@ -82,7 +82,7 @@ class CreateTableController extends GetxController {
|
|||
),
|
||||
FastDropdown(
|
||||
name: "ColumnTypes",
|
||||
hint: const Text("Select column type"),
|
||||
hint: const Text("Тип"),
|
||||
items: typeToNameMatcher.keys.toList(growable: false),
|
||||
itemsBuilder: (items, field) => items
|
||||
.map(
|
||||
|
|
@ -97,7 +97,7 @@ class CreateTableController extends GetxController {
|
|||
),
|
||||
FastCheckbox(
|
||||
name: "ColumnIsUnique",
|
||||
titleText: "Is Unique",
|
||||
titleText: "Уникальное значение?",
|
||||
initialValue: false,
|
||||
onChanged: (value) => columnIsUnique.value = value!,
|
||||
),
|
||||
|
|
@ -108,13 +108,13 @@ class CreateTableController extends GetxController {
|
|||
onPressed: () {
|
||||
Get.back(result: false);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
child: const Text("Отменить"),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back(result: true);
|
||||
},
|
||||
child: const Text('Create'),
|
||||
child: const Text("Создать"),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -129,42 +129,42 @@ class CreateTableController extends GetxController {
|
|||
columnName: columnName.value,
|
||||
);
|
||||
break;
|
||||
case "Text":
|
||||
case "Текст":
|
||||
ct = TextColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
isUnique: columnIsUnique.value,
|
||||
);
|
||||
break;
|
||||
case "Boolean":
|
||||
case "Логическое значение":
|
||||
ct = BooleanColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
isUnique: columnIsUnique.value,
|
||||
);
|
||||
break;
|
||||
case "Date/Time":
|
||||
case "Дата/Время":
|
||||
ct = TimestampColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
isUnique: columnIsUnique.value,
|
||||
);
|
||||
break;
|
||||
case "Double":
|
||||
case "Число с плавающей точкой":
|
||||
ct = DoubleColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
isUnique: columnIsUnique.value,
|
||||
);
|
||||
break;
|
||||
case "Integer":
|
||||
case "Целое число":
|
||||
ct = IntegerColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
isUnique: columnIsUnique.value,
|
||||
);
|
||||
break;
|
||||
case "User reference":
|
||||
case "Ссылка на пользователя":
|
||||
ct = UserRefColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
);
|
||||
break;
|
||||
case "Asset reference":
|
||||
case "Ссылка на ресурс":
|
||||
ct = AssetRefColumnDefinition(
|
||||
columnName: columnName.value,
|
||||
);
|
||||
|
|
@ -185,12 +185,12 @@ class CreateTableDialog extends GetView<CreateTableController> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Creating new table'),
|
||||
title: const Text("Создать новую таблицу"),
|
||||
content: Column(
|
||||
children: [
|
||||
TextField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Table name",
|
||||
labelText: "Название",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
onChanged: (value) => controller.tableName = value,
|
||||
|
|
@ -216,7 +216,7 @@ class CreateTableDialog extends GetView<CreateTableController> {
|
|||
[
|
||||
ElevatedButton(
|
||||
onPressed: () => controller.createNewColumn(),
|
||||
child: const Text("Create column"),
|
||||
child: const Text("Создать колонку"),
|
||||
).expanded()
|
||||
].toRow(),
|
||||
],
|
||||
|
|
@ -226,14 +226,14 @@ class CreateTableDialog extends GetView<CreateTableController> {
|
|||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('Close'),
|
||||
child: const Text("Закрыть"),
|
||||
),
|
||||
Obx(
|
||||
() => TextButton(
|
||||
onPressed: controller.columnsDefinition.isEmpty
|
||||
? null
|
||||
: () => controller.createTable(),
|
||||
child: const Text('Create'),
|
||||
child: const Text("Создать"),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue