From 9e961fe0ef09484fef5e4fbbd0e8677006cabda6 Mon Sep 17 00:00:00 2001
From: Michael Lange <dingoeatingfuzz@gmail.com>
Date: Thu, 15 Mar 2018 14:03:14 -0700
Subject: [PATCH] Ensure the task group is present whenever an allocation row
 is rendered

---
 ui/app/components/allocation-row.js | 3 +++
 ui/app/models/job.js                | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/ui/app/components/allocation-row.js b/ui/app/components/allocation-row.js
index 5625c092f8..088c07a820 100644
--- a/ui/app/components/allocation-row.js
+++ b/ui/app/components/allocation-row.js
@@ -58,6 +58,9 @@ function qualifyJob() {
         job,
         originalJobId: null,
       });
+      if (job.get('isPartial')) {
+        job.reload();
+      }
     } else {
       this.get('store')
         .findRecord('job', allocation.get('originalJobId'))
diff --git a/ui/app/models/job.js b/ui/app/models/job.js
index f9042ec394..4681b502e3 100644
--- a/ui/app/models/job.js
+++ b/ui/app/models/job.js
@@ -84,6 +84,11 @@ export default Model.extend({
   taskGroups: fragmentArray('task-group', { defaultValue: () => [] }),
   summary: belongsTo('job-summary'),
 
+  // A job model created from the jobs list response will be lacking
+  // task groups. This is an indicator that it needs to be reloaded
+  // if task group information is important.
+  isPartial: equal('taskGroups.length', 0),
+
   // If a job has only been loaded through the list request, the task groups
   // are still unknown. However, the count of task groups is available through
   // the job-summary model which is embedded in the jobs list response.
-- 
GitLab