Skip to content

Commit

Permalink
CGI-FR#2958 Remove 'Connection State' and 'Last status update' columns
Browse files Browse the repository at this point in the history
  • Loading branch information
E068097 committed Nov 29, 2024
1 parent f0a2365 commit c30e0fa
Show file tree
Hide file tree
Showing 25 changed files with 2,337 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@
</MudRadioGroup>

</MudItem>
<MudItem xs="12" md="6">
<MudText>Connection state</MudText>
<MudRadioGroup @bind-SelectedOption="@searchState" Style="display:flex;align-items:baseline">
<MudItem md="4" sm="12">
<MudRadio Option=@("true") Color="Color.Primary" id="searchStateConnected">Connected</MudRadio>
</MudItem>
<MudItem md="4" sm="12">
<MudRadio Option=@("false") Color="Color.Primary" id="searchStateDisconnected">Disconnected</MudRadio>
</MudItem>
<MudItem md="4" sm="12">
<MudRadio Option=@("") Color="Color.Secondary" id="searchStateAll">All</MudRadio>
</MudItem>
</MudRadioGroup>
</MudItem>
</MudGrid>

<MudItem xs="12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
deviceDetails.IsConnected = device.IsConnected;
deviceDetails.IsEnabled = device.IsEnabled;
deviceDetails.StatusUpdatedTime = device.StatusUpdatedTime;
deviceDetails.LastActivityTime = device.LastActivityTime;
deviceDetails.Labels = device.Labels.ToList();
deviceDetails.LayerId = device.LayerId;

Expand Down
33 changes: 2 additions & 31 deletions src/IoTHub.Portal.Client/Pages/Devices/DeviceListPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,6 @@
</MudRadioGroup>

</MudItem>
<MudItem xs="12" md="6">
<MudText>Connection state</MudText>
<MudRadioGroup @bind-SelectedOption="@searchState" Style="display:flex;align-items:baseline">
<MudItem md="4" sm="12">
<MudRadio Option=@("true") Color="Color.Primary" id="searchStateConnected">Connected</MudRadio>
</MudItem>
<MudItem md="4" sm="12">
<MudRadio Option=@("false") Color="Color.Primary" id="searchStateDisconnected">Disconnected</MudRadio>
</MudItem>
<MudItem md="4" sm="12">
<MudRadio Option=@("") Color="Color.Secondary" id="searchStateAll">All</MudRadio>
</MudItem>
</MudRadioGroup>
</MudItem>
</MudGrid>

<MudItem xs="12">
Expand Down Expand Up @@ -161,8 +147,7 @@
<MudTh></MudTh>
<MudTh><MudTableSortLabel id="sortDeviceId" SortLabel="Id" T="DeviceListItem">Device</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="IsEnabled" T="DeviceListItem">Allowed</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="IsConnected" T="DeviceListItem">Connection state</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="StatusUpdatedTime" T="DeviceListItem">Last status update</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="LastActivityTime" T="DeviceListItem">Last activity time</MudTableSortLabel></MudTh>
@if (Portal.IsLoRaSupported)
{
<MudTh Style="text-align: center">Telemetry</MudTh>
Expand Down Expand Up @@ -199,21 +184,7 @@
}
</MudTd>

<MudTd DataLabel="Connection" Style="text-align: center">
@if (context.IsConnected)
{
<MudTooltip Text="Device is connected">
<MudIcon Icon="@Icons.Material.Filled.Wifi" Color="Color.Success" />
</MudTooltip>
}
else
{
<MudTooltip Text="Device is not connected">
<MudIcon Icon="@Icons.Material.Filled.WifiOff" Color="Color.Error" />
</MudTooltip>
}
</MudTd>
<MudTd DataLabel="LSU" Style="text-align: center">@context.StatusUpdatedTime</MudTd>
<MudTd DataLabel="LSU" Style="text-align: center">@context.LastActivityTime</MudTd>

@if (Portal.IsLoRaSupported)
{
Expand Down
1 change: 1 addition & 0 deletions src/IoTHub.Portal.Client/Pages/Layer/LayerListPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
deviceDetails.IsConnected = device.IsConnected;
deviceDetails.IsEnabled = device.IsEnabled;
deviceDetails.StatusUpdatedTime = device.StatusUpdatedTime;
deviceDetails.LastActivityTime = device.LastActivityTime;
deviceDetails.Labels = device.Labels.ToList();
deviceDetails.LayerId = device.LayerId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
<MudItem xs="12">
<MudTable T="ConcentratorDto" id="concentrators-listing" ServerData=@LoadItems Dense=true Hover=true Bordered=true Striped=true @ref="table" Loading="@IsLoading" OnRowClick="@((e) => GoToDetails(e.Item))" RowStyle="cursor: pointer;">
<ColGroup>
<col style="width: 60%;" />
<col style="width: 10%;" />
<col style="width: 70%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
Expand All @@ -31,7 +30,6 @@
<HeaderContent>
<MudTh><MudTableSortLabel SortLabel="Name" T="ConcentratorDto">Device</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="IsEnabled" T="ConcentratorDto">Allowed</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="IsConnected" T="ConcentratorDto">Connection state</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center">See details</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
Expand All @@ -54,20 +52,6 @@
}
</MudTd>

