Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update devices pagination to distinguish devices that have telemetry #1641 #1658

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
@if (Portal.IsLoRaSupported)
{
<MudTd DataLabel="Telemetry" Style="text-align: center">
@if (context.SupportLoRaFeatures)
@if (context.HasLoRaTelemetry)
{
<MudTooltip Text="See device telemetries">
<MudIconButton id="@($"show-device-telemetry-{@context.DeviceID}")" Icon="@Icons.Filled.ShowChart" Color="Color.Default" OnClick="@(() => ShowDeviceTelemetry(context))" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public async Task<PaginatedResult<DeviceListItem>> GetDevices(string searchText
StatusUpdatedTime = device.StatusUpdatedTime,
DeviceModelId = device.DeviceModelId,
SupportLoRaFeatures = device is LorawanDevice,
HasLoRaTelemetry = device is LorawanDevice && ((LorawanDevice) device).Telemetry.Any(),
Labels = device.Labels
.Union(device.DeviceModel.Labels)
.Select(x => new LabelDto
Expand Down
5 changes: 5 additions & 0 deletions src/AzureIoTHub.Portal.Shared/Models/v1.0/DeviceListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public class DeviceListItem
/// </summary>
public bool SupportLoRaFeatures { get; set; }

/// <summary>
/// A value indicating whether the device has telemetry.
/// </summary>
public bool HasLoRaTelemetry { get; set; }

/// <summary>
/// The device last status updated time.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void ShowDeviceTelemetry_Clicked_LoRaDeviceTelemetryDialogIsShown()
service.GetDevices($"{this.apiBaseUrl}?pageNumber=0&pageSize=10&searchText=&searchStatus=&searchState=&orderBy=&modelId="))
.ReturnsAsync(new PaginationResult<DeviceListItem>
{
Items = new[] { new DeviceListItem { DeviceID = deviceId, SupportLoRaFeatures = true } }
Items = new[] { new DeviceListItem { DeviceID = deviceId, SupportLoRaFeatures = true, HasLoRaTelemetry = true } }
});

_ = this.mockDeviceClientService.Setup(service => service.GetAvailableLabels())
Expand Down