From 9a20123633c788ccc7cf824b134c0b0e7975e64a Mon Sep 17 00:00:00 2001 From: ssgueye2 <127868584+ssgueye2@users.noreply.github.com> Date: Wed, 31 May 2023 10:21:32 +0200 Subject: [PATCH] Remove device status from form in AWS (#2127) * remove status from form in AWS * FIX failed tests --- .../Pages/Devices/CreateDevicePage.razor | 36 ++++++++++------- .../Pages/Devices/DeviceDetailPage.razor | 35 ++++++++++------- .../EdgeDevices/CreateEdgeDevicePage.razor | 37 +++++++++++------- .../EdgeDevices/EdgeDeviceDetailPage.razor | 39 +++++++++++-------- .../EdgeDevices/CreateEdgeDevicePageTest.cs | 2 + .../EdgeDevices/EdgeDeviceDetailPageTests.cs | 2 + 6 files changed, 89 insertions(+), 62 deletions(-) diff --git a/src/AzureIoTHub.Portal.Client/Pages/Devices/CreateDevicePage.razor b/src/AzureIoTHub.Portal.Client/Pages/Devices/CreateDevicePage.razor index 519578f6c..46a95a51d 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/Devices/CreateDevicePage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/Devices/CreateDevicePage.razor @@ -10,6 +10,7 @@ @using AzureIoTHub.Portal.Shared.Models.v10.Filters @using AzureIoTHub.Portal.Shared.Constants + @attribute [Authorize] @inject ISnackbar Snackbar @inject PortalSettings Portal @@ -24,6 +25,7 @@ @implements IDisposable + Create Device @@ -135,21 +137,25 @@ Required="true" /> - - - Status - - - - Enabled - The device can connect to the platform. - - - Disabled - The device cannot connect to the platform. - - - + @if (Portal.CloudProvider.Equals(CloudProviders.Azure)) + { + + + Status + + + + Enabled + The device can connect to the platform. + + + Disabled + The device cannot connect to the platform. + + + + } + diff --git a/src/AzureIoTHub.Portal.Client/Pages/Devices/DeviceDetailPage.razor b/src/AzureIoTHub.Portal.Client/Pages/Devices/DeviceDetailPage.razor index d0f18f863..dd714a5ab 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/Devices/DeviceDetailPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/Devices/DeviceDetailPage.razor @@ -91,21 +91,26 @@ Required="true" ReadOnly="@(Portal.CloudProvider.Equals(CloudProviders.AWS))" /> - - - Status - - - - Enabled - The device can connect to the platform. - - - Disabled - The device cannot connect to the platform. - - - + + @if (Portal.CloudProvider.Equals(CloudProviders.Azure)) + { + + + Status + + + + Enabled + The device can connect to the platform. + + + Disabled + The device cannot connect to the platform. + + + + } + diff --git a/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/CreateEdgeDevicePage.razor b/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/CreateEdgeDevicePage.razor index 9b9e71c1d..8f5d56556 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/CreateEdgeDevicePage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/CreateEdgeDevicePage.razor @@ -2,8 +2,10 @@ @using AzureIoTHub.Portal @using AzureIoTHub.Portal.Models.v10 +@using AzureIoTHub.Portal.Shared.Constants @attribute [Authorize] +@inject PortalSettings Portal @inject ISnackbar Snackbar @inject NavigationManager NavigationManager @inject IEdgeDeviceClientService EdgeDeviceClientService @@ -106,21 +108,26 @@ For="@(()=> EdgeDevice.DeviceName)" Required="true" /> - - - Status - - - - Enabled - The device can connect to the platform. - - - Disabled - The device cannot connect to the platform. - - - + + @if (Portal.CloudProvider.Equals(CloudProviders.Azure)) + { + + + Status + + + + Enabled + The device can connect to the platform. + + + Disabled + The device cannot connect to the platform. + + + + } + diff --git a/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/EdgeDeviceDetailPage.razor b/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/EdgeDeviceDetailPage.razor index f8c3f77eb..6654e0c6a 100644 --- a/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/EdgeDeviceDetailPage.razor +++ b/src/AzureIoTHub.Portal.Client/Pages/EdgeDevices/EdgeDeviceDetailPage.razor @@ -1,9 +1,11 @@ @page "/edge/devices/{deviceId}" @using AzureIoTHub.Portal.Models.v10 -@using AzureIoTHub.Portal.Shared.Models.v10; +@using AzureIoTHub.Portal.Shared.Models.v10 +@using AzureIoTHub.Portal.Shared.Constants @attribute [Authorize] +@inject PortalSettings Portal @inject NavigationManager NavigationManager @inject ISnackbar Snackbar @inject IDialogService DialogService @@ -66,22 +68,25 @@ - - - Status - - - - Enabled - The device can connect to the platform. - - - Disabled - The device cannot connect to the platform. - - - - + @if (Portal.CloudProvider.Equals(CloudProviders.Azure)) + { + + + Status + + + + Enabled + The device can connect to the platform. + + + Disabled + The device cannot connect to the platform. + + + + } + Runtime response diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/CreateEdgeDevicePageTest.cs b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/CreateEdgeDevicePageTest.cs index 29d07c8f7..b8ac438b6 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/CreateEdgeDevicePageTest.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/CreateEdgeDevicePageTest.cs @@ -13,6 +13,7 @@ namespace AzureIoTHub.Portal.Tests.Unit.Client.Pages.EdgeDevices using AzureIoTHub.Portal.Client.Pages.EdgeDevices; using AzureIoTHub.Portal.Client.Services; using AzureIoTHub.Portal.Models.v10; + using AzureIoTHub.Portal.Shared.Constants; using AzureIoTHub.Portal.Tests.Unit.UnitTests.Bases; using Bunit; using Bunit.TestDoubles; @@ -45,6 +46,7 @@ public override void Setup() _ = Services.AddSingleton(this.mockIEdgeModelClientService.Object); _ = Services.AddSingleton(this.mockDeviceTagSettingsClientService.Object); _ = Services.AddSingleton(this.mockSnackbarService.Object); + _ = Services.AddSingleton(new PortalSettings { CloudProvider = CloudProviders.Azure }); _ = Services.AddSingleton(); diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/EdgeDeviceDetailPageTests.cs b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/EdgeDeviceDetailPageTests.cs index 586f1174d..7da4636fc 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/EdgeDeviceDetailPageTests.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Client/Pages/EdgeDevices/EdgeDeviceDetailPageTests.cs @@ -22,6 +22,7 @@ namespace AzureIoTHub.Portal.Tests.Unit.Client.Pages.EdgeDevices using NUnit.Framework; using UnitTests.Mocks; using AutoFixture; + using AzureIoTHub.Portal.Shared.Constants; [TestFixture] public class EdgeDeviceDetailPageTests : BlazorUnitTest @@ -51,6 +52,7 @@ public override void Setup() _ = Services.AddSingleton(this.mockDeviceTagSettingsClientService.Object); _ = Services.AddSingleton(this.mockDialogService.Object); _ = Services.AddSingleton(this.mockSnackbarService.Object); + _ = Services.AddSingleton(new PortalSettings { CloudProvider = CloudProviders.Azure }); _ = Services.AddSingleton();