mirror of
https://github.com/frosch95/K8sFileBrowser.git
synced 2026-04-11 12:58:22 +02:00
Compare commits
5 Commits
v.0.0.3-al
...
v0.0.5-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| ec60e55c7f | |||
| a4fb00010e | |||
|
|
6ad58270a9 | ||
|
|
e284e3f532 | ||
| 7e3c4248e1 |
@@ -28,6 +28,8 @@
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.1" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.1" />
|
||||
<PackageReference Include="Avalonia.Xaml.Interactions" Version="11.0.2" />
|
||||
<PackageReference Include="Avalonia.Xaml.Interactivity" Version="11.0.2" />
|
||||
<PackageReference Include="KubernetesClient" Version="11.0.44" />
|
||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
|
||||
@@ -6,6 +6,7 @@ public class FileInformation
|
||||
{
|
||||
public string Parent { get; set; } = string.Empty;
|
||||
public FileType Type { get; set; } = FileType.File;
|
||||
public string DisplayName => Parent.Length < 2 ? Name[Parent.Length..] : Name[( Parent.Length + 1)..];
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Size { get; set; } = string.Empty;
|
||||
public DateTimeOffset Date { get; set; } = DateTimeOffset.MinValue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using K8sFileBrowser.Models;
|
||||
@@ -167,7 +168,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
GetPodsForNamespace = ReactiveCommand.CreateFromObservable<Namespace, IEnumerable<Pod>>(ns =>
|
||||
Observable.StartAsync(_ => PodsAsync(ns, kubernetesService), RxApp.TaskpoolScheduler));
|
||||
|
||||
GetPodsForNamespace.ThrownExceptions
|
||||
GetPodsForNamespace.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||
}
|
||||
|
||||
@@ -186,7 +187,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
}, isNotRoot, RxApp.MainThreadScheduler);
|
||||
|
||||
ParentCommand.ThrownExceptions
|
||||
ParentCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||
}
|
||||
|
||||
@@ -211,7 +212,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
}, RxApp.TaskpoolScheduler);
|
||||
}, isSelectedPod, RxApp.MainThreadScheduler);
|
||||
|
||||
DownloadLogCommand.ThrownExceptions
|
||||
DownloadLogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
}, RxApp.TaskpoolScheduler);
|
||||
}, isFile, RxApp.MainThreadScheduler);
|
||||
|
||||
DownloadCommand.ThrownExceptions
|
||||
DownloadCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||
}
|
||||
|
||||
@@ -250,7 +251,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
OpenCommand = ReactiveCommand.Create(() => { SelectedPath = SelectedFile != null ? SelectedFile!.Name : "/"; },
|
||||
isDirectory, RxApp.MainThreadScheduler);
|
||||
|
||||
OpenCommand.ThrownExceptions
|
||||
OpenCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||
}
|
||||
|
||||
@@ -277,8 +278,10 @@ public class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await ShowErrorMessage(e.Message);
|
||||
RxApp.MainThreadScheduler.Schedule(Action);
|
||||
return new List<Namespace>();
|
||||
|
||||
async void Action() => await ShowErrorMessage(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
BorderThickness="1"
|
||||
SelectionMode="Single"
|
||||
SelectedItem="{Binding SelectedFile}"
|
||||
>
|
||||
Focusable="False">
|
||||
<DataGrid.Styles>
|
||||
<Style Selector="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="14"></Setter>
|
||||
@@ -116,19 +116,63 @@
|
||||
<DataGridTemplateColumn Header="Type">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="models:FileInformation">
|
||||
<Border ToolTip.Tip="{Binding Type}" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<StackPanel>
|
||||
<Border ToolTip.Tip="{Binding Type}" Background="Transparent">
|
||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<PathIcon Data="{StaticResource folder_regular}" IsVisible="{Binding IsDirectory}"></PathIcon>
|
||||
<PathIcon Data="{StaticResource document_regular}" IsVisible="{Binding IsFile}"></PathIcon>
|
||||
<PathIcon Data="{StaticResource document_unknown_regular}" IsVisible="{Binding IsUnknown}"></PathIcon>
|
||||
</StackPanel>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="DoubleTapped">
|
||||
<InvokeCommandAction Command="{Binding ((vm:MainWindowViewModel)DataContext).OpenCommand, RelativeSource={RelativeSource AncestorType=Window }}" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Name" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="models:FileInformation">
|
||||
<Border Background="Transparent">
|
||||
<TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center"/>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="DoubleTapped">
|
||||
<InvokeCommandAction Command="{Binding ((vm:MainWindowViewModel)DataContext).OpenCommand, RelativeSource={RelativeSource AncestorType=Window }}" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Size" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="models:FileInformation">
|
||||
<Border Background="Transparent">
|
||||
<TextBlock Text="{Binding Size}" VerticalAlignment="Center"/>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="DoubleTapped">
|
||||
<InvokeCommandAction Command="{Binding ((vm:MainWindowViewModel)DataContext).OpenCommand, RelativeSource={RelativeSource AncestorType=Window }}" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Date" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="models:FileInformation">
|
||||
<Border Background="Transparent">
|
||||
<TextBlock Text="{Binding Date}" VerticalAlignment="Center"/>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="DoubleTapped">
|
||||
<InvokeCommandAction Command="{Binding ((vm:MainWindowViewModel)DataContext).OpenCommand, RelativeSource={RelativeSource AncestorType=Window }}" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Name" Width="*" Binding="{Binding Name}" />
|
||||
<DataGridTextColumn Header="Size" Binding="{Binding Size}" />
|
||||
<DataGridTextColumn Header="Date" Binding="{Binding Date}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user