mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
* bracket keynav enabled * Use the right testcluster * Modifier made to be conditional * Lintfix * Custom ignore rule * changelog
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@ember/component';
|
|
import { tagName } from '@ember-decorators/component';
|
|
import classic from 'ember-classic-decorator';
|
|
import { action } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
import KeyboardShortcutModifier from 'nomad-ui/modifiers/keyboard-shortcut';
|
|
|
|
@classic
|
|
@tagName('')
|
|
export default class ListPager extends Component {
|
|
@service router;
|
|
|
|
// Even though we don't currently use "first" / "last" pagination in the app,
|
|
// the option is there at a component level, so let's make sure that we
|
|
// only append keyNav to the "next" and "prev" links.
|
|
// We use this to make the modifier conditional, per https://v5.chriskrycho.com/journal/conditional-modifiers-and-helpers-in-emberjs/
|
|
get includeKeyboardNav() {
|
|
return this.label === 'Next page' || this.label === 'Previous page'
|
|
? KeyboardShortcutModifier
|
|
: null;
|
|
}
|
|
|
|
@action
|
|
gotoRoute() {
|
|
this.router.transitionTo(this.router.currentRouteName, {
|
|
queryParams: { page: this.page },
|
|
});
|
|
}
|
|
}
|