diff --git a/src/assets/colors.scss b/src/assets/colors.scss index 146fac7a..3d2ad7ba 100644 --- a/src/assets/colors.scss +++ b/src/assets/colors.scss @@ -29,4 +29,3 @@ $blue-50: #a6dff7; // Black $black: #000; $black-80: #333; -$black-30: #212529; diff --git a/src/features/Instructors/InstructorsDetailPage/index.jsx b/src/features/Instructors/InstructorsDetailPage/index.jsx index 0520dbd7..dc911aa4 100644 --- a/src/features/Instructors/InstructorsDetailPage/index.jsx +++ b/src/features/Instructors/InstructorsDetailPage/index.jsx @@ -15,7 +15,6 @@ import { import { getConfig } from '@edx/frontend-platform'; import { CalendarExpanded } from 'react-paragon-topaz'; import { startOfMonth, endOfMonth } from 'date-fns'; -import { logError } from '@edx/frontend-platform/logging'; import Table from 'features/Main/Table'; import { fetchClassesData } from 'features/Classes/data/thunks'; @@ -23,8 +22,6 @@ import { resetClassesTable, updateCurrentPage } from 'features/Classes/data/slic import { fetchInstructorsData, fetchEventsData, resetEvents } from 'features/Instructors/data'; import { columns } from 'features/Instructors/InstructorDetailTable/columns'; import { initialPage, RequestStatus } from 'features/constants'; -import { deleteEvent } from 'features/Instructors/data/api'; -import { updateEvents } from 'features/Instructors/data/slice'; import { useInstitutionIdQueryParam } from 'hooks'; @@ -75,32 +72,6 @@ const InstructorsDetailPage = () => { dispatch(updateCurrentPage(targetPage)); }; - const handleDeleteEvent = async (event) => { - try { - const params = event?.recurrence ? { - delete_occurrence: true, - start_occurrence: event?.start, - } : {}; - - await deleteEvent(event.id, params); - - const newEventsState = events.filter(currentEvent => currentEvent.elementId !== event.elementId); - dispatch(updateEvents(newEventsState)); - } catch (error) { - logError(error); - } - }; - - const handleDeleteMultipleEvents = async (event) => { - try { - await deleteEvent(event.id); - const newEventsState = events.filter(currentEvent => currentEvent.id !== event.id); - dispatch(updateEvents(newEventsState)); - } catch (error) { - logError(error); - } - }; - useEffect(() => { if (institution.id) { dispatch(fetchInstructorsData(institution.id, initialPage, { instructor: instructorUsername })); @@ -119,10 +90,7 @@ const InstructorsDetailPage = () => { useEffect(() => { if (instructorInfo.instructorId && showInstructorCalendar) { - dispatch(fetchEventsData({ - ...rangeDates, - instructor_id: instructorInfo.instructorId, - })); + dispatch(fetchEventsData({ ...rangeDates, instructor_id: instructorInfo.instructorId })); } return () => { @@ -192,8 +160,8 @@ const InstructorsDetailPage = () => { eventsList={eventsList} onRangeChange={getRangeDate} onEdit={() => {}} - onDelete={handleDeleteEvent} - onDeleteMultiple={handleDeleteMultipleEvents} + onDelete={() => {}} + onDeleteMultiple={() => {}} onEditSinglRec={() => {}} /> diff --git a/src/features/Instructors/InstructorsDetailPage/index.scss b/src/features/Instructors/InstructorsDetailPage/index.scss index af78412a..1fdab58a 100644 --- a/src/features/Instructors/InstructorsDetailPage/index.scss +++ b/src/features/Instructors/InstructorsDetailPage/index.scss @@ -2,9 +2,4 @@ .container-calendar { box-shadow: 0px 3px 12px 0px $gray-30; - - .pgn__dropdown-item { - text-decoration: none; - color: $black-30; - } } diff --git a/src/features/Instructors/data/__test__/api.test.js b/src/features/Instructors/data/__test__/api.test.js index fd994432..364aeb6e 100644 --- a/src/features/Instructors/data/__test__/api.test.js +++ b/src/features/Instructors/data/__test__/api.test.js @@ -3,7 +3,6 @@ import { handleInstructorsEnrollment, handleNewInstructor, getEventsByInstructor, - deleteEvent, } from 'features/Instructors/data/api'; jest.mock('@edx/frontend-platform/auth', () => ({ @@ -101,25 +100,4 @@ describe('should call getAuthenticatedHttpClient with the correct parameters', ( }, ); }); - - test('delete event', () => { - const httpClientMock = { - delete: jest.fn(), - }; - - const eventId = 1; - - getAuthenticatedHttpClient.mockReturnValue(httpClientMock); - - deleteEvent(eventId); - - expect(getAuthenticatedHttpClient).toHaveBeenCalledTimes(1); - expect(getAuthenticatedHttpClient).toHaveBeenCalledWith(); - - expect(httpClientMock.delete).toHaveBeenCalledTimes(1); - expect(httpClientMock.delete).toHaveBeenCalledWith( - 'http://localhost:18000/pearson_course_operation/api/v2/events/', - { params: { event_id: eventId } }, - ); - }); }); diff --git a/src/features/Instructors/data/api.js b/src/features/Instructors/data/api.js index 95335f49..f00b3097 100644 --- a/src/features/Instructors/data/api.js +++ b/src/features/Instructors/data/api.js @@ -31,26 +31,8 @@ function getEventsByInstructor(params) { ); } -/** - * Delete event. - * - * @param {number} - Event id to be deleted - * @returns {Promise} - A promise that resolves with the response of the DELETE request. - */ -function deleteEvent(eventId, options = {}) { - const params = { - event_id: eventId, - ...options, - }; - return getAuthenticatedHttpClient().delete( - `${getConfig().COURSE_OPERATIONS_API_V2_BASE_URL}/events/`, - { params }, - ); -} - export { handleInstructorsEnrollment, handleNewInstructor, getEventsByInstructor, - deleteEvent, };