2021-12-20 20:11:01 +00:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
import { action } from '@ember/object';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
|
|
|
|
export default class EvaluationsController extends Controller {
|
2021-12-21 18:31:28 +00:00
|
|
|
queryParams = ['nextToken', 'pageSize'];
|
|
|
|
|
|
|
|
get shouldDisableNext() {
|
|
|
|
return !this.model.meta?.nextToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
get shouldDisablePrev() {
|
|
|
|
return !this.previousTokens.length;
|
|
|
|
}
|
2021-12-20 20:11:01 +00:00
|
|
|
|
|
|
|
@tracked pageSize = 25;
|
2021-12-21 18:31:28 +00:00
|
|
|
@tracked nextToken = null;
|
|
|
|
@tracked previousTokens = [];
|
2021-12-20 20:11:01 +00:00
|
|
|
|
|
|
|
@action
|
|
|
|
onChange(newPageSize) {
|
|
|
|
this.pageSize = newPageSize;
|
|
|
|
}
|
2021-12-21 18:31:28 +00:00
|
|
|
|
|
|
|
@action
|
|
|
|
onNext(nextToken) {
|
|
|
|
this.previousTokens = [...this.previousTokens, this.nextToken];
|
|
|
|
this.nextToken = nextToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
onPrev(lastToken) {
|
|
|
|
this.previousTokens.pop();
|
|
|
|
this.previousTokens = [...this.previousTokens];
|
|
|
|
this.nextToken = lastToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
refresh() {
|
|
|
|
this.nextToken = null;
|
|
|
|
this.previousTokens = [];
|
|
|
|
}
|
2021-12-20 20:11:01 +00:00
|
|
|
}
|