mirror of https://github.com/rancher/ui.git
37 lines
821 B
JavaScript
37 lines
821 B
JavaScript
import { alias } from '@ember/object/computed';
|
|
import { inject as service } from '@ember/service';
|
|
import Component from '@ember/component';
|
|
import C from 'ui/utils/constants';
|
|
import layout from './template';
|
|
|
|
const TABLE_COUNTS = [
|
|
{ value: "10", },
|
|
{ value: "25", },
|
|
{ value: "50", },
|
|
{ value: "100", },
|
|
{ value: "250", },
|
|
{ value: "500", },
|
|
{ value: "1000", },
|
|
];
|
|
|
|
export default Component.extend({
|
|
layout,
|
|
prefs: service(),
|
|
perPage: alias('prefs.tablePerPage'),
|
|
tableCounts: TABLE_COUNTS,
|
|
selectedCount: null,
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
this.set('selectedCount', this.get('perPage')+"");
|
|
},
|
|
|
|
actions: {
|
|
save(cb) {
|
|
this.set(`prefs.${C.PREFS.TABLE_COUNT}`, parseInt(this.get('selectedCount'),10));
|
|
cb(true);
|
|
this.sendAction('done');
|
|
}
|
|
}
|
|
});
|