-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fixed field is required' validation #4714
Fixed field is required' validation #4714
Conversation
@@ -171,6 +181,8 @@ | |||
cancelAction: 'Cancel', | |||
updateDescendantCheckbox: | |||
'Apply to all resources, folders, and subfolders contained within the selected folders.', | |||
addAdditionalCategoriesDescription: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string exists inshared/translators.js
already as addAdditionalCatgoriesDescription
, so let's use that one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AllanOXDi! Apologies it seems there have been a misunderstanding here 😅. This needs to be a change for all "boolean maps" fields, not just the categories. Boolean maps fields are fields that are represented as a boolean map, these are: Categories, Levels, ResourcesNeeded and Learning Activities. So to achieve the requirements:
- Don't display a "mixed" tag as a category. You have already removed the option from the categoryOptions, but further changes are needed:
- Remove these lines that add the mixed value to the selected categories https://github.com/AllanOXDi/studio/blob/86c0d78ad08ce242f4e724a98cadc76ea6373e25/contentcuration/contentcuration/frontend/shared/views/contentNodeFields/CategoryOptions.vue#L170-L175.
- As we dont have the mixed option anymore, the
autocompleteOptions
property is the same as thecategoriesList
. So we can remove theautocompleteOptions
property here https://github.com/AllanOXDi/studio/blob/86c0d78ad08ce242f4e724a98cadc76ea6373e25/contentcuration/contentcuration/frontend/shared/views/contentNodeFields/CategoryOptions.vue#L162-L165 and replace any reference withcategoriesList
.
- Don't display any indeterminate state checkboxes. This should be done for all boolean maps fields. For this
- we need to remove the isCheckboxIndeterminate method in the categories options component https://github.com/AllanOXDi/studio/blob/86c0d78ad08ce242f4e724a98cadc76ea6373e25/contentcuration/contentcuration/frontend/shared/views/contentNodeFields/CategoryOptions.vue#L294-L302 and all its references.
- We need to remove the isIndeterminate method in the ExpandableSelect componen https://github.com/AllanOXDi/studio/blob/86c0d78ad08ce242f4e724a98cadc76ea6373e25/contentcuration/contentcuration/frontend/shared/views/form/ExpandableSelect.vue#L191-L196 and all its references.
- If resources have different, existing categories (what would be currently shown as "mixed"), add a condition to display the new helper text
You selected resources that have different categories. The categories you choose below will be added to all selected resources. This will not remove existing categories.
- For this, we will need to fix the
hasMixedCategories
as the nodes can have multiple categories selected, but all these categories must be selected in all selected nodes, right now I see thehasMixedCategoriesMessage
even if we just select one resource, and this has two selected categories. SohasMixedCategories
should return true if any of theselectedValues
has an array with a length less thanthis.nodes.length
which would mean tha here is a selectedValue that is not common to all selected nodes. - We will need to update the handleSave method so that if there is mixed Categories, we get the current values of the nodes, and add any new value in
selectedValues
, without removing old values.
- The "save" button only be active if one or more boxes is checked, but no validation is required (and no error message). We wont need this for all cases, but just for these who has provided a validator like the learning activities modal https://github.com/AllanOXDi/studio/blob/bulk_editting-fix/contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLearningActivitiesModal.vue#L8. As we can save empty boolean maps for categories for example if we want to remove all categories of a single selected resource.
cc: @marcellamaki you can correct me if I said something wrong 😅
Thanks @AlexVelezLl for this clarification, yes it looks like I did not explain the requirements so well. The additional details here all seem correct to me. @AllanOXDi, please let us know if you have follow up questions about any of this. I know there's a lot of details here, especially for someone who is coming in and relatively new to the feature. We're happy to help. (On a somewhat tangential note, there is a little bit of a mix-up with the strings which is totally my responsibility, and I've been chatting about it already with @radinamatic. For now, you can continue to use the same string you are currently using, and I'll manage any additional changes in follow up.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work @AllanOXDi! I think this looks good as I've gone through the code and the manual QA and all seems to be working as expected and aligned with the requested changes. I have one small request for cleaning up some commented out code, but otherwise this should be good to go! Nice job implementing the feedback from Alex.
After this is merged, I'll get some feedback on the strings situation and I'll take on any follow up on that myself. 🎉
{{ error }} | ||
</span> | ||
</span> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is no longer needed at all with the change that you've made, so let's delete rather than just comment it out
} = optionsValues; | ||
expect(dailyLifeValue).toBe(CheckboxValue.CHECKED); | ||
expect(foundationsValue).toBe(CheckboxValue.INDETERMINATE); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning up the tests, too! I hadn't remembered about that, but it's great to stay on top of that 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, Allan!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I just noted a couple of things, I can take care of this over the weekend, just left these notes here to recall this later 😅
...ation/contentcuration/frontend/channelEdit/components/QuickEditModal/EditBooleanMapModal.vue
Show resolved
Hide resolved
...ation/contentcuration/frontend/channelEdit/components/QuickEditModal/EditBooleanMapModal.vue
Show resolved
Hide resolved
Let me open a new pr for that fix . Thanks |
@AllanOXDi we can also just revert the merge so to can merge the same back when ready 🙂 .The "Revert" button should be just above Alex's latest comment! |
Undo the reverted changes in #4714
Summary
This pull request addresses the issue where the text 'This field is required' is displayed when bulk editing learning activities.
Fixes #4651
Reviewer guidance
How can a reviewer test these changes?
References
#4651
Contributor's Checklist
PR process:
CHANGELOG
label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocs
label has been added if this introduces a change that needs to be updated in the user docs?requirements.txt
files also included in this PRStudio-specifc:
notranslate
class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages
,components
, andlayouts
directories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)