163 lines
11 KiB
XML
163 lines
11 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:u="https://irihi.tech/ursa"
|
|
xmlns:vm="using:Flawless.Client.ViewModels"
|
|
xmlns:views="clr-namespace:Flawless.Client.Views"
|
|
x:DataType="vm:SettingViewModel"
|
|
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="768"
|
|
x:Class="Flawless.Client.Views.SettingView">
|
|
|
|
<DockPanel Margin="50">
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="20">
|
|
<u:IconButton Height="4" Icon="{StaticResource SemiIconArrowLeft}" Content="Back"
|
|
Command="{Binding GoBackCommand}"/>
|
|
<Label FontWeight="400" FontSize="28" Content="Settings"/>
|
|
</StackPanel>
|
|
<TabControl TabStripPlacement="Left" Margin="0 20">
|
|
<TabItem Header="Account">
|
|
<ScrollViewer Width="600" HorizontalAlignment="Left" Margin="6">
|
|
<u:Form HorizontalAlignment="Stretch" VerticalAlignment="Stretch" LabelPosition="Top">
|
|
<Label IsVisible="{Binding LoginUser.IsAdmin}" Content="You are a server manager!"/>
|
|
<TextBox u:FormItem.Label="Username" IsReadOnly="True"
|
|
Text="{Binding LoginUser.Username, Mode=OneWay}"/>
|
|
<TextBox u:FormItem.Label="Nickname" Text="{Binding Nickname}"/>
|
|
<TextBox u:FormItem.Label="Email" Text="{Binding Email}"/>
|
|
<TextBox u:FormItem.Label="Phone Number" Text="{Binding PhoneNumber}"/>
|
|
<u:EnumSelector u:FormItem.Label="Gender" SelectedValue="{Binding Gender}"/>
|
|
<TextBox u:FormItem.Label="Bio" Classes="TextArea" Text="{Binding Bio}"/>
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
|
<u:IconButton Content="Save" Command="{Binding SaveAccountChangesCommand}"/>
|
|
<u:IconButton Content="Change Password" Command="{Binding ChangePasswordCommand}"/>
|
|
<u:IconButton Classes="Danger" Content="Delete" Command="{Binding DeleteSelfAccountCommand}"/>
|
|
</StackPanel>
|
|
</u:Form>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem Header="Preference">
|
|
<ScrollViewer Width="600" HorizontalAlignment="Left" Margin="6">
|
|
<u:Form HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<!-- <u:FormItem Label="Default Storage Location"> -->
|
|
<!-- <u:PathPicker/> -->
|
|
<!-- </u:FormItem> -->
|
|
<u:FormGroup Header="Extern Tools">
|
|
<u:PathPicker u:FormItem.Label="Diff Tool"/>
|
|
</u:FormGroup>
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
|
<u:IconButton Content="Save" Command="{Binding SaveClientPreferenceCommand}"/>
|
|
<u:IconButton Classes="Danger" Content="Reset" Command="{Binding ResetClientPreferenceCommand}"/>
|
|
</StackPanel>
|
|
</u:Form>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem IsVisible="{Binding LoginUser.IsAdmin}" Header="Server">
|
|
<ScrollViewer Width="600" HorizontalAlignment="Left" Margin="6">
|
|
<u:Form HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<u:FormGroup>
|
|
<TextBox u:FormItem.Label="IP Whitelist" Classes="TextArea" AcceptsReturn="True"
|
|
Text="{Binding ServerWhitelist}"/>
|
|
<TextBox u:FormItem.Label="IP Blacklist" Classes="TextArea" AcceptsReturn="True"
|
|
Text="{Binding ServerBlacklist}"/>
|
|
</u:FormGroup>
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
|
<u:IconButton Content="Save" Command="{Binding SaveServerPreferenceCommand}"/>
|
|
<u:IconButton Classes="Danger" Content="Reset"
|
|
Command="{Binding ResetServerPreferenceCommand}"/>
|
|
</StackPanel>
|
|
</u:Form>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem IsVisible="{Binding LoginUser.IsAdmin}" Header="Users">
|
|
<Grid RowDefinitions="Auto, *" Margin="10">
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
|
<Button Content="Refresh"
|
|
VerticalAlignment="Bottom"
|
|
HorizontalAlignment="Right"
|
|
Command="{Binding RefreshUsersCommand}"/>
|
|
<Button Content="Add"
|
|
VerticalAlignment="Bottom"
|
|
HorizontalAlignment="Right"
|
|
Command="{Binding CreateUserCommand}"/>
|
|
</StackPanel>
|
|
|
|
<ListBox Grid.Row="1" ItemsSource="{Binding Users, Mode=TwoWay}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Vertical" Spacing="12" Margin="6">
|
|
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
|
<PathIcon Data="{StaticResource SemiIconCrown}" Height="12" Width="12" IsVisible="{Binding IsAdmin}"/>
|
|
<PathIcon Data="{StaticResource SemiIconMinusCircle}" Height="12" Width="12" IsVisible="{Binding !IsActive}"/>
|
|
<Label Content="{Binding Username}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center" IsEnabled="{Binding CanEdit}">
|
|
<Button Content="Enable"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).ActivateUserCommand}"
|
|
CommandParameter="{Binding Username}"
|
|
IsVisible="{Binding !IsActive}"/>
|
|
<Button Content="Disable"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).InactivateUserCommand}"
|
|
CommandParameter="{Binding Username}"
|
|
IsVisible="{Binding IsActive}"/>
|
|
|
|
<Button Content="Promote"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).PromoteUserCommand}"
|
|
CommandParameter="{Binding Username}"
|
|
IsVisible="{Binding !IsAdmin}"
|
|
Classes="Danger"/>
|
|
|
|
<Button Content="Demote"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).DemoteUserCommand}"
|
|
CommandParameter="{Binding Username}"
|
|
IsVisible="{Binding IsAdmin}"
|
|
Classes="Danger"/>
|
|
|
|
<Button Content="Delete"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).DeleteUserCommand}"
|
|
CommandParameter="{Binding Username}"
|
|
Classes="Danger"/>
|
|
|
|
<Button Content="Reset Password"
|
|
Command="{Binding $parent[views:SettingView].((vm:SettingViewModel)DataContext).ForceUpdateUserPasswordCommand}"
|
|
CommandParameter="{Binding Username}"/>
|
|
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Grid>
|
|
</TabItem>
|
|
<TabItem IsVisible="{Binding LoginUser.IsAdmin}" Header="Logfile">
|
|
<StackPanel Spacing="8" Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="4">
|
|
<DatePicker SelectedDate="{Binding LogSearchFrom}"/>
|
|
<Label Content=" → "/>
|
|
<DatePicker SelectedDate="{Binding LogSearchTo}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
|
<u:EnumSelector SelectedValue="{Binding Loglevel, Mode=TwoWay}"/>
|
|
<NumericUpDown Value="{Binding PageSize, Mode=TwoWay}" Minimum="10" Maximum="100"/>
|
|
<NumericUpDown Value="{Binding Page, Mode=TwoWay}" Minimum="1"/>
|
|
<u:IconButton Icon="{StaticResource SemiIconSearch}"
|
|
Command="{Binding DownloadServerLogCommand}"/>
|
|
</StackPanel>
|
|
<ListBox ItemsSource="{Binding Logs, Mode=TwoWay}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid RowDefinitions="Auto, *" ColumnDefinitions="Auto,*,Auto">
|
|
<Label Grid.Row="0" Grid.Column="0" FontSize="16" Content="{Binding Level}"/>
|
|
<Label Grid.Row="0" Grid.Column="2" FontSize="16" Content="{Binding Time}"/>
|
|
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Content="{Binding Message}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</StackPanel>
|
|
</TabItem>
|
|
</TabControl>
|
|
</DockPanel>
|
|
</UserControl>
|