From f4b9b67f1abf29baccb4b52c0deae4baeb584bd3 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 23 Oct 2023 19:33:38 +0200 Subject: [PATCH] Workshop - Layout info WIP --- .../Workshop/Layout/LayoutInfoView.axaml | 10 ++ .../Workshop/Layout/LayoutInfoView.axaml.cs | 13 +++ .../Workshop/Layout/LayoutInfoViewModel.cs | 32 +++++++ .../SubmissionWizard/Models/IEntrySource.cs | 6 ++ .../Models/LayoutEntrySource.cs | 28 ++++++ .../Models/ProfileEntrySource.cs | 13 +++ .../{ => Models}/SubmissionWizardState.cs | 4 +- .../ReleaseWizardViewModel.cs | 1 + .../Steps/Layout/LayoutInfoStepView.axaml | 43 +++++++++ .../Steps/Layout/LayoutInfoStepView.axaml.cs | 14 +++ .../Steps/Layout/LayoutInfoStepViewModel.cs | 25 +++++ .../Layout/LayoutSelectionStepView.axaml | 13 --- .../Layout/LayoutSelectionStepViewModel.cs | 49 ++++++---- .../ProfileAdaptionHintsStepViewModel.cs | 15 +-- .../Profile/ProfileSelectionStepViewModel.cs | 7 +- .../Steps/SpecificationsStepViewModel.cs | 2 +- .../SubmissionWizard/SubmissionViewModel.cs | 1 + .../SubmissionWizardViewModel.cs | 1 + .../Queries/Fragments.graphql | 23 +++++ .../Queries/GetEntries.graphql | 3 +- .../Queries/GetEntryById.graphql | 3 +- .../Queries/GetSubmittedEntries.graphql | 10 +- .../Queries/GetSubmittedEntryById.graphql | 10 +- .../Queries/SearchEntries.graphql | 4 +- src/Artemis.WebClient.Workshop/schema.graphql | 94 +++++++++++++++++++ 25 files changed, 361 insertions(+), 63 deletions(-) create mode 100644 src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml create mode 100644 src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml.cs create mode 100644 src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoViewModel.cs create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/IEntrySource.cs create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/LayoutEntrySource.cs create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/ProfileEntrySource.cs rename src/Artemis.UI/Screens/Workshop/SubmissionWizard/{ => Models}/SubmissionWizardState.cs (94%) create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml.cs create mode 100644 src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepViewModel.cs create mode 100644 src/Artemis.WebClient.Workshop/Queries/Fragments.graphql diff --git a/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml new file mode 100644 index 000000000..92d02d58f --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml @@ -0,0 +1,10 @@ + + Welcome to Avalonia! + diff --git a/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml.cs b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml.cs new file mode 100644 index 000000000..b7371d6fe --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoView.axaml.cs @@ -0,0 +1,13 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace Artemis.UI.Screens.Workshop.Layout; + +public partial class LayoutInfoView : UserControl +{ + public LayoutInfoView() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoViewModel.cs b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoViewModel.cs new file mode 100644 index 000000000..eea0f305b --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Layout/LayoutInfoViewModel.cs @@ -0,0 +1,32 @@ +using System; +using Artemis.Core; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; +using Artemis.UI.Shared; +using PropertyChanged.SourceGenerator; +using RGB.NET.Core; +using KeyboardLayoutType = Artemis.Core.KeyboardLayoutType; + +namespace Artemis.UI.Screens.Workshop.Layout; + +public partial class LayoutInfoViewModel : ViewModelBase +{ + [Notify] private Guid _deviceProvider; + [Notify] private string? _vendor; + [Notify] private string? _model; + [Notify] private KeyboardLayoutType? _physicalLayout; + [Notify] private string? _logicalLayout; + + /// + public LayoutInfoViewModel(ArtemisLayout layout) + { + DisplayKeyboardLayout = layout.RgbLayout.Type == RGBDeviceType.Keyboard; + } + + public LayoutInfoViewModel(ArtemisLayout layout, LayoutInfo layoutInfo) + { + DisplayKeyboardLayout = layout.RgbLayout.Type == RGBDeviceType.Keyboard; + + } + + public bool DisplayKeyboardLayout { get; } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/IEntrySource.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/IEntrySource.cs new file mode 100644 index 000000000..1789cdc1b --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/IEntrySource.cs @@ -0,0 +1,6 @@ +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Models; + +public interface IEntrySource +{ + +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/LayoutEntrySource.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/LayoutEntrySource.cs new file mode 100644 index 000000000..5445b34ab --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/LayoutEntrySource.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using Artemis.Core; +using Artemis.WebClient.Workshop; +using KeyboardLayoutType = Artemis.WebClient.Workshop.KeyboardLayoutType; + +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Models; + +public class LayoutEntrySource : IEntrySource +{ + public LayoutEntrySource(ArtemisLayout layout) + { + Layout = layout; + } + + public ArtemisLayout Layout { get; set; } + public List LayoutInfo { get; } = new(); +} + +public class LayoutInfo +{ + public Guid DeviceProvider { get; set; } + public RGBDeviceType DeviceType { get; set; } + public string Model { get; set; } + public string Vendor { get; set; } + public string? LogicalLayout { get; set; } + public KeyboardLayoutType? PhysicalLayout { get; set; } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/ProfileEntrySource.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/ProfileEntrySource.cs new file mode 100644 index 000000000..7bd076666 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/ProfileEntrySource.cs @@ -0,0 +1,13 @@ +using Artemis.Core; + +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Models; + +public class ProfileEntrySource : IEntrySource +{ + public ProfileEntrySource(ProfileConfiguration profileConfiguration) + { + ProfileConfiguration = profileConfiguration; + } + + public ProfileConfiguration ProfileConfiguration { get; set; } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/SubmissionWizardState.cs similarity index 94% rename from src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs rename to src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/SubmissionWizardState.cs index 54099f4bc..15c6dca1d 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardState.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Models/SubmissionWizardState.cs @@ -7,7 +7,7 @@ using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop; using DryIoc; -namespace Artemis.UI.Screens.Workshop.SubmissionWizard; +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Models; public class SubmissionWizardState { @@ -34,7 +34,7 @@ public class SubmissionWizardState public List Tags { get; set; } = new(); public List Images { get; set; } = new(); - public object? EntrySource { get; set; } + public IEntrySource? EntrySource { get; set; } public void ChangeScreen() where TSubmissionViewModel : SubmissionViewModel { diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs index cfe1412f7..56ea19f09 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs @@ -1,4 +1,5 @@ using Artemis.UI.Screens.Workshop.CurrentUser; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop; diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml new file mode 100644 index 000000000..62d3b1563 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml @@ -0,0 +1,43 @@ + + + + + + + + + + Layout information + + + The information below is used by Artemis to automatically find your layout. + Some layouts can be shared across different devices and here you have a chance to set that up. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml.cs new file mode 100644 index 000000000..85dbd1e6e --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepView.axaml.cs @@ -0,0 +1,14 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; +using Avalonia.ReactiveUI; + +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout; + +public partial class LayoutInfoStepView : ReactiveUserControl +{ + public LayoutInfoStepView() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepViewModel.cs new file mode 100644 index 000000000..370000363 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutInfoStepViewModel.cs @@ -0,0 +1,25 @@ +using System.Collections.ObjectModel; +using System.Linq; +using System.Reactive.Disposables; +using Artemis.UI.Screens.Workshop.Layout; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; +using DynamicData; +using ReactiveUI; + +namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout; + +public class LayoutInfoStepViewModel : SubmissionViewModel +{ + public LayoutInfoStepViewModel() + { + GoBack = ReactiveCommand.Create(() => State.ChangeScreen()); + this.WhenActivated((CompositeDisposable _) => + { + LayoutInfo.Clear(); + if (State.EntrySource is LayoutEntrySource layoutEntrySource) + LayoutInfo.AddRange(layoutEntrySource.LayoutInfo.Select(i => new LayoutInfoViewModel(layoutEntrySource.Layout, i))); + }); + } + + public ObservableCollection LayoutInfo { get; } = new(); +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepView.axaml b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepView.axaml index 73d78c056..794174b2c 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepView.axaml +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepView.axaml @@ -4,22 +4,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:layout="clr-namespace:Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout" - xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout.LayoutSelectionStepView" x:DataType="layout:LayoutSelectionStepViewModel"> - - - - - - - - - - - - diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepViewModel.cs index 8250578a1..5c365fe6a 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Layout/LayoutSelectionStepViewModel.cs @@ -5,16 +5,15 @@ using Artemis.Core.Services; using PropertyChanged.SourceGenerator; using ReactiveUI; using System; +using System.Collections.Generic; using System.IO; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; -using Artemis.UI.Extensions; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services; -using Avalonia; using Avalonia.Media.Imaging; -using Material.Icons; -using RGB.NET.Core; using SkiaSharp; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout; @@ -36,10 +35,20 @@ public partial class LayoutSelectionStepViewModel : SubmissionViewModel .OrderBy(d => d.RgbDevice.DeviceInfo.Model) ); + GoBack = ReactiveCommand.Create(() => State.ChangeScreen()); Continue = ReactiveCommand.Create(ExecuteContinue, this.WhenAnyValue(vm => vm.Layout).Select(p => p != null)); this.WhenAnyValue(vm => vm.SelectedDevice).WhereNotNull().Subscribe(d => Layout = d.Layout); this.WhenAnyValue(vm => vm.Layout).Subscribe(CreatePreviewDevice); + + this.WhenActivated((CompositeDisposable _) => + { + ShowGoBack = State.EntryId == null; + if (State.EntrySource is not LayoutEntrySource layoutEntrySource) + return; + Layout = layoutEntrySource.Layout; + SelectedDevice = Devices.FirstOrDefault(d => d.Layout == Layout); + }); } public ObservableCollection Devices { get; } @@ -78,12 +87,22 @@ public partial class LayoutSelectionStepViewModel : SubmissionViewModel if (Layout == null) return; - State.EntrySource = Layout; + State.EntrySource = new LayoutEntrySource(Layout); State.Name = Layout.RgbLayout.Name ?? ""; State.Summary = !string.IsNullOrWhiteSpace(Layout.RgbLayout.Vendor) ? $"{Layout.RgbLayout.Vendor} {Layout.RgbLayout.Type} device layout" : $"{Layout.RgbLayout.Type} device layout"; + + State.Categories = new List {8}; // Device category, yes this could change but why would it + + State.Icon?.Dispose(); + State.Icon = GetDeviceIcon(); + + State.ChangeScreen(); + } + private Stream GetDeviceIcon() + { // Go through the hassle of resizing the image to 128x128 without losing aspect ratio, padding is added for this using RenderTargetBitmap image = Layout.RenderLayout(false); using MemoryStream stream = new(); @@ -99,18 +118,14 @@ public partial class LayoutSelectionStepViewModel : SubmissionViewModel SKSizeI scaledDimensions = new((int) Math.Floor(sourceWidth * scale), (int) Math.Floor(sourceHeight * scale)); SKPointI offset = new((128 - scaledDimensions.Width) / 2, (128 - scaledDimensions.Height) / 2); - using (SKBitmap? scaleBitmap = sourceBitmap.Resize(scaledDimensions, SKFilterQuality.High)) - using (SKBitmap targetBitmap = new(128, 128)) - using (SKCanvas canvas = new(targetBitmap)) - { - canvas.Clear(SKColors.Transparent); - canvas.DrawBitmap(scaleBitmap, offset.X, offset.Y); - targetBitmap.Encode(output, SKEncodedImageFormat.Png, 100); - output.Seek(0, SeekOrigin.Begin); - } + using SKBitmap? scaleBitmap = sourceBitmap.Resize(scaledDimensions, SKFilterQuality.High); + using SKBitmap targetBitmap = new(128, 128); + using SKCanvas canvas = new(targetBitmap); + canvas.Clear(SKColors.Transparent); + canvas.DrawBitmap(scaleBitmap, offset.X, offset.Y); + targetBitmap.Encode(output, SKEncodedImageFormat.Png, 100); + output.Seek(0, SeekOrigin.Begin); - State.Icon?.Dispose(); - State.Icon = output; - State.ChangeScreen(); + return output; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsStepViewModel.cs index fc55b987a..289ad846b 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsStepViewModel.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Artemis.UI.Shared.Services; using DynamicData; using DynamicData.Aggregation; @@ -34,12 +35,14 @@ public class ProfileAdaptionHintsStepViewModel : SubmissionViewModel this.WhenActivated((CompositeDisposable _) => { - if (State.EntrySource is ProfileConfiguration profileConfiguration && profileConfiguration.Profile != null) - _layers.Edit(l => - { - l.Clear(); - l.AddRange(profileConfiguration.Profile.GetAllLayers().Select(getLayerViewModel)); - }); + if (State.EntrySource is not ProfileEntrySource profileEntrySource || profileEntrySource.ProfileConfiguration.Profile == null) + return; + + _layers.Edit(l => + { + l.Clear(); + l.AddRange(profileEntrySource.ProfileConfiguration.Profile.GetAllLayers().Select(getLayerViewModel)); + }); }); } diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs index 8970a869f..5845a47d8 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs @@ -7,6 +7,7 @@ using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Extensions; using Artemis.UI.Screens.Workshop.Profile; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Material.Icons; using PropertyChanged.SourceGenerator; using ReactiveUI; @@ -38,8 +39,8 @@ public partial class ProfileSelectionStepViewModel : SubmissionViewModel this.WhenActivated((CompositeDisposable _) => { ShowGoBack = State.EntryId == null; - if (State.EntrySource is ProfileConfiguration profileConfiguration) - SelectedProfile = Profiles.FirstOrDefault(p => p.ProfileId == profileConfiguration.ProfileId); + if (State.EntrySource is ProfileEntrySource profileEntrySource) + SelectedProfile = Profiles.FirstOrDefault(p => p.ProfileId == profileEntrySource.ProfileConfiguration.ProfileId); }); } @@ -66,7 +67,7 @@ public partial class ProfileSelectionStepViewModel : SubmissionViewModel if (SelectedProfile == null) return; - State.EntrySource = SelectedProfile; + State.EntrySource = new ProfileEntrySource(SelectedProfile); State.Name = SelectedProfile.Name; State.Icon = SelectedProfile.Icon.GetIconStream(); diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs index fc366c336..729f5b352 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs @@ -39,7 +39,7 @@ public partial class SpecificationsStepViewModel : SubmissionViewModel switch (State.EntryType) { case EntryType.Layout: - State.ChangeScreen(); + State.ChangeScreen(); break; case EntryType.Plugin: break; diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs index 5e5284d58..5a118bae9 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs @@ -1,4 +1,5 @@ using System.Reactive; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Artemis.UI.Shared; using PropertyChanged.SourceGenerator; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs index a0cdc461b..787e9bdfc 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs @@ -1,4 +1,5 @@ using Artemis.UI.Screens.Workshop.CurrentUser; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Models; using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; diff --git a/src/Artemis.WebClient.Workshop/Queries/Fragments.graphql b/src/Artemis.WebClient.Workshop/Queries/Fragments.graphql new file mode 100644 index 000000000..38e33eb77 --- /dev/null +++ b/src/Artemis.WebClient.Workshop/Queries/Fragments.graphql @@ -0,0 +1,23 @@ +fragment category on Category { + name + icon +} + +fragment layoutInfo on LayoutInfo { + id + deviceProvider + deviceType + model + vendor + logicalLayout + physicalLayout +} + +fragment submittedEntry on Entry { + id + name + summary + entryType + downloads + createdAt +} \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Queries/GetEntries.graphql b/src/Artemis.WebClient.Workshop/Queries/GetEntries.graphql index c6223a835..366e3bae4 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetEntries.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetEntries.graphql @@ -10,8 +10,7 @@ query GetEntries($search: String $filter: EntryFilterInput $skip: Int $take: Int downloads createdAt categories { - name - icon + ...category } } } diff --git a/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql b/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql index 932ccef30..6467133ae 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetEntryById.graphql @@ -9,8 +9,7 @@ query GetEntryById($id: Long!) { createdAt description categories { - name - icon + ...category } latestRelease { id diff --git a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntries.graphql b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntries.graphql index d4199e074..2d4bd9a5a 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntries.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntries.graphql @@ -1,14 +1,8 @@ query GetSubmittedEntries($filter: EntryFilterInput) { submittedEntries(where: $filter order: {createdAt: DESC}) { - id - name - summary - entryType - downloads - createdAt + ...submittedEntry categories { - name - icon + ...category } } } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql index ea7b0bab3..85106a433 100644 --- a/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/GetSubmittedEntryById.graphql @@ -1,11 +1,6 @@ query GetSubmittedEntryById($id: Long!) { entry(id: $id) { - id - name - summary - entryType - downloads - createdAt + ...submittedEntry description categories { id @@ -13,5 +8,8 @@ query GetSubmittedEntryById($id: Long!) { tags { name } + layoutInfo { + ...layoutInfo + } } } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/Queries/SearchEntries.graphql b/src/Artemis.WebClient.Workshop/Queries/SearchEntries.graphql index 27e4eabbd..9f8dfac16 100644 --- a/src/Artemis.WebClient.Workshop/Queries/SearchEntries.graphql +++ b/src/Artemis.WebClient.Workshop/Queries/SearchEntries.graphql @@ -6,9 +6,7 @@ query SearchEntries($input: String! $type: EntryType) { entryType author categories { - id - name - icon + ...category } } } diff --git a/src/Artemis.WebClient.Workshop/schema.graphql b/src/Artemis.WebClient.Workshop/schema.graphql index 29e471408..c79569c64 100644 --- a/src/Artemis.WebClient.Workshop/schema.graphql +++ b/src/Artemis.WebClient.Workshop/schema.graphql @@ -42,6 +42,7 @@ type Entry { images: [Image!]! latestRelease: Release latestReleaseId: Long + layoutInfo: [LayoutInfo!]! name: String! releases: [Release!]! summary: String! @@ -53,9 +54,23 @@ type Image { mimeType: String! } +type LayoutInfo { + deviceProvider: UUID! + deviceType: RGBDeviceType! + entry: Entry! + entryId: Long! + id: Long! + logicalLayout: String + model: String! + physicalLayout: KeyboardLayoutType + vendor: String! +} + type Mutation { addEntry(input: CreateEntryInput!): Entry + addLayoutInfo(input: CreateLayoutInfoInput!): LayoutInfo removeEntry(id: Long!): Entry + removeLayoutInfo(id: Long!): LayoutInfo! updateEntry(input: UpdateEntryInput!): Entry } @@ -64,6 +79,8 @@ type Query { entries(order: [EntrySortInput!], search: String, skip: Int, take: Int, where: EntryFilterInput): EntriesCollectionSegment entry(id: Long!): Entry searchEntries(input: String!, order: [EntrySortInput!], type: EntryType, where: EntryFilterInput): [Entry!]! + searchKeyboardLayout(deviceProvider: UUID!, logicalLayout: String, model: String!, physicalLayout: KeyboardLayoutType!, vendor: String!): LayoutInfo + searchLayout(deviceProvider: UUID!, deviceType: RGBDeviceType!, model: String!, vendor: String!): LayoutInfo submittedEntries(order: [EntrySortInput!], where: EntryFilterInput): [Entry!]! } @@ -95,6 +112,37 @@ enum EntryType { PROFILE } +enum KeyboardLayoutType { + ABNT + ANSI + ISO + JIS + KS + UNKNOWN +} + +enum RGBDeviceType { + ALL + COOLER + DRAM + FAN + GRAPHICS_CARD + HEADSET + HEADSET_STAND + KEYBOARD + KEYPAD + LED_CONTROLLER + LED_MATRIX + LED_STRIPE + MAINBOARD + MONITOR + MOUSE + MOUSEPAD + NONE + SPEAKER + UNKNOWN +} + enum SortEnumType { ASC DESC @@ -131,6 +179,16 @@ input CreateEntryInput { tags: [String!]! } +input CreateLayoutInfoInput { + deviceProvider: UUID! + deviceType: RGBDeviceType! + entryId: Long! + logicalLayout: String + model: String! + physicalLayout: KeyboardLayoutType + vendor: String! +} + input DateTimeOperationFilterInput { eq: DateTime gt: DateTime @@ -161,6 +219,7 @@ input EntryFilterInput { images: ListFilterInputTypeOfImageFilterInput latestRelease: ReleaseFilterInput latestReleaseId: LongOperationFilterInput + layoutInfo: ListFilterInputTypeOfLayoutInfoFilterInput name: StringOperationFilterInput or: [EntryFilterInput!] releases: ListFilterInputTypeOfReleaseFilterInput @@ -203,6 +262,20 @@ input ImageSortInput { mimeType: SortEnumType } +input LayoutInfoFilterInput { + and: [LayoutInfoFilterInput!] + deviceProvider: UuidOperationFilterInput + deviceType: RGBDeviceTypeOperationFilterInput + entry: EntryFilterInput + entryId: LongOperationFilterInput + id: LongOperationFilterInput + logicalLayout: StringOperationFilterInput + model: StringOperationFilterInput + or: [LayoutInfoFilterInput!] + physicalLayout: NullableOfKeyboardLayoutTypeOperationFilterInput + vendor: StringOperationFilterInput +} + input ListFilterInputTypeOfCategoryFilterInput { all: CategoryFilterInput any: Boolean @@ -217,6 +290,13 @@ input ListFilterInputTypeOfImageFilterInput { some: ImageFilterInput } +input ListFilterInputTypeOfLayoutInfoFilterInput { + all: LayoutInfoFilterInput + any: Boolean + none: LayoutInfoFilterInput + some: LayoutInfoFilterInput +} + input ListFilterInputTypeOfReleaseFilterInput { all: ReleaseFilterInput any: Boolean @@ -246,6 +326,20 @@ input LongOperationFilterInput { nlte: Long } +input NullableOfKeyboardLayoutTypeOperationFilterInput { + eq: KeyboardLayoutType + in: [KeyboardLayoutType] + neq: KeyboardLayoutType + nin: [KeyboardLayoutType] +} + +input RGBDeviceTypeOperationFilterInput { + eq: RGBDeviceType + in: [RGBDeviceType!] + neq: RGBDeviceType + nin: [RGBDeviceType!] +} + input ReleaseFilterInput { and: [ReleaseFilterInput!] createdAt: DateTimeOperationFilterInput