diff --git a/lib/Components/rounded_input_field.dart b/lib/Components/rounded_input_field.dart index f0780cc..80a64fb 100644 --- a/lib/Components/rounded_input_field.dart +++ b/lib/Components/rounded_input_field.dart @@ -8,6 +8,7 @@ class RoundedInputField extends StatelessWidget { final ValueChanged onChanged; final String initialValue; final Color color, textColor, iconColor; + final int maxLength; const RoundedInputField({ Key key, this.hintText, @@ -17,6 +18,7 @@ class RoundedInputField extends StatelessWidget { this.textColor = kBlack, this.iconColor = kPrimaryColor, this.onChanged, + this.maxLength = 50, }) : super(key: key); @override @@ -27,6 +29,7 @@ class RoundedInputField extends StatelessWidget { onChanged: onChanged, initialValue: initialValue, cursorColor: textColor, + maxLength: maxLength, style: TextStyle(fontSize: 20, color: textColor), decoration: InputDecoration( icon: icon != null ? Icon( diff --git a/lib/Components/string_input_container.dart b/lib/Components/string_input_container.dart index 07eb0dd..b4ea2be 100644 --- a/lib/Components/string_input_container.dart +++ b/lib/Components/string_input_container.dart @@ -9,6 +9,7 @@ class StringInputContainer extends StatelessWidget { final ValueChanged onChanged; final bool isUrl; final bool isSmall; + final int maxLength; const StringInputContainer({ Key key, this.color = kSecond, @@ -17,6 +18,7 @@ class StringInputContainer extends StatelessWidget { this.onChanged, this.isUrl = false, this.isSmall = false, + this.maxLength = 50, }) : super(key: key); @override @@ -32,12 +34,13 @@ class StringInputContainer extends StatelessWidget { Padding( padding: const EdgeInsets.all(10.0), child: Container( - width: isUrl ? size.width *0.6 : isSmall != null ? size.width *0.1 : size.width *0.2, + width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.2, child: RoundedInputField( color: color, textColor: kBlack, initialValue: initialValue, onChanged: onChanged, + maxLength: maxLength, ), ), ), diff --git a/lib/Screens/Devices/change_device_info_modal.dart b/lib/Screens/Devices/change_device_info_modal.dart new file mode 100644 index 0000000..56292bc --- /dev/null +++ b/lib/Screens/Devices/change_device_info_modal.dart @@ -0,0 +1,145 @@ +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/rounded_button.dart'; +import 'package:manager_app/Components/string_input_container.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; + +import 'dropDown_configuration.dart'; + +showChangeInfo (String text, DeviceDTO inputDevice, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) { + Size size = MediaQuery.of(mainContext).size; + + showDialog( + builder: (BuildContext context) => AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20.0)) + ), + title: Center(child: Text(text)), + content: Container( + width: size.width * 0.3, + height: size.height * 0.3, + child: Column( + children: [ + Center( + child: Container( + width: size.width * 0.3, + height: size.height * 0.15, + child: StringInputContainer( + label: "Nom:", + initialValue: inputDevice.name, + onChanged: (value) { + inputDevice.name = value; + }, + maxLength: 20, + ), + ), + ), + Row( + children: [ + Align( + alignment: AlignmentDirectional.centerStart, + child: Text("Configuration:", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) + ), + Container( + height: size.height * 0.1, + child: FutureBuilder( + future: getConfigurations(appContext), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + return Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: DropDownConfig( + configurations: snapshot.data, + selectedConfigurationId: inputDevice.configurationId, + onChange: (ConfigurationDTO configurationOut) { + inputDevice.configuration = configurationOut.label; + inputDevice.configurationId = configurationOut.id; + }, + ), + ), + ], + ); + } else if (snapshot.connectionState == ConnectionState.none) { + return Text("No data"); + } else { + return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); + } + } + ), + ), + ], + ) + ], + ), + ), + actions: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + width: 180, + height: 70, + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: kSecond, + press: () { + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + Container( + width: 180, + height: 70, + child: RoundedButton( + text: "Changer", + icon: Icons.check, + color: kPrimaryColor, + textColor: kWhite, + press: () { + onGetResult(inputDevice); + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + ], + ), + ], + ), context: mainContext + ); +} + +getConfigurationsElement(DeviceDTO inputDevice, data, Function onGetResult) { + List widgets = new List(); + for(var configuration in data as List) { + var widget = new InkWell( + onTap: () { + inputDevice.configuration = configuration.label; + inputDevice.configurationId = configuration.id; + }, + child: Ink( + color: inputDevice.configurationId == configuration.id ? kPrimaryColor : null, + child: ListTile( + leading: Icon(Icons.account_tree_rounded), + title: Text(configuration.label), + ), + ), + ); + widgets.add(widget); + } + return widgets; +} + +Future> getConfigurations(dynamic appContext) async { + List configurations = await appContext.getContext().clientAPI.configurationApi.configurationGet(); + print("number of configurations " + configurations.length.toString()); + configurations.forEach((element) { + print(element); + }); + return configurations; +} + diff --git a/lib/Screens/Devices/change_name_modal.dart b/lib/Screens/Devices/change_name_modal.dart deleted file mode 100644 index 2d9488c..0000000 --- a/lib/Screens/Devices/change_name_modal.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/string_input_container.dart'; -import 'package:manager_app/constants.dart'; -import 'package:managerapi/api.dart'; - -showChangeNameModal (String text, String name, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) { - Size size = MediaQuery.of(mainContext).size; - - showDialog( - builder: (BuildContext context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20.0)) - ), - title: Center(child: Text(text)), - content: SingleChildScrollView( - child: Center( - child: Container( - width: size.width * 0.3, - height: size.height * 0.15, - child: StringInputContainer( - label: "Nom :", - initialValue: name, - onChanged: (value) { - name = value; - }, - ), - ), - ) - ), - actions: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Annuler", - icon: Icons.undo, - color: kSecond, - press: () { - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ), - Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Changer", - icon: Icons.check, - color: kPrimaryColor, - textColor: kWhite, - press: () { - onGetResult(name); - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ), - ], - ), - ], - ), context: mainContext - ); -} diff --git a/lib/Screens/Devices/device_element.dart b/lib/Screens/Devices/device_element.dart new file mode 100644 index 0000000..54c1590 --- /dev/null +++ b/lib/Screens/Devices/device_element.dart @@ -0,0 +1,129 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/Screens/Devices/change_device_info_modal.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:provider/provider.dart'; + +class DeviceElement extends StatefulWidget { + final DeviceDTO deviceDTO; + const DeviceElement({ + Key key, + this.deviceDTO, + }) : super(key: key); + + @override + _DeviceElementState createState() => _DeviceElementState(); +} + +class _DeviceElementState extends State { + DeviceDTO deviceDTO; + + @override + void initState() { + deviceDTO = widget.deviceDTO; + super.initState(); + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + return Stack( + children: [ + Positioned( + top: 10, + right: 10, + child: Container( + width: 15, + height: 15, + decoration: BoxDecoration( + color: deviceDTO.connected ? Colors.green : Colors.red, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(25.0), + boxShadow: [ + BoxShadow( + color: kSecond, + spreadRadius: 0.5, + blurRadius: 3, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ), + ), + ), + Positioned( + top: 10, + left: 10, + child: Row( + children: [ + AutoSizeText( + deviceDTO.name, + style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w300), + maxLines: 1, + ), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AutoSizeText( + deviceDTO.configuration, + style: new TextStyle(fontSize: 25), + maxLines: 1, + ), + ], + ), + ), + ], + ), + Positioned( + bottom: 10, + right: 10, + child: IconButton( + icon: Icon(Icons.edit), + onPressed: () { + showChangeInfo( + "Mettre à jour le device", + deviceDTO, + (DeviceDTO outputDevice) { + // For refresh + setState(() { + print("output"); + print(outputDevice); + deviceDTO = outputDevice; + // Update device main info + updateMainInfos(deviceDTO, appContext); + }); + }, + 1, + context, + appContext + ); + }, + color: kPrimaryColor, + ), + ), + ], + ); + } + + Future updateMainInfos(DeviceDTO deviceToUpdate, dynamic appContext) async { + ManagerAppContext managerAppContext = appContext.getContext(); + print(deviceToUpdate); + DeviceDTO device = await managerAppContext.clientAPI.deviceApi.deviceUpdateMainInfos(deviceToUpdate); + print(device); + return device; + } + +} \ No newline at end of file diff --git a/lib/Screens/Devices/devices_screen.dart b/lib/Screens/Devices/devices_screen.dart index 7e878de..b7ab1cd 100644 --- a/lib/Screens/Devices/devices_screen.dart +++ b/lib/Screens/Devices/devices_screen.dart @@ -1,8 +1,6 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Models/managerContext.dart'; -import 'package:manager_app/Screens/Devices/change_name_modal.dart'; -import 'package:manager_app/Screens/Devices/select_config_modal.dart'; +import 'package:manager_app/Screens/Devices/device_element.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; @@ -39,7 +37,7 @@ class _DevicesScreenState extends State { margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), child: Align( alignment: Alignment.center, - child: getElement(snapshot.data[index], size, appContext) + child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement() ), ); } @@ -56,7 +54,7 @@ class _DevicesScreenState extends State { ); } - getElement(DeviceDTO device, Size size, dynamic appContext) { + /*getElement(DeviceDTO device, Size size, dynamic appContext) { return Stack( children: [ Positioned( @@ -121,62 +119,81 @@ class _DevicesScreenState extends State { children: [ Align( alignment: Alignment.centerLeft, - child: Row( + child: device.configuration != null ? + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ AutoSizeText( - "Configuration: ", - style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w300), - maxLines: 1, - ), - device.configurationId != null ? - AutoSizeText( - device.configurationId, + device.configuration, style: new TextStyle(fontSize: 25), maxLines: 1, - ) : InkWell( - onTap: () { + ), + IconButton( + icon: Icon(Icons.edit), + onPressed: () { showSelectConfigModal( - "Sélectionner une configuration", - (String configurationId) { + "Sélectionner une configuration", + (String configurationId) { - device.configurationId = configurationId; - // Update device main info - updateMainInfos(device, appContext); + device.configurationId = configurationId; + // Update device main info + updateMainInfos(device, appContext); - // For refresh // TODO better refresh - setState(() { - }); - }, - 1, - context, - appContext + // For refresh // TODO better refresh + /*setState(() { + });*/ + }, + 1, + context, + appContext ); }, - child: Container( - decoration: BoxDecoration( - color: kPrimaryColor, - borderRadius: BorderRadius.circular(50), - ), - child: Padding( - padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15), - child: Center( - child: AutoSizeText( - "Sélectionner", - style: TextStyle(color: kWhite), - maxLines: 1, - ) - ), - ) - ), + color: kPrimaryColor, ) ], + ) : InkWell( + onTap: () { + showSelectConfigModal( + "Sélectionner une configuration", + (String configurationId) { + + device.configurationId = configurationId; + // Update device main info + updateMainInfos(device, appContext); + + // For refresh // TODO better refresh + /*setState(() { + });*/ + }, + 1, + context, + appContext + ); + }, + child: Container( + decoration: BoxDecoration( + color: kPrimaryColor, + borderRadius: BorderRadius.circular(50), + ), + child: Padding( + padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15), + child: Center( + child: AutoSizeText( + "Sélectionner", + style: TextStyle(color: kWhite), + maxLines: 1, + ) + ), + ) + ), ), ), ], ), ], ); - } + }*/ } Future updateMainInfos(DeviceDTO deviceToUpdate, dynamic appContext) async { diff --git a/lib/Screens/Devices/dropDown_configuration.dart b/lib/Screens/Devices/dropDown_configuration.dart new file mode 100644 index 0000000..f20ba3c --- /dev/null +++ b/lib/Screens/Devices/dropDown_configuration.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:provider/provider.dart'; + +class DropDownConfig extends StatefulWidget { + final List configurations; + final String selectedConfigurationId; + final ValueChanged onChange; + const DropDownConfig({ + Key key, + this.configurations, + this.selectedConfigurationId, + this.onChange, + }) : super(key: key); + + @override + _DropDownConfigState createState() => _DropDownConfigState(); +} + +class _DropDownConfigState extends State { + ConfigurationDTO configurationDTO; + + @override + void initState() { + configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId); + super.initState(); + } + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + return DropdownButton( + value: configurationDTO, + icon: const Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: const TextStyle(color: kBlack), + underline: Container( + height: 2, + color: kPrimaryColor, + ), + onChanged: (ConfigurationDTO newValue) { + setState(() { + configurationDTO = newValue; + widget.onChange(configurationDTO); + }); + }, + items: widget.configurations.map>((ConfigurationDTO value) { + return DropdownMenuItem( + value: value, + child: Text(value.label, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400)), + ); + }).toList(), + ); + } + +} \ No newline at end of file diff --git a/lib/Screens/Devices/select_config_modal.dart b/lib/Screens/Devices/select_config_modal.dart deleted file mode 100644 index b3d3853..0000000 --- a/lib/Screens/Devices/select_config_modal.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/constants.dart'; -import 'package:managerapi/api.dart'; - -showSelectConfigModal (String text, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) { - Size size = MediaQuery.of(mainContext).size; - - showDialog( - builder: (BuildContext context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20.0)) - ), - title: Center(child: Text(text)), - content: SingleChildScrollView( - child: Column( - children: [ - Container( - width: size.width * 0.2, - height: size.height * 0.3, - child: FutureBuilder( - future: getConfigurations(appContext), - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - return ListView( - scrollDirection: Axis.vertical, - children: getConfigurationsElement(snapshot.data, onGetResult, () { - Navigator.of(context).pop(); - }), - ); - } else if (snapshot.connectionState == ConnectionState.none) { - return Text("No data"); - } else { - return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); - } - } - ), - ), - ], - ) - ), - actions: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Annuler", - icon: Icons.undo, - color: kSecond, - press: () { - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ), - ], - ), - ], - ), context: mainContext - ); -} - -getConfigurationsElement(data, Function onGetResult, Function requestClose) { - List widgets = new List(); - for(var configuration in data as List) { - var widget = new InkWell( - onTap: () { - onGetResult(configuration.id); - requestClose(); - }, - child: ListTile( - leading: Icon(Icons.account_tree_rounded), - title: Text(configuration.label) - ), - ); - widgets.add(widget); - } - return widgets; -} - -Future> getConfigurations(dynamic appContext) async { - List configurations = await appContext.getContext().clientAPI.configurationApi.configurationGet(); - print("number of configurations " + configurations.length.toString()); - configurations.forEach((element) { - print(element); - }); - return configurations; -} diff --git a/manager_api/doc/DeviceDTO.md b/manager_api/doc/DeviceDTO.md index 02e4be1..6accbe9 100644 --- a/manager_api/doc/DeviceDTO.md +++ b/manager_api/doc/DeviceDTO.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **name** | **String** | | [optional] **ipAddress** | **String** | | [optional] **configurationId** | **String** | | [optional] +**configuration** | **String** | | [optional] **connected** | **bool** | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] diff --git a/manager_api/doc/DeviceDetailDTO.md b/manager_api/doc/DeviceDetailDTO.md index 75c41f1..4b27233 100644 --- a/manager_api/doc/DeviceDetailDTO.md +++ b/manager_api/doc/DeviceDetailDTO.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **name** | **String** | | [optional] **ipAddress** | **String** | | [optional] **configurationId** | **String** | | [optional] +**configuration** | **String** | | [optional] **connected** | **bool** | | [optional] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] **connectionLevel** | **String** | | [optional] diff --git a/manager_api/lib/model/device_detail_dto.dart b/manager_api/lib/model/device_detail_dto.dart index 6379db3..14841f5 100644 --- a/manager_api/lib/model/device_detail_dto.dart +++ b/manager_api/lib/model/device_detail_dto.dart @@ -16,6 +16,7 @@ class DeviceDetailDTO { this.name, this.ipAddress, this.configurationId, + this.configuration, this.connected, this.dateCreation, this.connectionLevel, @@ -32,6 +33,8 @@ class DeviceDetailDTO { String configurationId; + String configuration; + bool connected; DateTime dateCreation; @@ -50,6 +53,7 @@ class DeviceDetailDTO { other.name == name && other.ipAddress == ipAddress && other.configurationId == configurationId && + other.configuration == configuration && other.connected == connected && other.dateCreation == dateCreation && other.connectionLevel == connectionLevel && @@ -63,6 +67,7 @@ class DeviceDetailDTO { (name == null ? 0 : name.hashCode) + (ipAddress == null ? 0 : ipAddress.hashCode) + (configurationId == null ? 0 : configurationId.hashCode) + + (configuration == null ? 0 : configuration.hashCode) + (connected == null ? 0 : connected.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode) + (connectionLevel == null ? 0 : connectionLevel.hashCode) + @@ -71,7 +76,7 @@ class DeviceDetailDTO { (lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode); @override - String toString() => 'DeviceDetailDTO[id=$id, name=$name, ipAddress=$ipAddress, configurationId=$configurationId, connected=$connected, dateCreation=$dateCreation, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; + String toString() => 'DeviceDetailDTO[id=$id, name=$name, ipAddress=$ipAddress, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; Map toJson() { final json = {}; @@ -87,6 +92,9 @@ class DeviceDetailDTO { if (configurationId != null) { json[r'configurationId'] = configurationId; } + if (configuration != null) { + json[r'configuration'] = configuration; + } if (connected != null) { json[r'connected'] = connected; } @@ -117,6 +125,7 @@ class DeviceDetailDTO { name: json[r'name'], ipAddress: json[r'ipAddress'], configurationId: json[r'configurationId'], + configuration: json[r'configuration'], connected: json[r'connected'], dateCreation: json[r'dateCreation'] == null ? null diff --git a/manager_api/lib/model/device_dto.dart b/manager_api/lib/model/device_dto.dart index d803476..15c294e 100644 --- a/manager_api/lib/model/device_dto.dart +++ b/manager_api/lib/model/device_dto.dart @@ -16,6 +16,7 @@ class DeviceDTO { this.name, this.ipAddress, this.configurationId, + this.configuration, this.connected, this.dateCreation, }); @@ -28,6 +29,8 @@ class DeviceDTO { String configurationId; + String configuration; + bool connected; DateTime dateCreation; @@ -38,6 +41,7 @@ class DeviceDTO { other.name == name && other.ipAddress == ipAddress && other.configurationId == configurationId && + other.configuration == configuration && other.connected == connected && other.dateCreation == dateCreation; @@ -47,11 +51,12 @@ class DeviceDTO { (name == null ? 0 : name.hashCode) + (ipAddress == null ? 0 : ipAddress.hashCode) + (configurationId == null ? 0 : configurationId.hashCode) + + (configuration == null ? 0 : configuration.hashCode) + (connected == null ? 0 : connected.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode); @override - String toString() => 'DeviceDTO[id=$id, name=$name, ipAddress=$ipAddress, configurationId=$configurationId, connected=$connected, dateCreation=$dateCreation]'; + String toString() => 'DeviceDTO[id=$id, name=$name, ipAddress=$ipAddress, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation]'; Map toJson() { final json = {}; @@ -67,6 +72,9 @@ class DeviceDTO { if (configurationId != null) { json[r'configurationId'] = configurationId; } + if (configuration != null) { + json[r'configuration'] = configuration; + } if (connected != null) { json[r'connected'] = connected; } @@ -85,6 +93,7 @@ class DeviceDTO { name: json[r'name'], ipAddress: json[r'ipAddress'], configurationId: json[r'configurationId'], + configuration: json[r'configuration'], connected: json[r'connected'], dateCreation: json[r'dateCreation'] == null ? null diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index e7be1e3..cd10f14 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -225,6 +225,12 @@ paths: application/json: schema: type: string + '404': + description: '' + content: + application/json: + schema: + type: string '409': description: '' content: @@ -1307,6 +1313,9 @@ components: configurationId: type: string nullable: true + configuration: + type: string + nullable: true connected: type: boolean dateCreation: