diff --git a/ui/app/controllers/evaluations/index.js b/ui/app/controllers/evaluations/index.js index f83235f31..e277abe7f 100644 --- a/ui/app/controllers/evaluations/index.js +++ b/ui/app/controllers/evaluations/index.js @@ -1,9 +1,12 @@ import Controller from '@ember/controller'; import { action } from '@ember/object'; import { tracked } from '@glimmer/tracking'; +import { inject as service } from '@ember/service'; export default class EvaluationsController extends Controller { - queryParams = ['nextToken', 'pageSize']; + @service userSettings; + + queryParams = ['nextToken', 'pageSize', 'status']; get shouldDisableNext() { return !this.model.meta?.nextToken; @@ -13,9 +16,21 @@ export default class EvaluationsController extends Controller { return !this.previousTokens.length; } - @tracked pageSize = 25; + get optionsEvaluationsStatus() { + return [ + { key: null, label: 'All' }, + { key: 'blocked', label: 'Blocked' }, + { key: 'pending', label: 'Pending' }, + { key: 'complete', label: 'Complete' }, + { key: 'failed', label: 'Failed' }, + { key: 'canceled', label: 'Canceled' }, + ]; + } + + @tracked pageSize = this.userSettings.pageSize; @tracked nextToken = null; @tracked previousTokens = []; + @tracked status = null; @action onChange(newPageSize) { @@ -29,14 +44,26 @@ export default class EvaluationsController extends Controller { } @action - onPrev(lastToken) { - this.previousTokens.pop(); + onPrev() { + const lastToken = this.previousTokens.pop(); this.previousTokens = [...this.previousTokens]; this.nextToken = lastToken; } @action refresh() { + this._resetTokens(); + this.status = null; + this.pageSize = this.userSettings.pageSize; + } + + @action + setStatus(selection) { + this._resetTokens(); + this.status = selection; + } + + _resetTokens() { this.nextToken = null; this.previousTokens = []; } diff --git a/ui/app/models/evaluation.js b/ui/app/models/evaluation.js index 944d03e10..51507708b 100644 --- a/ui/app/models/evaluation.js +++ b/ui/app/models/evaluation.js @@ -6,6 +6,7 @@ import shortUUIDProperty from '../utils/properties/short-uuid'; export default class Evaluation extends Model { @shortUUIDProperty('id') shortId; + @shortUUIDProperty('nodeId') shortNodeId; @attr('number') priority; @attr('string') type; @attr('string') triggeredBy; @@ -18,6 +19,7 @@ export default class Evaluation extends Model { @equal('status', 'blocked') isBlocked; @belongsTo('job') job; + @belongsTo('node') node; @attr('number') modifyIndex; @attr('date') modifyTime; @@ -26,4 +28,18 @@ export default class Evaluation extends Model { @attr('date') createTime; @attr('date') waitUntil; + @attr('string') namespace; + @attr('string') plainJobId; + + get hasJob() { + return !!this.plainJobId; + } + + get hasNode() { + return !!this.belongsTo('node').id(); + } + + get nodeId() { + return this.belongsTo('node').id(); + } } diff --git a/ui/app/routes/evaluations/index.js b/ui/app/routes/evaluations/index.js index 0442d4cb6..6733e5bd6 100644 --- a/ui/app/routes/evaluations/index.js +++ b/ui/app/routes/evaluations/index.js @@ -13,13 +13,17 @@ export default class EvaluationsIndexRoute extends Route { nextToken: { refreshModel: true, }, + status: { + refreshModel: true, + }, }; - model({ pageSize, nextToken }) { + model({ pageSize, status, nextToken }) { return this.store.query('evaluation', { namespace: ALL_NAMESPACE_WILDCARD, per_page: pageSize, next_token: nextToken, + status, }); } } diff --git a/ui/app/templates/components/page-size-select.hbs b/ui/app/templates/components/page-size-select.hbs index f61c33295..3b2efb3c2 100644 --- a/ui/app/templates/components/page-size-select.hbs +++ b/ui/app/templates/components/page-size-select.hbs @@ -1,15 +1,16 @@ -