Files
threshold-ui/addons/api/mirage/factories/host-catalog.js
T

26 lines
757 B
JavaScript
Raw Normal View History

2020-06-04 16:53:37 -04:00
import factory from '../generated/factories/host-catalog';
import { trait } from 'ember-cli-mirage';
2021-08-19 16:06:47 -07:00
import permissions from '../helpers/permissions';
2020-06-04 16:53:37 -04:00
export default factory.extend({
2021-08-19 16:06:47 -07:00
authorized_actions: () =>
permissions.authorizedActionsFor('host-catalog') || [
'no-op',
'read',
'update',
'delete',
],
2021-09-02 15:28:40 -07:00
authorized_collection_actions: () => {
return {
hosts: ['create', 'list'],
'host-sets': ['create', 'list'],
2021-09-02 15:28:40 -07:00
};
},
withChildren: trait({
afterCreate(hostCatalog, server) {
const { scope, type } = hostCatalog;
const hosts = server.createList('host', 10, { scope, hostCatalog, type });
server.createList('host-set', 3, { scope, hostCatalog, hosts, type });
},
}),
});