1
- import { Colors , InputGroup , NonIdealState , Spinner } from '@blueprintjs/core'
1
+ import { Colors , FormGroup , InputGroup , NonIdealState , Spinner } from '@blueprintjs/core'
2
2
import { IconNames } from '@blueprintjs/icons'
3
3
import { ColDef , GridApi , GridReadyEvent } from 'ag-grid'
4
4
import { AgGridReact } from 'ag-grid-react'
@@ -24,6 +24,7 @@ import { OwnProps as GradingWorkspaceProps } from './GradingWorkspace'
24
24
type State = {
25
25
columnDefs : ColDef [ ]
26
26
filterValue : string
27
+ groupFilterEnabled : boolean
27
28
}
28
29
29
30
type GradingNavLinkProps = {
@@ -41,7 +42,7 @@ export interface IGradingWorkspaceParams {
41
42
}
42
43
43
44
export interface IDispatchProps {
44
- handleFetchGradingOverviews : ( ) => void
45
+ handleFetchGradingOverviews : ( filterToGroup ?: boolean ) => void
45
46
}
46
47
47
48
export interface IStateProps {
@@ -104,7 +105,9 @@ class Grading extends React.Component<IGradingProps, State> {
104
105
{ headerName : 'Max XP' , field : 'maxXp' , hide : true }
105
106
] ,
106
107
107
- filterValue : ''
108
+ filterValue : '' ,
109
+
110
+ groupFilterEnabled : false
108
111
}
109
112
}
110
113
@@ -138,17 +141,30 @@ class Grading extends React.Component<IGradingProps, State> {
138
141
const grid = (
139
142
< div className = "GradingContainer" >
140
143
< div >
141
- < div className = "col-md-6 col-md-offset-3" >
144
+ < FormGroup label = "Filter:" labelFor = "text-input" inline = { true } >
142
145
< InputGroup
146
+ id = "filterBar"
143
147
large = { false }
144
148
leftIcon = "filter"
145
- placeholder = "Filter... "
149
+ placeholder = "Enter any text(e.g. mission) "
146
150
value = { this . state . filterValue }
147
151
onChange = { this . handleFilterChange }
148
152
/>
153
+ </ FormGroup >
154
+
155
+ < div className = "checkboxPanel" >
156
+ < label > Show All Submissions:</ label >
157
+
158
+ < input
159
+ name = "showAllSubmissions"
160
+ type = "checkbox"
161
+ checked = { this . state . groupFilterEnabled }
162
+ onChange = { this . handleGroupsFilter }
163
+ />
149
164
</ div >
150
165
</ div >
151
166
167
+ < hr />
152
168
< br />
153
169
154
170
< div className = "Grading" >
@@ -161,6 +177,8 @@ class Grading extends React.Component<IGradingProps, State> {
161
177
columnDefs = { this . state . columnDefs }
162
178
onGridReady = { this . onGridReady }
163
179
rowData = { data }
180
+ pagination = { true }
181
+ paginationPageSize = { 50 }
164
182
/>
165
183
</ div >
166
184
< div className = "ag-grid-export-button" >
@@ -187,6 +205,12 @@ class Grading extends React.Component<IGradingProps, State> {
187
205
}
188
206
}
189
207
208
+ private handleGroupsFilter = ( event : React . ChangeEvent < HTMLInputElement > ) => {
209
+ const checkStatus = event . target . checked
210
+ this . setState ( { groupFilterEnabled : checkStatus } )
211
+ this . props . handleFetchGradingOverviews ( ! checkStatus )
212
+ }
213
+
190
214
private onGridReady = ( params : GridReadyEvent ) => {
191
215
this . gridApi = params . api
192
216
this . gridApi . sizeColumnsToFit ( )
0 commit comments