1- import { Colors , InputGroup , NonIdealState , Spinner } from '@blueprintjs/core'
1+ import { Colors , FormGroup , InputGroup , NonIdealState , Spinner } from '@blueprintjs/core'
22import { IconNames } from '@blueprintjs/icons'
33import { ColDef , GridApi , GridReadyEvent } from 'ag-grid'
44import { AgGridReact } from 'ag-grid-react'
@@ -24,6 +24,7 @@ import { OwnProps as GradingWorkspaceProps } from './GradingWorkspace'
2424type State = {
2525 columnDefs : ColDef [ ]
2626 filterValue : string
27+ groupFilterEnabled : boolean
2728}
2829
2930type GradingNavLinkProps = {
@@ -41,7 +42,7 @@ export interface IGradingWorkspaceParams {
4142}
4243
4344export interface IDispatchProps {
44- handleFetchGradingOverviews : ( ) => void
45+ handleFetchGradingOverviews : ( filterToGroup ?: boolean ) => void
4546}
4647
4748export interface IStateProps {
@@ -104,7 +105,9 @@ class Grading extends React.Component<IGradingProps, State> {
104105 { headerName : 'Max XP' , field : 'maxXp' , hide : true }
105106 ] ,
106107
107- filterValue : ''
108+ filterValue : '' ,
109+
110+ groupFilterEnabled : false
108111 }
109112 }
110113
@@ -138,17 +141,30 @@ class Grading extends React.Component<IGradingProps, State> {
138141 const grid = (
139142 < div className = "GradingContainer" >
140143 < div >
141- < div className = "col-md-6 col-md-offset-3" >
144+ < FormGroup label = "Filter:" labelFor = "text-input" inline = { true } >
142145 < InputGroup
146+ id = "filterBar"
143147 large = { false }
144148 leftIcon = "filter"
145- placeholder = "Filter... "
149+ placeholder = "Enter any text(e.g. mission) "
146150 value = { this . state . filterValue }
147151 onChange = { this . handleFilterChange }
148152 />
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+ />
149164 </ div >
150165 </ div >
151166
167+ < hr />
152168 < br />
153169
154170 < div className = "Grading" >
@@ -161,6 +177,8 @@ class Grading extends React.Component<IGradingProps, State> {
161177 columnDefs = { this . state . columnDefs }
162178 onGridReady = { this . onGridReady }
163179 rowData = { data }
180+ pagination = { true }
181+ paginationPageSize = { 50 }
164182 />
165183 </ div >
166184 < div className = "ag-grid-export-button" >
@@ -187,6 +205,12 @@ class Grading extends React.Component<IGradingProps, State> {
187205 }
188206 }
189207
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+
190214 private onGridReady = ( params : GridReadyEvent ) => {
191215 this . gridApi = params . api
192216 this . gridApi . sizeColumnsToFit ( )
0 commit comments