Files
nomad/ui/mirage/factories/variable.js
Phil Renaud bad23ee6b1 Link Variables to Jobs (#13627)
* Related entities scaffolded

* Added hint on edit

* Re-classic'd

* Dont create entities when path goes beyond task level

* only show the related entities hint for new vars, not edited ones

* Unit tests for pathLinkedEntities

* Acceptance tests for linked entities

* Add hint on creation

* Will be vs Is on @new boolean flag

* Link styles and namespaces on links

* Unused component class

* Delog

* Defensive shouldShowLinked

* Properly instantiating the accessibilty check test
2022-07-11 13:34:06 -04:00

36 lines
1019 B
JavaScript

import { Factory } from 'ember-cli-mirage';
import faker from 'nomad-ui/mirage/faker';
import { pickOne } from '../utils';
export default Factory.extend({
id: () => faker.random.words(3).split(' ').join('/').toLowerCase(),
path() {
return this.id;
},
namespace: null,
createdIndex: 100,
modifiedIndex: 100,
createTime: () => faker.date.past(15),
modifyTime: () => faker.date.recent(1),
items() {
return (
this.Items || {
[faker.database.column()]: faker.database.collation(),
[faker.database.column()]: faker.database.collation(),
[faker.database.column()]: faker.database.collation(),
[faker.database.column()]: faker.database.collation(),
[faker.database.column()]: faker.database.collation(),
}
);
},
afterCreate(variable, server) {
if (!variable.namespaceId) {
const namespace =
(server.db.jobs && server.db.jobs[0]?.namespace) || 'default';
variable.update({
namespace,
});
}
},
});