diff --git a/src/AzureIoTHub.Portal.Server.Tests/Mappers/ConcentratorTwinMapperTests.cs b/src/AzureIoTHub.Portal.Server.Tests/Mappers/ConcentratorTwinMapperTests.cs index 73a2143e4..7604b250d 100644 --- a/src/AzureIoTHub.Portal.Server.Tests/Mappers/ConcentratorTwinMapperTests.cs +++ b/src/AzureIoTHub.Portal.Server.Tests/Mappers/ConcentratorTwinMapperTests.cs @@ -54,7 +54,7 @@ public void CreateDeviceDetails_StateUnderTest_ExpectedBehavior() }; twin.Tags[nameof(Concentrator.DeviceType).ToCamelCase()] = Guid.NewGuid().ToString(); - twin.Tags[nameof(Concentrator.DeviceFriendlyName).ToCamelCase()] = Guid.NewGuid().ToString(); + twin.Tags[nameof(Concentrator.DeviceName).ToCamelCase()] = Guid.NewGuid().ToString(); twin.Tags[nameof(Concentrator.LoraRegion).ToCamelCase()] = Guid.NewGuid().ToString(); twin.Properties.Reported["DevAddr"] = Guid.NewGuid().ToString(); @@ -70,7 +70,7 @@ public void CreateDeviceDetails_StateUnderTest_ExpectedBehavior() Assert.IsFalse(result.IsConnected); Assert.IsFalse(result.IsEnabled); - Assert.AreEqual(twin.Tags[nameof(Concentrator.DeviceFriendlyName).ToCamelCase()].ToString(), result.DeviceFriendlyName); + Assert.AreEqual(twin.Tags[nameof(Concentrator.DeviceName).ToCamelCase()].ToString(), result.DeviceName); Assert.AreEqual(twin.Tags[nameof(Concentrator.LoraRegion).ToCamelCase()].ToString(), result.LoraRegion); Assert.AreEqual(twin.Tags[nameof(Concentrator.DeviceType).ToCamelCase()].ToString(), result.DeviceType); @@ -91,7 +91,7 @@ public void UpdateTwin_StateUnderTest_ExpectedBehavior() Concentrator item = new Concentrator { LoraRegion = Guid.NewGuid().ToString(), - DeviceFriendlyName = Guid.NewGuid().ToString(), + DeviceName = Guid.NewGuid().ToString(), DeviceType = Guid.NewGuid().ToString(), ClientCertificateThumbprint = Guid.NewGuid().ToString(), IsConnected = false, @@ -110,7 +110,7 @@ public void UpdateTwin_StateUnderTest_ExpectedBehavior() // .ReturnsAsync((HttpRequestMessage req, CancellationToken token) => deviceResponseMock) // .Verifiable(); - Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceFriendlyName), item.DeviceFriendlyName); + Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceName), item.DeviceName); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceType), item.DeviceType); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.LoraRegion), item.LoraRegion); @@ -120,7 +120,7 @@ public void UpdateTwin_StateUnderTest_ExpectedBehavior() concentratorTwinMapper.UpdateTwin(twin, item); // Assert - Assert.AreEqual(item.DeviceFriendlyName, twin.Tags[nameof(Concentrator.DeviceFriendlyName).ToCamelCase()].ToString()); + Assert.AreEqual(item.DeviceName, twin.Tags[nameof(Concentrator.DeviceName).ToCamelCase()].ToString()); Assert.AreEqual(item.DeviceType, twin.Tags[nameof(Concentrator.DeviceType).ToCamelCase()].ToString()); Assert.AreEqual(item.LoraRegion, twin.Tags[nameof(Concentrator.LoraRegion).ToCamelCase()].ToString()); diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor index 11aca8d13..21d6e0495 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/CreateDevicePage.razor @@ -45,6 +45,14 @@ HelperText="DeviceID must contain 16 hexadecimal characters (numbers from 0 to 9 and/or letters from A to F)" /> + + + - + + + + diff --git a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor index d8d87a08a..e618a70a0 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Devices/DeviceListPage.razor @@ -101,7 +101,7 @@ - @context.DeviceID + @context.DeviceName diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor index 8162553c0..62b10a189 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorDetailPage.razor @@ -56,10 +56,9 @@ - - + + - diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor index 8358bb360..a90f19d90 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/ConcentratorListPage.razor @@ -21,8 +21,7 @@ - - + @@ -35,8 +34,7 @@ - Name - Device Id + Device Status Connection state See details @@ -44,10 +42,7 @@ - @context.DeviceFriendlyName - - - @context.DeviceId + @context.DeviceName @if (context.IsEnabled) diff --git a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor index a65915ac5..93d45a0eb 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/LoRaWAN/Concentrator/CreateConcentratorPage.razor @@ -22,7 +22,7 @@ - + - - + + diff --git a/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs index dc75b40ac..11750c074 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/ConcentratorTwinMapper.cs @@ -25,7 +25,7 @@ public Concentrator CreateDeviceDetails(Twin twin) return new Concentrator { DeviceId = twin.DeviceId, - DeviceFriendlyName = DeviceHelper.RetrieveTagValue(twin, nameof(Concentrator.DeviceFriendlyName)), + DeviceName = DeviceHelper.RetrieveTagValue(twin, nameof(Concentrator.DeviceName)), LoraRegion = DeviceHelper.RetrieveTagValue(twin, nameof(Concentrator.LoraRegion)), ClientCertificateThumbprint = DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(Concentrator.ClientCertificateThumbprint)), IsEnabled = twin.Status == DeviceStatus.Enabled, @@ -37,7 +37,7 @@ public Concentrator CreateDeviceDetails(Twin twin) public void UpdateTwin(Twin twin, Concentrator item) { - DeviceHelper.SetTagValue(twin, nameof(item.DeviceFriendlyName), item.DeviceFriendlyName); + DeviceHelper.SetTagValue(twin, nameof(item.DeviceName), item.DeviceName); DeviceHelper.SetTagValue(twin, nameof(item.LoraRegion), item.LoraRegion); DeviceHelper.SetTagValue(twin, nameof(item.DeviceType), item.DeviceType); diff --git a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs index cb464de84..7999651b1 100644 --- a/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs +++ b/src/AzureIoTHub.Portal/Server/Mappers/DeviceTwinMapper.cs @@ -31,6 +31,7 @@ public DeviceDetails CreateDeviceDetails(Twin twin) { DeviceID = twin.DeviceId, ModelId = modelId, + DeviceName = Helpers.DeviceHelper.RetrieveTagValue(twin, nameof(DeviceDetails.DeviceName)), AlreadyLoggedInOnce = Helpers.DeviceHelper.RetrieveReportedPropertyValue(twin, "DevAddr") != null, ImageUrl = this.deviceModelImageManager.ComputeImageUri(modelId), IsConnected = twin.ConnectionState == DeviceConnectionState.Connected, @@ -51,6 +52,7 @@ public DeviceListItem CreateDeviceListItem(Twin twin) return new DeviceListItem { DeviceID = twin.DeviceId, + DeviceName = Helpers.DeviceHelper.RetrieveTagValue(twin, nameof(DeviceDetails.DeviceName)), ImageUrl = this.deviceModelImageManager.ComputeImageUri(Helpers.DeviceHelper.RetrieveTagValue(twin, nameof(DeviceDetails.ModelId))), IsConnected = twin.ConnectionState == DeviceConnectionState.Connected, IsEnabled = twin.Status == DeviceStatus.Enabled, @@ -62,6 +64,7 @@ public DeviceListItem CreateDeviceListItem(Twin twin) public void UpdateTwin(Twin twin, DeviceDetails item) { // Update the twin properties + Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceName), item.DeviceName); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.LocationCode), item.LocationCode); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.AssetId), item.AssetId); Helpers.DeviceHelper.SetTagValue(twin, nameof(item.DeviceType), item.DeviceType); diff --git a/src/AzureIoTHub.Portal/Shared/Models/Concentrator/Concentrator.cs b/src/AzureIoTHub.Portal/Shared/Models/Concentrator/Concentrator.cs index 39ddd7615..cd2a0d55e 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/Concentrator/Concentrator.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/Concentrator/Concentrator.cs @@ -17,7 +17,7 @@ public class Concentrator public string DeviceId { get; set; } [Required] - public string DeviceFriendlyName { get; set; } + public string DeviceName { get; set; } [Required] public string LoraRegion { get; set; } diff --git a/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceDetails.cs b/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceDetails.cs index f557e0583..0c8a5be23 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceDetails.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceDetails.cs @@ -13,6 +13,9 @@ public class DeviceDetails [RegularExpression("^[A-F0-9]{16}$", ErrorMessage = "DeviceID must contain 16 hexadecimal characters (numbers from 0 to 9 and/or letters from A to F)")] public string DeviceID { get; set; } + [Required] + public string DeviceName { get; set; } + public string ImageUrl { get; set; } public bool IsConnected { get; set; } diff --git a/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceListItem.cs b/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceListItem.cs index 17f754311..b4e7f5ca8 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceListItem.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/Device/DeviceListItem.cs @@ -9,6 +9,8 @@ public class DeviceListItem { public string DeviceID { get; set; } + public string DeviceName { get; set; } + public string ImageUrl { get; set; } public bool IsConnected { get; set; }