-
Notifications
You must be signed in to change notification settings - Fork 3
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
Submission Summary V2 with FetchContract #2350
Merged
Merged
Changes from 56 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
f8fc4e2
initial commit of resolvers working
macrael b355084
submitContract can only be called by state user
mojotalantikite ce369d7
create submissionsummaryv2
pearl-truss 3e45343
create and use v2 version of contract details summary section component
pearl-truss 5836518
temp comment out reviewsubmitv2 for testing
pearl-truss e2dd1b0
get submitContract working
macrael a36eb52
add test helpers for contracts, test single linked rate
macrael 0cd849c
fix after linting
macrael a42ea4b
fix some bugs
macrael 1686aa9
get setup of scenario working
macrael 8201ea0
Wip with handling submit
pearl-truss 0696cae
fix some of the api test
pearl-truss aa2e7c9
Remove console logs
pearl-truss ec4cd34
unlock child rates
macrael 609af02
fix linting to deploy review app
pearl-truss ff4d5b9
add 90% of jason's diagram to test
mojotalantikite 24f8970
get parentContractID into rate and check it
macrael 1b05f8d
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
macrael c66526b
Create graphql for submitContract and new fetchSubmittedContract
pearl-truss 8dd9b62
remove changes to submitContract postgres func
pearl-truss c5a1653
remove unneeded changes for this pr
pearl-truss 8a5ca31
remove submitContract graphql from this pr
pearl-truss 9cd0a58
remove submitContract.graphql
pearl-truss ec9bbc0
fix unlockRate
mojotalantikite c6ef2c9
assert length
mojotalantikite cc74d8c
cleaning up tests, adds asserts
mojotalantikite c342a11
remove fetchSubmittedContract
pearl-truss 5aee09a
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
pearl-truss c6516bf
add loading and error states
pearl-truss b37f87f
Merge branch 'main' into wml-db-history
macrael 5b28925
migrate to new draftRates
macrael 8d26735
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
pearl-truss 7ebbba6
wow everything passes
macrael f589287
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
pearl-truss 4fe6252
code clean up
pearl-truss dc11a52
fix import
macrael af49041
comments and fix a hidden build issue
macrael 745da54
skip unmigrated rates
mojotalantikite 23eb6ff
reimplmeent submit
macrael 9f83988
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
macrael acc5249
rate data mocks
macrael 1d96a2d
add mccrsID to fetchContract query
pearl-truss 78dc953
update v2 unlocksubmit modal to work with unlock contract
pearl-truss c82d4dc
create changeHistory V2 to use fetchContract, resolve errors
pearl-truss 18043fc
Merge branch 'main' of https://github.com/Enterprise-CMCS/managed-car…
pearl-truss c456132
Merge branch 'wml-db-history' of https://github.com/Enterprise-CMCS/m…
pearl-truss 3b6ac15
get submit working on ReviewSubmit page
pearl-truss 57e2b4a
update contractPackageDataMock
pearl-truss 37c9b04
remove references to packages in unlockSubmitModalV2
pearl-truss 2252971
remove access optioinal chanining
pearl-truss e3ae827
update changehistoryv2 language and logic
pearl-truss 7ee8429
add submissionsummartV2 for cmsRoutes
pearl-truss 8b09893
fix reviewsubmit test
pearl-truss 7784374
Merge branch 'main' of https://github.com/Enterprise-CMCS/managed-car…
pearl-truss f555a3b
pr updates
pearl-truss 11d0268
restrict change history to contract actions for now
pearl-truss 5bc2584
fix resubmit
pearl-truss d9c1df9
add reverse
pearl-truss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
services/app-web/src/components/ChangeHistory/ChangeHistoryV2.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import React from 'react' | ||
import { dayjs } from '../../common-code/dateHelpers/dayjs' | ||
import { SectionHeader } from '../SectionHeader' | ||
import { Accordion, Link } from '@trussworks/react-uswds' | ||
import type { AccordionItemProps } from '@trussworks/react-uswds/lib/components/Accordion/Accordion' | ||
import { UpdateInformation, Contract } from '../../gen/gqlClient' | ||
import styles from './ChangeHistory.module.scss' | ||
type ChangeHistoryProps = { | ||
contract: Contract | ||
} | ||
|
||
type flatRevisions = UpdateInformation & { | ||
kind: 'submit' | 'unlock' | ||
revisionVersion: string | undefined | ||
} | ||
|
||
export const ChangeHistoryV2 = ({ | ||
contract, | ||
}: ChangeHistoryProps): React.ReactElement => { | ||
const flattenedRevisions = (): flatRevisions[] => { | ||
const result: flatRevisions[] = [] | ||
const contractSubmissions = contract.packageSubmissions.filter( | ||
(submission) => { | ||
return submission.cause === 'CONTRACT_SUBMISSION' | ||
} | ||
) | ||
contractSubmissions.forEach((r, index) => { | ||
if (r.contractRevision.unlockInfo) { | ||
const newUnlock: flatRevisions = {} as flatRevisions | ||
newUnlock.updatedAt = r.contractRevision.unlockInfo.updatedAt | ||
newUnlock.updatedBy = r.contractRevision.unlockInfo.updatedBy | ||
newUnlock.updatedReason = | ||
r.contractRevision.unlockInfo.updatedReason | ||
newUnlock.kind = 'unlock' | ||
//Use unshift to push the latest revision unlock info to the beginning of the array | ||
result.unshift(newUnlock) | ||
} | ||
if (r.submitInfo) { | ||
const newSubmit: flatRevisions = {} as flatRevisions | ||
|
||
const revisionVersion = | ||
index !== contract.packageSubmissions.length - 1 | ||
? String(index + 1) //Offset version, we want to start at 1 | ||
: undefined | ||
|
||
newSubmit.updatedAt = r.submitInfo.updatedAt | ||
newSubmit.updatedBy = r.submitInfo.updatedBy | ||
newSubmit.updatedReason = r.submitInfo.updatedReason | ||
newSubmit.kind = 'submit' | ||
newSubmit.revisionVersion = revisionVersion | ||
//Use unshift to push the latest revision submit info to the beginning of the array | ||
result.unshift(newSubmit) | ||
} | ||
}) | ||
return result | ||
} | ||
|
||
const revisionHistory = flattenedRevisions() | ||
|
||
const revisedItems: AccordionItemProps[] = revisionHistory.map( | ||
(r, index) => { | ||
const isInitialSubmission = r.updatedReason === 'Initial contract' | ||
const isSubsequentSubmission = r.kind === 'submit' | ||
// We want to know if this contract has multiple submissions. To have multiple submissions, there must be minimum | ||
// more than the initial contract revision. | ||
const hasSubsequentSubmissions = revisionHistory.length > 1 | ||
return { | ||
title: ( | ||
<div> | ||
{dayjs | ||
.utc(r.updatedAt) | ||
.tz('America/New_York') | ||
.format('MM/DD/YY h:mma')}{' '} | ||
ET - {isSubsequentSubmission ? 'Submission' : 'Unlock'} | ||
</div> | ||
), | ||
// Display this code if this is the initial contract. We only want to display the link of the initial contract | ||
// only if there has been subsequent contracts. We do not want to display a link if the package initial | ||
// contract was unlocked, but has not been resubmitted yet. | ||
headingLevel: 'h4', | ||
content: isInitialSubmission ? ( | ||
<div data-testid={`change-history-record`}> | ||
<span className={styles.tag}>Submitted by:</span> | ||
<span> {r.updatedBy}</span> | ||
<br /> | ||
{r.revisionVersion && hasSubsequentSubmissions && ( | ||
<Link | ||
href={`/contracts/${contract.id}/revisions/${r.revisionVersion}`} | ||
data-testid={`revision-link-${r.revisionVersion}`} | ||
> | ||
View past contract version | ||
</Link> | ||
)} | ||
</div> | ||
) : ( | ||
<div data-testid={`change-history-record`}> | ||
<div> | ||
<span className={styles.tag}> | ||
{isSubsequentSubmission | ||
? 'Submitted by: ' | ||
: 'Unlocked by: '}{' '} | ||
</span> | ||
<span>{r.updatedBy}</span> | ||
</div> | ||
<div> | ||
<span className={styles.tag}> | ||
{isSubsequentSubmission | ||
? 'Changes made: ' | ||
: 'Reason for unlock: '} | ||
</span> | ||
<span>{r.updatedReason}</span> | ||
</div> | ||
{isSubsequentSubmission && r.revisionVersion && ( | ||
<Link | ||
href={`/contracts/${contract.id}/revisions/${r.revisionVersion}`} | ||
data-testid={`revision-link-${r.revisionVersion}`} | ||
> | ||
View past contract version | ||
</Link> | ||
)} | ||
</div> | ||
), | ||
expanded: false, | ||
id: r.updatedAt.toString(), | ||
} | ||
} | ||
) | ||
return ( | ||
<section id="changeHistory" className={styles.summarySection}> | ||
<SectionHeader header="Change history" hideBorder /> | ||
<Accordion items={revisedItems} multiselectable /> | ||
</section> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Previously this was set to >=3:
I thought it might make sense to change it to > 1 because each packageSubmission has an array of revs but the multiple submissions part might not be relevant anymore?
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 code change you made looks good to me. I would delete the comment totally- I agree that it doesn't make sense for the new world where related rate changes can result in entries in that same package submission array