|
| 1 | +<UserControl |
| 2 | + Initialized="StyledElement_OnInitialized" |
| 3 | + d:DesignHeight="450" |
| 4 | + d:DesignWidth="800" |
| 5 | + mc:Ignorable="d" |
| 6 | + x:Class="SnapX.Avalonia.Views.Settings.Views.DatabaseView" |
| 7 | + x:DataType="viewModels:DatabaseVM" |
| 8 | + xmlns="https://github.com/avaloniaui" |
| 9 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 10 | + xmlns:fluent="clr-namespace:FluentIcons.Avalonia.Fluent;assembly=FluentIcons.Avalonia.Fluent" |
| 11 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 12 | + xmlns:viewModels="clr-namespace:SnapX.Avalonia.ViewModels" |
| 13 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
| 14 | + <Design.DataContext> |
| 15 | + <viewModels:DatabaseVM /> |
| 16 | + </Design.DataContext> |
| 17 | + <Grid RowDefinitions="Auto, *"> |
| 18 | + <Border |
| 19 | + Background="{DynamicResource SolidBackgroundFillColorBaseBrush}" |
| 20 | + BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}" |
| 21 | + BorderThickness="0,0,0,1" |
| 22 | + Grid.Row="0" |
| 23 | + Padding="12"> |
| 24 | + <Grid ColumnDefinitions="*, Auto"> |
| 25 | + <StackPanel Orientation="Horizontal" Spacing="8"> |
| 26 | + <TextBox |
| 27 | + Text="{Binding SearchText, Mode=TwoWay}" |
| 28 | + Watermark="Search database..." |
| 29 | + Width="300"> |
| 30 | + <TextBox.InnerLeftContent> |
| 31 | + <fluent:SymbolIcon |
| 32 | + FontSize="16" |
| 33 | + Margin="8,0,0,0" |
| 34 | + Symbol="Search" /> |
| 35 | + </TextBox.InnerLeftContent> |
| 36 | + </TextBox> |
| 37 | + <Separator Classes="Vertical" /> |
| 38 | + <TextBlock Text="{Binding TotalCount, StringFormat='{}{0} Records'}" VerticalAlignment="Center" /> |
| 39 | + </StackPanel> |
| 40 | + |
| 41 | + <StackPanel |
| 42 | + Grid.Column="1" |
| 43 | + Orientation="Horizontal" |
| 44 | + Spacing="8"> |
| 45 | + <Button Classes="accent" Command="{Binding RefreshCommand}"> |
| 46 | + <StackPanel Orientation="Horizontal" Spacing="8"> |
| 47 | + <fluent:SymbolIcon Symbol="ArrowCounterclockwise" /> |
| 48 | + <TextBlock Text="Refresh" /> |
| 49 | + </StackPanel> |
| 50 | + </Button> |
| 51 | + <ComboBox |
| 52 | + ItemsSource="{Binding Tables}" |
| 53 | + SelectedItem="{Binding SelectedTable}" |
| 54 | + VerticalAlignment="Center" |
| 55 | + Width="150"> |
| 56 | + <ComboBox.SelectionBoxItemTemplate> |
| 57 | + <DataTemplate> |
| 58 | + <StackPanel Orientation="Horizontal" Spacing="8"> |
| 59 | + <fluent:SymbolIcon FontSize="16" Symbol="Table" /> |
| 60 | + <TextBlock Text="{Binding}" VerticalAlignment="Center" /> |
| 61 | + </StackPanel> |
| 62 | + </DataTemplate> |
| 63 | + </ComboBox.SelectionBoxItemTemplate> |
| 64 | + <ComboBox.ItemTemplate> |
| 65 | + <DataTemplate> |
| 66 | + <StackPanel Orientation="Horizontal" Spacing="8"> |
| 67 | + <fluent:SymbolIcon FontSize="16" Symbol="Table" /> |
| 68 | + <TextBlock Text="{Binding}" VerticalAlignment="Center" /> |
| 69 | + </StackPanel> |
| 70 | + </DataTemplate> |
| 71 | + </ComboBox.ItemTemplate> |
| 72 | + </ComboBox> |
| 73 | + <DropDownButton Content="Quick Actions"> |
| 74 | + <DropDownButton.Flyout> |
| 75 | + <MenuFlyout Placement="BottomEdgeAlignedRight"> |
| 76 | + <MenuItem Command="{Binding ChangePathCommand}" Header="Mass Change Screenshots Path"> |
| 77 | + <MenuItem.Icon> |
| 78 | + <fluent:SymbolIcon Symbol="FolderLink" /> |
| 79 | + </MenuItem.Icon> |
| 80 | + </MenuItem> |
| 81 | + <!-- <MenuItem Command="{Binding RebuildIndexCommand}" Header="Rebuild Index"> --> |
| 82 | + <!-- <MenuItem.Icon> --> |
| 83 | + <!-- <fluent:SymbolIcon Symbol="DatabaseLightning" /> --> |
| 84 | + <!-- </MenuItem.Icon> --> |
| 85 | + <!-- </MenuItem> --> |
| 86 | + <!-- <MenuItem Command="{Binding RebuildIndexCommand}" Header="Rebuild file paths"> --> |
| 87 | + <!-- <ToolTip.Tip> --> |
| 88 | + <!-- <StackPanel MaxWidth="300" Spacing="5"> --> |
| 89 | + <!-- <TextBlock FontWeight="Bold" Text="Repair Broken Links" /> --> |
| 90 | + <!-- <TextBlock Text="Scans your disks for missing or 0-byte files to restore database integrity." TextWrapping="Wrap" /> --> |
| 91 | + <!-- <Separator Margin="0,2" /> --> |
| 92 | + <!-- <TextBlock --> |
| 93 | + <!-- FontSize="11" --> |
| 94 | + <!-- Opacity="0.8" --> |
| 95 | + <!-- Text="• Defaults to searching your Home directory." /> --> |
| 96 | + <!-- <TextBlock --> |
| 97 | + <!-- FontSize="11" --> |
| 98 | + <!-- Opacity="0.8" --> |
| 99 | + <!-- Text="• You can select other disks or external drives." /> --> |
| 100 | + <!-- <TextBlock --> |
| 101 | + <!-- FontSize="11" --> |
| 102 | + <!-- FontWeight="SemiBold" --> |
| 103 | + <!-- Foreground="OrangeRed" --> |
| 104 | + <!-- Text="⚠️ Note: No backups are created during this process." /> --> |
| 105 | + <!-- </StackPanel> --> |
| 106 | + <!-- </ToolTip.Tip> --> |
| 107 | + <!-- <MenuItem.Icon> --> |
| 108 | + <!-- <fluent:SymbolIcon Symbol="DatabaseLink" /> --> |
| 109 | + <!-- </MenuItem.Icon> --> |
| 110 | + <!-- </MenuItem> --> |
| 111 | + <MenuItem |
| 112 | + Command="{Binding ExecuteRawSqlCommand}" |
| 113 | + CommandParameter="VACUUM;" |
| 114 | + Header="Vacuum Database"> |
| 115 | + <MenuItem.Icon> |
| 116 | + <fluent:SymbolIcon Symbol="BroomSparkle" /> |
| 117 | + </MenuItem.Icon> |
| 118 | + </MenuItem> |
| 119 | + <!-- <Separator /> --> |
| 120 | + <!-- <MenuItem Command="{Binding ExportCommand}" Header="Export to JSON"> --> |
| 121 | + <!-- <MenuItem.Icon> --> |
| 122 | + <!-- <fluent:SymbolIcon Symbol="ArrowExport" /> --> |
| 123 | + <!-- </MenuItem.Icon> --> |
| 124 | + <!-- </MenuItem> --> |
| 125 | + <!-- <MenuItem --> |
| 126 | + <!-- Command="{Binding PurgeCommand}" --> |
| 127 | + <!-- Foreground="{DynamicResource SystemFillColorCriticalBrush}" --> |
| 128 | + <!-- Header="Purge Missing Files"> --> |
| 129 | + <!-- <MenuItem.Icon> --> |
| 130 | + <!-- <fluent:SymbolIcon Symbol="Delete" /> --> |
| 131 | + <!-- </MenuItem.Icon> --> |
| 132 | + <!-- </MenuItem> --> |
| 133 | + </MenuFlyout> |
| 134 | + </DropDownButton.Flyout> |
| 135 | + </DropDownButton> |
| 136 | + </StackPanel> |
| 137 | + </Grid> |
| 138 | + </Border> |
| 139 | + <Grid Grid.Row="1"> |
| 140 | + <DataGrid |
| 141 | + AutoGenerateColumns="False" |
| 142 | + GridLinesVisibility="All" |
| 143 | + ItemsSource="{Binding Items}" |
| 144 | + SelectedItem="{Binding SelectedItem, Mode=TwoWay}" |
| 145 | + x:Name="MainDataGrid" /> |
| 146 | + |
| 147 | + <StackPanel |
| 148 | + HorizontalAlignment="Right" |
| 149 | + Margin="24" |
| 150 | + VerticalAlignment="Bottom"> |
| 151 | + |
| 152 | + <Button |
| 153 | + Height="48" |
| 154 | + Padding="0" |
| 155 | + ToolTip.Tip="Open SQL Editor" |
| 156 | + Width="48"> |
| 157 | + <Button.Flyout> |
| 158 | + <Flyout Placement="TopEdgeAlignedRight"> |
| 159 | + <Border Padding="4" Width="500"> |
| 160 | + <Grid ColumnDefinitions="*, Auto"> |
| 161 | + <TextBox |
| 162 | + AcceptsReturn="True" |
| 163 | + FontFamily="Cascadia Code,Consolas,Monospace" |
| 164 | + Height="100" |
| 165 | + Text="{Binding RawSqlQuery}" |
| 166 | + Watermark="Enter SQL Query..." /> |
| 167 | + <Button |
| 168 | + Command="{Binding ExecuteRawSqlCommand}" |
| 169 | + Grid.Column="1" |
| 170 | + Margin="10,0,0,0" |
| 171 | + VerticalAlignment="Stretch"> |
| 172 | + <StackPanel Spacing="4"> |
| 173 | + <fluent:SymbolIcon Symbol="Play" /> |
| 174 | + <TextBlock Text="Run" /> |
| 175 | + </StackPanel> |
| 176 | + </Button> |
| 177 | + </Grid> |
| 178 | + </Border> |
| 179 | + </Flyout> |
| 180 | + </Button.Flyout> |
| 181 | + |
| 182 | + <fluent:SymbolIcon FontSize="24" Symbol="DatabaseSearch" /> |
| 183 | + </Button> |
| 184 | + </StackPanel> |
| 185 | + </Grid> |
| 186 | + </Grid> |
| 187 | +</UserControl> |
0 commit comments