mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
Bug fixes (#637)
* Fix formatting * Handle case where server does not provide permissions information * Enhanced URL checks * Enhanced check * Fix for error dialog * Bump version information
This commit is contained in:
parent
762d1ae156
commit
52879c0fc2
@ -1,3 +1,7 @@
|
|||||||
|
### 0.18.1 - April 2025
|
||||||
|
---
|
||||||
|
- Fix bug associated with handling invalid URLs
|
||||||
|
|
||||||
### 0.18.0 - April 2025
|
### 0.18.0 - April 2025
|
||||||
---
|
---
|
||||||
- Adds ability to create new companies from the app
|
- Adds ability to create new companies from the app
|
||||||
|
69
lib/api.dart
69
lib/api.dart
@ -287,65 +287,67 @@ class InvenTreeAPI {
|
|||||||
int get apiVersion => (serverInfo["apiVersion"] ?? 1) as int;
|
int get apiVersion => (serverInfo["apiVersion"] ?? 1) as int;
|
||||||
|
|
||||||
// Consolidated search request API v102 or newer
|
// Consolidated search request API v102 or newer
|
||||||
bool get supportsConsolidatedSearch =>apiVersion >= 102;
|
bool get supportsConsolidatedSearch => apiVersion >= 102;
|
||||||
|
|
||||||
// ReturnOrder supports API v104 or newer
|
// ReturnOrder supports API v104 or newer
|
||||||
bool get supportsReturnOrders =>apiVersion >= 104;
|
bool get supportsReturnOrders => apiVersion >= 104;
|
||||||
|
|
||||||
// "Contact" model exposed to API
|
// "Contact" model exposed to API
|
||||||
bool get supportsContactModel =>apiVersion >= 104;
|
bool get supportsContactModel => apiVersion >= 104;
|
||||||
|
|
||||||
// Status label endpoints API v105 or newer
|
// Status label endpoints API v105 or newer
|
||||||
bool get supportsStatusLabelEndpoints =>apiVersion >= 105;
|
bool get supportsStatusLabelEndpoints => apiVersion >= 105;
|
||||||
|
|
||||||
// Regex search API v106 or newer
|
// Regex search API v106 or newer
|
||||||
bool get supportsRegexSearch =>apiVersion >= 106;
|
bool get supportsRegexSearch => apiVersion >= 106;
|
||||||
|
|
||||||
// Order barcodes API v107 or newer
|
// Order barcodes API v107 or newer
|
||||||
bool get supportsOrderBarcodes =>apiVersion >= 107;
|
bool get supportsOrderBarcodes => apiVersion >= 107;
|
||||||
|
|
||||||
// Project codes require v109 or newer
|
// Project codes require v109 or newer
|
||||||
bool get supportsProjectCodes =>apiVersion >= 109;
|
bool get supportsProjectCodes => apiVersion >= 109;
|
||||||
|
|
||||||
// Does the server support extra fields on stock adjustment actions?
|
// Does the server support extra fields on stock adjustment actions?
|
||||||
bool get supportsStockAdjustExtraFields =>apiVersion >= 133;
|
bool get supportsStockAdjustExtraFields => apiVersion >= 133;
|
||||||
|
|
||||||
// Does the server support receiving items against a PO using barcodes?
|
// Does the server support receiving items against a PO using barcodes?
|
||||||
bool get supportsBarcodePOReceiveEndpoint =>apiVersion >= 139;
|
bool get supportsBarcodePOReceiveEndpoint => apiVersion >= 139;
|
||||||
|
|
||||||
// Does the server support adding line items to a PO using barcodes?
|
// Does the server support adding line items to a PO using barcodes?
|
||||||
bool get supportsBarcodePOAddLineEndpoint =>apiVersion >= 153;
|
bool get supportsBarcodePOAddLineEndpoint => apiVersion >= 153;
|
||||||
|
|
||||||
// Does the server support allocating stock to sales order using barcodes?
|
// Does the server support allocating stock to sales order using barcodes?
|
||||||
bool get supportsBarcodeSOAllocateEndpoint =>apiVersion >= 160;
|
bool get supportsBarcodeSOAllocateEndpoint => apiVersion >= 160;
|
||||||
|
|
||||||
// Does the server support the "modern" test results API
|
// Does the server support the "modern" test results API
|
||||||
// Ref: https://github.com/inventree/InvenTree/pull/6430/
|
// Ref: https://github.com/inventree/InvenTree/pull/6430/
|
||||||
bool get supportsModernTestResults =>apiVersion >= 169;
|
bool get supportsModernTestResults => apiVersion >= 169;
|
||||||
|
|
||||||
// Does the server support "null" top-level filtering for PartCategory and StockLocation endpoints?
|
// Does the server support "null" top-level filtering for PartCategory and StockLocation endpoints?
|
||||||
bool get supportsNullTopLevelFiltering =>apiVersion < 174;
|
bool get supportsNullTopLevelFiltering => apiVersion < 174;
|
||||||
|
|
||||||
// Does the server support "active" status on Company and SupplierPart API endpoints?
|
// Does the server support "active" status on Company and SupplierPart API endpoints?
|
||||||
bool get supportsCompanyActiveStatus =>apiVersion >= 189;
|
bool get supportsCompanyActiveStatus => apiVersion >= 189;
|
||||||
|
|
||||||
// Does the server support the "modern" (consolidated) label printing API?
|
// Does the server support the "modern" (consolidated) label printing API?
|
||||||
bool get supportsModernLabelPrinting =>apiVersion >= 201;
|
bool get supportsModernLabelPrinting => apiVersion >= 201;
|
||||||
|
|
||||||
// Does the server support the "modern" (consolidated) attachment API?
|
// Does the server support the "modern" (consolidated) attachment API?
|
||||||
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
||||||
bool get supportsModernAttachments =>apiVersion >= 207;
|
bool get supportsModernAttachments => apiVersion >= 207;
|
||||||
|
|
||||||
|
bool get supportsUserPermissions => apiVersion >= 207;
|
||||||
|
|
||||||
// Does the server support the "destination" field on the PurchaseOrder model?
|
// Does the server support the "destination" field on the PurchaseOrder model?
|
||||||
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
||||||
bool get supportsPurchaseOrderDestination =>apiVersion >= 276;
|
bool get supportsPurchaseOrderDestination => apiVersion >= 276;
|
||||||
|
|
||||||
// Does the server support the "start_date" field for orders?
|
// Does the server support the "start_date" field for orders?
|
||||||
// Ref: https://github.com/inventree/InvenTree/pull/8966
|
// Ref: https://github.com/inventree/InvenTree/pull/8966
|
||||||
bool get supportsStartDate =>apiVersion >= 306;
|
bool get supportsStartDate => apiVersion >= 306;
|
||||||
|
|
||||||
// Supports separate search against "supplier" / "customer" / "manufacturer"
|
// Supports separate search against "supplier" / "customer" / "manufacturer"
|
||||||
bool get supportsSplitCompanySearch =>apiVersion >= 315;
|
bool get supportsSplitCompanySearch => apiVersion >= 315;
|
||||||
|
|
||||||
// Cached list of plugins (refreshed when we connect to the server)
|
// Cached list of plugins (refreshed when we connect to the server)
|
||||||
List<InvenTreePlugin> _plugins = [];
|
List<InvenTreePlugin> _plugins = [];
|
||||||
@ -725,7 +727,12 @@ class InvenTreeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
||||||
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
|
||||||
|
if (supportsUserPermissions && data.containsKey("permissions")) {
|
||||||
|
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
||||||
|
} else {
|
||||||
|
permissions = {};
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1194,6 +1201,15 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
var _url = makeApiUrl(url);
|
var _url = makeApiUrl(url);
|
||||||
|
|
||||||
|
if (_url.isEmpty) {
|
||||||
|
showServerError(
|
||||||
|
url,
|
||||||
|
L10().invalidHost,
|
||||||
|
L10().invalidHostDetails
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Add any required query parameters to the URL using ?key=value notation
|
// Add any required query parameters to the URL using ?key=value notation
|
||||||
if (urlParams.isNotEmpty) {
|
if (urlParams.isNotEmpty) {
|
||||||
String query = "?";
|
String query = "?";
|
||||||
@ -1210,13 +1226,12 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
Uri? _uri = Uri.tryParse(_url);
|
Uri? _uri = Uri.tryParse(_url);
|
||||||
|
|
||||||
if (_uri == null) {
|
if (_uri == null || _uri.host.isEmpty) {
|
||||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
showServerError(
|
||||||
return null;
|
_url,
|
||||||
}
|
L10().invalidHost,
|
||||||
|
L10().invalidHostDetails
|
||||||
if (_uri.host.isEmpty) {
|
);
|
||||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,13 +228,15 @@ Future<void> showServerError(String url, String title, String description) async
|
|||||||
playAudioFile("sounds/server_error.mp3");
|
playAudioFile("sounds/server_error.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description += "\nURL: $url";
|
||||||
|
|
||||||
showSnackIcon(
|
showSnackIcon(
|
||||||
title,
|
title,
|
||||||
success: false,
|
success: false,
|
||||||
actionText: L10().details,
|
actionText: L10().details,
|
||||||
onAction: () {
|
onAction: () {
|
||||||
showErrorDialog(
|
showErrorDialog(
|
||||||
L10().serverError,
|
title,
|
||||||
description: description,
|
description: description,
|
||||||
icon: TablerIcons.server
|
icon: TablerIcons.server
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: inventree
|
name: inventree
|
||||||
description: InvenTree stock management
|
description: InvenTree stock management
|
||||||
|
|
||||||
version: 0.18.0+97
|
version: 0.18.1+98
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.5 <3.13.0"
|
sdk: ">=2.19.5 <3.13.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user