Add exams dashboard MFE to instructor dash (#32493)

* feat: use new exams mfe for lti enabled courses
This commit is contained in:
Zachary Hancock
2023-06-20 10:21:43 -04:00
committed by GitHub
parent 5671dab975
commit 41c27e8cbd
5 changed files with 60 additions and 24 deletions

View File

@@ -180,6 +180,27 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase):
self.instructor.save()
self._assert_escalation_email_available(True)
@patch.dict(
settings.PROCTORING_BACKENDS,
{
'DEFAULT': 'test_proctoring_provider',
'test_proctoring_provider': {},
'lti_external': {}
},
)
@patch.dict(settings.FEATURES, {'ENABLE_PROCTORED_EXAMS': True})
def test_lti_proctoring_dashboard(self):
"""
The exams dasboard MFE will be shown instead of the default special exams tab content
"""
self.setup_course_with_proctoring_backend('lti_external', 'foo@bar.com')
self.instructor.is_staff = True
self.instructor.save()
response = self.client.get(self.url)
self.assertIn('proctoring-mfe-view', response.content.decode('utf-8'))
self.assertNotIn('proctoring-accordion', response.content.decode('utf-8'))
def test_review_dashboard(self):
"""
The exam review dashboard will appear for backends that support the feature

View File

@@ -286,8 +286,11 @@ def _section_special_exams(course, access):
course_key = str(course.id)
proctoring_provider = course.proctoring_provider
escalation_email = None
mfe_view_url = None
if proctoring_provider == 'proctortrack':
escalation_email = course.proctoring_escalation_email
elif proctoring_provider == 'lti_external':
mfe_view_url = f'{settings.EXAMS_DASHBOARD_MICROFRONTEND_URL}/course/{course_key}/exams/embed'
from edx_proctoring.api import is_backend_dashboard_available
section_data = {
@@ -298,6 +301,7 @@ def _section_special_exams(course, access):
'escalation_email': escalation_email,
'show_dashboard': is_backend_dashboard_available(course_key),
'show_onboarding': does_backend_support_onboarding(course.proctoring_provider),
'mfe_view_url': mfe_view_url,
}
return section_data

View File

@@ -4963,6 +4963,10 @@ DISCUSSIONS_MICROFRONTEND_URL = None
# .. setting_default: None
# .. setting_description: Base URL of the discussions micro-frontend google form based feedback.
DISCUSSIONS_MFE_FEEDBACK_URL = None
# .. setting_name: EXAMS_DASHBOARD_MICROFRONTEND_URL
# .. setting_default: None
# .. setting_description: Base URL of the exams dashboard micro-frontend for instructors.
EXAMS_DASHBOARD_MICROFRONTEND_URL = None
# .. toggle_name: ENABLE_AUTHN_RESET_PASSWORD_HIBP_POLICY
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False

View File

@@ -382,6 +382,7 @@ ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997'
COMMUNICATIONS_MICROFRONTEND_URL = 'http://localhost:1984'
AUTHN_MICROFRONTEND_URL = 'http://localhost:1999'
AUTHN_MICROFRONTEND_DOMAIN = 'localhost:1999'
EXAMS_DATE_MICROFRONTEND_URL = 'http://localhost:2020'
################### FRONTEND APPLICATION DISCUSSIONS ###################
DISCUSSIONS_MICROFRONTEND_URL = 'http://localhost:2002'

View File

@@ -5,29 +5,35 @@ from datetime import datetime, timedelta
import pytz
%>
<div class="proctoring-wrapper">
% if section_data.get('escalation_email'):
<h6 class = "hd hd-6 escalation-email-container">${_('Proctortrack Escalation Email:')} ${ section_data['escalation_email'] }</h6>
% endif
<div id="proctoring-accordion">
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Allowance Section')}</h3>
<div class="special-allowance-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% if section_data['show_onboarding']:
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Student Onboarding Status')}</h3>
<div class="student-onboarding-status-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% endif
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Student Special Exam Attempts')}</h3>
<div class="student-proctored-exam-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% if section_data['show_dashboard']:
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Review Dashboard')}</h3>
<div class="student-review-dashboard-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% endif
% if section_data.get('mfe_view_url'):
<div id="proctoring-mfe-view">
<iframe width="100%" height="1280" frameborder="0" src="${ section_data['mfe_view_url'] }"></iframe>
</div>
% else:
% if section_data.get('escalation_email'):
<h6 class = "hd hd-6 escalation-email-container">${_('Proctortrack Escalation Email:')} ${ section_data['escalation_email'] }</h6>
% endif
<div id="proctoring-accordion">
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Allowance Section')}</h3>
<div class="special-allowance-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% if section_data['show_onboarding']:
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Student Onboarding Status')}</h3>
<div class="student-onboarding-status-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% endif
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Student Special Exam Attempts')}</h3>
<div class="student-proctored-exam-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% if section_data['show_dashboard']:
<div class="wrap">
<h3 class="hd hd-3 special-exam-header">${_('Review Dashboard')}</h3>
<div class="student-review-dashboard-container" data-course-id="${ section_data['course_id'] }"></div>
</div>
% endif
</div>
% endif
</div>