open-nomad/ui/app/templates/components/job-page/system.hbs
Buck Doyle 8b5b2116ec
Fix job detail crash when recommendations off (#9269)
Without this, visiting any job detail page on Nomad OSS would crash with
an error like this:

Error: Ember Data Request GET
/v1/recommendations?job=ping%F0%9F%A5%B3&namespace=default returned a
404 Payload (text/xml)

The problem was twofold.

1. The recommendation ability didn’t include anything about checking
whether the feature was present. This adds a request to
/v1/operator/license on application load to determine which features are
present and store them in the system service. The ability now looks for
'Dynamic Application Sizing' in that feature list.

2. Second, I didn’t check permissions at all in the job-fetching or job
detail templates.
2020-11-06 08:21:38 -06:00

34 lines
1.2 KiB
Handlebars

<JobPage::Parts::Body @job={{this.job}}>
<JobPage::Parts::Error @errorMessage={{this.errorMessage}} @onDismiss={{action "clearErrorMessage"}} />
<JobPage::Parts::Title @job={{this.job}} @handleError={{action "handleError"}} />
<div class="boxed-section job-stats">
<div class="boxed-section-body">
<span data-test-job-stat="type"><strong>Type:</strong> {{this.job.type}} | </span>
<span data-test-job-stat="priority"><strong>Priority:</strong> {{this.job.priority}} </span>
{{#if (and this.job.namespace this.system.shouldShowNamespaces)}}
<span data-test-job-stat="namespace"> | <strong>Namespace:</strong> {{this.job.namespace.name}}</span>
{{/if}}
</div>
</div>
{{#if (can "accept recommendations")}}
{{#each this.job.recommendationSummaries as |summary|}}
<Das::RecommendationAccordion @summary={{summary}} />
{{/each}}
{{/if}}
<JobPage::Parts::Summary @job={{this.job}} />
<JobPage::Parts::PlacementFailures @job={{this.job}} />
<JobPage::Parts::TaskGroups
@job={{this.job}}
@sortProperty={{this.sortProperty}}
@sortDescending={{this.sortDescending}}
@gotoTaskGroup={{this.gotoTaskGroup}} />
<JobPage::Parts::RecentAllocations @job={{this.job}} />
</JobPage::Parts::Body>