-
Notifications
You must be signed in to change notification settings - Fork 4
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
DUOS-2014[risk=no] Updated Researcher Actions functionality to account for DarCollectionSummary #1744
Conversation
Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
…to use new summary endpoint, removed formatDraft call for revise
… updated url reference in summary fetch method
src/libs/utils.js
Outdated
@@ -1,7 +1,7 @@ | |||
import Noty from 'noty'; | |||
import 'noty/lib/noty.css'; | |||
import 'noty/lib/themes/bootstrap-v3.css'; | |||
import {map as nonFPMap} from 'lodash'; | |||
import {map as nonFPMap, forEach as nonFPForEach} from 'lodash'; |
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.
would you feel okay with leaving these as the original names? It seems less confusing that way
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.
So there's two forEach's being used in this file, one from 'lodash/fp' and one from 'lodash'. The reason being is that with the fp version, the function is forEach(collection, (value) => //code here)
where as in the regular version its forEach(value, key) => //insert code here)(collection)
.
As for why we need two versions, remember the error Shae pointed out here: #1718 (review)
It's being caused by this function in utils.js
export const applyHoverEffects = (e, style) => { nonFPForEach((key, value) => { e.target.style[key] = value; })(style); };
What had happened was that the normal forEach
that was used here was replaced with the fp
variant. The difference in the iterating function causes the function to error out.
So in short, we need both functions, but they can't be named the same variable, hence the nonFPForEach
.
That said, I still need to update the iterating function to match the non-fp version.
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.
Ok! Didnt realize it was because both lodash and lodash/fp were beign used.... That being said, I still think the name is confusing (just because it wasn't immediately obvious to me what it was "nonFP" was supposed to mean. Don't know what to do about that though
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.
maybe it could be lodashForEach
and lodashFpForEach
? that way they mirror each other
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.
Another way to solve this is to import a prefix for either the non-fp or the fp version. In the past, I've used import _ from 'lodash';
and import * as fp from 'lodash/fp';
, for example
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.
Yeah but that would cause Webpack to import the entire lodash
library on file bundling, and lodash is a pretty big library. Even if the code is minified, I'd rather not import methods that are never used for a particular file.
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.
maybe it could be
lodashForEach
andlodashFpForEach
? that way they mirror each other
That works for me
…n-fp forEach arguments
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.
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.
worked well in ui! other than the weird naming of the forEach & modal issue, 👍
… on applyStyleOnEnter, updated aliases for forEach methods in utils.js
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.
Changes look good to me!
@@ -7,7 +7,7 @@ import {getProjectTitle} from './DarCollectionTable'; | |||
export default function CollectionConfirmationModal(props) { | |||
const {collection, showConfirmation, setShowConfirmation, cancelCollection, reviseCollection, openCollection, consoleAction, deleteDraft} = props; | |||
|
|||
const getModalHeader = () => { | |||
const getModalHeader = (collection) => { | |||
if(!isNil(collection)) { | |||
return `${collection.darCode} - ${getProjectTitle(collection)}`; |
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.
Optional nit: I don't see getProjectTitle
used anywhere but here, so maybe inline collection.name
here and delete the function
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.
👍 changes since i last reviewed look good to me
…ary Endpoint (#1699) * [DUOS-1903] Updated dar collection table for chair console view * [DUOS-1903] Updated unit tests * [DUOS-1903] added votel abel back * DUOS-1992[risk=no] Update search bar function to handle DARCollectionSummary on Console pages (#1715) * DUOS-1992 updated search bar filter function to handle DARCollectionSummary * DUOS-1992 updated util tests for search function * [DUOS-1904] Added uniform Actions component (#1710) * fixed merge issue * ???? Testing new actions component. * updated unit tests? * Fixed eslint * fix admin console * fix tests * Fixing unit tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * added unit test for Update button (used to be combined with the vote button) * Update cypress/component/DarCollectionTable/admin_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fix codacy * Fixed unit tests * Fixed unit tests? * merged with DUOS-1902, deleted unnecessary files Co-authored-by: Connor Barker <connorlbark@gmail.com> Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * [DIOS-1906][risk=no] modify signing official console to use new collection summaries endpoint (#1709) * Switch endpoint * Remove unused prop Co-authored-by: Shae Marks <smarks.dev1@gmail.com> * [DUOS-1904] Added researcher actions to Actions component (#1718) * update researcher console dar table + actions * naming nit * fix tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * Update cypress/component/DarCollectionTable/researcher_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fixed merge issue * ???? Testing new actions component. * updated unit tests? * Fixed eslint * fix name * fix admin console * fix tests * Fixing unit tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * added unit test for Update button (used to be combined with the vote button) * Update cypress/component/DarCollectionTable/admin_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fix codacy * Fixed unit tests * Fixed unit tests? * merged with DUOS-1902, deleted unnecessary files * Merged with 1905 * Fixing unit tests? * Fixing eslint * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * feeling more confident now that the problem will be solved haha * Updated variable names, due to merge conflict discrepancies! * Updated variable names, due to merge conflict discrepancies! * testing cypress tests on github * Checking original researcher unit test. Getting mildly frustrated! * Converted hard coded researcher to console type * fixing? * fix test * removed unnecessary line * re-added actions (sorry connor, i deleted it) * [DUOS-1904] updated deleteDrafts to delete a draft with multiple referenceIds (previously only had one) * DUOS-setup-proxy initial setup of local proxy * [DUOS-1904] fixed eslint * DUOS-setup-proxy added status urls to proxy * DUOS-setup-proxy updated ontologyService url fetch * DUOS-setup-proxy fixed method reference in getOntologyUrl * DUOS-setup-proxy added comments, commented out notification proxy for now * [DUOS-1904] reverted referenceIds so we just delete the first one * DUOS-2011 [risk=no] Local Proxy setup for npm start (#1735) * DUOS-setup-proxy initial setup of local proxy * DUOS-setup-proxy added status urls to proxy * DUOS-setup-proxy updated ontologyService url fetch * DUOS-setup-proxy fixed method reference in getOntologyUrl * DUOS-setup-proxy added comments, commented out notification proxy for now * [DUOS-1973][risk=no]Change research purpose to Research Use Statement (Narrative) (#1738) * Change research purpose to Research Use Statement (Narrative) * Fix test Co-authored-by: Shae Marks <smarks.dev1@gmail.com> * added "breathing" margins on buttons * [DUOS-1904] Cleaning up more. * [DUOS-1904] fixed the weird bug with applyign style bug Co-authored-by: Connor Barker <connorlbark@gmail.com> Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> Co-authored-by: JVThomas <jthomas0209@gmail.com> Co-authored-by: Justin Variath Thomas <JVThomas@users.noreply.github.com> Co-authored-by: shaemarks <81024249+shaemarks@users.noreply.github.com> Co-authored-by: Shae Marks <smarks.dev1@gmail.com> * DUOS-1997[risk=no] Updated Open and Close Collection functions for Admin and Chair Consoles (#1723) * update researcher console dar table + actions * naming nit * fix tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * Update cypress/component/DarCollectionTable/researcher_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fixed merge issue * ???? Testing new actions component. * updated unit tests? * Fixed eslint * fix name * fix admin console * fix tests * Fixing unit tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * added unit test for Update button (used to be combined with the vote button) * Update cypress/component/DarCollectionTable/admin_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fix codacy * Fixed unit tests * Fixed unit tests? * merged with DUOS-1902, deleted unnecessary files * Merged with 1905 * Fixing unit tests? * Fixing eslint * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * feeling more confident now that the problem will be solved haha * DUOS-1997 updated open and close collection functions for Admin and Chair pages * DUOS-1997 updated integration tests for collection callback functions * Updated variable names, due to merge conflict discrepancies! * Updated variable names, due to merge conflict discrepancies! * testing cypress tests on github * Checking original researcher unit test. Getting mildly frustrated! * Converted hard coded researcher to console type * fixing? * fix test * removed unnecessary line * re-added actions (sorry connor, i deleted it) * DUOS-1997 used USER_ROLES instead of explicit string values * DUOS-1997 updated spec to use USER_ROLES instead of hard coded strings Co-authored-by: Connor Barker <connorlbark@gmail.com> Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> Co-authored-by: clu@asymmetrik.com <clu@asymmetrik.com> * DUOS-2014[risk=no] Updated Researcher Actions functionality to account for DarCollectionSummary (#1744) * update researcher console dar table + actions * naming nit * fix tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * Update cypress/component/DarCollectionTable/researcher_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fixed merge issue * ???? Testing new actions component. * updated unit tests? * Fixed eslint * fix name * fix admin console * fix tests * Fixing unit tests * Apply suggestions from code review Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * added unit test for Update button (used to be combined with the vote button) * Update cypress/component/DarCollectionTable/admin_actions.spec.js Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> * fix codacy * Fixed unit tests * Fixed unit tests? * merged with DUOS-1902, deleted unnecessary files * Merged with 1905 * Fixing unit tests? * Fixing eslint * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * Fixing unit test, but dont think this will sovle the problem * feeling more confident now that the problem will be solved haha * DUOS-1997 updated open and close collection functions for Admin and Chair pages * DUOS-1997 updated integration tests for collection callback functions * Updated variable names, due to merge conflict discrepancies! * Updated variable names, due to merge conflict discrepancies! * testing cypress tests on github * Checking original researcher unit test. Getting mildly frustrated! * Converted hard coded researcher to console type * fixing? * fix test * removed unnecessary line * re-added actions (sorry connor, i deleted it) * DUOS-1997 used USER_ROLES instead of explicit string values * DUOS-1997 updated spec to use USER_ROLES instead of hard coded strings * DUOS-2014 fixed missing forEach immport from lodash, updated actions to use new summary endpoint, removed formatDraft call for revise * DUOS-2014 adjusted tooltip on cancel action, removed unused function, updated url reference in summary fetch method * DUOS-2014 updated iterating function on applyHoverEffects to match non-fp forEach arguments * DUOS-2014 updated getProjectTitle helper method, updated style update on applyStyleOnEnter, updated aliases for forEach methods in utils.js * DUOS-2014 removed getProjectTitle, inlined collection name in string Co-authored-by: Connor Barker <connorlbark@gmail.com> Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> Co-authored-by: clu@asymmetrik.com <clu@asymmetrik.com> * DUOS-1903 pr feedback Co-authored-by: Justin Variath Thomas <JVThomas@users.noreply.github.com> Co-authored-by: Connor Barker <connorlbark@gmail.com> Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com> Co-authored-by: shaemarks <81024249+shaemarks@users.noreply.github.com> Co-authored-by: Shae Marks <smarks.dev1@gmail.com> Co-authored-by: JVThomas <jthomas0209@gmail.com>
Addresses DUOS-2014
PR updates the functions around Researcher actions to account for the new DarCollectionSummary format. PR also includes import corrections to
applyHoverStyle
in utilsHave you read Terra's Contributing Guide lately? If not, do that first.