Skip to content

Commit

Permalink
fix broken link to task-group in Recent Allocation table in `jobs…
Browse files Browse the repository at this point in the history
….job.index` (#12765)

* chore:  run prettier on hbs files

* ui:  ensure to pass a real job object to task-group link

* chore:  add changelog entry

* chore: prettify template

* ui:  template helper for formatting jobId in LinkTo component

* ui:  handle async relationship

* ui:  pass in job id to model arg instead of job model

* update test for serialized namespace

* ui:  defend against null  in tests

* ui:  prettified template added whitespace

* ui:  rollback ember-data to 3.24 because watcher return undefined on abort

* ui: use format-job-helper instead of job model via alloc

* ui: fix whitespace in template caused by prettier using template helper

* ui: update test for new namespace

* ui: revert prettier change

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
  • Loading branch information
ChaiWithJai and lgfa29 committed Apr 28, 2022
1 parent 522b630 commit c180c8d
Show file tree
Hide file tree
Showing 11 changed files with 1,215 additions and 328 deletions.
3 changes: 3 additions & 0 deletions .changelog/12765.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: fix broken link to task-groups in the Recent Allocations table in the Job Detail overview page.
```
8 changes: 8 additions & 0 deletions ui/app/helpers/format-job-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Helper from '@ember/component/helper';

export function formatJobId([jobId]) {
if (!jobId) return;
return JSON.parse(jobId).join('@');
}

export default Helper.helper(formatJobId);
11 changes: 6 additions & 5 deletions ui/app/routes/allocations/allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export default class AllocationRoute extends Route.extend(WithWatchers) {
// Preload the job for the allocation since it's required for the breadcrumb trail
return super
.model(...arguments)
.then((allocation) =>
allocation
.get('job')
.then((allocation) => {
const jobId = allocation.belongsTo('job').id();
return this.store
.findRecord('job', jobId)
.then(() => this.store.findAll('namespace')) // namespaces belong to a job and are an asynchronous relationship so we can peak them later on
.then(() => allocation)
)
.then(() => allocation);
})
.catch(notifyError(this));
}

Expand Down
Loading

0 comments on commit c180c8d

Please sign in to comment.