22 lines
634 B
JavaScript
22 lines
634 B
JavaScript
import factory from '../generated/factories/host';
|
|
import permissions from '../helpers/permissions';
|
|
|
|
export default factory.extend({
|
|
id: (i) => `host-id-${i}`,
|
|
type() {
|
|
return this.hostCatalog?.type || factory.attrs.type;
|
|
},
|
|
authorized_actions: function () {
|
|
const isStatic = this.type === 'static';
|
|
const defaults = ['no-op', 'read'];
|
|
// Only static allows update/delete at this time.
|
|
if (isStatic) defaults.push('update', 'delete');
|
|
return permissions.authorizedActionsFor('host') || defaults;
|
|
},
|
|
plugin() {
|
|
if (this.type === 'plugin') {
|
|
return this.hostCatalog.plugin;
|
|
}
|
|
},
|
|
});
|