From 4ccf0c7580e456449cdeed852e1d4d98ca2fd058 Mon Sep 17 00:00:00 2001 From: Sergio Valero Date: Wed, 2 Oct 2024 22:57:14 -0400 Subject: [PATCH] fix: Re-order options in dropdown menu (Classes table) --- .../Classes/Class/ClassPage/Actions.jsx | 12 ++- .../ClassesTable/_test_/columns.test.jsx | 10 ++- src/features/Classes/ClassesTable/columns.jsx | 83 +++++++++++++++++-- src/features/Courses/AddClass/index.jsx | 27 ++---- .../Courses/CourseDetailTable/columns.jsx | 8 +- .../Courses/CoursesDetailPage/index.jsx | 8 +- src/features/Courses/CoursesTable/columns.jsx | 13 ++- src/features/Courses/data/thunks.js | 2 +- 8 files changed, 123 insertions(+), 40 deletions(-) diff --git a/src/features/Classes/Class/ClassPage/Actions.jsx b/src/features/Classes/Class/ClassPage/Actions.jsx index ac68d0d..4f2d6c2 100644 --- a/src/features/Classes/Class/ClassPage/Actions.jsx +++ b/src/features/Classes/Class/ClassPage/Actions.jsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import PropTypes from 'prop-types'; -import { useSelector } from 'react-redux'; import { useParams, useHistory } from 'react-router-dom'; import { getConfig } from '@edx/frontend-platform'; @@ -15,12 +15,16 @@ import { useInstitutionIdQueryParam } from 'hooks'; import AddClass from 'features/Courses/AddClass'; import EnrollStudent from 'features/Classes/EnrollStudent'; +import { fetchAllClassesData } from 'features/Classes/data/thunks'; const Actions = ({ previousPage }) => { + const dispatch = useDispatch(); const history = useHistory(); const { courseId, classId } = useParams(); + const courseIdDecoded = decodeURIComponent(courseId); const classIdDecoded = decodeURIComponent(classId); const classes = useSelector((state) => state.classes.allClasses.data); + const selectedInstitution = useSelector((state) => state.main.selectedInstitution); const classLink = `${getConfig().LEARNING_MICROFRONTEND_URL}/course/${classIdDecoded}/home`; @@ -38,6 +42,10 @@ const Actions = ({ previousPage }) => { history.push(addQueryParam(`/manage-instructors/${courseId}/${classId}?previous=${previousPage}`)); }; + const finalCall = () => { + dispatch(fetchAllClassesData(selectedInstitution.id, courseIdDecoded)); + }; + return ( <>