Skip to content

Commit

Permalink
Remove device status from form in AWS (#2127)
Browse files Browse the repository at this point in the history
* remove status from form in AWS

* FIX failed tests
  • Loading branch information
ssgueye2 authored and kbeaugrand committed Jun 22, 2023
1 parent 50d0349 commit 9a20123
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 62 deletions.
36 changes: 21 additions & 15 deletions src/AzureIoTHub.Portal.Client/Pages/Devices/CreateDevicePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@using AzureIoTHub.Portal.Shared.Models.v10.Filters
@using AzureIoTHub.Portal.Shared.Constants


@attribute [Authorize]
@inject ISnackbar Snackbar
@inject PortalSettings Portal
Expand All @@ -24,6 +25,7 @@
@implements IDisposable



<MudText Typo="Typo.h5" Color="Color.Primary" Class="mb-4">Create Device</MudText>
<MudForm Model="@Device" @ref="form">
<MudGrid>
Expand Down Expand Up @@ -135,21 +137,25 @@
Required="true" />
</MudItem>

<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@Device.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>
@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@Device.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>
}

</MudGrid>
</ChildContent>
</MudExpansionPanel>
Expand Down
35 changes: 20 additions & 15 deletions src/AzureIoTHub.Portal.Client/Pages/Devices/DeviceDetailPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,26 @@
Required="true"
ReadOnly="@(Portal.CloudProvider.Equals(CloudProviders.AWS))" />
</MudItem>
<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@Device.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>

@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@Device.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>
}

</MudGrid>
</ChildContent>
</MudExpansionPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,21 +108,26 @@
For="@(()=> EdgeDevice.DeviceName)"
Required="true" />
</MudItem>
<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@EdgeDevice.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>

@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudItem xs="12">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@EdgeDevice.IsEnabled">
<MudRadio Option=@(true) Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@(false) Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>
}

</MudGrid>
</ChildContent>
</MudExpansionPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -66,22 +68,25 @@
<ChildContent>
<MudGrid>

<MudItem xs="12" md="6">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@edgeDevice.Status">
<MudRadio Option=@("Enabled") Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@("Disabled") Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>

@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudItem xs="12" md="6">
<MudText>
<b>Status</b>
</MudText>
<MudRadioGroup @bind-SelectedOption="@edgeDevice.Status">
<MudRadio Option=@("Enabled") Color="Color.Primary">
Enabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>can</b> connect to the platform.</MudText>
</MudRadio>
<MudRadio Option=@("Disabled") Color="Color.Primary">
Disabled
<MudText Typo="Typo.subtitle1" Class="mud-input-helper-text">The device <b>cannot</b> connect to the platform.</MudText>
</MudRadio>
</MudRadioGroup>
</MudItem>
}

<MudItem xs="12" md="6">
<MudText>
<b>Runtime response</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<IEdgeDeviceLayoutService, EdgeDeviceLayoutService>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<IEdgeDeviceLayoutService, EdgeDeviceLayoutService>();

Expand Down

0 comments on commit 9a20123

Please sign in to comment.