-
Notifications
You must be signed in to change notification settings - Fork 6
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
Recordedit with association picker when adding rows using prefill #2490
Conversation
…on change and update dropdowns when the set changes to have new values disabled
…sabled rows except the one that is currently selected (and disabled)
… clean up code and move some functions around. Proper types added in more places. Change single-select icons when row is selected or disabled. remove color change when a row is disabled
…lated multi picker modal
@RFSH This is ready for review now with the changes to ermrestJS that are ready for review as well. There are few things that we should discuss together about this PR:
|
// user closes the modal without making any selections | ||
const closeBulkForeignKeyCB = () => { | ||
// if the page was loaded with a modal showing and it is dismissed, update app state variable and do nothing else | ||
if (selectionsFillFirstForm) setSelectionsFillFirstForm(false); |
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.
@RFSH pointed out that there was a bug when:
- the recordedit app was loaded
- the user closed the first modal
- then used "Add more" to add 3 values, resulting in 4 forms displayed
- remove form 2
- open "Add more" again and the wrong row was still disabled
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.
The issue was that when the first modal is shown and closed, the first form is initialized but the code didn't initialize bulkForeignKeySelectedRows
to have a null
value for the first "selection". The following change to this condition will initialize that "array" with a null
value as the first element representing a null value in the first form.
if (selectionsFillFirstForm) {
setSelectionsFillFirstForm(false);
setBulkForeignKeySelectedRows([null]);
}
* | ||
* This means there are 2 foreign keys that are part of the same key (making the pair unique) and there are other columns that are not foreign keys | ||
*/ | ||
test.describe('for a table that is almost pure and binary and the foreign keys are a unique key', async () => { |
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.
From the comment above, there was a bug regarding selecting leaf values and removing forms that was fixed.
I need to update the test cases to ALSO check for the values that are disabled in the modals/dropdowns and not just the “# of disabled rows”.
I will also add a test case for the example where the initial modal is “closed” and make sure the first form remains “unfilled” for the “leaf value” since no selections were made.
}; | ||
} | ||
|
||
const modalReference = domainRef.addFacets(andFilters, customFacets) |
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.
We should come up with a new context for this in ermrestjs.
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.
New context added to ermrestJS called compactSelectBulkForeignKey
. See ermrestJS PR for comments about those changes.
…leared in fk modal inputs
… not the whole modal
…ws when clicking 'Add records'
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.
Overall everything looks and works as expected. My comments are mainly about code style or leftover code.
I left a comment about the "LogStackPath" that you introduced for this new popup and how we should change it to be more accurate. Please also update logging.md to include the new stack-path
.
This pull request will change how add records on record app works for adding rows to certain related tables (outlined in issue #2416 ). This is ready to review so we can discuss which functions to add to ermrestJS to make support for this simpler in chaise.
The changes to support this new workflow are as follows:
foreignKeyCallbacks
when generating the foreign key fields if the column for the foreign key field is the one used for the leaf column in the associationforeignkey-field
changed to update selected rows used for disabling when each input is changed or clearedremoveForm
updated to remove the selected row(s) associated with the removed formOther changes:
foreignkey-dropdown-field
also works with disabling rows and updating which rows are selectedRecordsetDisplayMode
added for customizing bulk foreign key picker title and "continue" buttonrecordedit-utils
so the generated promise function can be reusedchaise-input-group-text-sm
rule was not usingbtn-padding-sm-*
variablesaddTooManyFormsAlert
added for when trying to pick more than 200 foreign key values to add as recordedit formsTesting:
Since this applies to both foreign key picker popups and dropdowns, this should be tested for both cases. The ermrestJS branch
association-display
should be checked and installed alongside this branch.To test the modal picker, navigate to this Protocol and click "Add Records" for the "Protocol Author" related tabledev.atlas-d2k is unavailable for testing, see comment below for testing modal picker.To test the foreignkey dropdown, this catalog is using the foreign key dropdown for the recordedit inputs. If you can't test with this one, this was created using
createAssociationEdit
script in thetestScripts
folder ofErmrestDataUtils
. This schema could also be used to test the modal popup too if thetable-display
annotation on the table named "leaf" is modified.