-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add Hearing icon to queue/case views #8904
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
8d5539f
pull hearing data in task_serializer
joeyyang 8d1d248
show hearing badge in frontend
joeyyang dd44fb2
tweak negative margin on HearingBadge
joeyyang a08efa0
only show the hearing badge if the disposition type is 'held'
joeyyang 3184aed
add hearing badge to all TaskTables
joeyyang 16a1331
Merge branch 'master' into joey-hearing-badge-queue
joeyyang ccc3861
Merge branch 'master' into joey-hearing-badge-queue
joeyyang a0be4f4
load hearing data asynchronously
joeyyang 93894f7
Merge branch 'joey-hearing-badge-queue' of https://github.com/departm…
joeyyang 322c8ac
only send back the most recently held hearing
joeyyang 936b20a
Merge branch 'joey-hearing-badge-queue' of https://github.com/departm…
joeyyang 26f9c75
don't init most recent hearing to null
joeyyang da79fd9
only check for disposition == 'held' on the backend
joeyyang ae5ab73
Merge branch 'master' into joey-hearing-badge-queue
joeyyang f9700e3
Merge branch 'master' into joey-hearing-badge-queue
joeyyang 4df1966
merge branch 'master' into 'joey-hearing-badge-queue
joeyyang 25fe8cc
remove HearingBadgeLoader, allow HearingBadge to accept either a task…
joeyyang 310e0a8
joey-hearing-badge-queue' of https://github.com/department-of-veteran…
joeyyang e4e93a6
check AMA and legacy hearing dispositions for symbol and string
joeyyang b43f0ea
add hearing disposition types constants file
joeyyang 9f58a95
merge branch 'master' into 'joey-hearing-badge-queue'
joeyyang c001aca
use constant on backend
joeyyang 5a60288
update column numbers in tests to account for hearing badge column
joeyyang a90ebec
Merge branch 'master' into joey-hearing-badge-queue
joeyyang 9a1d4f7
update tests to account for extra table column
joeyyang c54a4ed
Merge branch 'master' into joey-hearing-badge-queue
joeyyang f0c308a
update one more test
joeyyang 7d7c31b
Merge branch 'joey-hearing-badge-queue' of https://github.com/departm…
joeyyang 7824062
Merge branch 'master' into joey-hearing-badge-queue
4736966
Merge branch 'master' into joey-hearing-badge-queue
18e288b
Merge branch 'master' into joey-hearing-badge-queue
8d06a4f
Merge branch 'master' into joey-hearing-badge-queue
df800b5
Merge branch 'master' into joey-hearing-badge-queue
55f9005
merge branch 'master' into 'joey-hearing-badge-queue'
joeyyang 6dd17c0
Merge branch 'joey-hearing-badge-queue' of https://github.com/departm…
joeyyang e2bd1fd
Merge branch 'master' into joey-hearing-badge-queue
joeyyang 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
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
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
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
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
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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
import PropTypes from 'prop-types'; | ||
import { css } from 'glamor'; | ||
import _ from 'lodash'; | ||
import * as React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
|
||
import Tooltip from '../../components/Tooltip'; | ||
import { COLORS } from '../../constants/AppConstants'; | ||
|
||
import ApiUtil from '../../util/ApiUtil'; | ||
import { DateString } from '../../util/DateUtil'; | ||
import { setMostRecentlyHeldHearingForAppeal } from '../QueueActions'; | ||
|
||
/** | ||
* This component can accept either a Hearing object or a Task object. | ||
* e.g., | ||
* <HearingBadge hearing={hearing} /> | ||
* <HearingBadge task={task} /> | ||
*/ | ||
|
||
const badgeStyling = css({ | ||
display: 'inline-block', | ||
|
@@ -30,27 +42,63 @@ const listStyling = css({ | |
} | ||
}); | ||
|
||
const HearingBadge = ({ hearing }) => { | ||
if (!hearing) { | ||
return null; | ||
class HearingBadge extends React.PureComponent { | ||
componentDidMount = () => { | ||
if (!this.props.mostRecentlyHeldHearingForAppeal && !this.props.hearing) { | ||
ApiUtil.get(`/appeals/${this.props.externalId}/hearings`).then((response) => { | ||
this.props.setMostRecentlyHeldHearingForAppeal(this.props.externalId, JSON.parse(response.text)); | ||
}); | ||
} | ||
} | ||
|
||
render = () => { | ||
const hearing = this.props.mostRecentlyHeldHearingForAppeal || this.props.hearing; | ||
|
||
if (!hearing || !hearing.date) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is meant to guard against the empty hearing badge bug by guarding against this case: hearing = {
heldBy: null,
date: null,
...: null,
} |
||
return null; | ||
} | ||
|
||
const tooltipText = <div> | ||
This case has a hearing associated with it. | ||
<ul {...listStyling}> | ||
<li>Judge: <strong>{hearing.heldBy}</strong></li> | ||
<li>Disposition: <strong>{_.startCase(hearing.disposition)}</strong></li> | ||
<li>Date: <strong><DateString date={hearing.date} /></strong></li> | ||
<li>Type: <strong>{_.startCase(hearing.type)}</strong></li> | ||
</ul> | ||
</div>; | ||
|
||
return <div {...css({ marginRight: '-2.5rem' })} className="cf-hearing-badge"> | ||
<Tooltip id={`badge-${hearing.id}`} text={tooltipText} position="bottom"> | ||
<span {...badgeStyling}>H</span> | ||
</Tooltip> | ||
</div>; | ||
} | ||
} | ||
|
||
const tooltipText = <div> | ||
This case has a hearing associated with it. | ||
<ul {...listStyling}> | ||
<li>Judge: <strong>{hearing.heldBy}</strong></li> | ||
<li>Disposition: <strong>{_.startCase(hearing.disposition)}</strong></li> | ||
<li>Date: <strong><DateString date={hearing.date} /></strong></li> | ||
<li>Type: <strong>{_.startCase(hearing.type)}</strong></li> | ||
</ul> | ||
</div>; | ||
|
||
// We expect this badge to be shown in a table, so we use this to get rid of the standard table padding. | ||
return <div {...css({ marginRight: '-3rem' })} className="cf-hearing-badge"> | ||
<Tooltip id={`badge-${hearing.id}`} text={tooltipText} position="bottom"> | ||
<span {...badgeStyling}>H</span> | ||
</Tooltip> | ||
</div>; | ||
HearingBadge.propTypes = { | ||
task: PropTypes.object, | ||
hearing: PropTypes.object | ||
}; | ||
|
||
export default HearingBadge; | ||
const mapStateToProps = (state, ownProps) => { | ||
let externalId, hearing; | ||
|
||
if (ownProps.hearing) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accept either a hearing or a task |
||
hearing = ownProps.hearing; | ||
} else if (ownProps.task) { | ||
externalId = ownProps.task.appeal.externalId; | ||
} | ||
|
||
return { | ||
hearing, | ||
externalId, | ||
mostRecentlyHeldHearingForAppeal: state.queue.mostRecentlyHeldHearingForAppeal[externalId] || null | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch) => bindActionCreators({ | ||
setMostRecentlyHeldHearingForAppeal | ||
}, dispatch); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(HearingBadge); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"held": "held", | ||
"cancelled": "cancelled", | ||
"postponed": "postponed", | ||
"no_show": "no_show" | ||
} |
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
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.
let me know what you think of this API
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 like it!