Skip to content
代码片段 群组 项目
提交 2063f10e 编辑于 作者: Payton Burdette's avatar Payton Burdette
浏览文件

Reset request data on each filter

Fix for when removing only one token does
not reset the request data when filtering jobs.

Changelog: fixed
上级 5ad73e78
No related branches found
No related tags found
无相关合并请求
......@@ -161,6 +161,8 @@ export default {
this.infiniteScrollingTriggered = false;
this.filterSearchTriggered = true;
this.resetRequestData();
filters.forEach((filter) => {
if (!filter.type) {
if (this.glFeatures.populateAndUseBuildNamesTable) {
......@@ -178,12 +180,6 @@ export default {
}
});
// all filters have been cleared reset query params
// and refetch jobs/count with defaults
if (!filters.length) {
this.resetRequestData();
}
this.$apollo.queries.jobs.refetch(this.requestData);
this.updateHistoryAndFetchCount();
},
......
......@@ -298,14 +298,9 @@ describe('Job table app', () => {
createComponent();
expect(successHandler).toHaveBeenCalledTimes(1);
expect(countSuccessHandler).toHaveBeenCalledTimes(1);
await findFilteredSearch().vm.$emit('filterJobsBySearch', ['raw text']);
expect(createAlert).toHaveBeenCalledWith(expectedWarning);
expect(successHandler).toHaveBeenCalledTimes(1);
expect(countSuccessHandler).toHaveBeenCalledTimes(1);
});
it('updates URL query string when filtering jobs by status', async () => {
......@@ -369,10 +364,45 @@ describe('Job table app', () => {
first: 30,
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: null,
});
expect(countSuccessHandler).toHaveBeenCalledWith({
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: null,
});
});
it('filters only by name after removing status filter', async () => {
await findFilteredSearch().vm.$emit('filterJobsBySearch', [
mockFailedSearchToken,
mockJobName,
]);
expect(successHandler).toHaveBeenCalledWith({
first: 30,
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: 'FAILED',
});
expect(countSuccessHandler).toHaveBeenCalledWith({
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: 'FAILED',
});
await findFilteredSearch().vm.$emit('filterJobsBySearch', [mockJobName]);
expect(successHandler).toHaveBeenCalledWith({
first: 30,
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: null,
});
expect(countSuccessHandler).toHaveBeenCalledWith({
fullPath: 'gitlab-org/gitlab',
name: mockJobName,
statuses: null,
});
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册