feat(app): add alerts, docker, and health views
This commit is contained in:
1 parent
3d474bb927
commit
302d77e620
6 files changed
+162
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:Vantage.App.ViewModels"
|
||||
xmlns:alerts="clr-namespace:Vantage.Core.Alerts;assembly=Vantage.Core"
|
||||
mc:Ignorable="d"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Class="Vantage.App.Views.AlertsView"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
x:CompileBindings="True">
|
||||
|
||||
<Grid RowDefinitions="Auto,*" Margin="4">
|
||||
|
||||
<TextBlock Grid.Row="0" Margin="2,0,0,8" Foreground="#8891A0" FontSize="12"
|
||||
Text="{Binding FiringAlertCount, StringFormat='Firing: {0}'}" />
|
||||
|
||||
<Border Grid.Row="1" Classes="card">
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{Binding Alerts}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="alerts:AlertStatus">
|
||||
<Grid ColumnDefinitions="Auto,2*,2*,Auto" Margin="0,7">
|
||||
<Border Grid.Column="0" Width="8" Margin="0,0,10,0" CornerRadius="2" Background="#333A45" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding RuleName}" FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding HostId}" Foreground="#8891A0" FontSize="11" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Metric}" />
|
||||
<TextBlock Foreground="#8891A0" FontSize="11"
|
||||
Text="{Binding LastValue, StringFormat='value {0:0.##}'}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||
<TextBlock Text="{Binding State}" HorizontalAlignment="Right" FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding Severity}" Foreground="#8891A0" FontSize="11" HorizontalAlignment="Right" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Vantage.App.Views;
|
||||
|
||||
public partial class AlertsView : UserControl
|
||||
{
|
||||
public AlertsView() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:Vantage.App.ViewModels"
|
||||
xmlns:conv="clr-namespace:Vantage.App.Converters"
|
||||
mc:Ignorable="d"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Class="Vantage.App.Views.DockerView"
|
||||
x:DataType="vm:DockerViewModel"
|
||||
x:CompileBindings="True">
|
||||
|
||||
<Grid RowDefinitions="Auto,*,Auto" Margin="4">
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="0,0,0,8">
|
||||
<Button Content="Refresh" Command="{Binding RefreshCommand}" />
|
||||
<TextBlock Text="Loading..." Foreground="#8891A0" VerticalAlignment="Center"
|
||||
IsVisible="{Binding IsBusy}" />
|
||||
<TextBlock Text="{Binding LastError}" Foreground="{DynamicResource DownBrush}" VerticalAlignment="Center"
|
||||
IsVisible="{Binding LastError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Row="1" Classes="card">
|
||||
<ListBox ItemsSource="{Binding Containers}"
|
||||
SelectedItem="{Binding SelectedContainer}"
|
||||
Background="Transparent">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:DockerContainerViewModel">
|
||||
<Grid ColumnDefinitions="Auto,*,2*,Auto" Margin="0,4">
|
||||
<Ellipse Grid.Column="0" Width="10" Height="10" VerticalAlignment="Center" Margin="0,0,10,0"
|
||||
Fill="{Binding IsRunning, Converter={x:Static conv:StateBrushConverters.RunningBrush}}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="SemiBold" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Image}" Foreground="#8891A0" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="3" Text="{Binding StatusText}" Foreground="#8891A0" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="8" Margin="0,10,0,0">
|
||||
<Button Content="Start" Command="{Binding StartCommand}" CommandParameter="{Binding SelectedContainer}" />
|
||||
<Button Content="Stop" Command="{Binding StopCommand}" CommandParameter="{Binding SelectedContainer}" />
|
||||
<Button Content="Restart" Command="{Binding RestartCommand}" CommandParameter="{Binding SelectedContainer}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Vantage.App.Views;
|
||||
|
||||
public partial class DockerView : UserControl
|
||||
{
|
||||
public DockerView() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:Vantage.App.ViewModels"
|
||||
xmlns:conv="clr-namespace:Vantage.App.Converters"
|
||||
mc:Ignorable="d"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Class="Vantage.App.Views.HealthView"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
x:CompileBindings="True">
|
||||
|
||||
<Grid RowDefinitions="Auto,*" Margin="4">
|
||||
|
||||
<Button Grid.Row="0" Content="Run all" Command="{Binding RunAllHealthCommand}" Margin="0,0,0,8" />
|
||||
|
||||
<Border Grid.Row="1" Classes="card">
|
||||
<ListBox ItemsSource="{Binding HealthChecks}" Background="Transparent">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:HealthCheckViewModel">
|
||||
<Grid ColumnDefinitions="Auto,2*,3*,Auto,Auto" Margin="0,6">
|
||||
<Ellipse Grid.Column="0" Width="10" Height="10" VerticalAlignment="Center" Margin="0,0,10,0"
|
||||
Fill="{Binding Status, Converter={x:Static conv:StateBrushConverters.HealthBrush}}" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding KindText}" Foreground="#8891A0" FontSize="11" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding StatusText}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding Target}" Foreground="#8891A0" FontSize="11" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="3" VerticalAlignment="Center" Margin="8,0" HorizontalAlignment="Right">
|
||||
<TextBlock Text="{Binding LatencyText}" HorizontalAlignment="Right" />
|
||||
<TextBlock Text="{Binding LastCheckedText}" Foreground="#8891A0" FontSize="11" HorizontalAlignment="Right" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="4" Content="Check" Command="{Binding RunCommand}" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Vantage.App.Views;
|
||||
|
||||
public partial class HealthView : UserControl
|
||||
{
|
||||
public HealthView() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
Reference in new issue
Block a user