mirror of
https://github.com/frosch95/K8sFileBrowser.git
synced 2026-04-11 12:58:22 +02:00
ui improvements and async test when download a file
This commit is contained in:
@@ -42,5 +42,6 @@
|
||||
</FluentTheme.Palettes>
|
||||
</FluentTheme>
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
<StyleInclude Source="avares://K8sFileBrowser/Assets/Icons.axaml"></StyleInclude>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -14,9 +14,8 @@ public static class ApplicationHelper
|
||||
{
|
||||
public static async Task<string?> SaveFile(string? initialFolder, string? initialFile)
|
||||
{
|
||||
Window? ret;
|
||||
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
|
||||
desktop.MainWindow is not { } wnd) return null;
|
||||
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
|
||||
desktop.MainWindow is not { } wnd) return null;
|
||||
try
|
||||
{
|
||||
var filter = new List<FilePickerFileType> { new("All files") { Patterns = new List<string> { "*" } } };
|
||||
|
||||
40
K8sFileBrowser/Assets/Icons.axaml
Normal file
40
K8sFileBrowser/Assets/Icons.axaml
Normal file
@@ -0,0 +1,40 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style>
|
||||
<Style.Resources>
|
||||
<StreamGeometry x:Key="folder_regular">M17.0606622,9 C17.8933043,9 18.7000032,9.27703406 19.3552116,9.78392956 L19.5300545,9.92783739 L22.116207,12.1907209 C22.306094,12.356872 22.5408581,12.4608817 22.7890575,12.4909364 L22.9393378,12.5 L40.25,12.5 C42.2542592,12.5 43.8912737,14.0723611 43.994802,16.0508414 L44,16.25 L44,35.25 C44,37.2542592 42.4276389,38.8912737 40.4491586,38.994802 L40.25,39 L7.75,39 C5.74574083,39 4.10872626,37.4276389 4.00519801,35.4491586 L4,35.25 L4,12.75 C4,10.7457408 5.57236105,9.10872626 7.55084143,9.00519801 L7.75,9 L17.0606622,9 Z M22.8474156,14.9988741 L20.7205012,17.6147223 C20.0558881,18.4327077 19.0802671,18.9305178 18.0350306,18.993257 L17.8100737,19 L6.5,18.999 L6.5,35.25 C6.5,35.8972087 6.99187466,36.4295339 7.62219476,36.4935464 L7.75,36.5 L40.25,36.5 C40.8972087,36.5 41.4295339,36.0081253 41.4935464,35.3778052 L41.5,35.25 L41.5,16.25 C41.5,15.6027913 41.0081253,15.0704661 40.3778052,15.0064536 L40.25,15 L22.8474156,14.9988741 Z M17.0606622,11.5 L7.75,11.5 C7.10279131,11.5 6.5704661,11.9918747 6.50645361,12.6221948 L6.5,12.75 L6.5,16.499 L17.8100737,16.5 C18.1394331,16.5 18.4534488,16.3701335 18.6858203,16.1419575 L18.7802162,16.0382408 L20.415,14.025 L17.883793,11.8092791 C17.693906,11.643128 17.4591419,11.5391183 17.2109425,11.5090636 L17.0606622,11.5 Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="document_regular">M12.25 4C9.90279 4 8 5.90279 8 8.25V39.75C8 42.0972 9.90279 44 12.25 44H35.75C38.0972 44 40 42.0972 40 39.75V18.4142C40 17.8175 39.7629 17.2452 39.341 16.8232L27.1768 4.65901C26.7548 4.23705 26.1825 4 25.5858 4H12.25ZM10.5 8.25C10.5 7.2835 11.2835 6.5 12.25 6.5H24V15.25C24 17.3211 25.6789 19 27.75 19H37.5V39.75C37.5 40.7165 36.7165 41.5 35.75 41.5H12.25C11.2835 41.5 10.5 40.7165 10.5 39.75V8.25ZM35.4822 16.5H27.75C27.0596 16.5 26.5 15.9404 26.5 15.25V7.51777L35.4822 16.5Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="question_regular">M24 5.5C18.4796 5.5 14 9.97964 14 15.5C14 16.1904 14.5596 16.75 15.25 16.75C15.9404 16.75 16.5 16.1904 16.5 15.5C16.5 11.3604 19.8604 8 24 8C28.1396 8 31.5 11.3604 31.5 15.5C31.5 17.3754 31.0292 18.4403 30.3989 19.2446C29.889 19.8954 29.2935 20.3788 28.5509 20.9815C28.2472 21.2281 27.9187 21.4947 27.5615 21.8009C26.3916 22.8037 25.1534 24.0676 24.2301 26.0903C23.3147 28.0953 22.75 30.7533 22.75 34.5V34.75C22.75 35.4404 23.3096 36 24 36C24.6904 36 25.25 35.4404 25.25 34.75V34.5C25.25 30.9967 25.779 28.7172 26.5043 27.1285C27.2216 25.5574 28.1709 24.5713 29.1885 23.6991C29.4213 23.4995 29.6744 23.2943 29.9373 23.0811C30.7553 22.4179 31.669 21.6771 32.3667 20.7866C33.377 19.4972 34 17.8746 34 15.5C34 9.97964 29.5204 5.5 24 5.5Z M24 42C24.8284 42 25.5 41.3284 25.5 40.5C25.5 39.6716 24.8284 39 24 39C23.1716 39 22.5 39.6716 22.5 40.5C22.5 41.3284 23.1716 42 24 42Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="document_none_regular">M18.5 20C18.5 20.275 18.276 20.5 18 20.5H12.2678C11.9806 21.051 11.6168 21.5557 11.1904 22H18C19.104 22 20 21.104 20 20V9.828C20 9.298 19.789 8.789 19.414 8.414L13.585 2.586C13.57 2.57105 13.5531 2.55808 13.5363 2.5452C13.5238 2.53567 13.5115 2.5262 13.5 2.516C13.429 2.452 13.359 2.389 13.281 2.336C13.2557 2.31894 13.2281 2.30548 13.2005 2.29207C13.1845 2.28426 13.1685 2.27647 13.153 2.268C13.1363 2.25859 13.1197 2.24897 13.103 2.23933C13.0488 2.20797 12.9944 2.17648 12.937 2.152C12.74 2.07 12.528 2.029 12.313 2.014C12.2933 2.01274 12.2738 2.01008 12.2542 2.00741C12.2271 2.00371 12.1999 2 12.172 2H6C4.896 2 4 2.896 4 4V11.4982C4.47417 11.3004 4.97679 11.1572 5.5 11.0764V4C5.5 3.725 5.724 3.5 6 3.5H12V8C12 9.104 12.896 10 14 10H18.5V20ZM13.5 4.621L17.378 8.5H14C13.724 8.5 13.5 8.275 13.5 8V4.621Z M12 17.5C12 20.5376 9.53757 23 6.5 23C3.46243 23 1 20.5376 1 17.5C1 14.4624 3.46243 12 6.5 12C9.53757 12 12 14.4624 12 17.5ZM2.5 17.5C2.5 18.3335 2.75495 19.1075 3.19112 19.7482L8.74822 14.1911C8.10751 13.755 7.33353 13.5 6.5 13.5C4.29086 13.5 2.5 15.2909 2.5 17.5ZM6.5 21.5C8.70914 21.5 10.5 19.7091 10.5 17.5C10.5 16.6665 10.245 15.8925 9.80888 15.2518L4.25178 20.8089C4.89249 21.245 5.66647 21.5 6.5 21.5Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="document_unknown_regular">M18.5 20C18.5 20.275 18.276 20.5 18 20.5H12.2678C11.9806 21.051 11.6168 21.5557 11.1904 22H18C19.104 22 20 21.104 20 20V9.828C20 9.298 19.789 8.789 19.414 8.414L13.585 2.586C13.57 2.57105 13.5531 2.55808 13.5363 2.5452C13.5238 2.53567 13.5115 2.5262 13.5 2.516C13.429 2.452 13.359 2.389 13.281 2.336C13.2557 2.31894 13.2281 2.30548 13.2005 2.29207C13.1845 2.28426 13.1685 2.27647 13.153 2.268C13.1363 2.25859 13.1197 2.24897 13.103 2.23933C13.0488 2.20797 12.9944 2.17648 12.937 2.152C12.74 2.07 12.528 2.029 12.313 2.014C12.2933 2.01274 12.2738 2.01008 12.2542 2.00741C12.2271 2.00371 12.1999 2 12.172 2H6C4.896 2 4 2.896 4 4V11.4982C4.47417 11.3004 4.97679 11.1572 5.5 11.0764V4C5.5 3.725 5.724 3.5 6 3.5H12V8C12 9.104 12.896 10 14 10H18.5V20ZM13.5 4.621L17.378 8.5H14C13.724 8.5 13.5 8.275 13.5 8V4.621Z M1 17.5C1 20.5376 3.46243 23 6.5 23C9.53757 23 12 20.5376 12 17.5C12 14.4624 9.53757 12 6.5 12C3.46243 12 1 14.4624 1 17.5ZM5.75 20.75C5.75 20.3358 6.08579 20 6.5 20C6.91421 20 7.25 20.3358 7.25 20.75C7.25 21.1642 6.91421 21.5 6.5 21.5C6.08579 21.5 5.75 21.1642 5.75 20.75ZM4.5 16C4.5 14.8954 5.39543 14 6.5 14C7.60457 14 8.5 14.8954 8.5 16C8.5 16.7305 8.28822 17.1397 7.74605 17.7079L7.48196 17.9775L7.36602 18.1025C7.08257 18.4207 7 18.6294 7 19C7 19.2761 6.77614 19.5 6.5 19.5C6.22386 19.5 6 19.2761 6 19C6 18.2695 6.21178 17.8603 6.75395 17.2921L7.01804 17.0225L7.13398 16.8975C7.41743 16.5793 7.5 16.3706 7.5 16C7.5 15.4477 7.05228 15 6.5 15C5.94772 15 5.5 15.4477 5.5 16C5.5 16.2761 5.27614 16.5 5 16.5C4.72386 16.5 4.5 16.2761 4.5 16Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="arrow_curve_up_left_regular">M5.85355 6.85355C5.65829 7.04882 5.34171 7.04882 5.14645 6.85355C4.95118 6.65829 4.95118 6.34171 5.14645 6.14645L9.14645 2.14645C9.34171 1.95118 9.65829 1.95118 9.85355 2.14645L13.8536 6.14645C14.0488 6.34171 14.0488 6.65829 13.8536 6.85355C13.6583 7.04882 13.3417 7.04882 13.1464 6.85355L10 3.70711L10 9.99999C10 11.9648 10.2468 13.3808 10.7644 14.4734C11.2756 15.5528 12.0719 16.36 13.2572 17.0712C13.494 17.2133 13.5708 17.5204 13.4287 17.7572C13.2867 17.994 12.9795 18.0708 12.7428 17.9287C11.4281 17.1399 10.4744 16.1972 9.86063 14.9015C9.25319 13.6192 9 12.0351 9 9.99999L9 3.70711L5.85355 6.85355Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="arrow_download_regular">M12.25,39.5 L35.75,39.5 C36.4403559,39.5 37,40.0596441 37,40.75 C37,41.3972087 36.5081253,41.9295339 35.8778052,41.9935464 L35.75,42 L12.25,42 C11.5596441,42 11,41.4403559 11,40.75 C11,40.1027913 11.4918747,39.5704661 12.1221948,39.5064536 L12.25,39.5 L35.75,39.5 L12.25,39.5 Z M23.6221948,6.00645361 L23.75,6 C24.3972087,6 24.9295339,6.49187466 24.9935464,7.12219476 L25,7.25 L25,31.54 L30.6466793,25.8942911 C31.1348346,25.4061358 31.9262909,25.4061358 32.4144462,25.8942911 C32.9026016,26.3824465 32.9026016,27.1739027 32.4144462,27.6620581 L24.6362716,35.4402327 C24.1481163,35.928388 23.35666,35.928388 22.8685047,35.4402327 L15.0903301,27.6620581 C14.6021747,27.1739027 14.6021747,26.3824465 15.0903301,25.8942911 C15.5784855,25.4061358 16.3699417,25.4061358 16.858097,25.8942911 L22.5,31.536 L22.5,7.25 C22.5,6.60279131 22.9918747,6.0704661 23.6221948,6.00645361 L23.75,6 L23.6221948,6.00645361 Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="arrow_right_regular">M15.2685,4.20949 C14.97,3.92233 14.4952,3.93153 14.208,4.23005 C13.9209,4.52857 13.9301,5.00335 14.2286,5.29051 L22.5028,13.25 L3.75,13.25 C3.33579,13.25 3,13.5858 3,13.9999982 C3,14.4142 3.33579,14.75 3.75,14.75 L22.5018,14.75 L14.2286,22.7085 C13.9301,22.9957 13.9209,23.4705 14.208,23.769 C14.4952,24.0675 14.97,24.0767 15.2685,23.7896 L24.6965,14.7202 C25.1054,14.3268 25.1054,13.6723 24.6965,13.2788 L15.2685,4.20949 Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="arrow_sync_circle_regular">M12,2 C17.5228,2 22,6.47715 22,12 C22,17.5228 17.5228,22 12,22 C6.47715,22 2,17.5228 2,12 C2,6.47715 6.47715,2 12,2 Z M12,3.5 C7.30558,3.5 3.5,7.30558 3.5,12 C3.5,16.6944 7.30558,20.5 12,20.5 C16.6944,20.5 20.5,16.6944 20.5,12 C20.5,7.30558 16.6944,3.5 12,3.5 Z M16.75,12 C17.1296833,12 17.4434889,12.2821653 17.4931531,12.6482323 L17.5,12.75 L17.5,15.75 C17.5,16.1642 17.1642,16.5 16.75,16.5 C16.3703167,16.5 16.0565111,16.2178347 16.0068469,15.8517677 L16,15.75 L16,15 C15.0881,16.2143 13.6362,17 11.9999,17 C10.4748,17 9.09587,16.316 8.17857,15.237 C7.91028,14.9214 7.94862,14.4481 8.2642,14.1798 C8.57979,13.9115 9.05311,13.9499 9.3214,14.2655 C9.96322,15.0204 10.9293,15.5 11.9999,15.5 C13.32553,15.5 14.4803167,14.7625672 15.0742404,13.6746351 L15.1633,13.5 L14,13.5 C13.5858,13.5 13.25,13.1642 13.25,12.75 C13.25,12.3703167 13.5321653,12.0565111 13.8982323,12.0068469 L14,12 L16.75,12 Z M11.9999,7 C13.5368,7 14.9041,7.66036 15.8268,8.77062 C16.0915,9.08918 16.0479,9.56205 15.7294,9.8268 C15.4108,10.0916 14.9379,10.0479 14.6732,9.72938 C14.0368,8.96361 13.093,8.5 11.9999,8.5 C10.5754318,8.5 9.34895806,9.35140335 8.80281957,10.5730172 L8.72948,10.75 L10,10.75 C10.4142,10.75 10.75,11.0858 10.75,11.5 C10.75,11.8796833 10.4678347,12.1934889 10.1017677,12.2431531 L10,12.25 L7.25,12.25 C6.8703075,12.25 6.55650958,11.9678347 6.50684668,11.6017677 L6.5,11.5 L6.5,8.25 C6.5,7.83579 6.83579,7.5 7.25,7.5 C7.6296925,7.5 7.94349042,7.78215688 7.99315332,8.14823019 L8,8.25 L8,8.99955 C8.9121,7.78531 10.364,7 11.9999,7 Z</StreamGeometry>
|
||||
|
||||
|
||||
<StreamGeometry x:Key="arrow_sync_regular">M7.74944331,5.18010908 C8.0006303,5.50946902 7.93725859,5.9800953 7.60789865,6.23128229 C5.81957892,7.59514774 4.75,9.70820889 4.75,12 C4.75,15.7359812 7.57583716,18.8119527 11.2066921,19.2070952 L10.5303301,18.5303301 C10.2374369,18.2374369 10.2374369,17.7625631 10.5303301,17.4696699 C10.7965966,17.2034034 11.2132603,17.1791973 11.5068718,17.3970518 L11.5909903,17.4696699 L13.5909903,19.4696699 C13.8572568,19.7359365 13.8814629,20.1526002 13.6636084,20.4462117 L13.5909903,20.5303301 L11.5909903,22.5303301 C11.298097,22.8232233 10.8232233,22.8232233 10.5303301,22.5303301 C10.2640635,22.2640635 10.2398575,21.8473998 10.4577119,21.5537883 L10.5303301,21.4696699 L11.280567,20.7208479 C6.78460951,20.3549586 3.25,16.5902554 3.25,12 C3.25,9.23526399 4.54178532,6.68321165 6.6982701,5.03856442 C7.02763004,4.78737743 7.49825632,4.85074914 7.74944331,5.18010908 Z M13.4696699,1.46966991 C13.7625631,1.76256313 13.7625631,2.23743687 13.4696699,2.53033009 L12.7204313,3.27923335 C17.2159137,3.64559867 20.75,7.4100843 20.75,12 C20.75,14.6444569 19.5687435,17.0974104 17.5691913,18.7491089 C17.2498402,19.0129038 16.7771069,18.9678666 16.513312,18.6485156 C16.2495171,18.3291645 16.2945543,17.8564312 16.6139054,17.5926363 C18.2720693,16.2229363 19.25,14.1922015 19.25,12 C19.25,8.26436254 16.4246828,5.18861329 12.7943099,4.7930139 L13.4696699,5.46966991 C13.7625631,5.76256313 13.7625631,6.23743687 13.4696699,6.53033009 C13.1767767,6.8232233 12.701903,6.8232233 12.4090097,6.53033009 L10.4090097,4.53033009 C10.1161165,4.23743687 10.1161165,3.76256313 10.4090097,3.46966991 L12.4090097,1.46966991 C12.701903,1.1767767 13.1767767,1.1767767 13.4696699,1.46966991 Z</StreamGeometry>
|
||||
|
||||
|
||||
</Style.Resources>
|
||||
|
||||
<Style Selector="PathIcon.loading">
|
||||
<Style.Animations>
|
||||
<Animation Duration="0:0:1" IterationCount="INFINITE">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="RotateTransform.Angle" Value="0"/>
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="RotateTransform.Angle" Value="179"/>
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -11,6 +11,8 @@ public class FileInformation
|
||||
public DateTimeOffset Date { get; set; } = DateTimeOffset.MinValue;
|
||||
|
||||
public bool IsFile => Type == FileType.File;
|
||||
public bool IsDirectory => Type == FileType.Directory;
|
||||
public bool IsUnknown => Type == FileType.Unknown;
|
||||
}
|
||||
|
||||
public enum FileType
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using k8s;
|
||||
using k8s.KubeConfigModels;
|
||||
using K8sFileBrowser.Models;
|
||||
@@ -72,7 +73,10 @@ public class KubernetesService
|
||||
.ConfigureAwait(false)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
return execResult.FileInformations;
|
||||
return execResult.FileInformations
|
||||
.Where(f => f.Name != "." && f.Name != path)
|
||||
.OrderBy(f => f.Type).ThenBy(f => f.Name)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -91,10 +95,10 @@ public class KubernetesService
|
||||
}
|
||||
|
||||
|
||||
public void DownloadFile(Namespace? selectedNamespace, Pod? selectedPod, FileInformation selectedFile, string? saveFileName)
|
||||
public async Task DownloadFile(Namespace? selectedNamespace, Pod? selectedPod, FileInformation selectedFile, string? saveFileName)
|
||||
{
|
||||
Log.Information($"{selectedNamespace} - {selectedPod} - {selectedFile} - {saveFileName}");
|
||||
|
||||
await Task.Delay(10000);
|
||||
// TODO: this is done with Tar
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,13 @@ public class MainWindowViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _selectedPath, value);
|
||||
}
|
||||
|
||||
private bool _isDownloadActive;
|
||||
public bool IsDownloadActive
|
||||
{
|
||||
get => _isDownloadActive;
|
||||
set => this.RaiseAndSetIfChanged(ref _isDownloadActive, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> DownloadCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ParentCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> OpenCommand { get; }
|
||||
@@ -68,16 +75,16 @@ public class MainWindowViewModel : ViewModelBase
|
||||
var kubernetesService = new KubernetesService();
|
||||
|
||||
var isFile = this
|
||||
.WhenAnyValue(x => x.SelectedFile)
|
||||
.Select(x => x is { Type: FileType.File });
|
||||
.WhenAnyValue(x => x.SelectedFile, x => x.IsDownloadActive)
|
||||
.Select(x => x is { Item1.Type: FileType.File, Item2: false });
|
||||
|
||||
var isDirectory = this
|
||||
.WhenAnyValue(x => x.SelectedFile)
|
||||
.Select(x => x is { Type: FileType.Directory });
|
||||
.WhenAnyValue(x => x.SelectedFile, x => x.IsDownloadActive)
|
||||
.Select(x => x is { Item1.Type: FileType.Directory, Item2: false });
|
||||
|
||||
var isNotRoot = this
|
||||
.WhenAnyValue(x => x.SelectedPath)
|
||||
.Select(x => x is not "/");
|
||||
.WhenAnyValue(x => x.SelectedPath, x => x.IsDownloadActive)
|
||||
.Select(x => x.Item1 is not "/" && !x.Item2);
|
||||
|
||||
OpenCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
@@ -86,11 +93,17 @@ public class MainWindowViewModel : ViewModelBase
|
||||
|
||||
DownloadCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await Observable.StartAsync(async () => {
|
||||
var fileName = SelectedFile!.Name.Substring(SelectedFile!.Name.LastIndexOf('/') + 1, SelectedFile!.Name.Length - SelectedFile!.Name.LastIndexOf('/') - 1);
|
||||
var saveFileName = await ApplicationHelper.SaveFile(".", fileName);
|
||||
kubernetesService.DownloadFile(SelectedNamespace, SelectedPod, SelectedFile, saveFileName);
|
||||
|
||||
}, isFile, RxApp.TaskpoolScheduler);
|
||||
if (saveFileName != null)
|
||||
{
|
||||
IsDownloadActive = true;
|
||||
await kubernetesService.DownloadFile(SelectedNamespace, SelectedPod, SelectedFile, saveFileName);
|
||||
IsDownloadActive = false;
|
||||
}
|
||||
}, RxApp.TaskpoolScheduler);
|
||||
}, isFile, RxApp.MainThreadScheduler);
|
||||
|
||||
ParentCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:vm="using:K8sFileBrowser.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:K8sFileBrowser.Models"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="K8sFileBrowser.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
@@ -13,8 +14,14 @@
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
|
||||
<Grid>
|
||||
<Border ZIndex="1" IsVisible="{Binding IsDownloadActive}" Background="Black" Opacity="0.7">
|
||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<PathIcon Classes="loading" Data="{StaticResource arrow_sync_regular}" Width="100" Height="100"></PathIcon>
|
||||
<TextBlock>Download File...</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<Border Padding="10 14" Background="#21252b">
|
||||
<Grid ColumnDefinitions="Auto,Auto,Auto,*">
|
||||
<Label Grid.Column="0"
|
||||
@@ -44,7 +51,6 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="*, 1, 3*" Grid.Row="1">
|
||||
<ListBox
|
||||
ItemsSource="{Binding Pods}"
|
||||
@@ -65,12 +71,24 @@
|
||||
</ListBox>
|
||||
<GridSplitter Grid.Column="1" ResizeDirection="Columns" />
|
||||
<Grid Grid.Column="2" RowDefinitions="Auto, *">
|
||||
<StackPanel Orientation="Horizontal" Spacing="4" Margin="10">
|
||||
<Button Command="{Binding ParentCommand}" VerticalAlignment="Center">Parent Directory</Button>
|
||||
<Button Command="{Binding OpenCommand}" VerticalAlignment="Center">Open Directory</Button>
|
||||
<Button Command="{Binding DownloadCommand}" VerticalAlignment="Center">Download</Button>
|
||||
<TextBlock Text="{Binding SelectedPath}" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock>
|
||||
</StackPanel>
|
||||
<Grid ColumnDefinitions="*, Auto">
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="Current Directory" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock>
|
||||
<TextBlock Text="{Binding SelectedPath}" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4" Margin="10" HorizontalAlignment="Right">
|
||||
|
||||
<Button Command="{Binding ParentCommand}" VerticalAlignment="Center" ToolTip.Tip="Go To Parent Directory">
|
||||
<PathIcon Data="{StaticResource arrow_curve_up_left_regular}"></PathIcon>
|
||||
</Button>
|
||||
<Button Command="{Binding OpenCommand}" VerticalAlignment="Center" ToolTip.Tip="Browse Directory">
|
||||
<PathIcon Data="{StaticResource arrow_right_regular}"></PathIcon>
|
||||
</Button>
|
||||
<Button Command="{Binding DownloadCommand}" VerticalAlignment="Center" ToolTip.Tip="Download File">
|
||||
<PathIcon Data="{StaticResource arrow_download_regular}"></PathIcon>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<DataGrid Grid.Row="1"
|
||||
Name="FileInformationDataGrid"
|
||||
Margin="2 0 2 0"
|
||||
@@ -79,7 +97,8 @@
|
||||
GridLinesVisibility="Horizontal"
|
||||
BorderThickness="1"
|
||||
SelectionMode="Single"
|
||||
SelectedItem="{Binding SelectedFile}">
|
||||
SelectedItem="{Binding SelectedFile}"
|
||||
>
|
||||
<DataGrid.Styles>
|
||||
<Style Selector="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="14"></Setter>
|
||||
@@ -90,7 +109,19 @@
|
||||
</Style>
|
||||
</DataGrid.Styles>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Type" Binding="{Binding Type}"/>
|
||||
<DataGridTemplateColumn Header="Type">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="models:FileInformation">
|
||||
<Border ToolTip.Tip="{Binding Type}" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<StackPanel>
|
||||
<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>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Name" Width="*" Binding="{Binding Name}" />
|
||||
<DataGridTextColumn Header="Size" Binding="{Binding Size}" />
|
||||
<DataGridTextColumn Header="Date" Binding="{Binding Date}" />
|
||||
@@ -99,5 +130,5 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user