Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Alert for VVA and VBMS document list retrievals (#8276)
Resolves #6049 ### Description Added error in the document list for when the was never a response from VBMS or VVA. Added a similar warning for when the last response was older than the eFolder cache limit. Reimplemented retrieval timestamps.
- Loading branch information
1 parent
aeba22a
commit b4aa4f6
Showing
8 changed files
with
109 additions
and
16 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import _ from 'lodash'; | ||
import moment from 'moment'; | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import Alert from '../components/Alert'; | ||
import { css } from 'glamor'; | ||
|
||
const CACHE_TIMEOUT_HOURS = 3; | ||
|
||
const alertStyling = css({ | ||
marginBottom: '20px' | ||
}); | ||
|
||
class LastRetrievalAlert extends React.PureComponent { | ||
|
||
render() { | ||
|
||
// Check that document manifests have been recieved from VVA and VBMS | ||
if (!this.props.manifestVbmsFetchedAt || !this.props.manifestVvaFetchedAt) { | ||
return <div {...alertStyling}> | ||
<Alert title="Error" type="error"> | ||
Some of {this.props.appeal.veteran_full_name}'s documents are not available at the moment due to | ||
a loading error from VBMS or VVA. As a result, you may be viewing a partial list of claims folder documents. | ||
<br /> | ||
<br /> | ||
Please refresh your browser at a later point to view a complete list of documents in the claims | ||
folder. | ||
</Alert> | ||
</div>; | ||
} | ||
|
||
const staleCacheTime = moment().subtract(CACHE_TIMEOUT_HOURS, 'h'), | ||
vbmsManifestTimestamp = moment(this.props.manifestVbmsFetchedAt, 'MM/DD/YY HH:mma Z'), | ||
vvaManifestTimestamp = moment(this.props.manifestVvaFetchedAt, 'MM/DD/YY HH:mma Z'); | ||
|
||
// Check that manifest results are fresh | ||
if (vbmsManifestTimestamp.isBefore(staleCacheTime) || vvaManifestTimestamp.isBefore(staleCacheTime)) { | ||
const now = moment(), | ||
vbmsDiff = now.diff(vbmsManifestTimestamp, 'hours'), | ||
vvaDiff = now.diff(vvaManifestTimestamp, 'hours'); | ||
|
||
return <div {...alertStyling}> | ||
<Alert title="Warning" type="warning"> | ||
We last synced with VBMS and VVA {Math.max(vbmsDiff, vvaDiff)} hours ago. If you'd like to check for new | ||
documents, refresh the page. | ||
</Alert> | ||
</div>; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
export default connect( | ||
(state) => _.pick(state.documentList, ['manifestVvaFetchedAt', 'manifestVbmsFetchedAt']) | ||
)(LastRetrievalAlert); |
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 +1,6 @@ | ||
VBMSService = (!ApplicationController.dependencies_faked? ? ExternalApi::VBMSService : Fakes::VBMSService) | ||
|
||
if ApplicationController.dependencies_faked? | ||
VBMSService.manifest_vbms_fetched_at = Time.zone.now | ||
VBMSService.manifest_vva_fetched_at = Time.zone.now | ||
end |
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