Show the list of posture checks.

This commit is contained in:
Jeremy Tellier - ROG
2021-03-25 21:17:44 +01:00
parent 33c060d6fd
commit 90ec0acb7e
3 changed files with 78 additions and 68 deletions
+5
View File
@@ -924,6 +924,11 @@ namespace ZitiDesktopEdge {
idItem.OnStatusChanged += Id_OnStatusChanged;
idItem.Identity = id;
IdList.Children.Add(idItem);
if (IdentityMenu.Visibility==Visibility.Visible) {
if (id.Fingerprint==IdentityMenu.Identity.Fingerprint) {
IdentityMenu.Identity = id;
}
}
}
//IdList.Height = ;
DoubleAnimation animation = new DoubleAnimation((double)(ids.Length * 64), TimeSpan.FromSeconds(.3));
@@ -1,82 +1,86 @@
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZitiDesktopEdge.Models;
using ZitiDesktopEdge.ServiceClient;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZitiDesktopEdge.Models;
using ZitiDesktopEdge.ServiceClient;
namespace ZitiDesktopEdge {
/// <summary>
/// Interaction logic for MenuItem.xaml
/// </summary>
public partial class ServiceInfo : UserControl {
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private ZitiService _info;
public delegate void Mesage(string message);
public event Mesage OnMessage;
public delegate void Details(ZitiService info);
public event Details OnDetails;
public ZitiService Info {
get {
return _info;
}
set {
this._info = value;
MainEdit.ToolTip = this._info.ToString();
MainEdit.Text = this._info.ToString();
MainLabel.ToolTip = this._info.Name;
MainLabel.Text = this._info.Name;
WarningColumn.Width = new GridLength(0);
if (this._info.Warning.Length > 0) {
WarnIcon.ToolTip = this._info.Warning;
WarnIcon.Visibility = Visibility.Visible;
WarningColumn.Width = new GridLength(30);
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private ZitiService _info;
public delegate void Mesage(string message);
public event Mesage OnMessage;
public delegate void Details(ZitiService info);
public event Details OnDetails;
public ZitiService Info {
get {
return _info;
}
set {
this._info = value;
MainEdit.ToolTip = this._info.ToString();
MainEdit.Text = this._info.ToString();
MainLabel.ToolTip = this._info.Name;
MainLabel.Text = this._info.Name;
WarningColumn.Width = new GridLength(0);
if (this._info.Warning.Length > 0) {
WarnIcon.ToolTip = this._info.Warning;
WarnIcon.Visibility = Visibility.Visible;
WarningColumn.Width = new GridLength(30);
}
if (this._info.IsAccessable) {
// the service is accessible - failing posture checks "probably" should be ignored...
logger.Debug("Service {0} is marked as accessible. failing posture checks probably do not matter", this._info.Name);
} else {
if (this._info.PostureChecks != null && this._info.PostureChecks.Length > 0) {
string checks = "";
bool hasFailing = false;
for (int i = 0; i < this._info.PostureChecks.Length; i++) {
if (!this._info.PostureChecks[i].IsPassing) {
WarnIcon.ToolTip = "Posture Check Failing: " + this._info.PostureChecks[i].QueryType;
hasFailing = true;
checks += ((checks.Length>0)?", ":"")+this._info.PostureChecks[i].QueryType;
WarnIcon.Visibility = Visibility.Visible;
WarningColumn.Width = new GridLength(30);
}
}
}
}
}
}
public ServiceInfo() {
InitializeComponent();
}
private void MainEdit_PreviewMouseUp(object sender, MouseButtonEventArgs e) {
(sender as TextBox).SelectAll();
}
private void WarnIcon_MouseUp(object sender, MouseButtonEventArgs e) {
OnMessage?.Invoke(WarnIcon.ToolTip.ToString());
}
private void DetailIcon_MouseUp(object sender, MouseButtonEventArgs e) {
OnDetails?.Invoke(Info);
}
}
}
if (hasFailing) WarnIcon.ToolTip = "Posture Check Failing: " + checks;
}
}
}
}
public ServiceInfo() {
InitializeComponent();
}
private void MainEdit_PreviewMouseUp(object sender, MouseButtonEventArgs e) {
(sender as TextBox).SelectAll();
}
private void WarnIcon_MouseUp(object sender, MouseButtonEventArgs e) {
OnMessage?.Invoke(WarnIcon.ToolTip.ToString());
}
private void DetailIcon_MouseUp(object sender, MouseButtonEventArgs e) {
OnDetails?.Invoke(Info);
}
}
}
@@ -118,6 +118,7 @@
<Label Content="Protocols" Padding="10,0,0,0" FontWeight="Bold" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></Label>
<TextBox x:Name="DetailProtocols" MaxWidth="300" Background="Transparent" IsReadOnly="True" HorizontalAlignment="Stretch" Height="20" BorderThickness="0" TextAlignment="Left" Padding="0,0,0,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
</StackPanel>
<Image Source="/Assets/Images/closeBlack.png" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,40,40,0" Width="10" Height="10" Cursor="Hand" MouseUp="CloseDetails"></Image>
</Grid>