Files
nomad/ui/app/abilities/job.js
Michael Lange 92391683da ui: Update namespaces design (#10444)
This rethinks namespaces as a filter on list pages rather than a global setting.

The biggest net-new feature here is being able to select All (*) to list all jobs
or CSI volumes across namespaces.
2021-04-29 15:00:59 -05:00

33 lines
991 B
JavaScript

import AbstractAbility from './abstract';
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
export default class Job extends AbstractAbility {
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportRunning')
canRun;
@or(
'bypassAuthorization',
'selfTokenIsManagement',
'policiesSupportRunning',
'policiesSupportScaling'
)
canScale;
// TODO: A person can also see all jobs if their token grants read access to all namespaces,
// but given the complexity of namespaces and policy precedence, there isn't a good quick way
// to confirm this.
@or('bypassAuthorization', 'selfTokenIsManagement')
canListAll;
@computed('rulesForNamespace.@each.capabilities')
get policiesSupportRunning() {
return this.namespaceIncludesCapability('submit-job');
}
@computed('rulesForNamespace.@each.capabilities')
get policiesSupportScaling() {
return this.namespaceIncludesCapability('scale-job');
}
}