open-nomad/ui/app/abilities/job.js

27 lines
733 B
JavaScript
Raw Normal View History

import AbstractAbility from './abstract';
2020-06-18 05:44:35 +00:00
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
export default class Job extends AbstractAbility {
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportRunning')
canRun;
2020-06-18 05:44:35 +00:00
@or(
'bypassAuthorization',
'selfTokenIsManagement',
'policiesSupportRunning',
'policiesSupportScaling'
)
canScale;
@computed('rulesForActiveNamespace.@each.capabilities')
get policiesSupportRunning() {
2020-06-18 05:44:35 +00:00
return this.activeNamespaceIncludesCapability('submit-job');
}
@computed('rulesForActiveNamespace.@each.capabilities')
get policiesSupportScaling() {
return this.activeNamespaceIncludesCapability('scale-job');
}
}