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

Revert "Revert "add reader banner"" #19406

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ def feedback_url
end
helper_method :feedback_url

def efolder_express_url
Rails.application.config.efolder_url.to_s
end
helper_method :efolder_express_url

def help_url
{
"certification" => certification_help_path,
Expand Down
2 changes: 2 additions & 0 deletions app/views/reader/appeal/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
applicationUrls: application_urls,
page: "DecisionReviewer",
feedbackUrl: feedback_url,
efolderExpressUrl: efolder_express_url,
userHasEfolderRole: current_user.can?('Download eFolder'),
featureToggles: {
interfaceVersion2: FeatureToggle.enabled?(:interface_version_2, user: current_user),
windowSlider: FeatureToggle.enabled?(:window_slider, user: current_user),
Expand Down
4 changes: 4 additions & 0 deletions client/app/reader/DecisionReviewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export class DecisionReviewer extends React.PureComponent {
annotations={this.props.annotations}
vacolsId={vacolsId}>
<PdfListView
efolderExpressUrl={this.props.efolderExpressUrl}
userHasEfolderRole={this.props.userHasEfolderRole}
showPdf={this.showPdf(props.history, vacolsId)}
sortBy={this.state.sortBy}
selectedLabels={this.state.selectedLabels}
Expand Down Expand Up @@ -173,6 +175,8 @@ DecisionReviewer.propTypes = {
dropdownUrls: PropTypes.array,
featureToggles: PropTypes.any,
feedbackUrl: PropTypes.any,
efolderExpressUrl: PropTypes.any,
userHasEfolderRole: PropTypes.bool,
isPlacingAnnotation: PropTypes.any,
onScrollToComment: PropTypes.func,
setCategoryFilter: PropTypes.func,
Expand Down
7 changes: 4 additions & 3 deletions client/app/reader/DocumentList/DocumentListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ export const setViewingDocumentsOrComments = (documentsOrComments) => ({
}
});

export const onReceiveManifests = (manifestVbmsFetchedAt, manifestVvaFetchedAt) => ({
export const onReceiveManifests = (manifestVbmsFetchedAt) => ({
type: Constants.RECEIVE_MANIFESTS,
payload: { manifestVbmsFetchedAt,
manifestVvaFetchedAt }
payload: {
manifestVbmsFetchedAt,
}
});
6 changes: 1 addition & 5 deletions client/app/reader/DocumentList/DocumentListReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ const initialState = {
category: false
}
},
manifestVbmsFetchedAt: null,
manifestVvaFetchedAt: null
manifestVbmsFetchedAt: null
};

const documentListReducer = (state = initialState, action = {}) => {
Expand Down Expand Up @@ -181,9 +180,6 @@ const documentListReducer = (state = initialState, action = {}) => {
return update(state, {
manifestVbmsFetchedAt: {
$set: action.payload.manifestVbmsFetchedAt
},
manifestVvaFetchedAt: {
$set: action.payload.manifestVvaFetchedAt
}
});
case Constants.UPDATE_FILTERED_RESULTS:
Expand Down
42 changes: 27 additions & 15 deletions client/app/reader/LastRetrievalAlert.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash';
import moment from 'moment';
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Alert from '../components/Alert';
import { css } from 'glamor';
Expand All @@ -13,36 +14,40 @@ const alertStyling = css({

class LastRetrievalAlert extends React.PureComponent {

displaySupportMessage = () => this.props.userHasEfolderRole ? (
<>Please visit <a href={this.props.efolderExpressUrl} target="_blank" rel="noopener noreferrer">eFolder Express</a> to fetch the latest list of documents or submit a support ticket via <a href="https://yourit.va.gov" target="_blank" rel="noopener noreferrer">YourIT</a> to sync their eFolder with Reader.</>
) : (
<>Please submit a support ticket via <a href="https://yourit.va.gov" target="_blank" rel="noopener noreferrer">YourIT</a> to sync their eFolder with Reader.</>
);

render() {

// Check that document manifests have been recieved from VVA and VBMS
if (!this.props.manifestVbmsFetchedAt || !this.props.manifestVvaFetchedAt) {
// Check that document manifests have been recieved from VBMS
if (!this.props.manifestVbmsFetchedAt) {
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 />
Some of {this.props.appeal.veteran_full_name}'s documents are unavailable at the moment due to
a loading error from their eFolder. As a result, you may be viewing a partial list of eFolder documents.
<br />
Please refresh your browser at a later point to view a complete list of documents in the claims
folder.
{this.displaySupportMessage()}
</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');
vbmsManifestTimestamp = moment(this.props.manifestVbmsFetchedAt, 'MM/DD/YY HH:mma Z');

// Check that manifest results are fresh
if (vbmsManifestTimestamp.isBefore(staleCacheTime) || vvaManifestTimestamp.isBefore(staleCacheTime)) {
if (vbmsManifestTimestamp.isBefore(staleCacheTime)) {
const now = moment(),
vbmsDiff = now.diff(vbmsManifestTimestamp, 'hours'),
vvaDiff = now.diff(vvaManifestTimestamp, 'hours');
vbmsDiff = now.diff(vbmsManifestTimestamp, '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.
Reader last synced the list of documents with {this.props.appeal.veteran_full_name}'s
eFolder {vbmsDiff} hours ago.
<br />
{this.displaySupportMessage()}
</Alert>
</div>;
}
Expand All @@ -51,6 +56,13 @@ class LastRetrievalAlert extends React.PureComponent {
}
}

LastRetrievalAlert.propTypes = {
manifestVbmsFetchedAt: PropTypes.string,
efolderExpressUrl: PropTypes.string,
appeal: PropTypes.object,
userHasEfolderRole: PropTypes.bool,
};

export default connect(
(state) => _.pick(state.documentList, ['manifestVvaFetchedAt', 'manifestVbmsFetchedAt'])
(state) => _.pick(state.documentList, ['manifestVbmsFetchedAt'])
)(LastRetrievalAlert);
20 changes: 9 additions & 11 deletions client/app/reader/LastRetrievalInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';

class UnconnectedLastRetrievalInfo extends React.PureComponent {
render() {
return [
this.props.manifestVbmsFetchedAt ?
<div id="vbms-manifest-retrieved-at" key="vbms">
Last VBMS retrieval: {this.props.manifestVbmsFetchedAt.slice(0, -5)}
</div> :
Last synced with {this.props.appeal.veteran_full_name}'s eFolder: {this.props.manifestVbmsFetchedAt.slice(0, -5)} </div> :
<div className="cf-red-text" key="vbms">
Unable to display VBMS documents at this time
</div>,
this.props.manifestVvaFetchedAt ?
<div id="vva-manifest-retrieved-at" key="vva">
Last VVA retrieval: {this.props.manifestVvaFetchedAt.slice(0, -5)}
</div> :
<div className="cf-red-text" key="vva">
Unable to display VVA documents at this time
Unable to display eFolder documents at this time
</div>
];
}
}

UnconnectedLastRetrievalInfo.propTypes = {
appeal: PropTypes.object,
manifestVbmsFetchedAt: PropTypes.string,
};

export default connect(
(state) => _.pick(state.documentList, ['manifestVvaFetchedAt', 'manifestVbmsFetchedAt'])
(state) => _.pick(state.documentList, ['manifestVbmsFetchedAt'])
)(UnconnectedLastRetrievalInfo);
23 changes: 15 additions & 8 deletions client/app/reader/PdfListView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,18 @@ export class PdfListView extends React.Component {
<AppSegment filledBackground>
<div className="section--document-list">
<ClaimsFolderDetails appeal={this.props.appeal} documents={this.props.documents} />
<LastRetrievalAlert appeal={this.props.appeal} />
<LastRetrievalAlert
userHasEfolderRole={this.props.userHasEfolderRole}
efolderExpressUrl={this.props.efolderExpressUrl}
appeal={this.props.appeal} />
<DocumentListHeader
documents={this.props.documents}
noDocuments={noDocuments}
/>
{tableView}
</div>
</AppSegment>
<LastRetrievalInfo />
<LastRetrievalInfo appeal={this.props.appeal} />
</div>;
}
}
Expand All @@ -89,7 +92,6 @@ const mapStateToProps = (state, props) => {
state.pdfViewer.loadedAppeal,
caseSelectedAppeal: state.caseSelect.selectedAppeal,
manifestVbmsFetchedAt: state.documentList.manifestVbmsFetchedAt,
manifestVvaFetchedAt: state.documentList.manifestVvaFetchedAt,
queueRedirectUrl: state.documentList.queueRedirectUrl,
queueTaskType: state.documentList.queueTaskType
};
Expand All @@ -102,12 +104,17 @@ const mapDispatchToProps = (dispatch) => (
}, dispatch)
);

export default connect(
mapStateToProps, mapDispatchToProps
)(PdfListView);

PdfListView.propTypes = {
documents: PropTypes.arrayOf(PropTypes.object).isRequired,
onJumpToComment: PropTypes.func,
sortBy: PropTypes.string
sortBy: PropTypes.string,
appeal: PropTypes.object,
efolderExpressUrl: PropTypes.string,
userHasEfolderRole: PropTypes.bool,
};


export default connect(
mapStateToProps, mapDispatchToProps
)(PdfListView);

3 changes: 3 additions & 0 deletions config/environments/demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@

ENV["DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL"] ||= "true"

# eFolder Express URL for demo environment used as a mock link
ENV["EFOLDER_EXPRESS_URL"] ||= "http://localhost:4000"

# BatchProcess ENVs
# priority_ep_sync
ENV["BATCH_PROCESS_JOB_DURATION"] ||= "1" # Number of hours the job will run for
Expand Down
Loading