diff --git a/admin/app/controllers/authenticated/users/list.js b/admin/app/controllers/authenticated/users/list.js index 9e2436400bc..dff191c7d13 100644 --- a/admin/app/controllers/authenticated/users/list.js +++ b/admin/app/controllers/authenticated/users/list.js @@ -1,13 +1,25 @@ import Controller from '@ember/controller'; import { action } from '@ember/object'; +import { service } from '@ember/service'; import { tracked } from '@glimmer/tracking'; const DEFAULT_PAGE_NUMBER = 1; +const DEFAULT_QUERY_TYPE = 'CONTAINS'; export default class ListController extends Controller { - queryParams = ['pageNumber', 'pageSize', 'id', 'firstName', 'lastName', 'email', 'username']; + @service intl; + + queryParams = ['pageNumber', 'pageSize', 'id', 'firstName', 'lastName', 'email', 'username', 'queryType']; + + get queryTypes() { + return [ + { value: 'CONTAINS', label: this.intl.t('pages.users-list.query.contains') }, + { value: 'EXACT_QUERY', label: this.intl.t('pages.users-list.query.exact') }, + ]; + } @tracked pageNumber = DEFAULT_PAGE_NUMBER; + @tracked queryType = DEFAULT_QUERY_TYPE; @tracked pageSize = 10; @tracked id = null; @tracked firstName = null; @@ -20,6 +32,7 @@ export default class ListController extends Controller { @tracked lastNameForm = null; @tracked emailForm = null; @tracked usernameForm = null; + @tracked queryTypeForm = DEFAULT_QUERY_TYPE; @action async refreshModel(event) { @@ -29,6 +42,7 @@ export default class ListController extends Controller { this.lastName = this.lastNameForm; this.email = this.emailForm; this.username = this.usernameForm; + this.queryType = this.queryTypeForm; this.pageNumber = DEFAULT_PAGE_NUMBER; } @@ -56,6 +70,10 @@ export default class ListController extends Controller { onChangeUsername(event) { this.usernameForm = event.target.value; } + @action + onChangeQueryType(value) { + this.queryTypeForm = value; + } @action clearSearchFields() { @@ -64,11 +82,13 @@ export default class ListController extends Controller { this.lastName = null; this.email = null; this.username = null; + this.queryType = DEFAULT_QUERY_TYPE; this.idForm = null; this.firstNameForm = null; this.lastNameForm = null; this.emailForm = null; this.usernameForm = null; + this.queryTypeForm = DEFAULT_QUERY_TYPE; } } diff --git a/admin/app/routes/authenticated/users/list.js b/admin/app/routes/authenticated/users/list.js index b933fd90162..f992477e227 100644 --- a/admin/app/routes/authenticated/users/list.js +++ b/admin/app/routes/authenticated/users/list.js @@ -7,6 +7,7 @@ export default class ListRoute extends Route { queryParams = { pageNumber: { refreshModel: true }, pageSize: { refreshModel: true }, + queryType: { refreshModel: true }, id: { refreshModel: true }, firstName: { refreshModel: true }, lastName: { refreshModel: true }, @@ -30,6 +31,7 @@ export default class ListRoute extends Route { number: params.pageNumber, size: params.pageSize, }, + queryType: params.queryType, }); return users; } catch (error) { @@ -46,6 +48,7 @@ export default class ListRoute extends Route { controller.lastName = null; controller.email = null; controller.username = null; + controller.queryType = 'CONTAINS'; } } } diff --git a/admin/app/styles/authenticated/users/list.scss b/admin/app/styles/authenticated/users/list.scss index e0191c782bd..60448071dbc 100644 --- a/admin/app/styles/authenticated/users/list.scss +++ b/admin/app/styles/authenticated/users/list.scss @@ -1,15 +1,26 @@ .user-list-form { display: flex; flex-wrap: wrap; - gap: 8px; + gap: var(--pix-spacing-2x); justify-content: flex-end; + .pix-select { + min-width: 7.5rem; + margin-right: var(--pix-spacing-2x); + } + + .pix-select .pix-icon { + width: 1.315rem; + height: 1.315rem; + + } + &__input--small { - max-width: 190px; + max-width: 9.35rem; } &__actions { display: flex; - gap: 8px; + gap: var(--pix-spacing-2x); } } diff --git a/admin/app/templates/authenticated/users/list.hbs b/admin/app/templates/authenticated/users/list.hbs index 2321fdb0717..def2ef1c675 100644 --- a/admin/app/templates/authenticated/users/list.hbs +++ b/admin/app/templates/authenticated/users/list.hbs @@ -4,6 +4,13 @@