Skip to content

AdminPanel: Filter skill dropdown by character class when adding learned skills#714

Merged
sven-n merged 3 commits into
masterfrom
copilot/adminpanel-filter-skills-by-class
Mar 21, 2026
Merged

AdminPanel: Filter skill dropdown by character class when adding learned skills#714
sven-n merged 3 commits into
masterfrom
copilot/adminpanel-filter-skills-by-class

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

  • Create SkillEntryCreationForm.razor component that filters skills by character class
  • Modify ItemTable.razor.cs to extract parent owner from ValueExpression and pass to ModalCreateNew
  • Modify ModalCreateNew.razor to accept an Owner parameter and use SkillEntryCreationForm when creating SkillEntry with a Character owner
  • Fix crash: Skill.Name is LocalizedString (not IComparable); use GetName() extension to sort alphabetically
Original prompt

This section details on the original issue you should resolve

<issue_title>AdminPanel: When adding skills, only show options that are allowed for the class</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
When editing a character's skills, the drop down shows skills of all character class.
It's hard to know which skill is allowed for that class.
User also needs to know the skill names when using the search text box.
(There is also that 'Level' field which I'm not sure what for)

Describe the solution you'd like
When adding skills, only show options that are allowed for the class.
(This is probably a subset of things to do in #561)

Describe alternatives you've considered
Alternatively, list all skills with checkbox markers whether it is learned or not

Additional context
Image
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update skill options to show allowed skills for class AdminPanel: Filter skill dropdown by character class when adding learned skills Mar 20, 2026
Copilot AI requested a review from sven-n March 20, 2026 22:32
@sven-n
Copy link
Copy Markdown
Member

sven-n commented Mar 20, 2026

@copilot When clicking the create button, the following error appears:

[2026-03-20T22:44:26.778Z] Error: System.InvalidOperationException: Failed to compare two elements in the array.
 ---> System.ArgumentException: At least one object must implement IComparable.
   at System.Collections.Comparer.Compare(Object a, Object b)
   at System.Collections.Generic.ObjectComparer`1.Compare(T x, T y)
   at System.Linq.Enumerable.EnumerableSorter`2.CompareAnyKeys_DefaultComparer_NoNext_Ascending(Int32 index1, Int32 index2)
   at System.Collections.Generic.ArraySortHelper`1.PickPivotAndPartition(Span`1 keys, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.IntroSort(Span`1 keys, Int32 depthLimit, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.Sort(Span`1 keys, Comparison`1 comparer)
   --- End of inner exception stack trace ---
   at System.Collections.Generic.ArraySortHelper`1.Sort(Span`1 keys, Comparison`1 comparer)
   at System.Linq.Enumerable.EnumerableSorter`2.QuickSort(Int32[] keys, Int32 lo, Int32 hi)
   at System.Linq.Enumerable.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   at System.Linq.Enumerable.OrderedIterator`1.Fill(TElement[] buffer, Span`1 destination)
   at System.Linq.Enumerable.OrderedIterator`1.ToList()
   at MUnique.OpenMU.Web.Shared.Components.Form.SkillEntryCreationForm.OnParametersSet() in C:\Users\Sven\Documents\GitHub\OpenMU\src\Web\Shared\Components\Form\SkillEntryCreationForm.razor:line 79
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() blazor.web.ax6tuj8tun.js:1:42438
    log http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    unhandledError http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    startConnection http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    _invokeClientMethod http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    _processIncomingData http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    onreceive http://localhost/_framework/blazor.web.ax6tuj8tun.js:1
    onmessage http://localhost/_framework/blazor.web.ax6tuj8tun.js:1

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot When clicking the create button, the following error appears:

[2026-03-20T22:44:26.778Z] Error: System.InvalidOperationException: Failed to compare two elements in the...

Fixed in bef8f9d. Skill.Name is a LocalizedString which doesn't implement IComparable, so OrderBy(s => s.Name) failed at sort time. Changed to OrderBy(s => s.GetName()) which uses the ObjectExtensions.GetName() method returning a plain string.

@sven-n sven-n marked this pull request as ready for review March 21, 2026 14:48
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the user experience in the Admin Panel when managing character skills. It introduces a specialized skill creation form that intelligently filters the available skills based on the character's class, preventing users from selecting invalid skills. This is achieved by passing contextual owner information through the UI components and dynamically rendering the appropriate form. Additionally, a crash related to sorting skills by their localized names has been fixed, enhancing the stability of the skill selection process.

Highlights

  • New Skill Creation Form: Introduced SkillEntryCreationForm.razor to provide a dedicated UI for adding skills, which filters available skills by the character's class.
  • Contextual Owner Passing: Enhanced ItemTable.razor.cs to extract the parent owner (e.g., a Character) from the ValueExpression and pass it to the ModalCreateNew component.
  • Dynamic Modal Content: Updated ModalCreateNew.razor to accept an Owner parameter and dynamically render the new SkillEntryCreationForm when creating SkillEntry for a Character.
  • Skill Sorting Fix: Resolved a potential crash by ensuring skills are sorted alphabetically using the GetName() extension method, addressing the issue where Skill.Name is a LocalizedString and not directly IComparable.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful feature to the Admin Panel by filtering the skill dropdown based on the character's class when adding learned skills. This is achieved by creating a new SkillEntryCreationForm component and modifying ItemTable and ModalCreateNew to pass the character context. The implementation is logical and also includes a fix for a sorting-related crash. I've found one issue regarding incorrect pattern matching syntax in ItemTable.razor.cs which would prevent compilation. My feedback includes a specific suggestion to correct it.

Comment thread src/Web/Shared/Components/Form/ItemTable.razor.cs
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@sven-n Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: b414155c-70dd-4d9f-bc55-9723b46b2cf0

Sorry for the inconvenience!

@sven-n sven-n merged commit f1639b2 into master Mar 21, 2026
3 checks passed
@sven-n sven-n deleted the copilot/adminpanel-filter-skills-by-class branch March 21, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AdminPanel: When adding skills, only show options that are allowed for the class

2 participants