diff --git a/K8sFileBrowser/FodyWeavers.xml b/K8sFileBrowser/FodyWeavers.xml
new file mode 100644
index 0000000..63fc148
--- /dev/null
+++ b/K8sFileBrowser/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/K8sFileBrowser/FodyWeavers.xsd b/K8sFileBrowser/FodyWeavers.xsd
new file mode 100644
index 0000000..f3ac476
--- /dev/null
+++ b/K8sFileBrowser/FodyWeavers.xsd
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/K8sFileBrowser/K8sFileBrowser.csproj b/K8sFileBrowser/K8sFileBrowser.csproj
index e5d48f7..93c1b1a 100644
--- a/K8sFileBrowser/K8sFileBrowser.csproj
+++ b/K8sFileBrowser/K8sFileBrowser.csproj
@@ -9,7 +9,7 @@
Debug;Release
AnyCPU
Assets/app.ico
- 0.0.8
+ 0.0.9
TRACE
@@ -31,6 +31,7 @@
+
diff --git a/K8sFileBrowser/Models/FileInformation.cs b/K8sFileBrowser/Models/FileInformation.cs
index 5c2bcb4..ed9ff16 100644
--- a/K8sFileBrowser/Models/FileInformation.cs
+++ b/K8sFileBrowser/Models/FileInformation.cs
@@ -19,6 +19,8 @@ public class FileInformation
public string Size { get; set; } = string.Empty;
public DateTimeOffset? Date { get; set; }
+ public string DateTimeOffsetString => Date?.ToString("yyyy-MM-dd HH:mm:ss") ?? string.Empty;
+
public bool IsFile => Type == FileType.File;
public bool IsDirectory => Type == FileType.Directory;
public bool IsUnknown => Type == FileType.Unknown;
diff --git a/K8sFileBrowser/ViewModels/MainWindowViewModel.cs b/K8sFileBrowser/ViewModels/MainWindowViewModel.cs
index 5a9aba9..8ac5747 100644
--- a/K8sFileBrowser/ViewModels/MainWindowViewModel.cs
+++ b/K8sFileBrowser/ViewModels/MainWindowViewModel.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using K8sFileBrowser.Models;
using K8sFileBrowser.Services;
using ReactiveUI;
+using ReactiveUI.Fody.Helpers;
namespace K8sFileBrowser.ViewModels;
@@ -16,81 +17,39 @@ public class MainWindowViewModel : ViewModelBase
private ObservableAsPropertyHelper> _clusterContexts = null!;
public IEnumerable ClusterContexts => _clusterContexts.Value;
- private ClusterContext? _selectedClusterContext;
+ [Reactive]
+ public ClusterContext? SelectedClusterContext { get; set; }
- public ClusterContext? SelectedClusterContext
- {
- get => _selectedClusterContext;
- set => this.RaiseAndSetIfChanged(ref _selectedClusterContext, value);
- }
+ [Reactive]
+ public IEnumerable Namespaces { get; set; }
- private IEnumerable _namespaces = null!;
- public IEnumerable Namespaces
- {
- get => _namespaces;
- set => this.RaiseAndSetIfChanged(ref _namespaces, value);
- }
-
- private Namespace? _selectedNamespace;
-
- public Namespace? SelectedNamespace
- {
- get => _selectedNamespace;
- set => this.RaiseAndSetIfChanged(ref _selectedNamespace, value);
- }
+ [Reactive]
+ public Namespace? SelectedNamespace { get; set; }
private ObservableAsPropertyHelper> _pods = null!;
public IEnumerable Pods => _pods.Value;
- private Pod? _selectedPod;
+ [Reactive]
+ public Pod? SelectedPod { get; set; }
- public Pod? SelectedPod
- {
- get => _selectedPod;
- set => this.RaiseAndSetIfChanged(ref _selectedPod, value);
- }
-
- private IEnumerable? _containers;
- public IEnumerable? Containers
- {
- get => _containers;
- set => this.RaiseAndSetIfChanged(ref _containers, value);
- }
+ [Reactive]
+ public IEnumerable? Containers { get; set; }
- private Container? _selectedContainer;
-
- public Container? SelectedContainer
- {
- get => _selectedContainer;
- set => this.RaiseAndSetIfChanged(ref _selectedContainer, value);
- }
+ [Reactive]
+ public Container? SelectedContainer { get; set; }
private ObservableAsPropertyHelper> _fileInformation = null!;
public IEnumerable FileInformation => _fileInformation.Value;
- private FileInformation? _selectedFile;
+ [Reactive]
+ public FileInformation? SelectedFile { get; set; }
- public FileInformation? SelectedFile
- {
- get => _selectedFile;
- set => this.RaiseAndSetIfChanged(ref _selectedFile, value);
- }
+ [Reactive]
+ public string? SelectedPath { get; set; }
- private string? _selectedPath;
+ [Reactive]
+ public Message Message { get; set; }
- public string? SelectedPath
- {
- get => _selectedPath;
- set => this.RaiseAndSetIfChanged(ref _selectedPath, value);
- }
-
- private Message _message = null!;
- public Message Message
- {
- get => _message;
- set => this.RaiseAndSetIfChanged(ref _message, value);
- }
-
public ReactiveCommand DownloadCommand { get; private set; } = null!;
public ReactiveCommand DownloadLogCommand { get; private set; } = null!;
public ReactiveCommand ParentCommand { get; private set; } = null!;
@@ -143,7 +102,7 @@ public class MainWindowViewModel : ViewModelBase
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(_ => SelectedPath = "/");
}
-
+
private void RegisterReadContainers()
{
// read the file information when the path changes
@@ -155,7 +114,7 @@ public class MainWindowViewModel : ViewModelBase
: x.Item1.Containers.Select(c => new Container {Name = c}))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe( x => Containers = x);
-
+
this.WhenAnyValue(x => x.Containers)
.Throttle(new TimeSpan(10))
.ObserveOn(RxApp.MainThreadScheduler)
@@ -318,14 +277,14 @@ public class MainWindowViewModel : ViewModelBase
}
catch (Exception e)
{
- RxApp.MainThreadScheduler.Schedule(Action);
+ RxApp.MainThreadScheduler.Schedule(Action);
return new List();
async void Action() => await ShowErrorMessage(e.Message);
}
}
-
- private IList GetFileInformation(IKubernetesService kubernetesService,
+
+ private IList GetFileInformation(IKubernetesService kubernetesService,
string path, Pod pod, Namespace nameSpace, Container container)
{
var kubernetesFileInformation = kubernetesService.GetFiles(
@@ -333,7 +292,7 @@ public class MainWindowViewModel : ViewModelBase
// when the path is root, we don't want to show the parent directory
if (SelectedPath is not { Length: > 1 }) return kubernetesFileInformation;
-
+
// add the parent directory
var parent = SelectedPath[..SelectedPath.LastIndexOf('/')];
if (string.IsNullOrEmpty(parent))
@@ -358,7 +317,7 @@ public class MainWindowViewModel : ViewModelBase
IsError = false
};
}
-
+
private async Task ShowErrorMessage(string message)
{
Message = new Message
@@ -370,7 +329,7 @@ public class MainWindowViewModel : ViewModelBase
await Task.Delay(7000);
HideWorkingMessage();
}
-
+
private void HideWorkingMessage()
{
Message = new Message
diff --git a/K8sFileBrowser/Views/MainWindow.axaml b/K8sFileBrowser/Views/MainWindow.axaml
index 55525ab..1f3d6bf 100644
--- a/K8sFileBrowser/Views/MainWindow.axaml
+++ b/K8sFileBrowser/Views/MainWindow.axaml
@@ -90,7 +90,9 @@
-
+
@@ -100,9 +102,6 @@
-
-
+
@@ -144,7 +143,7 @@
-
+
@@ -158,11 +157,11 @@
-
+
-
+
@@ -172,14 +171,14 @@
-
+
-
+
-
+