@@ -17,19 +17,15 @@ import { selectors, thunkActions } from 'data/redux';
17
17
18
18
import StatusBadge from 'components/StatusBadge' ;
19
19
import FilterStatusComponent from './FilterStatusComponent' ;
20
+ import TableAction from './TableAction' ;
21
+ import SelectedBulkAction from './SelectedBulkAction' ;
20
22
21
23
import messages from './messages' ;
22
24
23
25
/**
24
26
* <SubmissionsTable />
25
27
*/
26
28
export class SubmissionsTable extends React . Component {
27
- constructor ( props ) {
28
- super ( props ) ;
29
- this . handleViewAllResponsesClick = this . handleViewAllResponsesClick . bind ( this ) ;
30
- this . selectedBulkAction = this . selectedBulkAction . bind ( this ) ;
31
- }
32
-
33
29
get gradeStatusOptions ( ) {
34
30
return Object . keys ( gradingStatuses ) . map ( statusKey => ( {
35
31
name : this . translate ( lmsMessages [ gradingStatuses [ statusKey ] ] ) ,
@@ -66,82 +62,66 @@ export class SubmissionsTable extends React.Component {
66
62
67
63
translate = ( ...args ) => this . props . intl . formatMessage ( ...args ) ;
68
64
69
- handleViewAllResponsesClick ( data ) {
65
+ handleViewAllResponsesClick = ( data ) => ( ) => {
70
66
const getsubmissionUUID = ( row ) => row . original . submissionUUID ;
71
- const rows = data . selectedRows . length ? data . selectedRows : data . tableInstance . rows ;
72
- this . props . loadSelectionForReview ( rows . map ( getsubmissionUUID ) ) ;
73
- }
74
-
75
- selectedBulkAction ( selectedFlatRows ) {
76
- return {
77
- buttonText : this . translate (
78
- messages . viewSelectedResponses ,
79
- { value : selectedFlatRows . length } ,
80
- ) ,
81
- className : 'view-selected-responses-btn' ,
82
- handleClick : this . handleViewAllResponsesClick ,
83
- variant : 'primary' ,
84
- } ;
67
+ this . props . loadSelectionForReview ( data . map ( getsubmissionUUID ) ) ;
85
68
}
86
69
87
70
render ( ) {
88
71
if ( ! this . props . listData . length ) {
89
72
return null ;
90
73
}
91
74
return (
92
- < DataTable
93
- isFilterable
94
- FilterStatusComponent = { FilterStatusComponent }
95
- numBreakoutFilters = { 2 }
96
- defaultColumnValues = { { Filter : TextFilter } }
97
- isSelectable
98
- isSortable
99
- isPaginated
100
- itemCount = { this . props . listData . length }
101
- initialState = { { pageSize : 10 , pageIndex : 0 } }
102
- data = { this . props . listData }
103
- tableActions = { [
104
- {
105
- buttonText : this . translate ( messages . viewAllResponses ) ,
106
- handleClick : this . handleViewAllResponsesClick ,
107
- className : 'view-all-responses-btn' ,
108
- variant : 'primary' ,
109
- } ,
110
- ] }
111
- bulkActions = { [
112
- this . selectedBulkAction ,
113
- ] }
114
- columns = { [
115
- {
116
- Header : this . userLabel ,
117
- accessor : this . userAccessor ,
118
- } ,
119
- {
120
- Header : this . dateSubmittedLabel ,
121
- accessor : submissionFields . dateSubmitted ,
122
- Cell : this . formatDate ,
123
- disableFilters : true ,
124
- } ,
125
- {
126
- Header : this . translate ( messages . grade ) ,
127
- accessor : submissionFields . score ,
128
- Cell : this . formatGrade ,
129
- disableFilters : true ,
130
- } ,
131
- {
132
- Header : this . translate ( messages . gradingStatus ) ,
133
- accessor : submissionFields . gradingStatus ,
134
- Cell : this . formatStatus ,
135
- Filter : MultiSelectDropdownFilter ,
136
- filter : 'includesValue' ,
137
- filterChoices : this . gradeStatusOptions ,
138
- } ,
139
- ] }
140
- >
141
- < DataTable . TableControlBar />
142
- < DataTable . Table />
143
- < DataTable . TableFooter />
144
- </ DataTable >
75
+ < div className = "submissions-table" >
76
+ < DataTable
77
+ isFilterable
78
+ FilterStatusComponent = { FilterStatusComponent }
79
+ numBreakoutFilters = { 2 }
80
+ defaultColumnValues = { { Filter : TextFilter } }
81
+ isSelectable
82
+ isSortable
83
+ isPaginated
84
+ itemCount = { this . props . listData . length }
85
+ initialState = { { pageSize : 10 , pageIndex : 0 } }
86
+ data = { this . props . listData }
87
+ tableActions = { [
88
+ < TableAction handleClick = { this . handleViewAllResponsesClick } /> ,
89
+ ] }
90
+ bulkActions = { [
91
+ < SelectedBulkAction handleClick = { this . handleViewAllResponsesClick } /> ,
92
+ ] }
93
+ columns = { [
94
+ {
95
+ Header : this . userLabel ,
96
+ accessor : this . userAccessor ,
97
+ } ,
98
+ {
99
+ Header : this . dateSubmittedLabel ,
100
+ accessor : submissionFields . dateSubmitted ,
101
+ Cell : this . formatDate ,
102
+ disableFilters : true ,
103
+ } ,
104
+ {
105
+ Header : this . translate ( messages . grade ) ,
106
+ accessor : submissionFields . score ,
107
+ Cell : this . formatGrade ,
108
+ disableFilters : true ,
109
+ } ,
110
+ {
111
+ Header : this . translate ( messages . gradingStatus ) ,
112
+ accessor : submissionFields . gradingStatus ,
113
+ Cell : this . formatStatus ,
114
+ Filter : MultiSelectDropdownFilter ,
115
+ filter : 'includesValue' ,
116
+ filterChoices : this . gradeStatusOptions ,
117
+ } ,
118
+ ] }
119
+ >
120
+ < DataTable . TableControlBar />
121
+ < DataTable . Table />
122
+ < DataTable . TableFooter />
123
+ </ DataTable >
124
+ </ div >
145
125
) ;
146
126
}
147
127
}
0 commit comments