<MudTd DataLabel="Connection" Style="text-align: center">
@if (context.IsConnected)
{
<MudTooltip Text="Concentrator is connected">
<MudIcon Icon="@Icons.Material.Filled.Wifi" Color="Color.Success" />
</MudTooltip>
}
else
{
<MudTooltip Text="Concentrator is not connected">
<MudIcon Icon="@Icons.Material.Filled.WifiOff" Color="Color.Error" />
</MudTooltip>
}
</MudTd>
<MudTd DataLabel="Details" Style="text-align: center">
<MudTooltip Text="See concentrator details">
<MudIconButton Icon="@Icons.Material.Filled.Visibility" Color="Color.Default" OnClick="@(() => GoToDetails(context))" />
Expand Down
5 changes: 5 additions & 0 deletions src/IoTHub.Portal.Domain/Entities/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class Device : EntityBase
/// </summary>
public DateTime StatusUpdatedTime { get; set; }

/// <summary>
/// Gets or sets the last activity time.
/// </summary>
public DateTime LastActivityTime { get; set; }

/// <summary>
/// The current version of the device stored n he database
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions src/IoTHub.Portal.Domain/Entities/IDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public interface IDevice
/// </summary>
public DateTime StatusUpdatedTime { get; set; }

/// <summary>
/// Gets or sets the last activity time.
/// </summary>
public DateTime LastActivityTime { get; set; }

/// <summary>
/// The device labels.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/IoTHub.Portal.Infrastructure/Mappers/DeviceTwinMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public DeviceDetails CreateDeviceDetails(Twin twin, IEnumerable<string> tags)
IsConnected = twin.ConnectionState == DeviceConnectionState.Connected,
IsEnabled = twin.Status == DeviceStatus.Enabled,
StatusUpdatedTime = twin.StatusUpdatedTime ?? DateTime.MinValue,
LastActivityTime = twin.LastActivityTime ?? DateTime.MinValue,
LayerId = DeviceHelper.RetrieveTagValue(twin, nameof(DeviceDetails.LayerId))
};

Expand All @@ -57,6 +58,7 @@ public DeviceListItem CreateDeviceListItem(Twin twin)
IsConnected = twin.ConnectionState == DeviceConnectionState.Connected,
IsEnabled = twin.Status == DeviceStatus.Enabled,
StatusUpdatedTime = twin.StatusUpdatedTime ?? DateTime.MinValue,
LastActivityTime = twin.LastActivityTime ?? DateTime.MinValue,
DeviceName = DeviceHelper.RetrieveTagValue(twin, nameof(DeviceListItem.DeviceName)),
Image = this.deviceModelImageManager.GetDeviceModelImageAsync(DeviceHelper.RetrieveTagValue(twin, nameof(DeviceDetails.ModelId))!).Result,
SupportLoRaFeatures = bool.Parse(DeviceHelper.RetrieveTagValue(twin, nameof(DeviceListItem.SupportLoRaFeatures)) ?? "false"),
Expand Down
2 changes: 2 additions & 0 deletions src/IoTHub.Portal.Infrastructure/Mappers/LoRaDeviceMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public LoRaDeviceDetails CreateDeviceDetails(Twin twin, IEnumerable<string> tags
IsConnected = twin.ConnectionState == DeviceConnectionState.Connected,
IsEnabled = twin.Status == DeviceStatus.Enabled,
StatusUpdatedTime = twin.StatusUpdatedTime ?? DateTime.MinValue,
LastActivityTime = twin.LastActivityTime ?? DateTime.MinValue,
LayerId = DeviceHelper.RetrieveTagValue(twin, nameof(LoRaDeviceDetails.LayerId)),
GatewayID = DeviceHelper.RetrieveDesiredPropertyValue(twin, nameof(LoRaDeviceDetails.GatewayID)),
SensorDecoder =
Expand Down Expand Up @@ -150,6 +151,7 @@ public DeviceListItem CreateDeviceListItem(Twin twin)
IsEnabled = twin.Status == DeviceStatus.Enabled,
LayerId = DeviceHelper.RetrieveTagValue(twin, nameof(LoRaDeviceDetails.LayerId)),
StatusUpdatedTime = twin.StatusUpdatedTime ?? DateTime.MinValue,
LastActivityTime = twin.LastActivityTime ?? DateTime.MinValue,
SupportLoRaFeatures =
bool.Parse(DeviceHelper.RetrieveTagValue(twin, nameof(DeviceListItem.SupportLoRaFeatures)) ??
"false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public async Task<PaginatedResult<DeviceListItem>> GetDevices(string searchText
IsEnabled = device.IsEnabled,
IsConnected = device.IsConnected,
StatusUpdatedTime = device.StatusUpdatedTime,
LastActivityTime = device.LastActivityTime,
DeviceModelId = device.DeviceModelId,
SupportLoRaFeatures = device is LorawanDevice,
HasLoRaTelemetry = device is LorawanDevice && ((LorawanDevice) device).Telemetry.Any(),
Expand Down
Loading

0 comments on commit c30e0fa

Please sign in to comment.