persist assignment type filter
This commit is contained in:
@@ -120,6 +120,8 @@ export default class Gradebook extends React.Component {
|
||||
|
||||
updateAssignmentTypes = (event) => {
|
||||
this.props.filterColumns(event, this.props.grades[0]);
|
||||
const updatedQueryStrings = this.updateQueryParams('assignmentType', event);
|
||||
this.props.history.push(updatedQueryStrings);
|
||||
}
|
||||
|
||||
updateTracks = (event) => {
|
||||
@@ -132,8 +134,10 @@ export default class Gradebook extends React.Component {
|
||||
this.props.match.params.courseId,
|
||||
this.props.selectedCohort,
|
||||
selectedTrackSlug,
|
||||
this.props.selectedAssignmentType,
|
||||
);
|
||||
this.updateQueryParams('track', selectedTrackSlug);
|
||||
const updatedQueryStrings = this.updateQueryParams('track', selectedTrackSlug);
|
||||
this.props.history.push(updatedQueryStrings);
|
||||
};
|
||||
|
||||
updateCohorts = (event) => {
|
||||
@@ -146,19 +150,11 @@ export default class Gradebook extends React.Component {
|
||||
this.props.match.params.courseId,
|
||||
selectedCohortId,
|
||||
this.props.selectedTrack,
|
||||
this.props.selectedAssignmentType,
|
||||
);
|
||||
this.updateQueryParams('cohort', selectedCohortId);
|
||||
};
|
||||
|
||||
mapSelectedAssignmentTypeEntry = (entry) => {
|
||||
const selectedAssignmentTypeEntry = this.props.assignmentTypes
|
||||
.find(x => x.id === parseInt(entry, 10));
|
||||
if (selectedAssignmentTypeEntry) {
|
||||
return selectedAssignmentTypeEntry.name;
|
||||
}
|
||||
return 'All';
|
||||
};
|
||||
|
||||
mapSelectedCohortEntry = (entry) => {
|
||||
const selectedCohortEntry = this.props.cohorts.find(x => x.id === parseInt(entry, 10));
|
||||
if (selectedCohortEntry) {
|
||||
@@ -296,7 +292,7 @@ export default class Gradebook extends React.Component {
|
||||
<InputSelect
|
||||
name="assignment-types"
|
||||
ariaLabel="Assignment Types"
|
||||
value="All"
|
||||
value={this.props.selectedAssignmentType}
|
||||
options={this.mapAssignmentTypeEntries(this.props.assignmentTypes)}
|
||||
onChange={this.updateAssignmentTypes}
|
||||
/>
|
||||
@@ -335,6 +331,7 @@ export default class Gradebook extends React.Component {
|
||||
value,
|
||||
this.props.selectedCohort,
|
||||
this.props.selectedTrack,
|
||||
this.props.selectedAssignmentType,
|
||||
)
|
||||
}
|
||||
onChange={filterValue => this.setState({ filterValue })}
|
||||
@@ -343,6 +340,7 @@ export default class Gradebook extends React.Component {
|
||||
this.props.match.params.courseId,
|
||||
this.props.selectedCohort,
|
||||
this.props.selectedTrack,
|
||||
this.props.selectedAssignmentType,
|
||||
)
|
||||
}
|
||||
value={this.state.filterValue}
|
||||
@@ -457,6 +455,9 @@ Gradebook.propTypes = {
|
||||
columnSortable: PropTypes.bool,
|
||||
onSort: PropTypes.func,
|
||||
})).isRequired,
|
||||
history: PropTypes.shape({
|
||||
push: PropTypes.func,
|
||||
}).isRequired,
|
||||
location: PropTypes.shape({
|
||||
search: PropTypes.string,
|
||||
}),
|
||||
@@ -466,6 +467,7 @@ Gradebook.propTypes = {
|
||||
}),
|
||||
}),
|
||||
searchForUser: PropTypes.func.isRequired,
|
||||
selectedAssignmentType: PropTypes.string.isRequired,
|
||||
selectedCohort: PropTypes.shape({
|
||||
name: PropTypes.string,
|
||||
}),
|
||||
|
||||
@@ -4,7 +4,8 @@ import { Button } from '@edx/paragon';
|
||||
|
||||
|
||||
export default function PageButtons({
|
||||
prevPage, nextPage, selectedTrack, selectedCohort, getPrevNextGrades, match,
|
||||
prevPage, nextPage, selectedTrack, selectedCohort, selectedAssignmentType,
|
||||
getPrevNextGrades, match,
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
@@ -19,9 +20,10 @@ export default function PageButtons({
|
||||
onClick={() =>
|
||||
getPrevNextGrades(
|
||||
prevPage,
|
||||
match.params.courseId,
|
||||
selectedCohort,
|
||||
selectedTrack,
|
||||
match.params.courseId,
|
||||
selectedAssignmentType,
|
||||
)}
|
||||
/>
|
||||
<Button
|
||||
@@ -32,9 +34,10 @@ export default function PageButtons({
|
||||
onClick={() =>
|
||||
getPrevNextGrades(
|
||||
nextPage,
|
||||
match.params.courseId,
|
||||
selectedCohort,
|
||||
selectedTrack,
|
||||
match.params.courseId,
|
||||
selectedAssignmentType,
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
@@ -51,6 +54,7 @@ PageButtons.defaultProps = {
|
||||
prevPage: '',
|
||||
selectedCohort: null,
|
||||
selectedTrack: null,
|
||||
selectedAssignmentType: null,
|
||||
};
|
||||
|
||||
PageButtons.propTypes = {
|
||||
@@ -62,6 +66,7 @@ PageButtons.propTypes = {
|
||||
}),
|
||||
nextPage: PropTypes.string,
|
||||
prevPage: PropTypes.string,
|
||||
selectedAssignmentType: PropTypes.string,
|
||||
selectedCohort: PropTypes.shape({
|
||||
name: PropTypes.string,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user