mirror of https://github.com/hashicorp/consul
ui: Only allow partition creation with a single datacenter setup (#11817)
parent
64767b53e7
commit
31dee2340f
|
@ -48,7 +48,15 @@ as |route|>
|
||||||
</h1>
|
</h1>
|
||||||
</BlockSlot>
|
</BlockSlot>
|
||||||
<BlockSlot @name="actions">
|
<BlockSlot @name="actions">
|
||||||
<a data-test-create href="{{href-to 'dc.partitions.create'}}" class="type-create">Create</a>
|
{{#if (can 'create partitions')}}
|
||||||
|
<a
|
||||||
|
data-test-create
|
||||||
|
class="type-create"
|
||||||
|
href="{{href-to 'dc.partitions.create'}}"
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
</BlockSlot>
|
</BlockSlot>
|
||||||
<BlockSlot @name="toolbar">
|
<BlockSlot @name="toolbar">
|
||||||
{{#if (gt items.length 0)}}
|
{{#if (gt items.length 0)}}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default class PartitionAbility extends BaseAbility {
|
export default class PartitionAbility extends BaseAbility {
|
||||||
@service('env') env;
|
@service('env') env;
|
||||||
|
@service('repository/dc') dcs;
|
||||||
|
|
||||||
resource = 'operator';
|
resource = 'operator';
|
||||||
segmented = false;
|
segmented = false;
|
||||||
|
@ -12,7 +13,16 @@ export default class PartitionAbility extends BaseAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
get canManage() {
|
get canManage() {
|
||||||
return this.canCreate;
|
// management currently means "can I write", not necessarily just create
|
||||||
|
return this.canWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
get canCreate() {
|
||||||
|
// we can only currently create a partition if you have only one datacenter
|
||||||
|
if (this.dcs.peekAll().length > 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.canCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
get canDelete() {
|
get canDelete() {
|
||||||
|
|
Loading…
Reference in New Issue