Workshop - Show required plugins on profile pages

Workshop - Show related profiles on plugin pages
This commit is contained in:
RobertBeekman committed 2024-03-03 22:09:10 +01:00
1 parent 36bff3c5f3
commit 9132301dbf
25 files changed
+286 -111

No files matched your search

@@ -41,7 +41,7 @@ public class LayoutEntryInstallationHandler : IEntryInstallationHandler
}
// Ensure there is an installed entry
InstalledEntry installedEntry = _workshopService.GetInstalledEntry(entry) ?? new InstalledEntry(entry, release);
InstalledEntry installedEntry = _workshopService.GetInstalledEntry(entry.Id) ?? new InstalledEntry(entry, release);
DirectoryInfo releaseDirectory = installedEntry.GetReleaseDirectory(release);
// If the folder already exists, remove it so that if the layout now contains less files, old things dont stick around
@@ -25,7 +25,7 @@ public class PluginEntryInstallationHandler : IEntryInstallationHandler
public async Task<EntryInstallResult> InstallAsync(IEntryDetails entry, IRelease release, Progress<StreamProgress> progress, CancellationToken cancellationToken)
{
// Ensure there is an installed entry
InstalledEntry? installedEntry = _workshopService.GetInstalledEntry(entry);
InstalledEntry? installedEntry = _workshopService.GetInstalledEntry(entry.Id);
if (installedEntry != null)
{
// If the folder already exists, we're not going to reinstall the plugin since files may be in use, consider our job done
@@ -36,7 +36,7 @@ public class ProfileEntryInstallationHandler : IEntryInstallationHandler
}
// Find existing installation to potentially replace the profile
InstalledEntry? installedEntry = _workshopService.GetInstalledEntry(entry);
InstalledEntry? installedEntry = _workshopService.GetInstalledEntry(entry.Id);
if (installedEntry != null && installedEntry.TryGetMetadata("ProfileId", out Guid profileId))
{
ProfileConfiguration? existing = _profileService.ProfileCategories.SelectMany(c => c.ProfileConfigurations).FirstOrDefault(c => c.ProfileId == profileId);
@@ -28,6 +28,20 @@ fragment submittedEntry on Entry {
createdAt
}
fragment entrySummary on Entry {
id
author
name
summary
entryType
downloads
createdAt
latestReleaseId
categories {
...category
}
}
fragment entryDetails on Entry {
id
author
@@ -0,0 +1,15 @@
query GetDependantEntries($entryId: Long! $skip: Int $take: Int) {
entries(
where: {
latestRelease: { dependencies: { some: { id: { eq: $entryId } } } }
}
skip: $skip
take: $take
order: { createdAt: DESC }
) {
totalCount
items {
...entrySummary
}
}
}
@@ -2,16 +2,7 @@ query GetEntries($search: String $filter: EntryFilterInput $skip: Int $take: Int
entries(search: $search where: $filter skip: $skip take: $take, order: $order) {
totalCount
items {
id
author
name
summary
entryType
downloads
createdAt
categories {
...category
}
...entrySummary
}
}
}
@@ -0,0 +1,9 @@
query GetLatestDependencies($id: Long!) {
entry(id: $id) {
latestRelease {
dependencies {
...entrySummary
}
}
}
}
@@ -14,7 +14,7 @@ public interface IWorkshopService
Task NavigateToEntry(long entryId, EntryType entryType);
List<InstalledEntry> GetInstalledEntries();
InstalledEntry? GetInstalledEntry(IEntryDetails entry);
InstalledEntry? GetInstalledEntry(long entryId);
void RemoveInstalledEntry(InstalledEntry installedEntry);
void SaveInstalledEntry(InstalledEntry entry);
void Initialize();
@@ -152,9 +152,9 @@ public class WorkshopService : IWorkshopService
}
/// <inheritdoc />
public InstalledEntry? GetInstalledEntry(IEntryDetails entry)
public InstalledEntry? GetInstalledEntry(long entryId)
{
EntryEntity? entity = _entryRepository.GetByEntryId(entry.Id);
EntryEntity? entity = _entryRepository.GetByEntryId(entryId);
if (entity == null)
return null;
@@ -2,7 +2,7 @@ schema: schema.graphql
extensions:
endpoints:
Default GraphQL Endpoint:
url: https://localhost:7281/graphql
url: https://workshop.artemis-rgb.com/graphql
headers:
user-agent: JS GraphQL
introspect: true
+82 -2
View File
@@ -5,8 +5,6 @@ schema {
mutation: Mutation
}
directive @tag(name: String!) on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
type Category {
icon: String!
id: Long!
@@ -35,6 +33,7 @@ type Entry {
authorId: UUID!
categories: [Category!]!
createdAt: DateTime!
dependantReleases: [Release!]!
description: String!
downloads: Long!
entryType: EntryType!
@@ -46,6 +45,7 @@ type Entry {
latestReleaseId: Long
layoutInfo: [LayoutInfo!]!
name: String!
pluginInfo: PluginInfo
releases: [Release!]!
summary: String!
tags: [Tag!]!
@@ -84,10 +84,33 @@ type Mutation {
updateEntryImage(input: UpdateEntryImageInput!): Image
}
type PluginInfo {
api: Int
entry: Entry!
entryId: Long!
helpPage: String
platforms: PluginPlatform
pluginGuid: UUID!
repository: String
requiresAdmin: Boolean!
website: String
}
"A segment of a collection."
type PluginInfosCollectionSegment {
"A flattened list of the items."
items: [PluginInfo!]
"Information to aid in pagination."
pageInfo: CollectionSegmentInfo!
totalCount: Int!
}
type Query {
categories(order: [CategorySortInput!], where: CategoryFilterInput): [Category!]!
entries(order: [EntrySortInput!], search: String, skip: Int, take: Int, where: EntryFilterInput): EntriesCollectionSegment
entry(id: Long!): Entry
pluginInfo(pluginGuid: UUID!): PluginInfo
pluginInfos(order: [PluginInfoSortInput!], skip: Int, take: Int, where: PluginInfoFilterInput): PluginInfosCollectionSegment
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
@@ -96,6 +119,7 @@ type Query {
type Release {
createdAt: DateTime!
dependencies: [Entry!]!
downloadSize: Long!
downloads: Long!
entry: Entry!
@@ -131,11 +155,18 @@ enum KeyboardLayoutType {
UNKNOWN
}
enum PluginPlatform {
LINUX
OSX
WINDOWS
}
enum RGBDeviceType {
ALL
COOLER
DRAM
FAN
GAME_CONTROLLER
GRAPHICS_CARD
HEADSET
HEADSET_STAND
@@ -166,6 +197,11 @@ scalar Long
scalar UUID
input BooleanOperationFilterInput {
eq: Boolean
neq: Boolean
}
input CategoryFilterInput {
and: [CategoryFilterInput!]
icon: StringOperationFilterInput
@@ -220,6 +256,7 @@ input EntryFilterInput {
authorId: UuidOperationFilterInput
categories: ListFilterInputTypeOfCategoryFilterInput
createdAt: DateTimeOperationFilterInput
dependantReleases: ListFilterInputTypeOfReleaseFilterInput
description: StringOperationFilterInput
downloads: LongOperationFilterInput
entryType: EntryTypeOperationFilterInput
@@ -232,6 +269,7 @@ input EntryFilterInput {
layoutInfo: ListFilterInputTypeOfLayoutInfoFilterInput
name: StringOperationFilterInput
or: [EntryFilterInput!]
pluginInfo: PluginInfoFilterInput
releases: ListFilterInputTypeOfReleaseFilterInput
summary: StringOperationFilterInput
tags: ListFilterInputTypeOfTagFilterInput
@@ -250,6 +288,7 @@ input EntrySortInput {
latestRelease: ReleaseSortInput
latestReleaseId: SortEnumType
name: SortEnumType
pluginInfo: PluginInfoSortInput
summary: SortEnumType
}
@@ -322,6 +361,13 @@ input ListFilterInputTypeOfCategoryFilterInput {
some: CategoryFilterInput
}
input ListFilterInputTypeOfEntryFilterInput {
all: EntryFilterInput
any: Boolean
none: EntryFilterInput
some: EntryFilterInput
}
input ListFilterInputTypeOfImageFilterInput {
all: ImageFilterInput
any: Boolean
@@ -372,6 +418,39 @@ input NullableOfKeyboardLayoutTypeOperationFilterInput {
nin: [KeyboardLayoutType]
}
input NullableOfPluginPlatformOperationFilterInput {
eq: PluginPlatform
in: [PluginPlatform]
neq: PluginPlatform
nin: [PluginPlatform]
}
input PluginInfoFilterInput {
and: [PluginInfoFilterInput!]
api: IntOperationFilterInput
entry: EntryFilterInput
entryId: LongOperationFilterInput
helpPage: StringOperationFilterInput
or: [PluginInfoFilterInput!]
platforms: NullableOfPluginPlatformOperationFilterInput
pluginGuid: UuidOperationFilterInput
repository: StringOperationFilterInput
requiresAdmin: BooleanOperationFilterInput
website: StringOperationFilterInput
}
input PluginInfoSortInput {
api: SortEnumType
entry: EntrySortInput
entryId: SortEnumType
helpPage: SortEnumType
platforms: SortEnumType
pluginGuid: SortEnumType
repository: SortEnumType
requiresAdmin: SortEnumType
website: SortEnumType
}
input RGBDeviceTypeOperationFilterInput {
eq: RGBDeviceType
in: [RGBDeviceType!]
@@ -382,6 +461,7 @@ input RGBDeviceTypeOperationFilterInput {
input ReleaseFilterInput {
and: [ReleaseFilterInput!]
createdAt: DateTimeOperationFilterInput
dependencies: ListFilterInputTypeOfEntryFilterInput
downloadSize: LongOperationFilterInput
downloads: LongOperationFilterInput
entry: EntryFilterInput