Skip to content

Fixed bug - Support multiselect with integers #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kamil-orwat-vmltech
Copy link
Collaborator

No description provided.

return options;
}

public void setOptions(Map<String, V> options) {
public void setOptions(Map<Object, V> options) {
boolean match = options.keySet().stream().allMatch(key -> key instanceof String || key instanceof Integer);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assume only Strings and Integers are allowed here, unfortunately I had to change String here to Object, hope this validation is enough

@@ -114,7 +114,7 @@ const CodeArgumentInput: React.FC<CodeArgumentInputProps> = ({ arg }) => {
orientation="horizontal"
label={argLabel(arg)}
errorMessage={fieldState.error ? fieldState.error.message : undefined}
validationState={fieldState.error ? 'invalid' : 'valid'}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

validationState is deprecated

@@ -171,9 +172,9 @@ const CodeArgumentInput: React.FC<CodeArgumentInputProps> = ({ arg }) => {
<div>
<ListView
{...field}
maxHeight="size-1600"
maxHeight="size-2000"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This way always exactly 4 items display

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug by extending support for multiselect with integer keys in both the frontend and backend, while also refining validation handling in the CodeArgumentInput component.

  • Updated TypeScript types to allow integer keys for multiselect options.
  • Modified CodeArgumentInput to adjust validation and error handling.
  • Adjusted Java code to accept integer keys and added a runtime type check in setOptions.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ui.frontend/src/utils/api.types.ts Updated MultiSelectArgument options type to support both string and number keys.
ui.frontend/src/components/CodeArgumentInput.tsx Revised validation logic and UI props to better handle multiselect inputs.
core/src/main/java/com/vml/es/aem/acm/core/code/arg/MultiSelectArgument.java Changed options type and added a key type check to restrict keys to string or integer.

@kamil-orwat-vmltech kamil-orwat-vmltech marked this pull request as ready for review April 22, 2025 12:49
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.

1 participant