4 Commits

Author SHA1 Message Date
BlossomiShymae
4d6e04acb8 Fix bug where parameter types weren't correct 2024-08-10 05:56:06 -05:00
BlossomiShymae
dc538ee5ce Fix bug where parameters weren't showing up 2024-08-10 05:52:42 -05:00
BlossomiShymae
16d18878e0 Increment version 2024-08-10 05:04:47 -05:00
BlossomiShymae
893f226463 Add search for endpoint operations 2024-08-10 05:01:09 -05:00
4 changed files with 34 additions and 10 deletions

View File

@@ -9,10 +9,10 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Avalonia"> <PropertyGroup Label="Avalonia">
<AvaloniaXamlIlDebuggerLaunch>False</AvaloniaXamlIlDebuggerLaunch> <AvaloniaXamlIlDebuggerLaunch>False</AvaloniaXamlIlDebuggerLaunch>
<ApplicationIcon>app.ico</ApplicationIcon> <ApplicationIcon>app.ico</ApplicationIcon>
<AssemblyName>NeedleworkDotNet</AssemblyName> <AssemblyName>NeedleworkDotNet</AssemblyName>
<AssemblyVersion>0.1.1.0</AssemblyVersion> <AssemblyVersion>0.2.2.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion> <FileVersion>0.2.2.0</FileVersion>
<AvaloniaXamlVerboseExceptions>False</AvaloniaXamlVerboseExceptions> <AvaloniaXamlVerboseExceptions>False</AvaloniaXamlVerboseExceptions>
</PropertyGroup> </PropertyGroup>

View File

@@ -12,15 +12,31 @@ namespace Needlework.Net.Desktop.ViewModels
public string Endpoint { get; } public string Endpoint { get; }
public string Title => Endpoint; public string Title => Endpoint;
[ObservableProperty] private IAvaloniaReadOnlyList<PathOperationViewModel> _pathOperations; [ObservableProperty] private IAvaloniaReadOnlyList<PathOperationViewModel> _pathOperations;
[ObservableProperty] private PathOperationViewModel? _selectedPathOperation; [ObservableProperty] private PathOperationViewModel? _selectedPathOperation;
[ObservableProperty] private string? _search;
[ObservableProperty] private IAvaloniaReadOnlyList<PathOperationViewModel> _filteredPathOperations;
public EndpointViewModel(string endpoint) public EndpointViewModel(string endpoint)
{ {
Endpoint = endpoint; Endpoint = endpoint;
var handler = WeakReferenceMessenger.Default.Send<DataRequestMessage>().Response; var handler = WeakReferenceMessenger.Default.Send<DataRequestMessage>().Response;
PathOperations = new AvaloniaList<PathOperationViewModel>(handler.Plugins[endpoint].Select(x => new PathOperationViewModel(x))); PathOperations = new AvaloniaList<PathOperationViewModel>(handler.Plugins[endpoint].Select(x => new PathOperationViewModel(x)));
FilteredPathOperations = new AvaloniaList<PathOperationViewModel>(PathOperations);
}
partial void OnSearchChanged(string? value)
{
if (string.IsNullOrWhiteSpace(value))
{
FilteredPathOperations = new AvaloniaList<PathOperationViewModel>(PathOperations);
return;
}
FilteredPathOperations = new AvaloniaList<PathOperationViewModel>(PathOperations.Where(o => o.Path.ToLower().Contains(value.ToLower())));
} }
} }
} }

View File

@@ -48,8 +48,8 @@ namespace Needlework.Net.Desktop.ViewModels
var pathParameters = new AvaloniaList<ParameterViewModel>(); var pathParameters = new AvaloniaList<ParameterViewModel>();
foreach (var parameter in parameters) foreach (var parameter in parameters)
{ {
if (parameter.In != location) break; if (parameter.In != location) continue;
pathParameters.Add(new ParameterViewModel(parameter.Name, parameter.Schema.Type, parameter.Required)); pathParameters.Add(new ParameterViewModel(parameter.Name, GetSchemaType(parameter.Schema), parameter.Required));
} }
return pathParameters; return pathParameters;

View File

@@ -3,6 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:suki="clr-namespace:SukiUI.Controls;assembly=SukiUI" xmlns:suki="clr-namespace:SukiUI.Controls;assembly=SukiUI"
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:theme="clr-namespace:SukiUI.Theme;assembly=SukiUI" xmlns:theme="clr-namespace:SukiUI.Theme;assembly=SukiUI"
xmlns:vm="using:Needlework.Net.Desktop.ViewModels" xmlns:vm="using:Needlework.Net.Desktop.ViewModels"
xmlns:avalonEdit="https://github.com/avaloniaui/avaloniaedit" xmlns:avalonEdit="https://github.com/avaloniaui/avaloniaedit"
@@ -12,15 +13,22 @@
<Grid RowDefinitions="auto,*" ColumnDefinitions="3*,2,4*,2,4*"> <Grid RowDefinitions="auto,*" ColumnDefinitions="3*,2,4*,2,4*">
<Grid Grid.Row="0" <Grid Grid.Row="0"
Grid.Column="0" Grid.Column="0"
Grid.RowSpan="2" RowDefinitions="*"
RowDefinitions="auto,*" ColumnDefinitions="auto,*">
<TextBox Text="{Binding Search}"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"/>
</Grid>
<Grid Grid.Row="1"
Grid.Column="0"
RowDefinitions="*"
ColumnDefinitions="*"> ColumnDefinitions="*">
<ListBox ItemsSource="{Binding PathOperations}" <ListBox ItemsSource="{Binding FilteredPathOperations}"
SelectedItem="{Binding SelectedPathOperation}" SelectedItem="{Binding SelectedPathOperation}"
ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible"
Margin="0 0 0 0" Margin="0 0 0 0"
Grid.Row="0" Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="0"> Grid.Column="0">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>