diff --git a/src/ScriptRunner/ScriptRunner.GUI/Parameters/ParamsPanelFactory.cs b/src/ScriptRunner/ScriptRunner.GUI/Parameters/ParamsPanelFactory.cs index f7d66a7..d7e6e79 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Parameters/ParamsPanelFactory.cs +++ b/src/ScriptRunner/ScriptRunner.GUI/Parameters/ParamsPanelFactory.cs @@ -84,16 +84,15 @@ public ParamsPanel Create(ScriptConfig action, Dictionary values bool _isResizing = false; Point _lastPointerPosition = default; - // Create toolbar + // Create toolbar for expand button only var toolbar = new StackPanel() { Orientation = Orientation.Horizontal, Height = 24, HorizontalAlignment = HorizontalAlignment.Right, - //Background = new SolidColorBrush(Color.FromArgb(50, 128, 128, 128)), Spacing = 5, ZIndex = 1, - Margin = new Thickness(0,-25,0,0), + Margin = new Thickness(0,0,10,-35), }; // Expand button to open overlay @@ -133,15 +132,21 @@ public ParamsPanel Create(ScriptConfig action, Dictionary values } }; - // Resize handle + toolbar.Children.Add(expandButton); + + // Create a grid to overlay the resize handle on the editor + var grid = new Grid(); + grid.Children.Add(controlRecord.Control); + + // Resize handle positioned at bottom right of editor var resizeHandle = new Border() { - Width = 24, - Height = 24, Background = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.BottomRightCorner), - VerticalAlignment = VerticalAlignment.Center, - Margin = new Thickness(2,5,0,0), + VerticalAlignment = VerticalAlignment.Bottom, + HorizontalAlignment = HorizontalAlignment.Right, + Margin = new Thickness(0,0,5,0), + ZIndex = 10 }; var resizeIcon = new Icon() @@ -186,15 +191,14 @@ public ParamsPanel Create(ScriptConfig action, Dictionary values _isResizing = false; }; - toolbar.Children.Add(expandButton); - toolbar.Children.Add(resizeHandle); + grid.Children.Add(resizeHandle); var panel = new StackPanel() { Orientation = Orientation.Vertical }; - panel.Children.Add(controlRecord.Control); panel.Children.Add(toolbar); + panel.Children.Add(grid); controlForEdit = panel; @@ -535,35 +539,19 @@ private IControlRecord CreateControlRecord(ScriptParam p, string? value, int ind UncheckedValue = p.GetPromptSettings("uncheckedValue", out var uncheckedValue)? uncheckedValue: defaultUnchecked, }; case PromptType.Multilinetext: - if (p.GetPromptSettings("syntax", out var syntax) && !string.IsNullOrWhiteSpace(syntax)) - { - return new TextControl - { - Control = CreateAvaloniaEdit(value, index, syntax) - }; - } - - // Use regular TextBox without syntax highlighting + p.GetPromptSettings("syntax", out var syntax); + syntax ??= "txt"; return new TextControl { - Control = new TextBox - { - TextWrapping = TextWrapping.Wrap, - AcceptsReturn = true, - Height = 100, - Text = value, - TabIndex = index, - IsTabStop = true, - Width = 500, - } + Control = CreateAvaloniaEdit(value, index, syntax) }; + case PromptType.FileContent: if (string.IsNullOrWhiteSpace(value) == false && Path.IsPathRooted(value) == false) { value = Path.GetFullPath(value, scriptConfig.WorkingDirectory); } - var templateText = p.GetPromptSettings("templateText", out var rawTemplate)? rawTemplate: ""; var textForControl = File.Exists(value) ? File.ReadAllText(value) : templateText; diff --git a/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs b/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs index 7dc6e8c..ade8658 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs +++ b/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs @@ -216,20 +216,22 @@ public MainWindowViewModel(ParamsPanelFactory paramsPanelFactory, VaultProvider this._configRepositoryUpdater = new ConfigRepositoryUpdater(new CliRepositoryClient(command => { var tcs = new TaskCompletionSource(); - - var job = new RunningJobViewModel + Dispatcher.UIThread.Post(() => { - Tile = $"Update repository", - ExecutedCommand = $"{command.Command} {command.Parameters}", - }; - this.RunningJobs.Add(job); - SelectedRunningJob = job; + var job = new RunningJobViewModel + { + Tile = $"Update repository", + ExecutedCommand = $"{command.Command} {command.Parameters}", + }; + this.RunningJobs.Add(job); + SelectedRunningJob = job; - job.ExecutionCompleted += (sender, args) => - { - tcs.SetResult(new(job.RawOutput, job.RawErrorOutput)); - }; - job.RunJob(command.Command, command.Parameters, command.WorkingDirectory, Array.Empty(), Array.Empty()); + job.ExecutionCompleted += (sender, args) => + { + tcs.SetResult(new(job.RawOutput, job.RawErrorOutput)); + }; + job.RunJob(command.Command, command.Parameters, command.WorkingDirectory, Array.Empty(), Array.Empty()); + }); return tcs.Task; })); IsScriptListVisible = true; @@ -478,6 +480,10 @@ public void DismissNewVersionAvailable() ShowNewVersionAvailable = false; } + public void DismissOutdatedRepositories() + { + OutOfDateConfigRepositories.Clear(); + } private IEnumerable _controlRecords; //private ActionsConfig config; diff --git a/src/ScriptRunner/ScriptRunner.GUI/Views/NotificationSection.axaml b/src/ScriptRunner/ScriptRunner.GUI/Views/NotificationSection.axaml index 34bdd3d..a28bbe7 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Views/NotificationSection.axaml +++ b/src/ScriptRunner/ScriptRunner.GUI/Views/NotificationSection.axaml @@ -7,43 +7,170 @@ xmlns:viewModels="clr-namespace:ScriptRunner.GUI.ViewModels" xmlns:converters="clr-namespace:ScriptRunner.GUI.Converters" xmlns:avalonia="clr-namespace:LoadingIndicators.Avalonia;assembly=LoadingIndicators.Avalonia" + xmlns:icons="https://github.com/projektanker/icons.avalonia" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:DataType="viewModels:MainWindowViewModel" x:Class="ScriptRunner.GUI.Views.NotificationSection"> - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ScriptRunner/ScriptRunner.GUI/Views/PredefinedParameterSaveWindow.axaml b/src/ScriptRunner/ScriptRunner.GUI/Views/PredefinedParameterSaveWindow.axaml index 313b697..0264bd9 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Views/PredefinedParameterSaveWindow.axaml +++ b/src/ScriptRunner/ScriptRunner.GUI/Views/PredefinedParameterSaveWindow.axaml @@ -3,35 +3,132 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:views="clr-namespace:ScriptRunner.GUI.Views" - mc:Ignorable="d" Width="500" Height="250" + xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" + mc:Ignorable="d" + Width="550" + Height="470" x:Class="ScriptRunner.GUI.Views.PredefinedParameterSaveWindow" - Title="Save argument values as..." + Title="Save Argument Values" WindowStartupLocation="CenterOwner" - > - - - - - - - - - - - - - Default set - - New set: - - - - Existing set: - - + Background="#212222" + FontFamily="Segoe UI Variable"> + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ScriptRunner/ScriptRunner.GUI/Views/Vault.axaml b/src/ScriptRunner/ScriptRunner.GUI/Views/Vault.axaml index c9330ee..40651fc 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Views/Vault.axaml +++ b/src/ScriptRunner/ScriptRunner.GUI/Views/Vault.axaml @@ -4,70 +4,157 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:ScriptRunner.GUI.ViewModels" xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="650" - Width="800" + mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="650" + Width="900" Height="650" x:Class="ScriptRunner.GUI.Views.Vault" WindowStartupLocation="CenterOwner" - Title="Vault"> + Title="Vault - Secure Key-Value Storage" + Background="#212222" + FontFamily="Segoe UI Variable" + KeyboardNavigation.TabNavigation="Cycle"> - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + diff --git a/src/ScriptRunner/ScriptRunner.GUI/Views/VaultPicker.axaml b/src/ScriptRunner/ScriptRunner.GUI/Views/VaultPicker.axaml index 4198131..0b1e67c 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Views/VaultPicker.axaml +++ b/src/ScriptRunner/ScriptRunner.GUI/Views/VaultPicker.axaml @@ -3,25 +3,86 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:ScriptRunner.GUI.Views" - mc:Ignorable="d" Width="400" - SizeToContent="WidthAndHeight" + xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" + mc:Ignorable="d" + Width="500" + Height="300" x:Class="ScriptRunner.GUI.Views.VaultPicker" WindowStartupLocation="CenterOwner" - Title="Pick secret"> + Title="Select Vault Secret" + Background="#212222" + FontFamily="Segoe UI Variable"> - - - - - - - - - - Remember binding - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +