Disable scale buttons when a deployment is running or ACL forbids it

This commit is contained in:
Michael Lange 2020-06-17 22:45:21 -07:00
parent 3b7b5f9649
commit c664f57361
2 changed files with 10 additions and 4 deletions

View file

@ -1,6 +1,6 @@
import Component from '@ember/component';
import { computed, action } from '@ember/object';
import { oneWay } from '@ember/object/computed';
import { alias, oneWay } from '@ember/object/computed';
import { debounce } from '@ember/runloop';
import { classNames, tagName } from '@ember-decorators/component';
import classic from 'ember-classic-decorator';
@ -14,6 +14,7 @@ export default class TaskGroupRow extends Component {
debounce = 300;
@oneWay('taskGroup.count') count;
@alias('taskGroup.job.runningDeployment') runningDeployment;
onClick() {}

View file

@ -6,18 +6,23 @@
<td data-test-task-group-count class="nowrap">
{{count}}
{{#if taskGroup.scaling}}
<div class="button-bar is-shadowless is-text bumper-left">
<div
data-test-scale-controls
class="button-bar is-shadowless is-text bumper-left {{if (cannot "scale job") "tooltip"}}"
aria-label={{if (cannot "scale job") "You aren't allowed to scale task groups"}}>
<button
data-test-scale="decrement"
role="button"
class="button is-xsmall is-light"
disabled={{isMinimum}}
disabled={{or isMinimum runningDeployment (cannot "scale job")}}
onclick={{action "countDown"}}>
{{x-icon "minus-plain" class="is-text"}}
</button>
<button
data-test-scale="increment"
role="button"
class="button is-xsmall is-light"
disabled={{isMaximum}}
disabled={{or isMaximum runningDeployment (cannot "scale job")}}
onclick={{action "countUp"}}>
{{x-icon "plus-plain" class="is-text"}}
</button>