Перевёл ассеты

This commit is contained in:
Andrew 2023-05-17 20:44:12 +07:00
parent 7f7bbd9441
commit 8a3030addf

View file

@ -52,7 +52,7 @@ class AssetsPagePanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
_assetsList.clear(); _assetsList.clear();
@ -61,18 +61,18 @@ class AssetsPagePanelController 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 assets", "Ошибка получения ресурсов",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to get assets", "Ошибка получения ресурсов",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to get assets", "Ошибка получения ресурсов",
"$e", "$e",
); );
} }
@ -84,7 +84,7 @@ class AssetsPagePanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
_tagsList.clear(); _tagsList.clear();
@ -93,18 +93,18 @@ class AssetsPagePanelController 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 tags", "Ошибка получения тегов",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to get tags", "Ошибка получения тегов",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to get tags", "Ошибка получения тегов",
"$e", "$e",
); );
} }
@ -145,11 +145,11 @@ class AssetsPagePanelController extends GetxController {
Get.back(result: file); Get.back(result: file);
}, },
onError: (value) { onError: (value) {
Get.snackbar("Error", value.toString()); Get.snackbar("Ошибка", value.toString());
}, },
); );
}, },
child: const Text("Drop file here") child: const Text("Перенеите файл сюда")
.paddingAll(8) .paddingAll(8)
.fittedBox() .fittedBox()
.constrained(height: 200, width: 200), .constrained(height: 200, width: 200),
@ -157,7 +157,7 @@ class AssetsPagePanelController extends GetxController {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Get.back(result: null), onPressed: () => Get.back(result: null),
child: const Text("Cancel"), child: const Text("Отменить"),
) )
], ],
), ),
@ -195,7 +195,7 @@ class AssetsPagePanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
refreshData(); refreshData();
@ -203,18 +203,18 @@ class AssetsPagePanelController 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 put asset", "Ошибка загрузки ресурса",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to put asset", "Ошибка загрузки ресурса",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to put asset", "Ошибка загрузки ресурса",
"$e", "$e",
); );
} finally { } finally {
@ -228,7 +228,7 @@ class AssetsPagePanelController extends GetxController {
final confirm = await Get.dialog<bool>( final confirm = await Get.dialog<bool>(
AlertDialog( AlertDialog(
title: const Text("Edit asset"), title: const Text("Изменение ресурса"),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@ -237,7 +237,7 @@ class AssetsPagePanelController extends GetxController {
controller: TextEditingController(text: description.value), controller: TextEditingController(text: description.value),
onChanged: (value) => description.value = value, onChanged: (value) => description.value = value,
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: "Description", labelText: "Описание",
), ),
), ),
TextField( TextField(
@ -245,7 +245,7 @@ class AssetsPagePanelController extends GetxController {
onChanged: (value) => tags.value = onChanged: (value) => tags.value =
value.split(",").map((e) => e.trim()).toList(growable: false), value.split(",").map((e) => e.trim()).toList(growable: false),
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: "Tags", labelText: "Теги",
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -259,17 +259,17 @@ class AssetsPagePanelController extends GetxController {
), ),
ElevatedButton( ElevatedButton(
onPressed: () => previewAsset(e), onPressed: () => previewAsset(e),
child: const Text("View asset")), child: const Text("Предпросмотр")),
], ],
).constrained(width: Get.width * 0.5, height: Get.width * 0.5), ).constrained(width: Get.width * 0.5, height: Get.width * 0.5),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Get.back(result: false), onPressed: () => Get.back(result: false),
child: const Text("Cancel"), child: const Text("Отменить"),
), ),
TextButton( TextButton(
onPressed: () => Get.back(result: true), onPressed: () => Get.back(result: true),
child: const Text("Confirm"), child: const Text("Подтвердить"),
), ),
], ],
), ),
@ -287,7 +287,7 @@ class AssetsPagePanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
refreshData(); refreshData();
@ -295,18 +295,18 @@ class AssetsPagePanelController 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 edit asset", "Ошибка изменения ресурса",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to edit asset", "Ошибка изменения ресурса",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to edit asset", "Ошибка изменения ресурса",
"$e", "$e",
); );
} }
@ -318,23 +318,24 @@ class AssetsPagePanelController extends GetxController {
final confirm = await Get.dialog<bool>( final confirm = await Get.dialog<bool>(
AlertDialog( AlertDialog(
title: const Text("Remove asset"), title: const Text("Удаление ресурса"),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Text("You are about to remove an asset."), const Text(
"Вы планируете удалить ресурс. Это действие нельзя отменить."),
Obx( Obx(
() => CheckboxListTile( () => CheckboxListTile(
value: checkReferences.value, value: checkReferences.value,
onChanged: (value) => checkReferences.value = value ?? false, onChanged: (value) => checkReferences.value = value ?? false,
title: const Text("Check references"), title: const Text("Проверить ссылки"),
), ),
), ),
Obx( Obx(
() => CheckboxListTile( () => CheckboxListTile(
value: deleteReferencing.value, value: deleteReferencing.value,
onChanged: (value) => deleteReferencing.value = value ?? false, onChanged: (value) => deleteReferencing.value = value ?? false,
title: const Text("Delete referencing"), title: const Text("Удалить ссылающиеся сущности"),
), ),
), ),
], ],
@ -342,11 +343,11 @@ class AssetsPagePanelController extends GetxController {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Get.back(result: false), onPressed: () => Get.back(result: false),
child: const Text("Cancel"), child: const Text("Отменить"),
), ),
TextButton( TextButton(
onPressed: () => Get.back(result: true), onPressed: () => Get.back(result: true),
child: const Text("Remove"), child: const Text("Удалить"),
), ),
], ],
), ),
@ -363,7 +364,7 @@ class AssetsPagePanelController extends GetxController {
final respData = resp.data; final respData = resp.data;
if (respData == null) { if (respData == null) {
throw Exception("No data in response"); throw Exception("В ответе нет данных");
} }
refreshData(); refreshData();
@ -371,18 +372,18 @@ class AssetsPagePanelController 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 remove asset", "Ошибка удаления ресурса",
"${respData['error']}", "${respData['error']}",
); );
} else { } else {
Get.snackbar( Get.snackbar(
"Error trying to remove asset", "Ошибка удаления ресурса",
"$e", "$e",
); );
} }
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
"Error trying to remove asset", "Ошибка удаления ресурса",
"$e", "$e",
); );
} }
@ -404,7 +405,7 @@ class AssetsPagePanelController extends GetxController {
url: "${ApiController.to.endPoint}/assets/${e.fid}", url: "${ApiController.to.endPoint}/assets/${e.fid}",
) )
else else
const Text("Unsupported media type") const Text("На данный момент этот тип не поддерживает предпросмотр")
.fontSize(16) .fontSize(16)
.paddingAll(8) .paddingAll(8)
.card() .card()
@ -439,7 +440,7 @@ class AssetsPagePanel extends GetView<AssetsPagePanelController> {
elevation: 0, elevation: 0,
title: Row( title: Row(
children: [ children: [
const Text("Tags:"), const Text("Теги:"),
Obx( Obx(
() => FastChipsInput( () => FastChipsInput(
name: "FastChipsInput", name: "FastChipsInput",
@ -496,13 +497,13 @@ class AssetsPagePanel extends GetView<AssetsPagePanelController> {
horizontalScrollController: controller.scrollController, horizontalScrollController: controller.scrollController,
columns: const [ columns: const [
DataColumn2(label: Text(""), fixedWidth: 16), DataColumn2(label: Text(""), fixedWidth: 16),
DataColumn2(label: Text("Filename"), size: ColumnSize.M), DataColumn2(label: Text("Имя файла"), size: ColumnSize.M),
DataColumn2(label: Text("Description"), size: ColumnSize.L), DataColumn2(label: Text("Описание"), size: ColumnSize.L),
DataColumn2(label: Text("File ID"), size: ColumnSize.M), DataColumn2(label: Text("ID файла"), size: ColumnSize.M),
DataColumn2(label: Text("Tags"), size: ColumnSize.L), DataColumn2(label: Text("Теги"), size: ColumnSize.L),
DataColumn2(label: Text("Actions")), DataColumn2(label: Text("Действия")),
], ],
empty: const Text("No assets found"), empty: const Text("Ресурсы не найдены"),
rows: controller.assetsList rows: controller.assetsList
.where((element) { .where((element) {
if (controller.filterTags.isEmpty) return true; if (controller.filterTags.isEmpty) return true;