Update job row to no longer watch job-summary or reload the job

Now that job summary is pushed into the store from the list request
and the task group count is derived from the summary, the detailed
job information is no longer needed for a job row.
This commit is contained in:
Michael Lange
2018-03-15 10:27:29 -07:00
parent 415c6a0d3c
commit 030e229f5e
2 changed files with 3 additions and 33 deletions

View File

@@ -1,10 +1,8 @@
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { lazyClick } from '../helpers/lazy-click';
import { watchRelationship } from 'nomad-ui/utils/properties/watch';
import WithVisibilityDetection from 'nomad-ui/mixins/with-component-visibility-detection';
export default Component.extend(WithVisibilityDetection, {
export default Component.extend({
store: service(),
tagName: 'tr',
@@ -17,32 +15,4 @@ export default Component.extend(WithVisibilityDetection, {
click(event) {
lazyClick([this.get('onClick'), event]);
},
didReceiveAttrs() {
// Reload the job in order to get detail information
const job = this.get('job');
if (job && !job.get('isLoading')) {
job.reload().then(() => {
this.get('watch').perform(job, 100);
});
}
},
visibilityHandler() {
if (document.hidden) {
this.get('watch').cancelAll();
} else {
const job = this.get('job');
if (job && !job.get('isLoading')) {
this.get('watch').perform(job, 100);
}
}
},
willDestroy() {
this.get('watch').cancelAll();
this._super(...arguments);
},
watch: watchRelationship('summary'),
});

View File

@@ -5,8 +5,8 @@
<td data-test-job-type>{{job.displayType}}</td>
<td data-test-job-priority>{{job.priority}}</td>
<td data-test-job-task-groups>
{{#if job.taskGroups.length}}
{{job.taskGroups.length}}
{{#if job.taskGroupCount}}
{{job.taskGroupCount}}
{{else}}
--
{{/if}}