File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import moment from 'moment';
5
5
import ReactTable from 'react-table-6' ;
6
6
7
7
import { bugsEndpoint } from '../helpers/url' ;
8
+ import { setUrlParam , getUrlParam } from '../helpers/location' ;
8
9
9
10
import BugColumn from './BugColumn' ;
10
11
import {
@@ -32,6 +33,9 @@ const MainView = (props) => {
32
33
} = props ;
33
34
34
35
const textFilter = ( filter , row ) => {
36
+ if ( getUrlParam ( filter . id ) !== filter . value ) {
37
+ setUrlParam ( filter . id , filter . value ) ;
38
+ }
35
39
const text = row [ filter . id ] ;
36
40
const regex = RegExp ( filter . value , 'i' ) ;
37
41
if ( regex . test ( text ) ) {
@@ -119,6 +123,17 @@ const MainView = (props) => {
119
123
} ;
120
124
} ;
121
125
126
+ const setInitialFiltersFromUrl = ( ) => {
127
+ const filters = [ ] ;
128
+ for ( const header of [ 'product' , 'component' , 'summary' , 'whiteboard' ] ) {
129
+ const param = getUrlParam ( header ) ;
130
+ if ( param ) {
131
+ filters . push ( { id : header , value : getUrlParam ( header ) } ) ;
132
+ }
133
+ }
134
+ return filters ;
135
+ } ;
136
+
122
137
return (
123
138
< Layout
124
139
{ ...props }
@@ -179,6 +194,7 @@ const MainView = (props) => {
179
194
showPaginationTop
180
195
defaultPageSize = { 50 }
181
196
filterable
197
+ defaultFiltered = { setInitialFiltersFromUrl ( ) }
182
198
/>
183
199
)
184
200
}
You can’t perform that action at this time.
0 commit comments