2
0
mirror of https://github.com/inventree/inventree-app.git synced 2026-01-22 10:49:41 +00:00

List filtering fix (#746)

* Bug fix for API forms without URL

- Ensure submitted data is returned

* Translate search fields

* Update release notes

* Remove debug message

* dart format
This commit is contained in:
Oliver
2026-01-14 15:15:21 +11:00
committed by GitHub
parent 225c40f9a6
commit a4631cda7a
4 changed files with 22 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
--- ---
- Fixes bug which launched camera twice when uploading an attachment - Fixes bug which launched camera twice when uploading an attachment
- Fixed bug related to list sorting and filtering
### 0.21.1 - November 2025 ### 0.21.1 - November 2025
--- ---

View File

@@ -1011,17 +1011,16 @@ Future<void> launchApiForm(
APIFormWidgetState? formHandler, APIFormWidgetState? formHandler,
IconData icon = TablerIcons.device_floppy, IconData icon = TablerIcons.device_floppy,
}) async { }) async {
showLoadingOverlay();
// List of fields defined by the server // List of fields defined by the server
Map<String, dynamic> serverFields = {}; Map<String, dynamic> serverFields = {};
if (url.isNotEmpty) { if (url.isNotEmpty) {
showLoadingOverlay();
var options = await InvenTreeAPI().options(url); var options = await InvenTreeAPI().options(url);
hideLoadingOverlay();
// Invalid response from server // Invalid response from server
if (!options.isValid()) { if (!options.isValid()) {
hideLoadingOverlay();
return; return;
} }
@@ -1030,8 +1029,6 @@ Future<void> launchApiForm(
if (serverFields.isEmpty) { if (serverFields.isEmpty) {
// User does not have permission to perform this action // User does not have permission to perform this action
showSnackIcon(L10().response403, icon: TablerIcons.user_x); showSnackIcon(L10().response403, icon: TablerIcons.user_x);
hideLoadingOverlay();
return; return;
} }
} }
@@ -1075,6 +1072,8 @@ Future<void> launchApiForm(
formFields.add(field); formFields.add(field);
} }
showLoadingOverlay();
// Grab existing data for each form field // Grab existing data for each form field
for (var field in formFields) { for (var field in formFields) {
await field.loadInitialData(); await field.loadInitialData();
@@ -1430,7 +1429,7 @@ class APIFormWidgetState extends State<APIFormWidget> {
// Perhaps we just want to process the data? // Perhaps we just want to process the data?
if (widget.url.isEmpty) { if (widget.url.isEmpty) {
// Hide the form // Hide the form
handleSuccess(data, {}); handleSuccess(data, data);
return; return;
} }

View File

@@ -1298,6 +1298,18 @@
"searchLocation": "Search for location", "searchLocation": "Search for location",
"@searchLocation": {}, "@searchLocation": {},
"searchOrderingField": "Ordering Field",
"@searchOrderingField": {},
"searchOrderingDirection": "Ordering Direction",
"@searchOrderingDirection": {},
"searchOrderingAscending": "Ascending",
"@searchOrderingAscending": {},
"searchOrderingDescending": "Descending",
"@searchOrderingDescending": {},
"searchParts": "Search Parts", "searchParts": "Search Parts",
"@searchParts": {}, "@searchParts": {},

View File

@@ -152,19 +152,19 @@ abstract class PaginatedSearchState<T extends PaginatedSearchWidget>
Map<String, dynamic> fields = { Map<String, dynamic> fields = {
"ordering_field": { "ordering_field": {
"type": "choice", "type": "choice",
"label": "Ordering Field", "label": L10().searchOrderingField,
"required": true, "required": true,
"choices": _opts, "choices": _opts,
"value": _field, "value": _field,
}, },
"ordering_order": { "ordering_order": {
"type": "choice", "type": "choice",
"label": "Ordering Direction", "label": L10().searchOrderingDirection,
"required": true, "required": true,
"value": _order, "value": _order,
"choices": [ "choices": [
{"value": "+", "display_name": "Ascending"}, {"value": "+", "display_name": L10().searchOrderingAscending},
{"value": "-", "display_name": "Descending"}, {"value": "-", "display_name": L10().searchOrderingDescending},
], ],
}, },
}; };