Skip to content

Commit

Permalink
Add warning on device card for outdated devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 26, 2021
1 parent 2b67448 commit db3850d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Server/Components/Devices/DeviceCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@

<div class="card-header">
<div>

<i class="oi oi-power-standby @(Device.IsOnline ? "text-success" : "text-danger")"
title="@(Device.IsOnline ? "Online" : "Offline")"></i>
@if (Device.IsOnline)
{
if (IsOutdated)
{
<i class="oi oi-power-standby text-warning" title="Agent Outdated"></i>
}
else
{
<i class="oi oi-power-standby text-success" title="Online"></i>
}
}
else
{
<i class="oi oi-power-standby text-danger" title="Offline"></i>
}
</div>
<div class="overflow-hidden ml-2">
<div class="d-inline-block">
Expand Down
4 changes: 4 additions & 0 deletions Server/Components/Devices/DeviceCard.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public partial class DeviceCard : AuthComponentBase, IDisposable

private bool IsSelected => AppState.DevicesFrameSelectedDevices.Contains(Device.ID);

private bool IsOutdated =>
Version.TryParse(Device.AgentVersion, out var result) &&
result < ParentFrame.HighestVersion;

[Inject]
private IJsInterop JsInterop { get; set; }

Expand Down
4 changes: 4 additions & 0 deletions Server/Components/Devices/DevicesFrame.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public partial class DevicesFrame : AuthComponentBase, IDisposable
private string _selectedSortProperty = "DeviceName";
private ListSortDirection _sortDirection;

public Version HighestVersion { get; private set; }

[Inject]
private IClientAppState AppState { get; set; }

Expand Down Expand Up @@ -222,6 +224,8 @@ private void LoadDevices()

_allDevices.AddRange(devices);

HighestVersion = _allDevices.Max(x => Version.TryParse(x.AgentVersion, out var result) ? result : default);

FilterDevices();
}

Expand Down

2 comments on commit db3850d

@futuredata123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're doing fantastic! Needn't bother responding, just sharing a thought bubble.. this would also be a interesting spot to put activity like user "idle" or "active" last check? I do not know enough though to know if it's possible.

@bitbound
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! :)

I opened #316 to track these ideas.

Please sign in to comment.