Skip to content

Commit

Permalink
Merge branch 'feature/APPEALS-26734' into revert-19239-revert-19112-l…
Browse files Browse the repository at this point in the history
…thompson/APPEALS-26633
  • Loading branch information
mchbidwell authored Aug 23, 2023
2 parents 0cbb257 + 3508af2 commit c676fc8
Show file tree
Hide file tree
Showing 14 changed files with 231 additions and 42 deletions.
29 changes: 29 additions & 0 deletions app/jobs/virtual_hearings/conference_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module VirtualHearings::ConferenceClient
def client
case RequestStore.store[:current_user].meeting_type
when "pexip"
@client ||= PexipService.new(
host: ENV["PEXIP_MANAGEMENT_NODE_HOST"],
port: ENV["PEXIP_MANAGEMENT_NODE_PORT"],
user_name: ENV["PEXIP_USERNAME"],
password: ENV["PEXIP_PASSWORD"],
client_host: ENV["PEXIP_CLIENT_HOST"]
)
when "webex"
msg = "You hit the Webex Service!"
fail Caseflow::Error::WebexApiError, message: msg
# @client ||= WebexService.new(
# host: ENV["WEBEX_MANAGEMENT_NODE_HOST"],
# port: ENV["WEBEX_MANAGEMENT_NODE_PORT"],
# user_name: ENV["WEBEX_USERNAME"],
# password: ENV["WEBEX_PASSWORD"],
# client_host: ENV["WEBEX_CLIENT_HOST"]
# )
else
msg = "Meeting type for the user is invalid"
fail Caseflow::Error::MeetingTypeNotFoundError, message: msg
end
end
end
2 changes: 1 addition & 1 deletion app/jobs/virtual_hearings/conference_job.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class VirtualHearings::ConferenceJob < ApplicationJob
include VirtualHearings::PexipClient
include VirtualHearings::ConferenceClient

private

Expand Down
16 changes: 8 additions & 8 deletions app/jobs/virtual_hearings/create_conference_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,25 @@ def create_conference
"[#{virtual_hearing.hearing_id}])..."
)

pexip_response = create_pexip_conference
create_conference_response = create_new_conference

Rails.logger.info("Pexip response: #{pexip_response.inspect}")
Rails.logger.info("Create Conference Response: #{create_conference_response.inspect}")

if pexip_response.error
error_display = pexip_error_display(pexip_response)
if create_conference_response.error
error_display = error_display(create_conference_response)

Rails.logger.error("CreateConferenceJob failed: #{error_display}")

virtual_hearing.establishment.update_error!(error_display)

DataDogService.increment_counter(metric_name: "created_conference.failed", **create_conference_datadog_tags)

fail pexip_response.error
fail create_conference_response.error
end

DataDogService.increment_counter(metric_name: "created_conference.successful", **create_conference_datadog_tags)

virtual_hearing.update(conference_id: pexip_response.data[:conference_id])
virtual_hearing.update(conference_id: create_conference_response.data[:conference_id])
end
end

Expand All @@ -172,11 +172,11 @@ def send_emails(email_type)
end
end

def pexip_error_display(response)
def error_display(response)
"(#{response.error.code}) #{response.error.message}"
end

def create_pexip_conference
def create_new_conference
client.create_conference(
host_pin: virtual_hearing.host_pin,
guest_pin: virtual_hearing.guest_pin,
Expand Down
13 changes: 0 additions & 13 deletions app/jobs/virtual_hearings/pexip_client.rb

This file was deleted.

4 changes: 3 additions & 1 deletion app/views/queue/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
canEditCavcDashboards: current_user.can_edit_cavc_dashboards?,
canViewCavcDashboards: current_user.can_view_cavc_dashboards?,
userIsCobAdmin: ClerkOfTheBoard.singleton.admins.include?(current_user),
meetingType: current_user.meeting_type,
featureToggles: {
collect_video_and_central_emails: FeatureToggle.enabled?(:collect_video_and_central_emails, user: current_user),
enable_hearing_time_slots: FeatureToggle.enabled?(:enable_hearing_time_slots, user: current_user),
Expand Down Expand Up @@ -53,7 +54,8 @@
cavc_remand_granted_substitute_appellant: FeatureToggle.enabled?(:cavc_remand_granted_substitute_appellant, user: current_user),
cavc_dashboard_workflow: FeatureToggle.enabled?(:cavc_dashboard_workflow, user: current_user),
cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user),
cc_vacatur_visibility: FeatureToggle.enabled?(:cc_vacatur_visibility, user: current_user)
cc_vacatur_visibility: FeatureToggle.enabled?(:cc_vacatur_visibility, user: current_user),
conference_selection_visibility: FeatureToggle.enabled?(:conference_selection_visibility,user: current_user)
}
}) %>
<% end %>
25 changes: 19 additions & 6 deletions client/app/queue/OrganizationUsers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,23 @@ export default class OrganizationUsers extends React.PureComponent {
organization={this.props.organization}
user={user} />
</div>
}
</div> }
</ul>
</div>
</React.Fragment>;
{this.state.organizationName === 'Hearing Admin' &&
!conferenceSelectionVisibility && (
<div
{...radioContainerStyle}
>
<SelectConferenceTypeRadioField
key={`${user.id}-conference-selection`}
name={user.id}
/>
</div>
)}
</div>
)}
</ul>
</div>
</React.Fragment>
);
});

