aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/LogsView.xaml
blob: d78cfd31158b86a0e7742d8f72a1f8583248f529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<UserControl x:Class="Tango.FSE.PPCConsole.Views.LogsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:global="clr-namespace:Tango.FSE.PPCConsole"
             xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
             xmlns:vm="clr-namespace:Tango.FSE.PPCConsole.ViewModels"
             xmlns:components="clr-namespace:Tango.SharedUI.Components;assembly=Tango.SharedUI"
             xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
             xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:local="clr-namespace:Tango.FSE.PPCConsole.Views"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LogsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LogsViewVM}" x:Name="control">
    <Grid IsEnabled="{Binding IsFree}">
        <Grid Margin="0 20 0 0" IsEnabled="{Binding MachineProvider.IsPPCAvailable}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="270"/>
                <ColumnDefinition Width="303*"/>
            </Grid.ColumnDefinitions>

            <Grid>
                <Border Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="3" CornerRadius="3" Padding="5 5">
                    <ListBox x:Name="listLogFiles" Background="Transparent" BorderThickness="0" ItemsSource="{Binding LogFiles}" SelectedItem="{Binding SelectedLogFile}">
                        <ListBox.InputBindings>
                            <KeyBinding Key="Return" Command="{Binding SelectedLogFile.DownloadCommand}" />
                        </ListBox.InputBindings>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <DockPanel>
                                    <DockPanel.Style>
                                        <Style TargetType="DockPanel">
                                            <Setter Property="Opacity" Value="0.6"></Setter>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Status}" Value="Downloaded">
                                                    <Setter Property="Opacity" Value="1"></Setter>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </DockPanel.Style>
                                    <material:PackIcon Kind="FileDocument" Width="Auto" Height="35" />
                                    <StackPanel Margin="5 0 0 0">
                                        <TextBlock Text="{Binding RemoteLogFile.DateCreated,Converter={StaticResource DateTimeUtcToLocalDateTime},StringFormat='MM/dd/yyyy HH:mm'}"></TextBlock>
                                        <TextBlock Margin="0 5 0 0" Foreground="{StaticResource FSE_GrayBrush}" FontSize="{StaticResource FSE_SmallFontSize}">
                                            <Run Text="{Binding RemoteLogFile.Length,Converter={StaticResource ByteArrayToFileSizeConverter}}"></Run>
                                            <Run>|</Run>
                                            <Run ToolTip="Duration" Text="{Binding Duration,Mode=OneWay,StringFormat='hh\\:mm'}"></Run>
                                        </TextBlock>
                                    </StackPanel>
                                </DockPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Border>
            </Grid>

            <Border Grid.Column="1" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="3" CornerRadius="3" Padding="2" Margin="10 0 0 0">
                <Grid>
                    <Grid>
                        <DockPanel Margin="10 0 10 10">
                            <Grid DockPanel.Dock="Top" Margin="12 10 0 0" Panel.ZIndex="100">
                                <TextBlock Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontWeight="SemiBold">
                                    <Run Text="{Binding SelectedLogFile.RemoteLogFile.DateCreated,Converter={StaticResource DateTimeUtcToLocalDateTime},StringFormat='MM/dd/yyyy HH:mm'}"></Run>
                                    <Run>-</Run>
                                    <Run Text="{Binding SelectedLogFile.RemoteLogFile.DateModified,Converter={StaticResource DateTimeUtcToLocalDateTime},StringFormat='HH:mm'}"></Run>
                                </TextBlock>
                                <StackPanel Margin="0 0 0 -70" HorizontalAlignment="Right" >
                                    <StackPanel Margin="0 30 0 0" Orientation="Horizontal">
                                        <ItemsControl VerticalAlignment="Center" ItemsSource="{Binding SelectedApplicationLogsCategories}" Visibility="{Binding ResolutionService.IsHighResolution,Converter={StaticResource BooleanToVisibilityConverter}}">
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <StackPanel Orientation="Horizontal" />
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <StackPanel Orientation="Horizontal" Margin="10 0 0 0">
                                                        <CheckBox FocusVisualStyle="{x:Null}" IsChecked="{Binding IsSelected,Delay=200}" VerticalAlignment="Center">
                                                            <CheckBox.Content>
                                                                <TextBlock Text="{Binding Data}" VerticalAlignment="Center"></TextBlock>
                                                            </CheckBox.Content>
                                                        </CheckBox>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>

                                        <DockPanel Margin="20 0 0 0" VerticalAlignment="Center">
                                            <material:PackIcon Kind="Search" VerticalAlignment="Center" Width="18" Height="18" />
                                            <TextBox Margin="5 0 0 0" Style="{StaticResource FSE_Rounded_Corners_TextBox}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" FontSize="{StaticResource FSE_SmallFontSize}" material:HintAssist.Hint="filter" material:TextFieldAssist.RippleOnFocusEnabled="True" Text="{Binding ApplicationLogsFilter,UpdateSourceTrigger=PropertyChanged,Delay=1000}" Width="200"/>
                                        </DockPanel>
                                    </StackPanel>
                                </StackPanel>
                            </Grid>

                            <DataGrid x:Name="dataGridLogs" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding ApplicationLogs}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" helpers:DataGridHelper.DoubleClickCommand="{Binding OpenApplicationLogItemCommand}" CanUserSortColumns="True">
                                <DataGrid.Resources>
                                    <components:BindingProxy x:Key="proxy" Data="{Binding}" />
                                </DataGrid.Resources>
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="#" Width="40" CellTemplate="{StaticResource FSE_LogIcon_Cell}"/>
                                    <DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='HH:mm:ss.ff'}" Width="100" />
                                    <DataGridTextColumn Visibility="{Binding Source={StaticResource proxy},Path=Data.ResolutionService.IsHighResolution,Converter={StaticResource BooleanToVisibilityConverter}}" Header="SERVICE" Binding="{Binding ClassName}" Width="200" />
                                    <DataGridTemplateColumn Header="MESSAGE" Width="1*" >
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock TextWrapping="NoWrap" Text="{Binding Message,Converter={StaticResource StringToOneLineConverter},ConverterParameter='120'}"></TextBlock>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </Grid>

                    <Grid Background="{StaticResource FSE_SemiTransparentBrush}">
                        <Grid.Style>
                            <Style TargetType="Grid">
                                <Setter Property="Visibility" Value="Visible"></Setter>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding SelectedLogFile.Status}" Value="Downloaded">
                                        <Setter Property="Visibility" Value="Hidden"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Style>

                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Setter Property="Visibility" Value="Hidden"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding SelectedLogFile.Status}" Value="None">
                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <material:PackIcon Kind="FileDocument" Width="100" Height="100" HorizontalAlignment="Center" />
                            <TextBlock Margin="0 20 0 0">Download this log file from the remote machine in order to display its content</TextBlock>
                            <controls:TextIconButton Style="{StaticResource FSE_TextIconButton_Dark}" Margin="0 100 0 0" Height="45" Icon="Download" HorizontalAlignment="Center" Width="180" Command="{Binding SelectedLogFile.DownloadCommand}">DOWNLOAD</controls:TextIconButton>
                        </StackPanel>

                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Setter Property="Visibility" Value="Hidden"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding SelectedLogFile.Status}" Value="Failed">
                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <material:PackIcon Kind="AlertOutline" Width="100" Height="100" HorizontalAlignment="Center" Foreground="{StaticResource FSE_ErrorBrush}" />
                            <TextBlock Margin="0 20 0 0">Error occurred while trying to download this log file</TextBlock>
                            <controls:TextIconButton Style="{StaticResource FSE_TextIconButton_Dark}" Margin="0 100 0 0" Height="45" Icon="Download" HorizontalAlignment="Center" Width="180" Command="{Binding SelectedLogFile.DownloadCommand}">TRY AGAIN</controls:TextIconButton>
                        </StackPanel>

                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Setter Property="Visibility" Value="Hidden"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding SelectedLogFile.Status}" Value="Downloading">
                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <material:PackIcon Kind="FileDownload" Width="100" Height="100" HorizontalAlignment="Center" />
                            <TextBlock Margin="0 20 0 0" HorizontalAlignment="Center">Downloading log file, please wait...</TextBlock>
                            <ProgressBar Margin="0 140 0 0" Width="600" Height="5" Minimum="0" Maximum="{Binding SelectedLogFile.Handler.Progress.Maximum}" Value="{Binding SelectedLogFile.Handler.Progress.Value}"></ProgressBar>
                        </StackPanel>
                    </Grid>

                    <StackPanel Margin="0 0 40 20" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                        <material:PopupBox PopupMode="Click" Style="{StaticResource MaterialDesignMultiFloatingActionPopupBox}" PlacementMode="TopAndAlignCentres" FocusVisualStyle="{x:Null}">
                            <StackPanel>
                                <Button ToolTip="Download all log files" Command="{Binding DownloadAllLogFilesCommand}">
                                    <material:PackIcon Kind="DownloadMultiple" />
                                </Button>
                                <Button ToolTip="Export all downloaded log files" Command="{Binding ExportAllDownloadedLogFilesCommand}">
                                    <material:PackIcon Kind="DatabaseExport" />
                                </Button>
                                <Button ToolTip="Export selected log file" Command="{Binding ExportLogFileCommand}">
                                    <material:PackIcon Kind="FileExportOutline" />
                                </Button>
                                <Button ToolTip="Reload selected log file" Command="{Binding ReDownloadSelectedLogFileCommand}">
                                    <material:PackIcon Kind="Download" />
                                </Button>
                            </StackPanel>
                        </material:PopupBox>
                    </StackPanel>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>