2021-02-17 21:01:44 +00:00
|
|
|
import Model from '@ember-data/model';
|
|
|
|
import { attr, belongsTo } from '@ember-data/model';
|
2020-10-29 12:46:42 +00:00
|
|
|
import { get } from '@ember/object';
|
|
|
|
|
|
|
|
export default class Recommendation extends Model {
|
|
|
|
@belongsTo('job') job;
|
2021-12-28 16:08:12 +00:00
|
|
|
@belongsTo('recommendation-summary', { inverse: 'recommendations' })
|
|
|
|
recommendationSummary;
|
2020-10-29 12:46:42 +00:00
|
|
|
|
|
|
|
@attr('date') submitTime;
|
|
|
|
|
|
|
|
get taskGroup() {
|
|
|
|
return get(this, 'recommendationSummary.taskGroup');
|
|
|
|
}
|
|
|
|
|
|
|
|
@attr('string') taskName;
|
|
|
|
|
|
|
|
get task() {
|
|
|
|
return get(this, 'taskGroup.tasks').findBy('name', this.taskName);
|
|
|
|
}
|
|
|
|
|
|
|
|
@attr('string') resource;
|
|
|
|
@attr('number') value;
|
|
|
|
|
|
|
|
get currentValue() {
|
2021-12-28 16:08:12 +00:00
|
|
|
const resourceProperty =
|
|
|
|
this.resource === 'CPU' ? 'reservedCPU' : 'reservedMemory';
|
2020-10-29 12:46:42 +00:00
|
|
|
return get(this, `task.${resourceProperty}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
@attr() stats;
|
|
|
|
}
|