Initial evaluations page

This commit is contained in:
Michael Lange 2018-07-06 16:41:09 -07:00
parent a526eab044
commit bbb923ea89
5 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,12 @@
import { alias } from '@ember/object/computed';
import Controller, { inject as controller } from '@ember/controller';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
export default Controller.extend(WithNamespaceResetting, {
jobController: controller('jobs.job'),
job: alias('model'),
evaluations: alias('model.evaluations'),
breadcrumbs: alias('jobController.breadcrumbs'),
});

View file

@ -13,6 +13,7 @@ Router.map(function() {
this.route('definition');
this.route('versions');
this.route('deployments');
this.route('evaluations');
});
});

View file

@ -0,0 +1,19 @@
import Route from '@ember/routing/route';
import { collect } from '@ember/object/computed';
import { watchRelationship } from 'nomad-ui/utils/properties/watch';
import WithWatchers from 'nomad-ui/mixins/with-watchers';
export default Route.extend(WithWatchers, {
model() {
const job = this.modelFor('jobs.job');
return job.get('evaluations').then(() => job);
},
startWatchers(controller, model) {
controller.set('watchEvaluations', this.get('watchEvaluations').perform(model));
},
watchEvaluations: watchRelationship('evaluations'),
watchers: collect('watchEvaluations'),
});

View file

@ -0,0 +1,53 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb index|}}
<li class="{{if (eq (inc index) breadcrumbs.length) "is-active"}}">
{{#link-to params=breadcrumb.args}}{{breadcrumb.label}}{{/link-to}}
</li>
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body" onNamespaceChange=(action "gotoJobs")}}
{{partial "jobs/job/subnav"}}
<section class="section">
<div class="boxed-section">
<div class="boxed-section-head">
Evaluations
</div>
<div class="boxed-section-body {{if evaluations.length "is-full-bleed"}} evaluations">
{{#if evaluations.length}}
{{#list-table source=evaluations as |t|}}
{{#t.head}}
<th>ID</th>
<th>Priority</th>
<th>Triggered By</th>
<th>Status</th>
<th>Placement Failures</th>
{{/t.head}}
{{#t.body as |row|}}
<tr data-test-evaluation="{{row.model.shortId}}">
<td data-test-id>{{row.model.shortId}}</td>
<td data-test-priority>{{row.model.priority}}</td>
<td data-test-triggered-by>{{row.model.triggeredBy}}</td>
<td data-test-status>{{row.model.status}}</td>
<td data-test-blocked>
{{#if (eq row.model.status "blocked")}}
N/A - In Progress
{{else if row.model.hasPlacementFailures}}
True
{{else}}
False
{{/if}}
</td>
</tr>
{{/t.body}}
{{/list-table}}
{{else}}
<div data-test-empty-evaluations-list class="empty-message">
<h3 data-test-empty-evaluations-list-headline class="empty-message-headline">No Evaluations</h3>
<p class="empty-message-body">This is most likely due to garbage collection.</p>
</div>
{{/if}}
</div>
</div>
</section>
{{/gutter-menu}}

View file

@ -6,5 +6,6 @@
{{#if job.supportsDeployments}}
<li data-test-tab="deployments">{{#link-to "jobs.job.deployments" job activeClass="is-active"}}Deployments{{/link-to}}</li>
{{/if}}
<li data-test-tab="evaluations">{{#link-to "jobs.job.evaluations" job activeClass="is-active"}}Evaluations{{/link-to}}</li>
</ul>
</div>