Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
allowEmpty: true
}),
// alias title validation especially for unique validation
validator('alias', {
alias: 'title',
firstMessageOnly: true
}),
// alias is partially filled validation as that's part of time validation
validator('alias', {
alias: 'isPartiallyFilled',
}),
]
});
export default Fragment.extend(Validations, {
poll: fragmentOwner(),
title: attr('string'),
date: computed('title', function() {
const allowedFormats = [
'YYYY-MM-DD',
'YYYY-MM-DDTHH:mm:ss.SSSZ'
];
const value = this.title;
if (isEmpty(value)) {
return;
}
const format = allowedFormats.find((f) => {
// if format length does not match value length
// string can't be in this format
return f.length === value.length && moment(value, f, true).isValid();
import { computed } from '@ember/object';
import Fragment from 'ember-data-model-fragments/fragment';
import attr from 'ember-data/attr';
import { fragmentOwner, fragmentArray } from 'ember-data-model-fragments/attributes';
import sumAggregation from '../utils/properties/sum-aggregation';
const maybe = arr => arr || [];
export default Fragment.extend({
job: fragmentOwner(),
name: attr('string'),
count: attr('number'),
tasks: fragmentArray('task'),
allocations: computed('job.allocations.@each.taskGroup', function() {
return maybe(this.get('job.allocations')).filterBy('taskGroupName', this.get('name'));
}),
reservedCPU: sumAggregation('tasks', 'reservedCPU'),
reservedMemory: sumAggregation('tasks', 'reservedMemory'),
reservedDisk: sumAggregation('tasks', 'reservedDisk'),
reservedEphemeralDisk: attr('number'),
import Fragment from 'ember-data-model-fragments/fragment';
import attr from 'ember-data/attr';
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
export default Fragment.extend({
state: fragmentOwner(),
type: attr('string'),
signal: attr('number'),
exitCode: attr('number'),
time: attr('date'),
timeNanos: attr('number'),
message: attr('string'),
});
import { computed } from '@ember/object';
import { alias, none, and } from '@ember/object/computed';
import Fragment from 'ember-data-model-fragments/fragment';
import attr from 'ember-data/attr';
import { fragment, fragmentOwner, fragmentArray } from 'ember-data-model-fragments/attributes';
export default Fragment.extend({
allocation: fragmentOwner(),
name: attr('string'),
state: attr('string'),
startedAt: attr('date'),
finishedAt: attr('date'),
failed: attr('boolean'),
isActive: none('finishedAt'),
isRunning: and('isActive', 'allocation.isRunning'),
task: computed('allocation.taskGroup.tasks.[]', function() {
const tasks = this.get('allocation.taskGroup.tasks');
return tasks && tasks.findBy('name', this.name);
}),
driver: alias('task.driver'),