240 lines
15 KiB
XML
240 lines
15 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:OTSSignsOrchestrator.Desktop.ViewModels"
|
|
xmlns:dto="using:OTSSignsOrchestrator.Core.Models.DTOs"
|
|
xmlns:svc="using:OTSSignsOrchestrator.Core.Services"
|
|
x:Class="OTSSignsOrchestrator.Desktop.Views.InstanceDetailsWindow"
|
|
x:DataType="vm:InstanceDetailsViewModel"
|
|
Title="Instance Details"
|
|
Width="620" Height="860"
|
|
MinWidth="520" MinHeight="700"
|
|
WindowStartupLocation="CenterOwner"
|
|
CanResize="True">
|
|
|
|
<DockPanel Margin="24">
|
|
|
|
<!-- Header -->
|
|
<StackPanel DockPanel.Dock="Top" Margin="0,0,0,16">
|
|
<StackPanel Orientation="Horizontal" Spacing="10">
|
|
<TextBlock Text="{Binding StackName}" FontSize="22" FontWeight="Bold"
|
|
Foreground="{StaticResource AccentBrush}" />
|
|
</StackPanel>
|
|
<TextBlock Text="{Binding HostLabel, StringFormat='Host: {0}'}"
|
|
FontSize="12" Foreground="{StaticResource TextMutedBrush}" Margin="0,2,0,0" />
|
|
<TextBlock Text="{Binding InstanceUrl}"
|
|
FontSize="11" Foreground="{StaticResource TextMutedBrush}" />
|
|
</StackPanel>
|
|
|
|
<!-- Status bar -->
|
|
<TextBlock DockPanel.Dock="Bottom" Text="{Binding StatusMessage}" Classes="status"
|
|
Margin="0,12,0,0" TextWrapping="Wrap" />
|
|
|
|
<!-- Main scrollable content -->
|
|
<ScrollViewer>
|
|
<StackPanel Spacing="16">
|
|
|
|
<!-- ═══ Pending Setup Banner ═══ -->
|
|
<Border IsVisible="{Binding IsPendingSetup}"
|
|
Background="#1F2A1A" BorderBrush="#4ADE80" BorderThickness="1"
|
|
CornerRadius="8" Padding="14,10">
|
|
<StackPanel Orientation="Horizontal" Spacing="10">
|
|
<TextBlock Text="⚙" FontSize="18" VerticalAlignment="Center" Foreground="#4ADE80" />
|
|
<StackPanel>
|
|
<TextBlock Text="Pending Setup" FontSize="14" FontWeight="SemiBold"
|
|
Foreground="#4ADE80" />
|
|
<TextBlock FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"
|
|
TextWrapping="Wrap"
|
|
Text="Enter your Xibo OAuth credentials below to complete instance initialisation." />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ═══ OTS Admin Account ═══ -->
|
|
<Border Classes="card">
|
|
<StackPanel Spacing="8">
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,4">
|
|
<Border Width="4" Height="20" CornerRadius="2" Background="#F97316" />
|
|
<TextBlock Text="OTS Admin Account" FontSize="16" FontWeight="SemiBold"
|
|
Foreground="#F97316" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<TextBlock Text="Username" FontSize="12" Foreground="{StaticResource TextSecondaryBrush}" />
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<TextBox Grid.Column="0" Text="{Binding AdminUsername}" IsReadOnly="True" />
|
|
<Button Grid.Column="1" Content="Copy" Margin="4,0,0,0"
|
|
Command="{Binding CopyAdminPasswordCommand}" />
|
|
</Grid>
|
|
|
|
<TextBlock Text="Password" FontSize="12" Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0" />
|
|
<Grid ColumnDefinitions="*,Auto,Auto,Auto">
|
|
<TextBox Grid.Column="0" Text="{Binding AdminPasswordDisplay}" IsReadOnly="True"
|
|
FontFamily="Consolas,monospace" />
|
|
<Button Grid.Column="1" Content="Show" Margin="4,0,0,0"
|
|
IsVisible="{Binding !AdminPasswordVisible}"
|
|
Command="{Binding ToggleAdminPasswordVisibilityCommand}" />
|
|
<Button Grid.Column="2" Content="Hide" Margin="4,0,0,0"
|
|
IsVisible="{Binding AdminPasswordVisible}"
|
|
Command="{Binding ToggleAdminPasswordVisibilityCommand}" />
|
|
<Button Grid.Column="3" Content="Copy" Margin="4,0,0,0"
|
|
Command="{Binding CopyAdminPasswordCommand}" />
|
|
</Grid>
|
|
|
|
<Button Content="Rotate Admin Password"
|
|
Command="{Binding RotateAdminPasswordCommand}"
|
|
IsEnabled="{Binding !IsBusy}"
|
|
Classes="accent"
|
|
Margin="0,6,0,0" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ═══ Database Credentials ═══ -->
|
|
<Border Classes="card">
|
|
<StackPanel Spacing="8">
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,4">
|
|
<Border Width="4" Height="20" CornerRadius="2" Background="#4ADE80" />
|
|
<TextBlock Text="Database Credentials" FontSize="16" FontWeight="SemiBold"
|
|
Foreground="#4ADE80" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<TextBlock Text="MySQL Username" FontSize="12" Foreground="{StaticResource TextSecondaryBrush}" />
|
|
<Grid ColumnDefinitions="*">
|
|
<TextBox Text="{Binding DbUsername}" IsReadOnly="True" />
|
|
</Grid>
|
|
|
|
<TextBlock Text="MySQL Password" FontSize="12" Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0" />
|
|
<Grid ColumnDefinitions="*,Auto,Auto,Auto">
|
|
<TextBox Grid.Column="0" Text="{Binding DbPasswordDisplay}" IsReadOnly="True"
|
|
FontFamily="Consolas,monospace" />
|
|
<Button Grid.Column="1" Content="Show" Margin="4,0,0,0"
|
|
IsVisible="{Binding !DbPasswordVisible}"
|
|
Command="{Binding ToggleDbPasswordVisibilityCommand}" />
|
|
<Button Grid.Column="2" Content="Hide" Margin="4,0,0,0"
|
|
IsVisible="{Binding DbPasswordVisible}"
|
|
Command="{Binding ToggleDbPasswordVisibilityCommand}" />
|
|
<Button Grid.Column="3" Content="Copy" Margin="4,0,0,0"
|
|
Command="{Binding CopyDbPasswordCommand}" />
|
|
</Grid>
|
|
|
|
<Button Content="Rotate DB Password"
|
|
Command="{Binding RotateDbPasswordCommand}"
|
|
IsEnabled="{Binding !IsBusy}"
|
|
Margin="0,6,0,0" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ═══ Xibo OAuth2 Application ═══ -->
|
|
<Border Classes="card">
|
|
<StackPanel Spacing="8">
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,4">
|
|
<Border Width="4" Height="20" CornerRadius="2" Background="#60A5FA" />
|
|
<TextBlock Text="OTS OAuth2 Application" FontSize="16" FontWeight="SemiBold"
|
|
Foreground="#60A5FA" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
<TextBlock Text="Client credentials used by the OTS orchestrator for Xibo API access."
|
|
FontSize="12" Foreground="{StaticResource TextMutedBrush}" Margin="0,0,0,6"
|
|
TextWrapping="Wrap" />
|
|
|
|
<!-- ── Pending: editable credential input ── -->
|
|
<StackPanel Spacing="8" IsVisible="{Binding IsPendingSetup}">
|
|
<TextBlock FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"
|
|
TextWrapping="Wrap"
|
|
Text="Log into the Xibo CMS as xibo_admin (password: password), go to Administration → Applications, create a client_credentials app, then paste the credentials here." />
|
|
|
|
<TextBlock Text="Client ID" FontSize="12"
|
|
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0" />
|
|
<TextBox Text="{Binding InitClientId}" Watermark="OAuth2 Client ID" />
|
|
|
|
<TextBlock Text="Client Secret" FontSize="12"
|
|
Foreground="{StaticResource TextSecondaryBrush}" />
|
|
<TextBox Text="{Binding InitClientSecret}" PasswordChar="●"
|
|
Watermark="(paste from Xibo Applications page)" />
|
|
|
|
<Button Content="Initialize Instance"
|
|
Command="{Binding InitializeCommand}"
|
|
IsEnabled="{Binding !IsBusy}"
|
|
Classes="accent"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
Padding="14,10" FontSize="14"
|
|
Margin="0,8,0,0" />
|
|
</StackPanel>
|
|
|
|
<!-- ── Initialized: read-only display ── -->
|
|
<StackPanel Spacing="8" IsVisible="{Binding !IsPendingSetup}">
|
|
<TextBlock Text="Client ID" FontSize="12"
|
|
Foreground="{StaticResource TextSecondaryBrush}" />
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<TextBox Grid.Column="0" Text="{Binding OAuthClientId}" IsReadOnly="True"
|
|
FontFamily="Consolas,monospace" />
|
|
<Button Grid.Column="1" Content="Copy" Margin="4,0,0,0"
|
|
Command="{Binding CopyOAuthClientIdCommand}" />
|
|
</Grid>
|
|
|
|
<TextBlock Text="Client Secret" FontSize="12"
|
|
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0" />
|
|
<Grid ColumnDefinitions="*,Auto,Auto,Auto">
|
|
<TextBox Grid.Column="0" Text="{Binding OAuthSecretDisplay}" IsReadOnly="True"
|
|
FontFamily="Consolas,monospace" />
|
|
<Button Grid.Column="1" Content="Show" Margin="4,0,0,0"
|
|
IsVisible="{Binding !OAuthSecretVisible}"
|
|
Command="{Binding ToggleOAuthSecretVisibilityCommand}" />
|
|
<Button Grid.Column="2" Content="Hide" Margin="4,0,0,0"
|
|
IsVisible="{Binding OAuthSecretVisible}"
|
|
Command="{Binding ToggleOAuthSecretVisibilityCommand}" />
|
|
<Button Grid.Column="3" Content="Copy" Margin="4,0,0,0"
|
|
Command="{Binding CopyOAuthSecretCommand}" />
|
|
</Grid>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ═══ Stack Services ═══ -->
|
|
<Border Classes="card">
|
|
<StackPanel Spacing="8">
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,4">
|
|
<Border Width="4" Height="20" CornerRadius="2" Background="#A78BFA" />
|
|
<TextBlock Text="Stack Services" FontSize="16" FontWeight="SemiBold"
|
|
Foreground="#A78BFA" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
<TextBlock Text="Force-restart individual services within this stack."
|
|
FontSize="12" Foreground="{StaticResource TextMutedBrush}" Margin="0,0,0,6"
|
|
TextWrapping="Wrap" />
|
|
|
|
<!-- Loading indicator -->
|
|
<TextBlock Text="Loading services..." FontSize="12"
|
|
Foreground="{StaticResource TextMutedBrush}"
|
|
IsVisible="{Binding IsLoadingServices}" />
|
|
|
|
<!-- Services list -->
|
|
<ItemsControl ItemsSource="{Binding StackServices}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="svc:ServiceInfo">
|
|
<Border Background="#232336" CornerRadius="6" Padding="12,10" Margin="0,3"
|
|
BorderBrush="{StaticResource BorderSubtleBrush}" BorderThickness="1">
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<StackPanel Grid.Column="0" Spacing="3">
|
|
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" FontSize="13" />
|
|
<TextBlock Text="{Binding Image}" FontSize="11"
|
|
Foreground="{StaticResource TextMutedBrush}" />
|
|
<TextBlock Text="{Binding Replicas, StringFormat='Replicas: {0}'}"
|
|
FontSize="11" Foreground="{StaticResource TextSecondaryBrush}" />
|
|
</StackPanel>
|
|
<Button Grid.Column="1" Content="Restart"
|
|
Command="{Binding $parent[ItemsControl].((vm:InstanceDetailsViewModel)DataContext).RestartServiceCommand}"
|
|
CommandParameter="{Binding}"
|
|
IsEnabled="{Binding $parent[ItemsControl].((vm:InstanceDetailsViewModel)DataContext).IsBusy, Converter={x:Static BoolConverters.Not}}"
|
|
VerticalAlignment="Center"
|
|
FontSize="12" Padding="10,6"
|
|
ToolTip.Tip="Force-restart this service" />
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Window> |