Skip to content

Commit

Permalink
Add null LayerId to Device Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-mrq committed Apr 25, 2024
1 parent 1042f7d commit 9dd5e9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudTooltip Text="Delete device">
@if (context.LayerId == Layer.Id || DeviceList.Contains(context.DeviceID) )
@if ((context.LayerId != null && context.LayerId == Layer.Id) || DeviceList.Contains(context.DeviceID))
{
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.CheckBox" Size="Size.Medium" @onclick="() => UpdateChecked(context)"></MudIconButton>
}
else if (context.LayerId.Contains('-'))
else if (context.LayerId != null && context.LayerId.Contains('-'))
{
<MudIconButton Color="Color.Error" Icon="@Icons.Material.Filled.IndeterminateCheckBox" Size="Size.Medium" @onclick="() => UpdateChecked(context)"></MudIconButton>
}
Expand Down Expand Up @@ -139,7 +139,7 @@

public void UpdateChecked(DeviceListItem device)
{
if (device.LayerId == Layer.Id)
if (device.LayerId != null && device.LayerId == Layer.Id)
{
if (DeviceRemoveList.Contains(device.DeviceID)) DeviceRemoveList.Remove(device.DeviceID);
else DeviceRemoveList.Add(device.DeviceID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public async Task UpdateDatabase()
PaginatedResult<DeviceListItem> devices = await this.deviceService.GetDevices();
foreach (var device in devices.Data)
{
if (device.LayerId.Contains('-')) await AddNewDevice(device);
if (device.LayerId != null && device.LayerId.Contains('-')) await AddNewDevice(device);
}
}
catch (ProblemDetailsException exception)
Expand Down
4 changes: 2 additions & 2 deletions src/IoTHub.Portal.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ Specify the authorization token got from your IDP as a header.
opts.UseInlineDefinitionsForEnums();
});

//_ = services.AddHostedService<SendPlanningCommandService>();
//_ = services.AddScoped<ISendPlanningCommandService, SendPlanningCommandService>();
_ = services.AddHostedService<SendPlanningCommandService>();
_ = services.AddScoped<ISendPlanningCommandService, SendPlanningCommandService>();

_ = services.AddApiVersioning(o =>
{
Expand Down

0 comments on commit 9dd5e9d

Please sign in to comment.