diff --git a/lib/Screens/Devices/devices_screen.dart b/lib/Screens/Devices/devices_screen.dart index 5e907e4..90118ee 100644 --- a/lib/Screens/Devices/devices_screen.dart +++ b/lib/Screens/Devices/devices_screen.dart @@ -21,41 +21,40 @@ class _DevicesScreenState extends State { Size size = MediaQuery.of(context).size; return Container( - child: Column( - children: [ - FutureBuilder( - future: getDevices(appContext), - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - return GridView.builder( - shrinkWrap: true, - gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), - itemCount: snapshot.data.length, - itemBuilder: (BuildContext context, int index) { - return Container( - decoration: boxDecoration(), - padding: const EdgeInsets.all(15), - margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), - child: Align( - alignment: Alignment.center, - child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement() - ), - ); - } - ); - } else if (snapshot.connectionState == ConnectionState.none) { - return Text("No data"); - } else { - return Center( - child: Container( - height: size.height * 0.2, - child: Loading() - ) - ); - } - } - ), - ] + child: Align( + alignment: AlignmentDirectional.topCenter, + child: FutureBuilder( + future: getDevices(appContext), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + return GridView.builder( + shrinkWrap: true, + gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), + itemCount: snapshot.data.length, + itemBuilder: (BuildContext context, int index) { + return Container( + decoration: boxDecoration(), + padding: const EdgeInsets.all(15), + margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + child: Align( + alignment: Alignment.center, + child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement() + ), + ); + } + ); + } else if (snapshot.connectionState == ConnectionState.none) { + return Text("No data"); + } else { + return Center( + child: Container( + height: size.height * 0.2, + child: Loading() + ) + ); + } + } + ), ), ); } diff --git a/manager_api/doc/DeviceDTO.md b/manager_api/doc/DeviceDTO.md index 6accbe9..0004f9f 100644 --- a/manager_api/doc/DeviceDTO.md +++ b/manager_api/doc/DeviceDTO.md @@ -10,7 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] -**ipAddress** | **String** | | [optional] +**ipAddressWLAN** | **String** | | [optional] +**ipAddressETH** | **String** | | [optional] **configurationId** | **String** | | [optional] **configuration** | **String** | | [optional] **connected** | **bool** | | [optional] diff --git a/manager_api/doc/DeviceDetailDTO.md b/manager_api/doc/DeviceDetailDTO.md index 4b27233..fa40fcd 100644 --- a/manager_api/doc/DeviceDetailDTO.md +++ b/manager_api/doc/DeviceDetailDTO.md @@ -10,7 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | [optional] **name** | **String** | | [optional] -**ipAddress** | **String** | | [optional] +**ipAddressWLAN** | **String** | | [optional] +**ipAddressETH** | **String** | | [optional] **configurationId** | **String** | | [optional] **configuration** | **String** | | [optional] **connected** | **bool** | | [optional] diff --git a/manager_api/lib/model/device_detail_dto.dart b/manager_api/lib/model/device_detail_dto.dart index 14841f5..f936a30 100644 --- a/manager_api/lib/model/device_detail_dto.dart +++ b/manager_api/lib/model/device_detail_dto.dart @@ -14,7 +14,8 @@ class DeviceDetailDTO { DeviceDetailDTO({ this.id, this.name, - this.ipAddress, + this.ipAddressWLAN, + this.ipAddressETH, this.configurationId, this.configuration, this.connected, @@ -29,7 +30,9 @@ class DeviceDetailDTO { String name; - String ipAddress; + String ipAddressWLAN; + + String ipAddressETH; String configurationId; @@ -51,7 +54,8 @@ class DeviceDetailDTO { bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO && other.id == id && other.name == name && - other.ipAddress == ipAddress && + other.ipAddressWLAN == ipAddressWLAN && + other.ipAddressETH == ipAddressETH && other.configurationId == configurationId && other.configuration == configuration && other.connected == connected && @@ -65,7 +69,8 @@ class DeviceDetailDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + - (ipAddress == null ? 0 : ipAddress.hashCode) + + (ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) + + (ipAddressETH == null ? 0 : ipAddressETH.hashCode) + (configurationId == null ? 0 : configurationId.hashCode) + (configuration == null ? 0 : configuration.hashCode) + (connected == null ? 0 : connected.hashCode) + @@ -76,7 +81,7 @@ class DeviceDetailDTO { (lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode); @override - 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]'; + String toString() => 'DeviceDetailDTO[id=$id, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]'; Map toJson() { final json = {}; @@ -86,8 +91,11 @@ class DeviceDetailDTO { if (name != null) { json[r'name'] = name; } - if (ipAddress != null) { - json[r'ipAddress'] = ipAddress; + if (ipAddressWLAN != null) { + json[r'ipAddressWLAN'] = ipAddressWLAN; + } + if (ipAddressETH != null) { + json[r'ipAddressETH'] = ipAddressETH; } if (configurationId != null) { json[r'configurationId'] = configurationId; @@ -123,7 +131,8 @@ class DeviceDetailDTO { : DeviceDetailDTO( id: json[r'id'], name: json[r'name'], - ipAddress: json[r'ipAddress'], + ipAddressWLAN: json[r'ipAddressWLAN'], + ipAddressETH: json[r'ipAddressETH'], configurationId: json[r'configurationId'], configuration: json[r'configuration'], connected: json[r'connected'], diff --git a/manager_api/lib/model/device_dto.dart b/manager_api/lib/model/device_dto.dart index 15c294e..ff51a82 100644 --- a/manager_api/lib/model/device_dto.dart +++ b/manager_api/lib/model/device_dto.dart @@ -14,7 +14,8 @@ class DeviceDTO { DeviceDTO({ this.id, this.name, - this.ipAddress, + this.ipAddressWLAN, + this.ipAddressETH, this.configurationId, this.configuration, this.connected, @@ -25,7 +26,9 @@ class DeviceDTO { String name; - String ipAddress; + String ipAddressWLAN; + + String ipAddressETH; String configurationId; @@ -39,7 +42,8 @@ class DeviceDTO { bool operator ==(Object other) => identical(this, other) || other is DeviceDTO && other.id == id && other.name == name && - other.ipAddress == ipAddress && + other.ipAddressWLAN == ipAddressWLAN && + other.ipAddressETH == ipAddressETH && other.configurationId == configurationId && other.configuration == configuration && other.connected == connected && @@ -49,14 +53,15 @@ class DeviceDTO { int get hashCode => (id == null ? 0 : id.hashCode) + (name == null ? 0 : name.hashCode) + - (ipAddress == null ? 0 : ipAddress.hashCode) + + (ipAddressWLAN == null ? 0 : ipAddressWLAN.hashCode) + + (ipAddressETH == null ? 0 : ipAddressETH.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, configuration=$configuration, connected=$connected, dateCreation=$dateCreation]'; + String toString() => 'DeviceDTO[id=$id, name=$name, ipAddressWLAN=$ipAddressWLAN, ipAddressETH=$ipAddressETH, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation]'; Map toJson() { final json = {}; @@ -66,8 +71,11 @@ class DeviceDTO { if (name != null) { json[r'name'] = name; } - if (ipAddress != null) { - json[r'ipAddress'] = ipAddress; + if (ipAddressWLAN != null) { + json[r'ipAddressWLAN'] = ipAddressWLAN; + } + if (ipAddressETH != null) { + json[r'ipAddressETH'] = ipAddressETH; } if (configurationId != null) { json[r'configurationId'] = configurationId; @@ -91,7 +99,8 @@ class DeviceDTO { : DeviceDTO( id: json[r'id'], name: json[r'name'], - ipAddress: json[r'ipAddress'], + ipAddressWLAN: json[r'ipAddressWLAN'], + ipAddressETH: json[r'ipAddressETH'], configurationId: json[r'configurationId'], configuration: json[r'configuration'], connected: json[r'connected'], diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index cd10f14..adc429b 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -27,8 +27,6 @@ paths: application/json: schema: type: string - security: - - bearer: [] post: tags: - Configuration @@ -243,8 +241,6 @@ paths: application/json: schema: type: string - security: - - bearer: [] put: tags: - Device @@ -771,8 +767,6 @@ paths: application/json: schema: type: string - security: - - bearer: [] delete: tags: - Section @@ -1307,7 +1301,10 @@ components: name: type: string nullable: true - ipAddress: + ipAddressWLAN: + type: string + nullable: true + ipAddressETH: type: string nullable: true configurationId: