github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/controllers/allocations/allocation.js (about) 1 import Controller from '@ember/controller'; 2 import { inject as service } from '@ember/service'; 3 import { qpBuilder } from 'nomad-ui/utils/classes/query-params'; 4 5 export default class AllocationsAllocationController extends Controller { 6 @service store; 7 8 get allocation() { 9 return this.model; 10 } 11 12 get job() { 13 const allocation = this.model; 14 const jobId = allocation.belongsTo('job').id(); 15 const job = this.store.peekRecord('job', jobId); 16 return job; 17 } 18 19 get jobNamespace() { 20 const jobNamespaceId = this.job.belongsTo('namespace').id(); 21 22 return jobNamespaceId || 'default'; 23 } 24 // Allocation breadcrumbs extend from job / task group breadcrumbs 25 // even though the route structure does not. 26 get breadcrumbs() { 27 const { allocation, job, jobNamespace } = this; 28 const jobQueryParams = qpBuilder({ 29 jobNamespace, 30 }); 31 32 return [ 33 { label: 'Jobs', args: ['jobs.index', jobQueryParams] }, 34 { type: 'job', job: job }, 35 { 36 title: 'Task Group', 37 label: allocation.taskGroupName, 38 args: [ 39 'jobs.job.task-group', 40 job.idWithNamespace, 41 allocation.taskGroupName, 42 ], 43 }, 44 { 45 title: 'Allocation', 46 label: allocation.shortId, 47 args: ['allocations.allocation', allocation], 48 }, 49 ]; 50 } 51 }