2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 20:25:26 +00:00

Request and cache plugin information when connecting to the server

This commit is contained in:
Oliver Walters
2022-03-25 22:48:21 +11:00
parent 0c9c7b2a68
commit de45e18359
2 changed files with 54 additions and 4 deletions

View File

@ -509,8 +509,27 @@ class InvenTreePlugin extends InvenTreeModel {
InvenTreePlugin.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {
return InvenTreePlugin.fromJson(json);
}
@override
String get URL => "plugin/";
String get key => (jsondata["key"] ?? "") as String;
bool get active => (jsondata["active"] ?? false) as bool;
// Return the metadata struct for this plugin
Map<String, dynamic> get _meta => (jsondata["meta"] ?? {}) as Map<String, dynamic>;
// Return the mixins struct for this plugin
Map<String, dynamic> get _mixins => (jsondata["mixins"] ?? {}) as Map<String, dynamic>;
bool supportsMixin(String mixin) {
return _mixins.containsKey(mixin);
}
}