return <React.Fragment>
Expand Down Expand Up @@ -386,5 +398,6 @@ export default class OrganizationUsers extends React.PureComponent {
}

OrganizationUsers.propTypes = {
organization: PropTypes.string
organization: PropTypes.string,
conferenceSelectionVisibility: PropTypes.bool
};
29 changes: 18 additions & 11 deletions client/app/queue/QueueApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
setCanEditCavcDashboards,
setCanViewCavcDashboards,
setFeatureToggles,
setMeetingType,
setUserId,
setUserRole,
setUserCssId,
Expand Down Expand Up @@ -111,6 +112,7 @@ class QueueApp extends React.PureComponent {
this.props.setCanEditAod(this.props.canEditAod);
this.props.setCanEditNodDate(this.props.userCanViewEditNodDate);
this.props.setUserIsCobAdmin(this.props.userIsCobAdmin);
this.props.setMeetingType(this.props.meetingType);
this.props.setCanEditCavcRemands(this.props.canEditCavcRemands);
this.props.setCanEditCavcDashboards(this.props.canEditCavcDashboards);
this.props.setCanViewCavcDashboards(this.props.canViewCavcDashboards);
Expand Down Expand Up @@ -582,7 +584,9 @@ class QueueApp extends React.PureComponent {
};

routedOrganizationUsers = (props) => (
<OrganizationUsers {...props.match.params} />
<OrganizationUsers {...props.match.params}
conferenceSelectionVisibility = {this.props.featureToggles.conference_selection_visibility}
/>
);

routedTeamManagement = (props) => <TeamManagement {...props.match.params} />;
Expand Down Expand Up @@ -755,15 +759,15 @@ class QueueApp extends React.PureComponent {

// eslint-disable-next-line default-case
switch (this.props.reviewActionType) {
case DECISION_TYPES.OMO_REQUEST:
reviewActionType = 'OMO';
break;
case DECISION_TYPES.DRAFT_DECISION:
reviewActionType = 'Draft Decision';
break;
case DECISION_TYPES.DISPATCH:
reviewActionType = 'to Dispatch';
break;
case DECISION_TYPES.OMO_REQUEST:
reviewActionType = 'OMO';
break;
case DECISION_TYPES.DRAFT_DECISION:
reviewActionType = 'Draft Decision';
break;
case DECISION_TYPES.DISPATCH:
reviewActionType = 'to Dispatch';
break;
}

return `Draft Decision | Submit ${reviewActionType}`;
Expand Down Expand Up @@ -1215,7 +1219,7 @@ class QueueApp extends React.PureComponent {
/>
<PageRoute
path={`/queue/appeals/:appealId/tasks/:taskId/${TASK_ACTIONS.
CANCEL_ADDRESS_VERIFY_TASK_AND_ASSIGN_REGIONAL_OFFICE.value
CANCEL_ADDRESS_VERIFY_TASK_AND_ASSIGN_REGIONAL_OFFICE.value
}`}
title={`${PAGE_TITLES.CANCEL_AND_ASSIGN_TO_RO} | Caseflow`}
render={this.routedUpdateTaskAndAssignRegionalOfficeModal(
Expand Down Expand Up @@ -1418,6 +1422,8 @@ QueueApp.propTypes = {
canEditCavcDashboards: PropTypes.bool,
canViewCavcDashboards: PropTypes.bool,
userIsCobAdmin: PropTypes.bool,
meetingType: PropTypes.string,
setMeetingType: PropTypes.string
};

const mapStateToProps = (state) => ({
Expand All @@ -1430,6 +1436,7 @@ const mapDispatchToProps = (dispatch) =>
setCanEditAod,
setCanEditNodDate,
setUserIsCobAdmin,
setMeetingType,
setCanEditCavcRemands,
setCanEditCavcDashboards,
setCanViewCavcDashboards,
Expand Down
7 changes: 7 additions & 0 deletions client/app/queue/uiReducer/uiActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export const setUserIsCobAdmin = (userIsCobAdmin) => ({
}
});

export const setMeetingType = (meetingType) => ({
type: ACTIONS.SET_MEETING_TYPE,
payload: {
meetingType
}
});

export const setCanViewOvertimeStatus = (canViewOvertimeStatus) => ({
type: ACTIONS.SET_CAN_VIEW_OVERTIME_STATUS,
payload: {
Expand Down
1 change: 1 addition & 0 deletions client/app/queue/uiReducer/uiConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const ACTIONS = {
SET_FEEDBACK_URL: 'SET_FEEDBACK_URL',

SET_TARGET_USER: 'SET_TARGET_USER',
SET_MEETING_TYPE: 'SET_MEETING_TYPE',

HIGHLIGHT_INVALID_FORM_ITEMS: 'HIGHLIGHT_INVALID_FORM_ITEMS',
RESET_ERROR_MESSAGES: 'RESET_ERROR_MESSAGES',
Expand Down
4 changes: 4 additions & 0 deletions client/app/queue/uiReducer/uiReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ const workQueueUiReducer = (state = initialState, action = {}) => {
return update(state, {
userIsCobAdmin: { $set: action.payload.userIsCobAdmin }
});
case ACTIONS.SET_MEETING_TYPE:
return update(state, {
meetingType: { $set: action.payload.meetingType }
});
case ACTIONS.SET_CAN_EDIT_CAVC_REMANDS:
return update(state, {
canEditCavcRemands: { $set: action.payload.canEditCavcRemands }
Expand Down
122 changes: 122 additions & 0 deletions client/test/app/queue/organizationUsers/OrganizationUsers.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import React from 'react';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import OrganizationUsers from 'app/queue/OrganizationUsers';
import ApiUtil from 'app/util/ApiUtil';

jest.mock('app/util/ApiUtil');

describe('Conference Selection Visibility Feature Toggle', () => {
beforeEach(() => {
jest.clearAllMocks();
});
ApiUtil.get.mockResolvedValue({
body: {
organization_name: 'Hearing Admin',
judge_team: false,
dvc_team: false,
organization_users: {
data: [
{
id: '126',
type: 'administered_user',
attributes: {
css_id: 'BVASORANGE',
full_name: 'Felicia BuildAndEditHearingSchedule Orange',
email: null,
admin: false,
dvc: null,
},
},
{
id: '2000001601',
type: 'administered_user',
attributes: {
css_id: 'AMBRISVACO',
full_name: 'Gail Maggio V',
email: 'juli@stroman-kertzmann.net',
admin: true,
dvc: null,
},
},
],
},
membership_requests: [],
isVhaOrg: false,
},
});
it('Finds component by Text when conferenceSelectionVisibility is false', async () => {
const conferenceSelectionVisibilityValue = false;

const { findAllByText } = render(
<OrganizationUsers
conferenceSelectionVisibility={conferenceSelectionVisibilityValue}
/>
);
const nestedText = await findAllByText('Webex');

expect(nestedText[0]).toBeInTheDocument();
});

it('Component does not render when conferenceSelectionVisibility is true', async () => {
const conferenceSelectionVisibilityValue = true;

const { queryAllByText } = render(
<OrganizationUsers
conferenceSelectionVisibility={conferenceSelectionVisibilityValue}
/>
);
const nestedText = await queryAllByText('Webex');

expect(nestedText).toHaveLength(0);
});

it('Component does not render when orginization_name is not Hearing Admin', async () => {
const conferenceSelectionVisibilityValue = false;

ApiUtil.get.mockResolvedValue({
body: {
organization_name: 'Hearing Management',
judge_team: false,
dvc_team: false,
organization_users: {
data: [
{
id: '126',
type: 'administered_user',
attributes: {
css_id: 'BVASORANGE',
full_name: 'Felicia BuildAndEditHearingSchedule Orange',
email: null,
admin: false,
dvc: null,
},
},
{
id: '2000001601',
type: 'administered_user',
attributes: {
css_id: 'AMBRISVACO',
full_name: 'Gail Maggio V',
email: 'juli@stroman-kertzmann.net',
admin: true,
dvc: null,
},
},
],
},
membership_requests: [],
isVhaOrg: false,
},
});

const { queryAllByText } = render(
<OrganizationUsers
conferenceSelectionVisibility={conferenceSelectionVisibilityValue}
/>
);
const nestedTextWebex = await queryAllByText('Webex');

expect(nestedTextWebex).toHaveLength(0);
});
});
2 changes: 1 addition & 1 deletion config/initializers/pexip.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PexipService = (!ApplicationController.dependencies_faked? ? ExternalApi::PexipService : Fakes::PexipService)
PexipService = (ApplicationController.dependencies_faked? ? Fakes::PexipService : ExternalApi::PexipService)
Loading

0 comments on commit c676fc8

Please sign in to comment.