Skip to content

feat(CheckboxGroup): add support for required field #1131

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

Merged
merged 6 commits into from
Apr 11, 2024

Conversation

rohanm-crest
Copy link
Contributor

  • Implemented a new checkboxgroup component named "Required checkbox example" with required validation.
  • Updated "schema.json" and "valid_config.json" to include the "required" attribute.
  • Addressed the issue where the "required" validation was not functioning correctly when only a single field was present in the form.

@rohanm-crest rohanm-crest added the enhancement New feature or request label Apr 10, 2024
@rohanm-crest rohanm-crest self-assigned this Apr 10, 2024
Copy link

github-actions bot commented Apr 10, 2024

CLA Assistant Lite bot CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@rohanm-crest
Copy link
Contributor Author

I have read the Code of Conduct and I hereby accept the Terms

@vtsvetkov-splunk
Copy link
Contributor

vtsvetkov-splunk commented Apr 10, 2024

@artemrys you remember I complained the bot sends only one message at the time? The bot asked about COC and the check passed, but CLA check did not. Because it did not asked about it.

upd: seems like this github action is not supposed to be used as parallel jobs. It looks for it's own comment and updates it.
https://github.com/contributor-assistant/github-action/blob/master/src/pullrequest/pullRequestComment.ts#L58

upd2: raised an issue: splunk/addonfactory-github-workflows#59

@vtsvetkov-splunk
Copy link
Contributor

@rohanm-crest could you also sign https://github.com/splunk/cla-agreement/blob/main/CLA.md by commenting here

I have read the CLA Document and I hereby accept the CLA

@@ -975,7 +975,8 @@
}
]
}
}
},
"required" : true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"required" : true
"required" : {
"type": "boolean"
}

it should describe that possible value type for field required is boolean (true or false).
Reference: https://json-schema.org/learn/getting-started-step-by-step#properties

@@ -944,7 +944,7 @@ class BaseFormView extends PureComponent<BaseFormProps, BaseFormState> {
) => {
const index = this.entities?.findIndex((x) => x.field === field);
const validator = [{ type: 'custom', validatorFunc }];
if (index && this.entities?.[index]) {
if (index!=undefined && this.entities?.[index]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wow, nice catch.
just to double check with @soleksy-splunk, what do you think?

@vtsvetkov-splunk
Copy link
Contributor

and please pay attention to correct PR title. it should be like
feat(CheckboxGroup): add support for required field.

technically, it is adding new feature since we unlock possibility to use required validation. Adding something to storybook accompanies that feature, allowing us to test it easily

@rohanm-crest rohanm-crest force-pushed the ADDON-69417-checkBox-required branch from 082ea2a to ca87932 Compare April 10, 2024 09:07
@rohanm-crest rohanm-crest changed the title added required checkbox component in storybook feat(CheckboxGroup): add support for required field Apr 10, 2024
@rohanm-crest
Copy link
Contributor Author

rohanm-crest commented Apr 10, 2024

I have read the CLA Document and I hereby accept the CLA

@rohanm-crest rohanm-crest marked this pull request as ready for review April 10, 2024 10:09
@rohanm-crest rohanm-crest requested review from a team as code owners April 10, 2024 10:09
@artemrys artemrys enabled auto-merge (squash) April 11, 2024 06:55
@artemrys artemrys merged commit e101aa3 into develop Apr 11, 2024
@artemrys artemrys deleted the ADDON-69417-checkBox-required branch April 11, 2024 07:27
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants