@openedx/frontend-app-instructor-dashboard 1.0.0-alpha.33 → 1.0.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/certificates/CertificatesPage.js +34 -8
- package/dist/certificates/CertificatesPage.js.map +1 -1
- package/dist/certificates/components/CertificatesPageHeader.d.ts +2 -2
- package/dist/certificates/components/CertificatesPageHeader.js +3 -3
- package/dist/certificates/components/CertificatesPageHeader.js.map +1 -1
- package/dist/certificates/components/DisableCertificatesModal.js +16 -8
- package/dist/certificates/components/DisableCertificatesModal.js.map +1 -1
- package/dist/certificates/components/GrantExceptionsModal.d.ts +2 -1
- package/dist/certificates/components/GrantExceptionsModal.js +49 -4
- package/dist/certificates/components/GrantExceptionsModal.js.map +1 -1
- package/dist/certificates/components/InvalidateCertificateModal.js +19 -3
- package/dist/certificates/components/InvalidateCertificateModal.js.map +1 -1
- package/dist/certificates/data/api.d.ts +7 -0
- package/dist/certificates/data/api.js +10 -0
- package/dist/certificates/data/api.js.map +1 -1
- package/dist/certificates/data/apiHook.d.ts +10 -0
- package/dist/certificates/data/apiHook.js +16 -1
- package/dist/certificates/data/apiHook.js.map +1 -1
- package/dist/certificates/messages.d.ts +100 -0
- package/dist/certificates/messages.js +104 -4
- package/dist/certificates/messages.js.map +1 -1
- package/dist/components/SpecifyLearnerField.js +25 -5
- package/dist/components/SpecifyLearnerField.js.map +1 -1
- package/dist/components/SpecifyProblemField.js +2 -2
- package/dist/components/SpecifyProblemField.js.map +1 -1
- package/dist/components/messages.d.ts +5 -0
- package/dist/components/messages.js +5 -0
- package/dist/components/messages.js.map +1 -1
- package/dist/enrollments/components/UpdateBetaTesterModal.js +9 -1
- package/dist/enrollments/components/UpdateBetaTesterModal.js.map +1 -1
- package/dist/grading/components/GradingLearnerContent.js +4 -0
- package/dist/grading/components/GradingLearnerContent.js.map +1 -1
- package/dist/slots/CourseInfoSlot/CourseInfoSlot.d.ts +2 -0
- package/dist/slots/CourseInfoSlot/CourseInfoSlot.js +14 -0
- package/dist/slots/CourseInfoSlot/CourseInfoSlot.js.map +1 -0
- package/dist/slots.js +9 -1
- package/dist/slots.js.map +1 -1
- package/dist/specialExams/components/AllowancesList.js +9 -4
- package/dist/specialExams/components/AllowancesList.js.map +1 -1
- package/dist/specialExams/components/AttemptsList.js +9 -4
- package/dist/specialExams/components/AttemptsList.js.map +1 -1
- package/dist/specialExams/components/EditAllowanceModal.js +1 -1
- package/dist/specialExams/components/EditAllowanceModal.js.map +1 -1
- package/dist/specialExams/data/api.js +6 -0
- package/dist/specialExams/data/api.js.map +1 -1
- package/dist/specialExams/data/queryKeys.d.ts +2 -2
- package/dist/specialExams/data/queryKeys.js +2 -2
- package/dist/specialExams/data/queryKeys.js.map +1 -1
- package/dist/specialExams/types.d.ts +1 -0
- package/dist/specialExams/types.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -56,7 +56,7 @@ const EditAllowanceModal = ({ isOpen, onClose, allowance }) => {
|
|
|
56
56
|
if (!(learner === null || learner === void 0 ? void 0 : learner.username)) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
return (_jsxs(ModalDialog, { isOpen: isOpen, onClose: onClose, title: intl.formatMessage(messages.editAllowance), isOverflowVisible: false, size: "lg", children: [_jsx(ModalDialog.Header, { className: "border-bottom border-light-700", children: _jsx(ModalDialog.Title, { className: "text-primary-700", children: intl.formatMessage(messages.editAllowance) }) }), _jsxs(Form, { className: "position-relative overflow-auto", onSubmit: handleEdit, children: [_jsxs(ModalDialog.Body, { children: [_jsx(Form.Group, { controlId: "learner-info", children: _jsx(SpecifyLearnerField, { learner: learner, onClickSelect: () => { } }) }), _jsxs(Form.Group, { controlId: "select-exam-type", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectExamType), ":"] }), _jsx(Form.Control, { as: "select", disabled: true, children: _jsx("option", { value: "", children: allowance.proctoredExam.examType }) })] }), _jsxs(Form.Group, { controlId: "select-exams", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectExams), ":"] }), _jsx("div", { children: _jsx(Form.Checkbox, { className: "mt-2", checked: true, disabled: true, labelClassName: "text-primary-500", children: allowance.proctoredExam.examName }, allowance.proctoredExam.examName) })] }), _jsxs(Form.Group, { controlId: "select-allowance-type", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectAllowanceType), ":"] }), _jsx(Form.Control, { as: "select", name: "allowanceType", onChange: handleChanges, value: editedAllowance.allowanceType, children: allowanceTypesOptions.map(option => (_jsx("option", { value: option.value, children: intl.formatMessage(option.label) }, option.value))) })] }), _jsxs(Form.Group, { controlId: "allowance-value", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(addLabel[editedAllowance.allowanceType || 'additional_time_granted']), ":"] }), _jsx(Form.Control, { type: editedAllowance.allowanceType === 'review_policy_exception' ? 'text' : 'number', placeholder: intl.formatMessage(addPlaceholder[editedAllowance.allowanceType || 'additional_time_granted']), name: "value", value: editedAllowance.value, onChange: handleChanges })] })] }), _jsx(ModalDialog.Footer, { className: "border-top border-light-700", children: _jsxs(ActionRow, { children: [_jsx(Button, { variant: "tertiary", onClick: onClose, children: intl.formatMessage(messages.cancel) }), _jsx(Button, { variant: "primary", type: "submit", disabled: !hasChanges, children: intl.formatMessage(messages.editAllowance) })] }) })] })] }));
|
|
59
|
+
return (_jsxs(ModalDialog, { isOpen: isOpen, onClose: onClose, title: intl.formatMessage(messages.editAllowance), isOverflowVisible: false, size: "lg", children: [_jsx(ModalDialog.Header, { className: "border-bottom border-light-700", children: _jsx(ModalDialog.Title, { className: "text-primary-700", children: intl.formatMessage(messages.editAllowance) }) }), _jsxs(Form, { className: "position-relative overflow-auto", onSubmit: handleEdit, children: [_jsxs(ModalDialog.Body, { children: [_jsx(Form.Group, { controlId: "learner-info", children: _jsx(SpecifyLearnerField, { learner: learner, onClickSelect: () => { } }) }), _jsxs(Form.Group, { controlId: "select-exam-type", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectExamType), ":"] }), _jsx(Form.Control, { as: "select", disabled: true, controlClassName: "text-capitalize", children: _jsx("option", { value: "", children: allowance.proctoredExam.examType }) })] }), _jsxs(Form.Group, { controlId: "select-exams", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectExams), ":"] }), _jsx("div", { children: _jsx(Form.Checkbox, { className: "mt-2", checked: true, disabled: true, labelClassName: "text-primary-500", children: allowance.proctoredExam.examName }, allowance.proctoredExam.examName) })] }), _jsxs(Form.Group, { controlId: "select-allowance-type", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(messages.selectAllowanceType), ":"] }), _jsx(Form.Control, { as: "select", name: "allowanceType", onChange: handleChanges, value: editedAllowance.allowanceType, children: allowanceTypesOptions.map(option => (_jsx("option", { value: option.value, children: intl.formatMessage(option.label) }, option.value))) })] }), _jsxs(Form.Group, { controlId: "allowance-value", children: [_jsxs(Form.Label, { className: "text-primary-500 x-small", children: [intl.formatMessage(addLabel[editedAllowance.allowanceType || 'additional_time_granted']), ":"] }), _jsx(Form.Control, { type: editedAllowance.allowanceType === 'review_policy_exception' ? 'text' : 'number', placeholder: intl.formatMessage(addPlaceholder[editedAllowance.allowanceType || 'additional_time_granted']), name: "value", value: editedAllowance.value, onChange: handleChanges })] })] }), _jsx(ModalDialog.Footer, { className: "border-top border-light-700", children: _jsxs(ActionRow, { children: [_jsx(Button, { variant: "tertiary", onClick: onClose, children: intl.formatMessage(messages.cancel) }), _jsx(Button, { variant: "primary", type: "submit", disabled: !hasChanges, children: intl.formatMessage(messages.editAllowance) })] }) })] })] }));
|
|
60
60
|
};
|
|
61
61
|
export default EditAllowanceModal;
|
|
62
62
|
//# sourceMappingURL=EditAllowanceModal.js.map
|
|
@@ -1 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AM,CAAC,CAAC,CAAC,QAAQ,EACrF,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,eAAe,CAAC,aAAa,IAAI,yBAAyB,CAAC,CAAC,EAC3G,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,eAAe,CAAC,KAAK,EAC5B,QAAQ,EAAE,aAAa,GACvB,IACS,IACI,EACnB,KAAC,WAAW,CAAC,MAAM,IAAC,SAAS,EAAC,6BAA6B,YACzD,MAAC,SAAS,eACR,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAU,EAC3F,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,UAAU,YAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAU,IAC1G,GACO,IAChB,IACK,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useIntl } from '@openedx/frontend-base';\nimport { ActionRow, Button, Form, ModalDialog } from '@openedx/paragon';\nimport SpecifyLearnerField from '@src/components/SpecifyLearnerField';\nimport { useLearner } from '@src/data/apiHook';\nimport { addLabel, addPlaceholder, allowanceTypesOptions } from '@src/specialExams/constants';\nimport { useAddAllowance } from '@src/specialExams/data/apiHook';\nimport messages from '@src/specialExams/messages';\nimport { Allowance } from '@src/specialExams/types';\nimport { useAlert } from '@src/providers/AlertProvider';\n\ninterface EditAllowanceModalProps {\n isOpen: boolean,\n onClose: () => void,\n allowance: Allowance,\n}\n\nconst EditAllowanceModal = ({ isOpen, onClose, allowance }: EditAllowanceModalProps) => {\n const intl = useIntl();\n const { courseId = '' } = useParams<{ courseId: string }>();\n const { mutate: editAllowance } = useAddAllowance(courseId);\n const { data: learner, refetch } = useLearner(courseId, allowance.user.username);\n const [editedAllowance, setEditedAllowance] = useState({\n allowanceType: allowance.key,\n value: allowance.value,\n });\n const { showModal } = useAlert();\n\n useEffect(() => {\n if (isOpen) {\n // Refetch learner data when modal opens to ensure we have the most up-to-date information\n refetch();\n }\n }, [isOpen, refetch]);\n\n const handleChanges = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) => {\n const { name, value } = e.target;\n setEditedAllowance(prev => ({ ...prev, [name]: value }));\n };\n\n const hasChanges = useMemo(() => {\n return (editedAllowance.allowanceType !== allowance.key && editedAllowance.allowanceType !== '')\n || editedAllowance.value !== allowance.value;\n }, [editedAllowance, allowance]);\n\n const handleEdit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n editAllowance({\n examType: allowance.proctoredExam.examType,\n allowanceType: editedAllowance.allowanceType,\n value: editedAllowance.value,\n userIds: [allowance.user.username],\n examIds: [allowance.proctoredExam.id],\n }, {\n onSuccess: () => {\n onClose();\n },\n onError: () => {\n showModal({\n message: intl.formatMessage(messages.editAllowanceError),\n variant: 'danger',\n });\n }\n });\n };\n\n if (!learner?.username) {\n return null;\n }\n\n return (\n <ModalDialog isOpen={isOpen} onClose={onClose} title={intl.formatMessage(messages.editAllowance)} isOverflowVisible={false} size=\"lg\">\n <ModalDialog.Header className=\"border-bottom border-light-700\">\n <ModalDialog.Title className=\"text-primary-700\">{intl.formatMessage(messages.editAllowance)}</ModalDialog.Title>\n </ModalDialog.Header>\n <Form className=\"position-relative overflow-auto\" onSubmit={handleEdit}>\n <ModalDialog.Body>\n <Form.Group controlId=\"learner-info\">\n <SpecifyLearnerField learner={learner} onClickSelect={() => {}} />\n </Form.Group>\n <Form.Group controlId=\"select-exam-type\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectExamType)}:</Form.Label>\n <Form.Control as=\"select\" disabled>\n <option value=\"\">{allowance.proctoredExam.examType}</option>\n </Form.Control>\n </Form.Group>\n <Form.Group controlId=\"select-exams\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectExams)}:</Form.Label>\n <div>\n <Form.Checkbox className=\"mt-2\" key={allowance.proctoredExam.examName} checked disabled labelClassName=\"text-primary-500\">\n {allowance.proctoredExam.examName}\n </Form.Checkbox>\n </div>\n </Form.Group>\n <Form.Group controlId=\"select-allowance-type\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectAllowanceType)}:</Form.Label>\n <Form.Control as=\"select\" name=\"allowanceType\" onChange={handleChanges} value={editedAllowance.allowanceType}>\n {allowanceTypesOptions.map(option => (\n <option key={option.value} value={option.value}>{intl.formatMessage(option.label)}</option>\n ))}\n </Form.Control>\n </Form.Group>\n <Form.Group controlId=\"allowance-value\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(addLabel[editedAllowance.allowanceType || 'additional_time_granted'])}:</Form.Label>\n <Form.Control\n type={editedAllowance.allowanceType === 'review_policy_exception' ? 'text' : 'number'}\n placeholder={intl.formatMessage(addPlaceholder[editedAllowance.allowanceType || 'additional_time_granted'])}\n name=\"value\"\n value={editedAllowance.value}\n onChange={handleChanges}\n />\n </Form.Group>\n </ModalDialog.Body>\n <ModalDialog.Footer className=\"border-top border-light-700\">\n <ActionRow>\n <Button variant=\"tertiary\" onClick={onClose}>{intl.formatMessage(messages.cancel)}</Button>\n <Button variant=\"primary\" type=\"submit\" disabled={!hasChanges}>{intl.formatMessage(messages.editAllowance)}</Button>\n </ActionRow>\n </ModalDialog.Footer>\n </Form>\n </ModalDialog>\n );\n};\n\nexport default EditAllowanceModal;\n"]}
|
|
1
|
+
{"version":3,"file":"EditAllowanceModal.js","sourceRoot":"","sources":["../../../src/specialExams/components/EditAllowanceModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C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Aa,GACvB,IACS,IACI,EACnB,KAAC,WAAW,CAAC,MAAM,IAAC,SAAS,EAAC,6BAA6B,YACzD,MAAC,SAAS,eACR,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAU,EAC3F,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,UAAU,YAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAU,IAC1G,GACO,IAChB,IACK,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useIntl } from '@openedx/frontend-base';\nimport { ActionRow, Button, Form, ModalDialog } from '@openedx/paragon';\nimport SpecifyLearnerField from '@src/components/SpecifyLearnerField';\nimport { useLearner } from '@src/data/apiHook';\nimport { addLabel, addPlaceholder, allowanceTypesOptions } from '@src/specialExams/constants';\nimport { useAddAllowance } from '@src/specialExams/data/apiHook';\nimport messages from '@src/specialExams/messages';\nimport { Allowance } from '@src/specialExams/types';\nimport { useAlert } from '@src/providers/AlertProvider';\n\ninterface EditAllowanceModalProps {\n isOpen: boolean,\n onClose: () => void,\n allowance: Allowance,\n}\n\nconst EditAllowanceModal = ({ isOpen, onClose, allowance }: EditAllowanceModalProps) => {\n const intl = useIntl();\n const { courseId = '' } = useParams<{ courseId: string }>();\n const { mutate: editAllowance } = useAddAllowance(courseId);\n const { data: learner, refetch } = useLearner(courseId, allowance.user.username);\n const [editedAllowance, setEditedAllowance] = useState({\n allowanceType: allowance.key,\n value: allowance.value,\n });\n const { showModal } = useAlert();\n\n useEffect(() => {\n if (isOpen) {\n // Refetch learner data when modal opens to ensure we have the most up-to-date information\n refetch();\n }\n }, [isOpen, refetch]);\n\n const handleChanges = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) => {\n const { name, value } = e.target;\n setEditedAllowance(prev => ({ ...prev, [name]: value }));\n };\n\n const hasChanges = useMemo(() => {\n return (editedAllowance.allowanceType !== allowance.key && editedAllowance.allowanceType !== '')\n || editedAllowance.value !== allowance.value;\n }, [editedAllowance, allowance]);\n\n const handleEdit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n editAllowance({\n examType: allowance.proctoredExam.examType,\n allowanceType: editedAllowance.allowanceType,\n value: editedAllowance.value,\n userIds: [allowance.user.username],\n examIds: [allowance.proctoredExam.id],\n }, {\n onSuccess: () => {\n onClose();\n },\n onError: () => {\n showModal({\n message: intl.formatMessage(messages.editAllowanceError),\n variant: 'danger',\n });\n }\n });\n };\n\n if (!learner?.username) {\n return null;\n }\n\n return (\n <ModalDialog isOpen={isOpen} onClose={onClose} title={intl.formatMessage(messages.editAllowance)} isOverflowVisible={false} size=\"lg\">\n <ModalDialog.Header className=\"border-bottom border-light-700\">\n <ModalDialog.Title className=\"text-primary-700\">{intl.formatMessage(messages.editAllowance)}</ModalDialog.Title>\n </ModalDialog.Header>\n <Form className=\"position-relative overflow-auto\" onSubmit={handleEdit}>\n <ModalDialog.Body>\n <Form.Group controlId=\"learner-info\">\n <SpecifyLearnerField learner={learner} onClickSelect={() => {}} />\n </Form.Group>\n <Form.Group controlId=\"select-exam-type\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectExamType)}:</Form.Label>\n <Form.Control as=\"select\" disabled controlClassName=\"text-capitalize\">\n <option value=\"\">{allowance.proctoredExam.examType}</option>\n </Form.Control>\n </Form.Group>\n <Form.Group controlId=\"select-exams\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectExams)}:</Form.Label>\n <div>\n <Form.Checkbox className=\"mt-2\" key={allowance.proctoredExam.examName} checked disabled labelClassName=\"text-primary-500\">\n {allowance.proctoredExam.examName}\n </Form.Checkbox>\n </div>\n </Form.Group>\n <Form.Group controlId=\"select-allowance-type\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(messages.selectAllowanceType)}:</Form.Label>\n <Form.Control as=\"select\" name=\"allowanceType\" onChange={handleChanges} value={editedAllowance.allowanceType}>\n {allowanceTypesOptions.map(option => (\n <option key={option.value} value={option.value}>{intl.formatMessage(option.label)}</option>\n ))}\n </Form.Control>\n </Form.Group>\n <Form.Group controlId=\"allowance-value\">\n <Form.Label className=\"text-primary-500 x-small\">{intl.formatMessage(addLabel[editedAllowance.allowanceType || 'additional_time_granted'])}:</Form.Label>\n <Form.Control\n type={editedAllowance.allowanceType === 'review_policy_exception' ? 'text' : 'number'}\n placeholder={intl.formatMessage(addPlaceholder[editedAllowance.allowanceType || 'additional_time_granted'])}\n name=\"value\"\n value={editedAllowance.value}\n onChange={handleChanges}\n />\n </Form.Group>\n </ModalDialog.Body>\n <ModalDialog.Footer className=\"border-top border-light-700\">\n <ActionRow>\n <Button variant=\"tertiary\" onClick={onClose}>{intl.formatMessage(messages.cancel)}</Button>\n <Button variant=\"primary\" type=\"submit\" disabled={!hasChanges}>{intl.formatMessage(messages.editAllowance)}</Button>\n </ActionRow>\n </ModalDialog.Footer>\n </Form>\n </ModalDialog>\n );\n};\n\nexport default EditAllowanceModal;\n"]}
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getAuthenticatedHttpClient, camelCaseObject, snakeCaseObject } from '@openedx/frontend-base';
|
|
11
|
+
import { snakeCase } from 'lodash';
|
|
11
12
|
import { getApiBaseUrl } from '../../data/api';
|
|
12
13
|
const getQueryParams = (params) => {
|
|
13
14
|
const queryParams = new URLSearchParams({
|
|
@@ -17,6 +18,11 @@ const getQueryParams = (params) => {
|
|
|
17
18
|
if (params.emailOrUsername) {
|
|
18
19
|
queryParams.append('search', params.emailOrUsername);
|
|
19
20
|
}
|
|
21
|
+
if (params.ordering) {
|
|
22
|
+
const hasNegativePrefix = params.ordering.startsWith('-');
|
|
23
|
+
const orderingParam = params.ordering.split('.').map((part) => snakeCase(part)).join('.');
|
|
24
|
+
queryParams.append('ordering', `${hasNegativePrefix ? '-' : ''}${orderingParam}`);
|
|
25
|
+
}
|
|
20
26
|
return queryParams;
|
|
21
27
|
};
|
|
22
28
|
export const getAttempts = (courseId, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/specialExams/data/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C,MAAM,cAAc,GAAG,CAAC,MAAsB,EAAE,EAAE;IAChD,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC;QACtC,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;QAClC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;KACtC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAO,QAAgB,EAAE,MAAsB,EAA8B,EAAE;IACxG,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CACrD,GAAG,aAAa,EAAE,8BAA8B,QAAQ,2BAA2B,WAAW,CAAC,QAAQ,EAAE,EAAE,CAC5G,CAAC;I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AAG,aAAa,EAAE,8BAA8B,QAAQ,gBAAgB,EAAE;QACxE,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;KAChC,CACF,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAA,CAAC","sourcesContent":["import { getAuthenticatedHttpClient, camelCaseObject, snakeCaseObject } from '@openedx/frontend-base';\nimport { getApiBaseUrl } from '@src/data/api';\nimport { DataList } from '@src/types';\nimport { AddAllowanceParams, Allowance, Attempt, AttemptsParams, DeleteAllowanceParams, SpecialExam } from '../types';\n\nconst getQueryParams = (params: AttemptsParams) => {\n const queryParams = new URLSearchParams({\n page: (params.page + 1).toString(),\n page_size: params.pageSize.toString(),\n });\n\n if (params.emailOrUsername) {\n queryParams.append('search', params.emailOrUsername);\n }\n\n return queryParams;\n};\n\nexport const getAttempts = async (courseId: string, params: AttemptsParams): Promise<DataList<Attempt>> => {\n const queryParams = getQueryParams(params);\n\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/attempts?${queryParams.toString()}`\n );\n return camelCaseObject(data);\n};\n\nexport const getAllowances = async (courseId: string, params: AttemptsParams): Promise<DataList<Allowance>> => {\n const queryParams = getQueryParams(params);\n\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/allowances?${queryParams.toString()}`\n );\n return camelCaseObject(data);\n};\n\nexport const addAllowance = async (courseId: string, newAllowance: AddAllowanceParams): Promise<Allowance[]> => {\n const newAllowanceSnakeCase = snakeCaseObject(newAllowance);\n const { data } = await getAuthenticatedHttpClient().post(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/allowances`,\n newAllowanceSnakeCase\n );\n return camelCaseObject(data);\n};\n\nexport const deleteAllowance = async (courseId: string, params: DeleteAllowanceParams): Promise<void> => {\n const snakeCaseParams = snakeCaseObject(params);\n await getAuthenticatedHttpClient().delete(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/${params.examId}/allowance`, {\n data: snakeCaseParams\n }\n );\n};\n\nexport const getSpecialExams = async (courseId: string, examType: string): Promise<SpecialExam[]> => {\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams`, {\n params: { exam_type: examType }\n }\n );\n return camelCaseObject(data);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/specialExams/data/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C,MAAM,cAAc,GAAG,CAAC,MAAsB,EAAE,EAAE;IAChD,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC;QACtC,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;QAClC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;KACtC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAE1D,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE1F,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CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,QAAgB,EAAE,MAA6B,EAAiB,EAAE;IACtG,MAAM,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,0BAA0B,EAAE,CAAC,MAAM,CACvC,GAAG,aAAa,EAAE,8BAA8B,QAAQ,kBAAkB,MAAM,CAAC,MAAM,YAAY,EAAE;QACnG,IAAI,EAAE,eAAe;KACtB,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,QAAgB,EAAE,QAAgB,EAA0B,EAAE;IAClG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CACrD,GAAG,aAAa,EAAE,8BAA8B,QAAQ,gBAAgB,EAAE;QACxE,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;KAChC,CACF,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAA,CAAC","sourcesContent":["import { getAuthenticatedHttpClient, camelCaseObject, snakeCaseObject } from '@openedx/frontend-base';\nimport { snakeCase } from 'lodash';\nimport { getApiBaseUrl } from '@src/data/api';\nimport { DataList } from '@src/types';\nimport { AddAllowanceParams, Allowance, Attempt, AttemptsParams, DeleteAllowanceParams, SpecialExam } from '../types';\n\nconst getQueryParams = (params: AttemptsParams) => {\n const queryParams = new URLSearchParams({\n page: (params.page + 1).toString(),\n page_size: params.pageSize.toString(),\n });\n\n if (params.emailOrUsername) {\n queryParams.append('search', params.emailOrUsername);\n }\n\n if (params.ordering) {\n const hasNegativePrefix = params.ordering.startsWith('-');\n\n const orderingParam = params.ordering.split('.').map((part) => snakeCase(part)).join('.');\n\n queryParams.append('ordering', `${hasNegativePrefix ? '-' : ''}${orderingParam}`);\n }\n\n return queryParams;\n};\n\nexport const getAttempts = async (courseId: string, params: AttemptsParams): Promise<DataList<Attempt>> => {\n const queryParams = getQueryParams(params);\n\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/attempts?${queryParams.toString()}`\n );\n return camelCaseObject(data);\n};\n\nexport const getAllowances = async (courseId: string, params: AttemptsParams): Promise<DataList<Allowance>> => {\n const queryParams = getQueryParams(params);\n\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/allowances?${queryParams.toString()}`\n );\n return camelCaseObject(data);\n};\n\nexport const addAllowance = async (courseId: string, newAllowance: AddAllowanceParams): Promise<Allowance[]> => {\n const newAllowanceSnakeCase = snakeCaseObject(newAllowance);\n const { data } = await getAuthenticatedHttpClient().post(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/allowances`,\n newAllowanceSnakeCase\n );\n return camelCaseObject(data);\n};\n\nexport const deleteAllowance = async (courseId: string, params: DeleteAllowanceParams): Promise<void> => {\n const snakeCaseParams = snakeCaseObject(params);\n await getAuthenticatedHttpClient().delete(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams/${params.examId}/allowance`, {\n data: snakeCaseParams\n }\n );\n};\n\nexport const getSpecialExams = async (courseId: string, examType: string): Promise<SpecialExam[]> => {\n const { data } = await getAuthenticatedHttpClient().get(\n `${getApiBaseUrl()}/api/instructor/v2/courses/${courseId}/special_exams`, {\n params: { exam_type: examType }\n }\n );\n return camelCaseObject(data);\n};\n"]}
|
|
@@ -2,7 +2,7 @@ import { AttemptsParams } from '../types';
|
|
|
2
2
|
export declare const specialExamsQueryKeys: {
|
|
3
3
|
all: readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams"];
|
|
4
4
|
byCourse: (courseId: string) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string];
|
|
5
|
-
attempts: (courseId: string, params: AttemptsParams) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string, "attempts", number, string];
|
|
6
|
-
allowances: (courseId: string, params?: AttemptsParams) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string, "allowances", number, string];
|
|
5
|
+
attempts: (courseId: string, params: AttemptsParams) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string, "attempts", number, string, string];
|
|
6
|
+
allowances: (courseId: string, params?: AttemptsParams) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string, "allowances", number, string, string];
|
|
7
7
|
specialExams: (courseId: string, examType: string) => readonly ["org.openedx.frontend.app.instructorDashboard", "specialExams", string, "specialExams", string];
|
|
8
8
|
};
|
|
@@ -2,8 +2,8 @@ import { appId } from '../../constants';
|
|
|
2
2
|
export const specialExamsQueryKeys = {
|
|
3
3
|
all: [appId, 'specialExams'],
|
|
4
4
|
byCourse: (courseId) => [...specialExamsQueryKeys.all, courseId],
|
|
5
|
-
attempts: (courseId, params) => [...specialExamsQueryKeys.byCourse(courseId), 'attempts', params.page, params.emailOrUsername],
|
|
6
|
-
allowances: (courseId, params) => [...specialExamsQueryKeys.byCourse(courseId), 'allowances', (params === null || params === void 0 ? void 0 : params.page) || 1, (params === null || params === void 0 ? void 0 : params.emailOrUsername) || ''],
|
|
5
|
+
attempts: (courseId, params) => [...specialExamsQueryKeys.byCourse(courseId), 'attempts', params.page, params.emailOrUsername, params.ordering],
|
|
6
|
+
allowances: (courseId, params) => [...specialExamsQueryKeys.byCourse(courseId), 'allowances', (params === null || params === void 0 ? void 0 : params.page) || 1, (params === null || params === void 0 ? void 0 : params.emailOrUsername) || '', (params === null || params === void 0 ? void 0 : params.ordering) || ''],
|
|
7
7
|
specialExams: (courseId, examType) => [...specialExamsQueryKeys.byCourse(courseId), 'specialExams', examType],
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=queryKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../src/specialExams/data/queryKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,E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AAN,MAAM,CAAE,QAAQ,KAAI,EAAE,CAAU;IACzM,YAAY,EAAE,CAAC,QAAgB,EAAE,QAAgB,EAAE,EAAE,CAAC,CAAC,GAAG,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAU;CACvI,CAAC","sourcesContent":["import { appId } from '@src/constants';\nimport { AttemptsParams } from '../types';\n\nexport const specialExamsQueryKeys = {\n all: [appId, 'specialExams'] as const,\n byCourse: (courseId: string) => [...specialExamsQueryKeys.all, courseId] as const,\n attempts: (courseId: string, params: AttemptsParams) => [...specialExamsQueryKeys.byCourse(courseId), 'attempts', params.page, params.emailOrUsername, params.ordering] as const,\n allowances: (courseId: string, params?: AttemptsParams) => [...specialExamsQueryKeys.byCourse(courseId), 'allowances', params?.page || 1, params?.emailOrUsername || '', params?.ordering || ''] as const,\n specialExams: (courseId: string, examType: string) => [...specialExamsQueryKeys.byCourse(courseId), 'specialExams', examType] as const,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/specialExams/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PaginationParams } from '@src/types';\n\nexport interface Attempt {\n id: number,\n user: {\n username: string,\n },\n examId: number,\n examName: string,\n allowedTimeLimitMins: number,\n type: string,\n startTime: string,\n endTime: string,\n status: string,\n}\n\nexport interface AttemptsParams extends PaginationParams {\n emailOrUsername: string,\n}\n\nexport interface Allowance {\n value: string,\n key: string,\n proctoredExam: {\n examName: string,\n examType: string,\n id: number,\n },\n user: {\n username: string,\n email: string,\n id: number,\n },\n id: number,\n}\n\nexport interface AddAllowanceParams {\n userIds: string[],\n examType: string,\n examIds: number[],\n allowanceType: string,\n value: string,\n}\n\nexport interface AddAllowanceForm {\n users: string,\n examType: string,\n examIds: number[],\n allowanceType: string,\n value: string,\n}\n\nexport interface SpecialExam {\n examName: string,\n examType: string,\n timeLimitMins: number,\n contentId: string,\n courseId: string,\n dueDate: string | null,\n isProctored: boolean,\n isActive: boolean,\n isPracticeExam: boolean,\n hideAfterDue: boolean,\n id: number,\n}\n\nexport interface DeleteAllowanceParams {\n examId: number,\n userIds: number[],\n allowanceType: string,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/specialExams/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PaginationParams } from '@src/types';\n\nexport interface Attempt {\n id: number,\n user: {\n username: string,\n },\n examId: number,\n examName: string,\n allowedTimeLimitMins: number,\n type: string,\n startTime: string,\n endTime: string,\n status: string,\n}\n\nexport interface AttemptsParams extends PaginationParams {\n emailOrUsername: string,\n ordering: string,\n}\n\nexport interface Allowance {\n value: string,\n key: string,\n proctoredExam: {\n examName: string,\n examType: string,\n id: number,\n },\n user: {\n username: string,\n email: string,\n id: number,\n },\n id: number,\n}\n\nexport interface AddAllowanceParams {\n userIds: string[],\n examType: string,\n examIds: number[],\n allowanceType: string,\n value: string,\n}\n\nexport interface AddAllowanceForm {\n users: string,\n examType: string,\n examIds: number[],\n allowanceType: string,\n value: string,\n}\n\nexport interface SpecialExam {\n examName: string,\n examType: string,\n timeLimitMins: number,\n contentId: string,\n courseId: string,\n dueDate: string | null,\n isProctored: boolean,\n isActive: boolean,\n isPracticeExam: boolean,\n hideAfterDue: boolean,\n id: number,\n}\n\nexport interface DeleteAllowanceParams {\n examId: number,\n userIds: number[],\n allowanceType: string,\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAiBC,CAAC;AAMD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAiBC,CAAC;AAMD,CAAC;AAyBD,CAAC","sourcesContent":["export interface TableCellValue<T> {\n row: {\n original: T,\n },\n}\n\nexport interface PaginationParams {\n page: number,\n pageSize: number,\n}\n\nexport interface APIError {\n response: {\n data: {\n error: string,\n },\n },\n};\n\nexport interface DataList<T> {\n count: number,\n numPages: number,\n results: T[],\n};\n\nexport interface PendingTask {\n taskType: string,\n taskInput: Record<string, any>,\n taskId: string,\n requester: string,\n taskState: string,\n created: string,\n taskOutput: Record<string, any> | null,\n durationSec: number,\n status: string,\n taskMessage: string,\n}\n\nexport interface DataTableFetchDataProps {\n filters: { id: string, value: string }[],\n pageIndex: number,\n sortBy: { id: string, desc: boolean }[],\n}\n\nexport interface Learner {\n username: string,\n fullName: string,\n email: string,\n};\n\nexport interface SelectedLearner extends Learner {\n progressUrl: string,\n isEnrolled: boolean,\n}\n"]}
|