mirror of
https://github.com/frosch95/K8sFileBrowser.git
synced 2026-04-11 12:58:22 +02:00
Closes #9 : Refresh button for the file list
This commit is contained in:
@@ -67,6 +67,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> DownloadCommand { get; private set; } = null!;
|
public ReactiveCommand<Unit, Unit> DownloadCommand { get; private set; } = null!;
|
||||||
public ReactiveCommand<Unit, Unit> DownloadLogCommand { 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> ParentCommand { get; private set; } = null!;
|
||||||
public ReactiveCommand<Unit, Unit> OpenCommand { get; private set; } = null!;
|
public ReactiveCommand<Unit, Unit> OpenCommand { get; private set; } = null!;
|
||||||
private ReactiveCommand<Namespace, IEnumerable<Pod>> GetPodsForNamespace { get; set; } = null!;
|
private ReactiveCommand<Namespace, IEnumerable<Pod>> GetPodsForNamespace { get; set; } = null!;
|
||||||
@@ -82,6 +83,7 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
// commands
|
// commands
|
||||||
ConfigureOpenDirectoryCommand();
|
ConfigureOpenDirectoryCommand();
|
||||||
ConfigureDownloadFileCommand(kubernetesService);
|
ConfigureDownloadFileCommand(kubernetesService);
|
||||||
|
ConfigureRefreshCommand(kubernetesService);
|
||||||
ConfigureDownloadLogCommand(kubernetesService);
|
ConfigureDownloadLogCommand(kubernetesService);
|
||||||
ConfigureParentDirectoryCommand();
|
ConfigureParentDirectoryCommand();
|
||||||
ConfigureGetPodsForNamespaceCommand(kubernetesService);
|
ConfigureGetPodsForNamespaceCommand(kubernetesService);
|
||||||
@@ -248,6 +250,24 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
DownloadLogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
DownloadLogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Subscribe(ShowErrorMessage);
|
.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)
|
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 ">
|
<Button Command="{Binding DownloadLogCommand}" VerticalAlignment="Center" ToolTip.Tip="Download Container Log" Margin="0 0 48 0 ">
|
||||||
<PathIcon Data="{StaticResource document_one_page_regular}"></PathIcon>
|
<PathIcon Data="{StaticResource document_one_page_regular}"></PathIcon>
|
||||||
</Button>
|
</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">
|
<Button Command="{Binding ParentCommand}" VerticalAlignment="Center" ToolTip.Tip="Go To Parent Directory">
|
||||||
<PathIcon Data="{StaticResource arrow_curve_up_left_regular}"></PathIcon>
|
<PathIcon Data="{StaticResource arrow_curve_up_left_regular}"></PathIcon>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user