From 68c8d31dd15d6bc01f5c70366b82242b35b9f716 Mon Sep 17 00:00:00 2001 From: alangsto <46360176+alangsto@users.noreply.github.com> Date: Thu, 21 Jan 2021 12:15:56 -0500 Subject: [PATCH] added component for proctoring panel (#345) added 404 test updated for feedback updated test --- src/course-home/data/api.js | 14 +++ src/course-home/outline-tab/OutlineTab.jsx | 4 + .../outline-tab/OutlineTab.test.jsx | 35 ++++++- src/course-home/outline-tab/messages.js | 72 ++++++++++++++ .../widgets/ProctoringInfoPanel.jsx | 99 +++++++++++++++++++ .../widgets/ProctoringInfoPanel.scss | 10 ++ src/index.scss | 1 + 7 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx create mode 100644 src/course-home/outline-tab/widgets/ProctoringInfoPanel.scss diff --git a/src/course-home/data/api.js b/src/course-home/data/api.js index 79184b5f..031bb273 100644 --- a/src/course-home/data/api.js +++ b/src/course-home/data/api.js @@ -130,6 +130,20 @@ export async function getProgressTabData(courseId) { } } +export async function getProctoringInfoData(courseId) { + const url = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?course_id=${courseId}`; + try { + const { data } = await getAuthenticatedHttpClient().get(url); + return data; + } catch (error) { + const { httpErrorStatus } = error && error.customAttributes; + if (httpErrorStatus === 404) { + return {}; + } + throw error; + } +} + export async function getOutlineTabData(courseId) { const url = `${getConfig().LMS_BASE_URL}/api/course_home/v1/outline/${courseId}`; let { tabData } = {}; diff --git a/src/course-home/outline-tab/OutlineTab.jsx b/src/course-home/outline-tab/OutlineTab.jsx index a1b9d066..b349e45e 100644 --- a/src/course-home/outline-tab/OutlineTab.jsx +++ b/src/course-home/outline-tab/OutlineTab.jsx @@ -25,6 +25,7 @@ import useOfferAlert from '../../alerts/offer-alert'; import usePrivateCourseAlert from '../../alerts/private-course-alert'; import { useModel } from '../../generic/model-store'; import WelcomeMessage from './widgets/WelcomeMessage'; +import ProctoringInfoPanel from './widgets/ProctoringInfoPanel'; function OutlineTab({ intl }) { const { @@ -162,6 +163,9 @@ function OutlineTab({ intl }) { {rootCourseId && (
+ {intl.formatMessage(messages.proctoringCurrentStatus)} {intl.formatMessage(messages[`${readableStatus}ProctoringStatus`])} +
++ {intl.formatMessage(messages[`${readableStatus}ProctoringMessage`])} +
+ > + )} + {(readableStatus !== 'verified') && ( + <> +{intl.formatMessage(messages.proctoringPanelGeneralInfo)}
+{intl.formatMessage(messages.proctoringPanelGeneralTime)}
+ > + )} + {showExamLink(status) && ( + + )} + +