diff --git a/admin/src/components/UserQuery.vue b/admin/src/components/UserQuery.vue new file mode 100644 index 000000000..2a31a8dea --- /dev/null +++ b/admin/src/components/UserQuery.vue @@ -0,0 +1,37 @@ + + diff --git a/admin/src/graphql/adminListContributions.js b/admin/src/graphql/adminListContributions.js index 3c1dcd69c..6a9a69b17 100644 --- a/admin/src/graphql/adminListContributions.js +++ b/admin/src/graphql/adminListContributions.js @@ -7,6 +7,7 @@ export const adminListContributions = gql` $order: Order = DESC $statusFilter: [ContributionStatus!] $userId: Int + $query: String ) { adminListContributions( currentPage: $currentPage @@ -14,6 +15,7 @@ export const adminListContributions = gql` order: $order statusFilter: $statusFilter userId: $userId + query: $query ) { contributionCount contributionList { diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index c8f01d40d..9e1ddb4a4 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -341,6 +341,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['CONFIRMED'], }) }) @@ -356,6 +357,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['IN_PROGRESS', 'PENDING'], }) }) @@ -372,6 +374,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['DENIED'], }) }) @@ -388,6 +391,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['DELETED'], }) }) @@ -404,6 +408,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'], }) }) @@ -424,6 +429,7 @@ describe('CreationConfirm', () => { currentPage: 2, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'], }) }) @@ -439,6 +445,7 @@ describe('CreationConfirm', () => { currentPage: 1, order: 'DESC', pageSize: 25, + query: '', statusFilter: ['IN_PROGRESS', 'PENDING'], }) }) @@ -449,6 +456,40 @@ describe('CreationConfirm', () => { }) }) + describe('user query', () => { + describe('with user query', () => { + beforeEach(() => { + wrapper.findComponent({ name: 'UserQuery' }).vm.$emit('input', 'query') + }) + + it('calls the API with query', () => { + expect(adminListContributionsMock).toBeCalledWith({ + currentPage: 1, + order: 'DESC', + pageSize: 25, + query: 'query', + statusFilter: ['IN_PROGRESS', 'PENDING'], + }) + }) + + describe('reset query', () => { + beforeEach(() => { + wrapper.findComponent({ name: 'UserQuery' }).vm.$emit('input', '') + }) + + it('calls the API with empty query', () => { + expect(adminListContributionsMock).toBeCalledWith({ + currentPage: 1, + order: 'DESC', + pageSize: 25, + query: '', + statusFilter: ['IN_PROGRESS', 'PENDING'], + }) + }) + }) + }) + }) + describe('update status', () => { beforeEach(async () => { await wrapper.findComponent({ name: 'OpenCreationsTable' }).vm.$emit('update-status', 2) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index c8e756223..34458e0aa 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -1,6 +1,7 @@