Applied ember-concurrency task usage to admin UI model hooks to help fix the debouncing issue.
32 lines
660 B
JavaScript
32 lines
660 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Controller from '@ember/controller';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
export default class ScopesScopeScopesIndexController extends Controller {
|
|
// =attributes
|
|
|
|
queryParams = ['search', 'page', 'pageSize'];
|
|
|
|
@tracked search;
|
|
@tracked page = 1;
|
|
@tracked pageSize = 10;
|
|
|
|
// =methods
|
|
|
|
/**
|
|
* Handles input on each keystroke and the search queryParam
|
|
* @param {object} event
|
|
*/
|
|
@action
|
|
handleSearchInput(event) {
|
|
const { value } = event.target;
|
|
this.search = value;
|
|
this.page = 1;
|
|
}
|
|
}
|