mirror of
https://github.com/frosch95/K8sFileBrowser.git
synced 2026-04-11 12:58:22 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d405677420 | |||
| 0e979fad5f | |||
| 6754210e9b | |||
| 0d11fdd000 |
@@ -67,6 +67,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
|
||||
public ReactiveCommand<Unit, Unit> DownloadCommand { get; private set; } = null!;
|
||||
public ReactiveCommand<Unit, Unit> DownloadLogCommand { get; private set; } = null!;
|
||||
public ReactiveCommand<Unit, Unit> RefreshCommand { get; private set; } = null!;
|
||||
public ReactiveCommand<Unit, Unit> ParentCommand { get; private set; } = null!;
|
||||
public ReactiveCommand<Unit, Unit> OpenCommand { get; private set; } = null!;
|
||||
private ReactiveCommand<Namespace, IEnumerable<Pod>> GetPodsForNamespace { get; set; } = null!;
|
||||
@@ -82,6 +83,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
// commands
|
||||
ConfigureOpenDirectoryCommand();
|
||||
ConfigureDownloadFileCommand(kubernetesService);
|
||||
ConfigureRefreshCommand(kubernetesService);
|
||||
ConfigureDownloadLogCommand(kubernetesService);
|
||||
ConfigureParentDirectoryCommand();
|
||||
ConfigureGetPodsForNamespaceCommand(kubernetesService);
|
||||
@@ -110,7 +112,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
.Subscribe(x =>
|
||||
{
|
||||
ResetNamespaces();
|
||||
ClusterContexts = x;
|
||||
ClusterContexts = x.OrderBy(c => c.Name);
|
||||
|
||||
// select the current cluster context
|
||||
SelectedClusterContext = ClusterContexts
|
||||
@@ -129,7 +131,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
.Subscribe(ns =>
|
||||
{
|
||||
ResetPods();
|
||||
Namespaces = ns;
|
||||
Namespaces = ns.OrderBy(n => n.Name);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -145,7 +147,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
.Subscribe(x =>
|
||||
{
|
||||
ResetContainers();
|
||||
Pods = x;
|
||||
Pods = x.OrderBy(p => p.Name);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -248,6 +250,24 @@ public class MainWindowViewModel : ViewModelBase
|
||||
DownloadLogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ShowErrorMessage);
|
||||
}
|
||||
|
||||
private void ConfigureRefreshCommand(IKubernetesService kubernetesService)
|
||||
{
|
||||
var isSelectedContainer = this
|
||||
.WhenAnyValue(x => x.SelectedContainer)
|
||||
.Select(x => x != null);
|
||||
|
||||
RefreshCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await Observable.Start(() =>
|
||||
{
|
||||
FileInformation = GetFileInformation(kubernetesService, SelectedPath!, SelectedPod!, SelectedNamespace!, SelectedContainer!);
|
||||
}, RxApp.TaskpoolScheduler);
|
||||
}, isSelectedContainer, RxApp.MainThreadScheduler);
|
||||
|
||||
RefreshCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Subscribe(ShowErrorMessage);
|
||||
}
|
||||
|
||||
private void ConfigureDownloadFileCommand(IKubernetesService kubernetesService)
|
||||
{
|
||||
|
||||
@@ -94,6 +94,9 @@
|
||||
<Button Command="{Binding DownloadLogCommand}" VerticalAlignment="Center" ToolTip.Tip="Download Container Log" Margin="0 0 48 0 ">
|
||||
<PathIcon Data="{StaticResource document_one_page_regular}"></PathIcon>
|
||||
</Button>
|
||||
<Button Command="{Binding RefreshCommand}" VerticalAlignment="Center" ToolTip.Tip="Refresh Directory">
|
||||
<PathIcon Data="{StaticResource arrow_sync_circle_regular}"></PathIcon>
|
||||
</Button>
|
||||
<Button Command="{Binding ParentCommand}" VerticalAlignment="Center" ToolTip.Tip="Go To Parent Directory">
|
||||
<PathIcon Data="{StaticResource arrow_curve_up_left_regular}"></PathIcon>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user