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.-->
|
<!--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 Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.1" />
|
||||||
<PackageReference Include="Avalonia.ReactiveUI" 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="KubernetesClient" Version="11.0.44" />
|
||||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ public class FileInformation
|
|||||||
{
|
{
|
||||||
public string Parent { get; set; } = string.Empty;
|
public string Parent { get; set; } = string.Empty;
|
||||||
public FileType Type { get; set; } = FileType.File;
|
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 Name { get; set; } = string.Empty;
|
||||||
public string Size { get; set; } = string.Empty;
|
public string Size { get; set; } = string.Empty;
|
||||||
public DateTimeOffset Date { get; set; } = DateTimeOffset.MinValue;
|
public DateTimeOffset Date { get; set; } = DateTimeOffset.MinValue;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
|
using System.Reactive.Concurrency;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using K8sFileBrowser.Models;
|
using K8sFileBrowser.Models;
|
||||||
@@ -167,7 +168,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
GetPodsForNamespace = ReactiveCommand.CreateFromObservable<Namespace, IEnumerable<Pod>>(ns =>
|
GetPodsForNamespace = ReactiveCommand.CreateFromObservable<Namespace, IEnumerable<Pod>>(ns =>
|
||||||
Observable.StartAsync(_ => PodsAsync(ns, kubernetesService), RxApp.TaskpoolScheduler));
|
Observable.StartAsync(_ => PodsAsync(ns, kubernetesService), RxApp.TaskpoolScheduler));
|
||||||
|
|
||||||
GetPodsForNamespace.ThrownExceptions
|
GetPodsForNamespace.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +187,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
}, isNotRoot, RxApp.MainThreadScheduler);
|
}, isNotRoot, RxApp.MainThreadScheduler);
|
||||||
|
|
||||||
ParentCommand.ThrownExceptions
|
ParentCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
}, RxApp.TaskpoolScheduler);
|
}, RxApp.TaskpoolScheduler);
|
||||||
}, isSelectedPod, RxApp.MainThreadScheduler);
|
}, isSelectedPod, RxApp.MainThreadScheduler);
|
||||||
|
|
||||||
DownloadLogCommand.ThrownExceptions
|
DownloadLogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
}, RxApp.TaskpoolScheduler);
|
}, RxApp.TaskpoolScheduler);
|
||||||
}, isFile, RxApp.MainThreadScheduler);
|
}, isFile, RxApp.MainThreadScheduler);
|
||||||
|
|
||||||
DownloadCommand.ThrownExceptions
|
DownloadCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
.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 : "/"; },
|
OpenCommand = ReactiveCommand.Create(() => { SelectedPath = SelectedFile != null ? SelectedFile!.Name : "/"; },
|
||||||
isDirectory, RxApp.MainThreadScheduler);
|
isDirectory, RxApp.MainThreadScheduler);
|
||||||
|
|
||||||
OpenCommand.ThrownExceptions
|
OpenCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
.Subscribe(ex => ShowErrorMessage(ex.Message).ConfigureAwait(false).GetAwaiter().GetResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,8 +278,10 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
await ShowErrorMessage(e.Message);
|
RxApp.MainThreadScheduler.Schedule(Action);
|
||||||
return new List<Namespace>();
|
return new List<Namespace>();
|
||||||
|
|
||||||
|
async void Action() => await ShowErrorMessage(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectedItem="{Binding SelectedFile}"
|
SelectedItem="{Binding SelectedFile}"
|
||||||
>
|
Focusable="False">
|
||||||
<DataGrid.Styles>
|
<DataGrid.Styles>
|
||||||
<Style Selector="DataGridColumnHeader">
|
<Style Selector="DataGridColumnHeader">
|
||||||
<Setter Property="FontSize" Value="14"></Setter>
|
<Setter Property="FontSize" Value="14"></Setter>
|
||||||
@@ -116,19 +116,63 @@
|
|||||||
<DataGridTemplateColumn Header="Type">
|
<DataGridTemplateColumn Header="Type">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="models:FileInformation">
|
<DataTemplate DataType="models:FileInformation">
|
||||||
<Border ToolTip.Tip="{Binding Type}" VerticalAlignment="Center" HorizontalAlignment="Center">
|
<Border ToolTip.Tip="{Binding Type}" Background="Transparent">
|
||||||
<StackPanel>
|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
<PathIcon Data="{StaticResource folder_regular}" IsVisible="{Binding IsDirectory}"></PathIcon>
|
<PathIcon Data="{StaticResource folder_regular}" IsVisible="{Binding IsDirectory}"></PathIcon>
|
||||||
<PathIcon Data="{StaticResource document_regular}" IsVisible="{Binding IsFile}"></PathIcon>
|
<PathIcon Data="{StaticResource document_regular}" IsVisible="{Binding IsFile}"></PathIcon>
|
||||||
<PathIcon Data="{StaticResource document_unknown_regular}" IsVisible="{Binding IsUnknown}"></PathIcon>
|
<PathIcon Data="{StaticResource document_unknown_regular}" IsVisible="{Binding IsUnknown}"></PathIcon>
|
||||||
</StackPanel>
|
</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>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="Name" Width="*" Binding="{Binding Name}" />
|
|
||||||
<DataGridTextColumn Header="Size" Binding="{Binding Size}" />
|
|
||||||
<DataGridTextColumn Header="Date" Binding="{Binding Date}" />
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user