Backup
This commit is contained in:
parent
151307c416
commit
e29a9a92b2
@ -1 +0,0 @@
|
||||
PSCHelpdesk
|
||||
@ -11,18 +11,21 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="95257dc5-08bd-4c50-8726-85956b3c2c92" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/riderPublish.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/riderPublish.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/FastBill/Views/CustomerView.axaml.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/.name" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.PSCHelpdesk/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FastBill/FastBill.cs" beforeDir="false" afterPath="$PROJECT_DIR$/FastBill/FastBill.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FastBill/FastBill.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/FastBill/FastBill.csproj" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Models/Server.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Models/Server.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Models/ServerSetting.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Models/ServerSetting.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Service/ServerService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Service/ServerService.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Views/ServerDetailView.axaml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Views/ServerDetailView.axaml.cs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PSCHelpdesk.sln.DotSettings.user" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk.sln.DotSettings.user" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Services/PluginManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Services/PluginManager.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/MainWindowViewModel.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/ViewModels/PluginListViewModel.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/MainWindow.axaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.deps.json" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.deps.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.dll" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/hetzner/HetznerServer.pdb" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/_dist/nextcloud/Nextcloud.dll" beforeDir="false" afterPath="$PROJECT_DIR$/_dist/nextcloud/Nextcloud.dll" afterDir="false" />
|
||||
@ -34,19 +37,18 @@
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DpaMonitoringSettings">
|
||||
<option name="autoShow" value="false" />
|
||||
<option name="firstShow" value="false" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/41a0cf7c8a374f46b063a4351ae9caba572200/c2/b03cb7ea/MaterialIconKind.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/667004c0a83e47158c9865f6d54f01d91ac00/59/bf99e13a/IPluginLoader.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/27be5d106a789638721745a2a46f9cb0f7a39905117d644638b6e0d56261be/ReplaySubject.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/2e6883f773fb7c69a15db509adac9a0c068e4ca54fa119e835fd2324311c3b/Ioc.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/9d4f4ac7db6d2c5d183ab2d92602280ed4349fd6e6a1b6313546b3d01fdab5/ServiceProvider.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/b4d338c08631a580604cf98f3ead4bcf84405bb3807bfc9f3bc14ac2d2be/Activator.RuntimeType.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/fa3c59274a754721f822d1776be91c7ffdd37ff4219098396aa16ba1fc5447/Ioc.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/boonkerz/RiderProjects/PSCHelpDesk/HetznerServer/Views/ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/boonkerz/RiderProjects/PSCHelpDesk/HetznerServer/Views/ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/boonkerz/RiderProjects/PSCHelpDesk/HetznerServer/Views/ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/boonkerz/RiderProjects/PSCHelpDesk/HetznerServer/Views/ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/HetznerServer/Views/ServerView.axaml.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Nextcloud/Views/NotesView.axaml" root0="FORCE_HIGHLIGHTING" />
|
||||
@ -56,6 +58,8 @@
|
||||
<setting file="file://$PROJECT_DIR$/Vendor/Prise/AssemblyScanning/DefaultAssemblyResolver.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Vendor/Prise/DefaultPluginLoader.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Vendor/Prise/DependencyInjection/ServiceCollectionExtensions.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="mock://ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock://ServerDetailView.axaml" root0="SKIP_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="InvalidFacetManager">
|
||||
<ignored-facets>
|
||||
@ -81,7 +85,7 @@
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
".NET Project.PSCHelpdesk.Desktop ohne plugin.executor": "Run",
|
||||
".NET Project.PSCHelpdesk.Desktop.executor": "Run",
|
||||
".NET Project.PSCHelpdesk.Desktop.executor": "Debug",
|
||||
"Publish to folder.Build HetznerServer Plugin Debug.executor": "Run",
|
||||
"Publish to folder.Copy Fastbill.executor": "Run",
|
||||
"Publish to folder.Copy Hetzner Target.executor": "Run",
|
||||
@ -93,6 +97,7 @@
|
||||
"Publish to folder.Publish NextCloud to folder.executor": "Run",
|
||||
"Publish to folder.Publish Nextcloud to folder.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"XThreadsFramesViewSplitterKey": "0.4427131",
|
||||
"git-widget-placeholder": "master",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
@ -102,7 +107,7 @@
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "SolutionBuilderGeneralOptionsPage",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
@ -183,10 +188,10 @@
|
||||
<option name="Build" default="false" projectName="HetznerServer" projectPath="$PROJECT_DIR$/HetznerServer/HetznerServer.csproj" />
|
||||
<option name="Build" default="false" projectName="FastBill" projectPath="$PROJECT_DIR$/FastBill/FastBill.csproj" />
|
||||
<option name="Build" default="false" projectName="PrintshopCreator" projectPath="$PROJECT_DIR$/PrintshopCreator/PrintshopCreator.csproj" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy NextCloud Target" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy Hetzner Target" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy Fastbill" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy PrinshopCreator" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy Hetzner" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Copy NextCloud" run_configuration_type="DotNetFolderPublish" />
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
@ -210,7 +215,6 @@
|
||||
<item itemvalue=".NET Project.PSCHelpdesk.Browser" />
|
||||
<item itemvalue=".NET Project.PSCHelpdesk.Desktop" />
|
||||
<item itemvalue=".NET Project.PSCHelpdesk.Desktop ohne plugin" />
|
||||
<item itemvalue="Android.PSCHelpdesk.Android" />
|
||||
<item itemvalue="iOS.PSCHelpdesk.iOS" />
|
||||
<item itemvalue="Publish to folder.Copy NextCloud" />
|
||||
<item itemvalue="Publish to folder.Copy Fastbill" />
|
||||
@ -243,6 +247,9 @@
|
||||
<workItem from="1731437334002" duration="2883000" />
|
||||
<workItem from="1731491898307" duration="3676000" />
|
||||
<workItem from="1731659978668" duration="9478000" />
|
||||
<workItem from="1731775118011" duration="3650000" />
|
||||
<workItem from="1731831383500" duration="6829000" />
|
||||
<workItem from="1731872471713" duration="6104000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -274,19 +281,6 @@
|
||||
<properties documentPath="C:\Users\info\RiderProjects\pschelpdesk\HetznerServer\Menu\MainMenu.cs" containingFunctionPresentation="Method 'addMenu'" />
|
||||
<option name="timeStamp" value="92" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/Shared/Setting/SettingsManager.cs</url>
|
||||
<line>85</line>
|
||||
<properties documentPath="$PROJECT_DIR$/Shared/Setting/SettingsManager.cs" containingFunctionPresentation="Method 'SavePluginSettings'">
|
||||
<startOffsets>
|
||||
<option value="2568" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="2611" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="154" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/PSCHelpdesk/PSCHelpdesk/Views/SettingsGlobalView.axaml.cs</url>
|
||||
<line>29</line>
|
||||
@ -392,17 +386,56 @@
|
||||
<option name="timeStamp" value="196" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/FastBill/FastBill.cs</url>
|
||||
<line>18</line>
|
||||
<properties documentPath="C:\Users\info\RiderProjects\pschelpdesk\FastBill\FastBill.cs" containingFunctionPresentation="Method 'Configure'">
|
||||
<url>file://$PROJECT_DIR$/HetznerServer/ViewModels/ServerViewModel.cs</url>
|
||||
<line>99</line>
|
||||
<properties documentPath="C:\Users\boonkerz\RiderProjects\PSCHelpDesk\HetznerServer\ViewModels\ServerViewModel.cs" containingFunctionPresentation="Method 'saveServerSettings'">
|
||||
<startOffsets>
|
||||
<option value="365" />
|
||||
<option value="3608" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="438" />
|
||||
<option value="3651" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="200" />
|
||||
<option name="timeStamp" value="204" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/FastBill/Api/Customers.cs</url>
|
||||
<line>20</line>
|
||||
<properties documentPath="C:\Users\boonkerz\RiderProjects\PSCHelpDesk\FastBill\Api\Customers.cs" containingFunctionPresentation="Method 'SearchCustomer'">
|
||||
<startOffsets>
|
||||
<option value="781" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="802" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="208" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/FastBill/ViewModels/CustomerViewModel.cs</url>
|
||||
<line>28</line>
|
||||
<properties documentPath="C:\Users\boonkerz\RiderProjects\PSCHelpDesk\FastBill\ViewModels\CustomerViewModel.cs" containingFunctionPresentation="Method 'SearchTerm'">
|
||||
<startOffsets>
|
||||
<option value="689" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="744" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="209" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/FastBill/Api/Customers.cs</url>
|
||||
<line>18</line>
|
||||
<properties documentPath="C:\Users\boonkerz\RiderProjects\PSCHelpDesk\FastBill\Api\Customers.cs" containingFunctionPresentation="Method 'SearchCustomer'">
|
||||
<startOffsets>
|
||||
<option value="702" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="758" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="210" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
|
||||
26
FastBill/Api/Customers.cs
Normal file
26
FastBill/Api/Customers.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using FastBill.Models;
|
||||
using RestSharp;
|
||||
using RestSharp.Authenticators;
|
||||
|
||||
namespace FastBill.Api;
|
||||
|
||||
public class Customers
|
||||
{
|
||||
async public Task<List<Customer>> SearchCustomer(Settings settings, string term)
|
||||
{
|
||||
var customers = new List<Customer>();
|
||||
|
||||
var client = new RestClient("https://my.fastbill.com/");
|
||||
var request = new RestRequest("api/1.0/api.php");
|
||||
request.Authenticator = new HttpBasicAuthenticator(settings.EMail, settings.ApiKey);
|
||||
request.RequestFormat = DataFormat.Json;
|
||||
request.AddJsonBody(new { SERVICE = "customer.get", FILTER = new { TERM = term } });
|
||||
var response = await client.ExecuteAsync<List<Customer>>(request);
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
return customers;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using FastBill.Services;
|
||||
using FastBill.ViewModels;
|
||||
using FastBill.Views;
|
||||
using PSCHelpdesk.Shared.Plugin;
|
||||
@ -16,6 +17,13 @@ public class FastBill: Contract
|
||||
|
||||
public void Configure()
|
||||
{
|
||||
var menuService = Ioc.Default.GetRequiredService<IMenuService>();
|
||||
var fastBillTab = new PSCHelpdesk.Shared.Menu.Item()
|
||||
{
|
||||
Header = "Customers",
|
||||
CommandParameter = new CustomerViewModel(new CustomerService())
|
||||
};
|
||||
menuService.AddMenuItem(fastBillTab);
|
||||
var settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
|
||||
var fastbillSettings = new Item()
|
||||
{
|
||||
@ -27,6 +35,6 @@ public class FastBill: Contract
|
||||
|
||||
public List<Type> LoadViews()
|
||||
{
|
||||
return [typeof(SettingsView)];
|
||||
return [typeof(SettingsView), typeof(CustomerView)];
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
|
||||
<PackageReference Include="ReactiveUI" Version="20.1.1" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
7
FastBill/Models/Customer.cs
Normal file
7
FastBill/Models/Customer.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace FastBill.Models;
|
||||
|
||||
public class Customer
|
||||
{
|
||||
public string CustomerNr { get; set; }
|
||||
public string CustomerId { get; set; }
|
||||
}
|
||||
28
FastBill/Services/CustomerService.cs
Normal file
28
FastBill/Services/CustomerService.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using FastBill.Models;
|
||||
using PSCHelpdesk.Shared.Service;
|
||||
using PSCHelpdesk.Shared.Setting;
|
||||
|
||||
namespace FastBill.Services;
|
||||
|
||||
public class CustomerService
|
||||
{
|
||||
private readonly SettingsManager? _settingsManager;
|
||||
private readonly Api.Customers _customerApi;
|
||||
|
||||
public CustomerService()
|
||||
{
|
||||
_settingsManager = (SettingsManager)Ioc.Default.GetService<ISettingsManager>();
|
||||
_customerApi = new Api.Customers();
|
||||
}
|
||||
|
||||
public async Task<List<Customer>> SearchCustomer(string term)
|
||||
{
|
||||
var settings = new Settings();
|
||||
_settingsManager.LoadPluginSettings("FastbillSettings", settings);
|
||||
|
||||
List<Customer> customers = new List<Customer>();
|
||||
customers = await _customerApi.SearchCustomer(settings, term);
|
||||
return customers;
|
||||
}
|
||||
}
|
||||
31
FastBill/ViewModels/CustomerViewModel.cs
Normal file
31
FastBill/ViewModels/CustomerViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Reactive;
|
||||
using FastBill.Services;
|
||||
using PSCHelpdesk.Shared.ViewModels;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace FastBill.ViewModels;
|
||||
|
||||
public class CustomerViewModel: ViewModelBase, IViewModelBase
|
||||
{
|
||||
public string _term;
|
||||
|
||||
public string Term
|
||||
{
|
||||
get => _term;
|
||||
set => SetAndRaisePropertyChanged(ref _term, value);
|
||||
}
|
||||
|
||||
private CustomerService _customerService;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SearchCustomer { get; }
|
||||
|
||||
public CustomerViewModel(CustomerService customerService)
|
||||
{
|
||||
_customerService = customerService;
|
||||
SearchCustomer = ReactiveCommand.Create(searchTerm);
|
||||
}
|
||||
async void searchTerm()
|
||||
{
|
||||
var list = await _customerService.SearchCustomer(Term);
|
||||
}
|
||||
}
|
||||
15
FastBill/Views/CustomerView.axaml
Normal file
15
FastBill/Views/CustomerView.axaml
Normal file
@ -0,0 +1,15 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:FastBill.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="vm:CustomerViewModel"
|
||||
x:Class="FastBill.Views.CustomerView">
|
||||
<Design.DataContext><vm:CustomerViewModel></vm:CustomerViewModel></Design.DataContext>
|
||||
<StackPanel>
|
||||
<TextBox Text="{Binding Term}"></TextBox>
|
||||
<Button Content="Search" Command="{Binding SearchCustomer}"></Button>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
13
FastBill/Views/CustomerView.axaml.cs
Normal file
13
FastBill/Views/CustomerView.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace FastBill.Views;
|
||||
|
||||
public partial class CustomerView : UserControl
|
||||
{
|
||||
public CustomerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
48
HetznerServer/Controls/ServerDetailView.axaml
Normal file
48
HetznerServer/Controls/ServerDetailView.axaml
Normal file
@ -0,0 +1,48 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:PSCHelpdesk.Plugins.HetznerServer.Controls">
|
||||
<Design.PreviewWith>
|
||||
<controls:ServerDetailView />
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="controls|ServerDetailView">
|
||||
<!-- Set Defaults -->
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding SelectedServer.Name}" FontSize="24"/>
|
||||
<TabControl>
|
||||
<TabItem Header="Domains">
|
||||
<StackPanel>
|
||||
<ListBox ItemsSource="{Binding SelectedServer.Domains}" Margin="0" Padding="0">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Padding="1" Margin="0">
|
||||
<!--<TextBox Text="{Binding Name}" DoubleTapped="InputElement_OnDoubleTapped"></TextBox>-->
|
||||
<HyperlinkButton Content="{Binding LinkDomain}" NavigateUri="{Binding LinkDomain}"></HyperlinkButton>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Settings">
|
||||
<StackPanel>
|
||||
<TextBlock Text="PSC ApiKey" Margin="0 5"></TextBlock>
|
||||
<TextBox Text="{Binding SelectedServer.PscApiKey}"></TextBox>
|
||||
<TextBlock Text="FastBill Id" Margin="0 5"></TextBlock>
|
||||
<TextBox Text="{Binding SelectedServer.FastBillId}"></TextBox>
|
||||
<Button Content="Save" Command="{Binding RunTheThing}"></Button>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Styles>
|
||||
9
HetznerServer/Controls/ServerDetailView.axaml.cs
Normal file
9
HetznerServer/Controls/ServerDetailView.axaml.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
|
||||
namespace PSCHelpdesk.Plugins.HetznerServer.Controls;
|
||||
|
||||
public class ServerDetailView : TemplatedControl
|
||||
{
|
||||
}
|
||||
@ -32,6 +32,7 @@
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.0" Private="false" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.2.0" Private="false" />
|
||||
<PackageReference Include="Avalonia.Xaml.Interactions" Version="11.2.0" Private="false" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
|
||||
<PackageReference Include="HetznerCloud.API" Version="1.1.9" Private="false" />
|
||||
<PackageReference Include="Material.Icons.Avalonia" Version="2.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Private="false" Version="8.0.1" />
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Xml.Linq;
|
||||
using Avalonia.Media;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Material.Icons;
|
||||
using PSCHelpdesk.Shared.Service;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PSCHelpdesk.Plugins.HetznerServer.Models;
|
||||
|
||||
public class Server : ReactiveObject
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long ServerId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
private string _pscApiKey;
|
||||
@ -90,9 +93,9 @@ public class Server : ReactiveObject
|
||||
public string Ipv4 { get; set; }
|
||||
public string Ipv6 { get; set; }
|
||||
|
||||
public Server(long id, string name, string type, string status, string ipv4, string ipv6)
|
||||
public Server(long serverId, string name, string type, string status, string ipv4, string ipv6)
|
||||
{
|
||||
Id = id;
|
||||
ServerId = serverId;
|
||||
Name = name;
|
||||
Type = type;
|
||||
Status = status;
|
||||
|
||||
@ -2,12 +2,14 @@ namespace PSCHelpdesk.Plugins.HetznerServer.Models;
|
||||
|
||||
public class ServerSetting
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
public long ServerId { get; set; }
|
||||
public string PscApiKey { get; set; }
|
||||
public string FastBillId { get; set; }
|
||||
|
||||
public ServerSetting()
|
||||
public ServerSetting(long serverId, string pscApiKey, string fastBillId)
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
ApiKey = string.Empty;
|
||||
ServerId = serverId;
|
||||
PscApiKey = pscApiKey;
|
||||
FastBillId = fastBillId;
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace PSCHelpdesk.Plugins.HetznerServer.Service;
|
||||
|
||||
public class ServerService: IServerService
|
||||
{
|
||||
public SourceCache<Server, long> SourceCache = new (x => x.Id);
|
||||
public SourceCache<Server, long> SourceCache = new (x => x.ServerId);
|
||||
private SettingsManager _settingsManager;
|
||||
private readonly DispatcherTimer _reloadTimer = new DispatcherTimer();
|
||||
private string _searchText = string.Empty;
|
||||
@ -73,8 +73,18 @@ public class ServerService: IServerService
|
||||
{
|
||||
_reloadTimer.Stop();
|
||||
});
|
||||
|
||||
var settings = new Settings();
|
||||
_settingsManager.LoadPluginSettings("HetznerSettings", settings);
|
||||
|
||||
foreach (Server serv in SourceCache.Items)
|
||||
{
|
||||
if (settings.ServerSettings.Count(e => e.ServerId == serv.ServerId) > 0)
|
||||
{
|
||||
serv.FastBillId = settings.ServerSettings.First(e => e.ServerId == serv.ServerId).FastBillId;
|
||||
serv.PscApiKey = settings.ServerSettings.First(e => e.ServerId == serv.ServerId).PscApiKey;
|
||||
}
|
||||
|
||||
var connectionInfo = new ConnectionInfo(serv.Ipv4,
|
||||
"root",
|
||||
new PrivateKeyAuthenticationMethod("root", new PrivateKeyFile(this._settingsManager.CoreSettings.PrivateSSHKeyPath)));
|
||||
@ -185,4 +195,20 @@ public class ServerService: IServerService
|
||||
this._reloadTimer.Start();
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveSettings(Server selectedServer)
|
||||
{
|
||||
var settings = new Settings();
|
||||
_settingsManager.LoadPluginSettings("HetznerSettings", settings);
|
||||
if (settings.ServerSettings.Count(e => e.ServerId == selectedServer.ServerId) > 0)
|
||||
{
|
||||
settings.ServerSettings.First(e => e.ServerId == selectedServer.ServerId).FastBillId = selectedServer.FastBillId;
|
||||
settings.ServerSettings.First(e => e.ServerId == selectedServer.ServerId).PscApiKey = selectedServer.PscApiKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.ServerSettings.Add(new ServerSetting(selectedServer.ServerId, selectedServer.PscApiKey, selectedServer.FastBillId));
|
||||
}
|
||||
_settingsManager.SavePluginSettings("HetznerSettings", settings);
|
||||
}
|
||||
}
|
||||
@ -37,8 +37,8 @@ public partial class ServerViewModel : ViewModelBase, IViewModelBase
|
||||
ServerService = _serverService;
|
||||
ServerService.SourceCache.Connect()
|
||||
// Sort Ascending on the OrderIndex property
|
||||
.Sort(SortExpressionComparer<Server>.Ascending(t => t.Id))
|
||||
.Filter(x => x.Name.Contains(_searchText, StringComparison.OrdinalIgnoreCase) || x.Domains.Count(d => d.Name.Contains(_searchText, StringComparison.OrdinalIgnoreCase)) > 0)
|
||||
.Sort(SortExpressionComparer<Server>.Ascending(t => t.ServerId))
|
||||
.Filter(x => x.Name.Contains(_searchText, StringComparison.OrdinalIgnoreCase) || x.ServerId.ToString().Contains(_searchText, StringComparison.OrdinalIgnoreCase) || x.Domains.Count(d => d.Name.Contains(_searchText, StringComparison.OrdinalIgnoreCase)) > 0)
|
||||
// Bind to our ReadOnlyObservableCollection<T>
|
||||
.Bind(out _server)
|
||||
// Subscribe for changes
|
||||
@ -97,6 +97,6 @@ public partial class ServerViewModel : ViewModelBase, IViewModelBase
|
||||
|
||||
void saveServerSettings()
|
||||
{
|
||||
|
||||
ServerService.SaveSettings(SelectedServer);
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,8 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
xmlns:vm="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.ViewModels"
|
||||
xmlns:views="clr-namespace:PSCHelpdesk.Plugins.HetznerServer.Views"
|
||||
x:Class="PSCHelpdesk.Plugins.HetznerServer.Views.ServerDetailView">
|
||||
<Design.DataContext>
|
||||
<vm:ServerViewModel></vm:ServerViewModel>
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding SelectedServer.Name}" FontSize="24"/>
|
||||
<TabControl>
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using PSCHelpdesk.Plugins.HetznerServer.Models;
|
||||
using PSCHelpdesk.Plugins.HetznerServer.ViewModels;
|
||||
|
||||
namespace PSCHelpdesk.Plugins.HetznerServer.Views;
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Width="75" Header="Id" Binding="{Binding Id}"/>
|
||||
<DataGridTextColumn Width="75" Header="Id" Binding="{Binding ServerId}"/>
|
||||
<DataGridTextColumn Width="*" Header="Name" Binding="{Binding Name}" />
|
||||
<DataGridTextColumn Width="60" Header="Status" Binding="{Binding Status}" CellStyleClasses="status" />
|
||||
<DataGridTextColumn Width="45" Header="Type" Binding="{Binding Type}" />
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIBrush_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fbe37f94ace60e93760f363e28be5136e9e82a6dce891cef5f298e2bcd812c256_003FIBrush_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIoc_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F2e6883f773fb7c69a15db509adac9a0c068e4ca54fa119e835fd2324311c3b_003FIoc_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIoc_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ffa3c59274a754721f822d1776be91c7ffdd37ff4219098396aa16ba1fc5447_003FIoc_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIoc_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ffa3c59274a754721f822d1776be91c7ffdd37ff4219098396aa16ba1fc5447_003FIoc_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIoc_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F2e6883f773fb7c69a15db509adac9a0c068e4ca54fa119e835fd2324311c3b_003FIoc_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIpv6_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F95e899f2b13d4189874af98ec00443321e400_003Ff7_003F54c88032_003FIpv6_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIServerActionsService_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa924c6fef45b419cbbc71e86813a9b3a35000_003Ff5_003Fd14c12da_003FIServerActionsService_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"Avalonia.ReactiveUI": "11.2.0",
|
||||
"Avalonia.Xaml.Behaviors": "11.2.0",
|
||||
"Avalonia.Xaml.Interactions": "11.2.0",
|
||||
"CommunityToolkit.Mvvm": "8.3.2",
|
||||
"HetznerCloud.API": "1.1.9",
|
||||
"Material.Icons.Avalonia": "2.1.10",
|
||||
"Microsoft.Extensions.DependencyInjection": "8.0.1",
|
||||
@ -193,6 +194,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CommunityToolkit.Mvvm/8.3.2": {
|
||||
"runtime": {
|
||||
"lib/net8.0/CommunityToolkit.Mvvm.dll": {
|
||||
"assemblyVersion": "8.3.0.0",
|
||||
"fileVersion": "8.3.2.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DynamicData/8.4.1": {
|
||||
"dependencies": {
|
||||
"System.Reactive": "6.0.1"
|
||||
@ -400,6 +409,13 @@
|
||||
"path": "avalonia.xaml.interactivity/11.2.0",
|
||||
"hashPath": "avalonia.xaml.interactivity.11.2.0.nupkg.sha512"
|
||||
},
|
||||
"CommunityToolkit.Mvvm/8.3.2": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-m8EolE1A0Updj68WTsZSGI6VWb6mUqHPh7QFo0kt7+JPhYMNXRS1ch8TS/oITAdcxTLrwMOp3ku1KjeG1/Zdpg==",
|
||||
"path": "communitytoolkit.mvvm/8.3.2",
|
||||
"hashPath": "communitytoolkit.mvvm.8.3.2.nupkg.sha512"
|
||||
},
|
||||
"DynamicData/8.4.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user