1
1
<script >
2
2
import { GlTabs , GlTab , GlBadge , GlFilteredSearchToken } from ' @gitlab/ui' ;
3
- import { isEqual } from ' lodash' ;
3
+ import { isEqual , pick } from ' lodash' ;
4
4
import { __ } from ' ~/locale' ;
5
5
import { TIMESTAMP_TYPE_UPDATED_AT } from ' ~/vue_shared/components/resource_lists/constants' ;
6
6
import { QUERY_PARAM_END_CURSOR , QUERY_PARAM_START_CURSOR } from ' ~/graphql_shared/constants' ;
@@ -23,6 +23,8 @@ import {
23
23
CONTRIBUTED_TAB ,
24
24
CUSTOM_DASHBOARD_ROUTE_NAMES ,
25
25
PROJECT_DASHBOARD_TABS ,
26
+ FILTERED_SEARCH_TOKEN_LANGUAGE ,
27
+ FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL ,
26
28
} from ' ../constants' ;
27
29
import projectCountsQuery from ' ../graphql/queries/project_counts.query.graphql' ;
28
30
import TabView from ' ./tab_view.vue' ;
@@ -90,7 +92,7 @@ export default {
90
92
filteredSearchTokens () {
91
93
return [
92
94
{
93
- type: ' language ' ,
95
+ type: FILTERED_SEARCH_TOKEN_LANGUAGE ,
94
96
icon: ' lock' ,
95
97
title: __ (' Language' ),
96
98
token: GlFilteredSearchToken,
@@ -103,7 +105,7 @@ export default {
103
105
})),
104
106
},
105
107
{
106
- type: ' min_access_level ' ,
108
+ type: FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL ,
107
109
icon: ' user' ,
108
110
title: __ (' Role' ),
109
111
token: GlFilteredSearchToken,
@@ -141,6 +143,22 @@ export default {
141
143
endCursor () {
142
144
return this .$route .query [QUERY_PARAM_END_CURSOR ];
143
145
},
146
+ routeQueryWithoutPagination () {
147
+ const {
148
+ [QUERY_PARAM_START_CURSOR ]: startCursor ,
149
+ [QUERY_PARAM_END_CURSOR ]: endCursor ,
150
+ ... routeQuery
151
+ } = this .$route .query ;
152
+
153
+ return routeQuery;
154
+ },
155
+ filters () {
156
+ return pick (this .routeQueryWithoutPagination , [
157
+ FILTERED_SEARCH_TOKEN_LANGUAGE ,
158
+ FILTERED_SEARCH_TOKEN_MIN_ACCESS_LEVEL ,
159
+ FILTERED_SEARCH_TERM_KEY ,
160
+ ]);
161
+ },
144
162
},
145
163
methods: {
146
164
numberToMetricPrefix,
@@ -178,12 +196,12 @@ export default {
178
196
onSortDirectionChange (isAscending ) {
179
197
const sort = this .createSortQuery ({ sortBy: this .activeSortOption .value , isAscending });
180
198
181
- this .pushQuery ({ ... this .$route . query , sort });
199
+ this .pushQuery ({ ... this .routeQueryWithoutPagination , sort });
182
200
},
183
201
onSortByChange (sortBy ) {
184
202
const sort = this .createSortQuery ({ sortBy, isAscending: this .isAscending });
185
203
186
- this .pushQuery ({ ... this .$route . query , sort });
204
+ this .pushQuery ({ ... this .routeQueryWithoutPagination , sort });
187
205
},
188
206
onFilter (filters ) {
189
207
const { sort } = this .$route .query ;
@@ -219,6 +237,8 @@ export default {
219
237
:tab =" tab"
220
238
:start-cursor =" startCursor"
221
239
:end-cursor =" endCursor"
240
+ :sort =" sort"
241
+ :filters =" filters"
222
242
@page-change =" onPageChange"
223
243
/>
224
244
<template v-else >{{ tab.text }}</template >
0 commit comments