Skip to content

Commit

Permalink
Added setting to the admin panel to hide/show deleted users
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Jun 12, 2024
1 parent f67f18e commit 500c471
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# GameVault App Changelog

## 1.10.2.0
Recommended Gamevault Server Version: `v12.1.1`
### Changes

- Bug fix: Crash on local download directory has wrong name format
- Added setting to the admin panel to hide/show deleted users

## 1.10.1.0
Recommended Gamevault Server Version: `v12.1.1`
### Changes
Expand Down
2 changes: 1 addition & 1 deletion gamevault/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: AssemblyVersion("1.10.1.0")]
[assembly: AssemblyVersion("1.10.2.0")]
[assembly: AssemblyCopyright("© Phalcode™. All Rights Reserved.")]
#if DEBUG
[assembly: XmlnsDefinition("debug-mode", "Namespace")]
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Converter/InverseNullConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class InverseNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (value == null);
return (value == null);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
12 changes: 11 additions & 1 deletion gamevault/UserControls/AdminConsoleUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded" KeyDown="Reload_Click" Focusable="True" IsVisibleChanged="UserControl_IsVisibleChanged">
<UserControl.Resources>
<conv:InverseEmptyStringConverter x:Key="InvertStringConv"/>
<conv:InverseNullConverter x:Key="InvertNullConv"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
Expand Down Expand Up @@ -39,6 +40,7 @@
</Hyperlink>
</TextBlock>
</StackPanel>
<mah:ToggleSwitch Header="Show deleted Users" IsOn="{Binding ShowDeletedUsers,Mode=TwoWay}" HorizontalAlignment="Right" Margin="0,0,430,0" Padding="0,0,0,0"/>
<local:IconButton Text="Backup / Restore Database" Icon="{StaticResource IconDatabase}" IconMargin="0,0,5,2" HorizontalAlignment="Right" FontSize="15" Width="225" Margin="10,10,200,10" Click="BackupRestore_Click"/>
<local:IconButton Text="Reindex Games" HorizontalAlignment="Right" FontSize="15" Icon="{StaticResource IconReload}" IconMargin="0,0,5,2" Width="140" Margin="10,10,46,10" Click="Reindex_Click"/>
<Grid x:Name="uiBtnReload" Style="{DynamicResource HoverEffect}" VerticalAlignment="Center" HorizontalAlignment="Right" Background="Transparent" Cursor="Hand" Width="30" Height="30" Margin="0,0,5,0" RenderTransformOrigin="0.5,0.5" ToolTip="Refresh admin console (F5)" MouseLeftButtonUp="Reload_Click">
Expand Down Expand Up @@ -73,8 +75,16 @@
<Grid Height="6" Width="100" Margin="1,1,0,0">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Setter Property="Visibility" Value="Visible"/>
<Setter Property="Background" Value="#26FF0000"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=DataContext.ShowDeletedUsers,RelativeSource={RelativeSource AncestorType=UserControl}}" Value="False" />
<Condition Binding="{Binding Path=DeletedAt,Converter={StaticResource InvertNullConv}}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Collapsed"/>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Path=DeletedAt}" Value="{x:Null}">
<Setter Property="Background" Value="{x:Null}"/>
</DataTrigger>
Expand All @@ -94,7 +104,7 @@
<Viewbox Width="11" Margin="0,0,10,0" HorizontalAlignment="Right">
<ComboBox ItemsSource="{Binding Path=DataContext.PermissionRoleEnumTypes,RelativeSource={RelativeSource AncestorType=UserControl}}" SelectedItem="{Binding Path=Role}" SelectionChanged="PermissionRole_SelectionChanged"/>
</Viewbox>

<Grid Style="{DynamicResource HoverEffect}" VerticalAlignment="Top" HorizontalAlignment="Right" Background="Transparent" Cursor="Hand" Width="2.5" Height="2.5" Margin="0,1.8,5,0" RenderTransformOrigin="0.5,0.5" MouseLeftButtonUp="EditUser_Clicked">
<Path Data="{StaticResource IconInstalledGamesSettings}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" Margin="0,0,-20,-20">
<Path.RenderTransform>
Expand Down
16 changes: 10 additions & 6 deletions gamevault/UserControls/DownloadsUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ public async Task RestoreDownloadedGames()
List<string> allIds = new List<string>();
foreach (string dir in Directory.GetDirectories(downloadPath))
{
if (new DirectoryInfo(dir).GetFiles().Length == 0)
continue;
try
{
if (new DirectoryInfo(dir).GetFiles().Length == 0)
continue;
string dirName = dir.Substring(dir.LastIndexOf('\\'));
string gameId = dirName.Substring(2, dirName.IndexOf(')') - 2);
string dirName = dir.Substring(dir.LastIndexOf('\\'));
string gameId = dirName.Substring(2, dirName.IndexOf(')') - 2);
if (int.TryParse(gameId, out int id))
allIds.Add(id.ToString());
if (int.TryParse(gameId, out int id))
allIds.Add(id.ToString());
}
catch { continue; }
}
if (allIds.Count == 0)
return null;
Expand Down
6 changes: 6 additions & 0 deletions gamevault/ViewModels/AdminConsoleViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ namespace gamevault.ViewModels
internal class AdminConsoleViewModel : ViewModelBase
{
private User[] m_Users { get; set; }
private bool showDeletedUsers { get; set; }
private KeyValuePair<string, string> m_ServerVersionInfo { get; set; }

public User[]? Users
{
get { return m_Users; }
set { m_Users = value; OnPropertyChanged(); }
}
public bool ShowDeletedUsers
{
get { return showDeletedUsers; }
set { showDeletedUsers = value; OnPropertyChanged(); }
}
public Array PermissionRoleEnumTypes
{
get
Expand Down

0 comments on commit 500c471

Please sign in to comment.