diff --git a/package.json b/package.json index d865b4b..7c00322 100755 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "semantic-release": "semantic-release", "start": "NODE_ENV=development BABEL_ENV=development node_modules/.bin/webpack-dev-server --config=config/webpack.dev.config.js --progress", "test": "jest --coverage --passWithNoTests", + "watch-tests": "jest --watch", "travis-deploy-once": "travis-deploy-once" }, "author": "edX", diff --git a/src/components/Gradebook/index.jsx b/src/components/Gradebook/index.jsx index 52374c4..7253000 100644 --- a/src/components/Gradebook/index.jsx +++ b/src/components/Gradebook/index.jsx @@ -8,6 +8,7 @@ import { StatusAlert, Table, Icon, + Tabs, } from '@edx/paragon'; import queryString from 'query-string'; import { configuration } from '../../config'; @@ -26,11 +27,13 @@ export default class Gradebook extends React.Component { updateModuleId: null, updateUserId: null, }; + this.fileFormRef = React.createRef(); + this.fileInputRef = React.createRef(); } componentDidMount() { const urlQuery = queryString.parse(this.props.location.search); - this.props.getRoles(this.props.match.params.courseId, urlQuery); + this.props.getRoles(this.props.courseId, urlQuery); } setNewModalState = (userEntry, subsection) => { @@ -68,9 +71,16 @@ export default class Gradebook extends React.Component { ) + getActiveTabs = () => { + if (this.props.showBulkManagement) { + return ['Grades', 'Bulk Management']; + } + return ['Grades']; + }; + handleAdjustedGradeClick = () => { this.props.updateGrades( - this.props.match.params.courseId, [ + this.props.courseId, [ { user_id: this.state.updateUserId, usage_id: this.state.updateModuleId, @@ -138,7 +148,7 @@ export default class Gradebook extends React.Component { selectedTrackSlug = selectedTrackItem.slug; } this.props.getUserGrades( - this.props.match.params.courseId, + this.props.courseId, this.props.selectedCohort, selectedTrackSlug, this.props.selectedAssignmentType, @@ -154,7 +164,7 @@ export default class Gradebook extends React.Component { selectedCohortId = selectedCohortItem.id; } this.props.getUserGrades( - this.props.match.params.courseId, + this.props.courseId, selectedCohortId, this.props.selectedTrack, this.props.selectedAssignmentType, @@ -162,6 +172,29 @@ export default class Gradebook extends React.Component { this.updateQueryParams('cohort', selectedCohortId); }; + handleClickExportGrades = () => { + window.location = this.props.gradeExportUrl; + }; + + handleClickImportGrades = () => { + const fileInput = this.fileInputRef.current; + if (fileInput) { + fileInput.click(); + } + }; + + handleFileInputChange = (event) => { + const fileInput = event.target; + const file = fileInput.files[0]; + const form = this.fileFormRef.current; + if (file && form) { + const formData = new FormData(form); + this.props.submitFileUploadFormData(this.props.courseId, formData).then(() => { + fileInput.value = null; + }); + } + }; + mapSelectedCohortEntry = (entry) => { const selectedCohortEntry = this.props.cohorts.find(x => x.id === parseInt(entry, 10)); if (selectedCohortEntry) { @@ -265,13 +298,13 @@ export default class Gradebook extends React.Component {
{'Back to Dashboard'}

Gradebook

-

{this.props.match.params.courseId}

+

{this.props.courseId}

{ this.props.areGradesFrozen &&
The grades for this course are now frozen. Editing of grades is no longer allowed. @@ -352,13 +385,10 @@ export default class Gradebook extends React.Component {
-
- Generate Grade Report -
this.props.searchForUser( - this.props.match.params.courseId, + this.props.courseId, value, this.props.selectedCohort, this.props.selectedTrack, @@ -369,7 +399,7 @@ export default class Gradebook extends React.Component { onChange={filterValue => this.setState({ filterValue })} onClear={() => this.props.getUserGrades( - this.props.match.params.courseId, + this.props.courseId, this.props.selectedCohort, this.props.selectedTrack, this.props.selectedAssignmentType, @@ -380,55 +410,85 @@ export default class Gradebook extends React.Component { Search by username, email, or student key
-
- this.props.updateBanner(false)} - open={this.props.showSuccess} - /> - {PageButtons(this.props)} -
- - - {PageButtons(this.props)} - -

{this.state.modalModel[0].assignmentName}

+ +
+ this.props.closeBanner()} + open={this.props.showSuccess} + /> +
-
Note: Once you save, your changes will be visible to students.
- )} - buttons={[ -
+
Note: Once you save, your changes will be visible to students.
+ + )} + buttons={[ +