-
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-1903][risk=low] Modify Chair Manage DAR Collections to use Summary Endpoint #1699
Conversation
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.
Looks great and functioned well when I tested it! If we decide to keep the separate actions classes, then I think it's ready to have stuff merged in.
actionComponent = h(ChairActions, { | ||
collection, showConfirmationModal, goToVote, relevantDatasets, | ||
openEnabled: actions.includes('Open'), | ||
cancelEnabled: actions.includes('Cancel'), | ||
voteEnabled: actions.includes('Vote') | ||
}); |
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 personally don't have a strong opinion, but since we're being told what actions are acceptable from the backend, would it make sense to consolidate AdminActions
, ChairActions
, etc., into one Actions
class which displays the actions the backend says are available? That way the frontend is more separate from the backend.
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 considered doing that initially, but the ChairActions object was really complex, with further logic that controls what the state of the button should be (based on failure of request). I wasn't sure if the other Action components would also have a lot of specific logic to their state, but assumed they had to since they were split out in this way in the first place 🤔
What would you think about adding the combined actions as a separate function? I think it needs more investigation than the single ticket for conversion of the summary endpoint requires, and is a slight bit of scope creep from the original ask |
I definitely agree this might be getting into some scope creep! @rushtong what do you think? |
Agreed on the scope issue. I suggest we address refactoring the actions in a separate PR/ticket, depending on what seems the most practical. |
…Summary on Console pages (#1715) * DUOS-1992 updated search bar filter function to handle DARCollectionSummary * DUOS-1992 updated util tests for search function
* 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>
…ction summaries endpoint (#1709) * Switch endpoint * Remove unused prop Co-authored-by: Shae Marks <smarks.dev1@gmail.com>
* 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>
…min 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>
…t 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>
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.
Tested locally, consoles are loading the summaries quickly. Actions go through successfully and re-renders the table with the updated summary model. Search bar looks to be working as intended.
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.
Dar Collection Table appearance and functionality looks great! I think DarDraftTable
wasn't meant to be added here, and I left some minor suggestions for using the USER_ROLES constants more consistently, but overall 👍
} | ||
}; | ||
|
||
export default function DarDraftTable(props) { |
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 file was deleted while we worked on this feature branch and adding it back in here is unintentional
@@ -26,7 +26,7 @@ export default function AdminManageDarCollections() { | |||
useEffect(() => { | |||
const init = async() => { | |||
try { | |||
const collectionsResp = await Collections.getCollectionsByRoleName('admin'); | |||
const collectionsResp = await Collections.getCollectionSummariesByRoleName('admin'); |
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.
const collectionsResp = await Collections.getCollectionSummariesByRoleName('admin'); | |
const collectionsResp = await Collections.getCollectionSummariesByRoleName(USER_ROLES.admin); |
nit: use existing user role constant
src/pages/ChairConsole.js
Outdated
@@ -29,7 +29,7 @@ export default function ChairConsole(props) { | |||
const init = async() => { | |||
try { | |||
const [collections, datasets] = await Promise.all([ | |||
Collections.getCollectionsByRoleName('chairperson'), | |||
Collections.getCollectionSummariesByRoleName('chairperson'), |
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.
Collections.getCollectionSummariesByRoleName('chairperson'), | |
Collections.getCollectionSummariesByRoleName(USER_ROLES.chairperson), |
src/pages/MemberConsole.js
Outdated
@@ -27,7 +27,7 @@ export default function MemberConsole(props) { | |||
const init = async () => { | |||
try { | |||
const [collections, datasets] = await Promise.all([ | |||
Collections.getCollectionsByRoleName('member'), | |||
Collections.getCollectionSummariesByRoleName('member'), |
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.
Collections.getCollectionSummariesByRoleName('member'), | |
Collections.getCollectionSummariesByRoleName(USER_ROLES.member), |
src/pages/ResearcherConsole.js
Outdated
} | ||
setResearcherCollections(collectionArray); | ||
setFilteredList(collectionArray); | ||
const collections = await Collections.getCollectionSummariesByRoleName('Researcher'); |
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.
const collections = await Collections.getCollectionSummariesByRoleName('Researcher'); | |
const collections = await Collections.getCollectionSummariesByRoleName(USER_ROLES.researcher); |
return { | ||
data: datasets.length > 0 ? datasets.length : '- -', | ||
data: datasetIds.length > 0 ? datasetIds.length : '- -', |
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: dar collection summaries have a datasetCount
field that could be used instead
Currently updating the branch, doesn't make sense to review myself
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.
Looks good to me! Tested the DarCollectionTables on all consoles and actions.
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.
Tested locally, feature branch looks to be in good working condition
... sorry :(
Have you read Terra's Contributing Guide lately? If not, do that first.