Skip to content
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

Merged
merged 55 commits into from
Aug 10, 2022

Conversation

JVThomas
Copy link
Contributor

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 utils

Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

connorlbark and others added 30 commits July 25, 2022 15:40
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>
@JVThomas JVThomas changed the base branch from develop to DUOS-1903 August 10, 2022 13:11
@@ -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';
Copy link
Contributor

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

Copy link
Contributor Author

@JVThomas JVThomas Aug 10, 2022

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.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

That works for me

@JVThomas JVThomas marked this pull request as ready for review August 10, 2022 14:14
@JVThomas JVThomas requested a review from a team as a code owner August 10, 2022 14:14
Copy link
Contributor

@shaemarks shaemarks left a comment

Choose a reason for hiding this comment

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

Actions are all functioning as expected 👍

I think the header of the CollectionConfirmationModal needs to be updated as well - currently it always says undefined as the project title
Screenshot (87)

Copy link
Contributor

@connorlbark connorlbark left a 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
Copy link
Contributor

@shaemarks shaemarks left a 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)}`;
Copy link
Contributor

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

Copy link
Contributor

@connorlbark connorlbark left a 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

@JVThomas JVThomas merged commit 9c91328 into DUOS-1903 Aug 10, 2022
@JVThomas JVThomas deleted the DUOS-2014 branch August 10, 2022 20:44
JVThomas added a commit that referenced this pull request Aug 15, 2022
…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>
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.

5 participants