mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
76f5de1455
* ui: Ensure dc selector correctly shows the currently selected dc * ui: Restrict access to non-default partitions in non-primaries (#11420) This PR restricts access via the UI to only the default partition when in a non-primary datacenter i.e. you can only have multiple (non-default) partitions in the primary datacenter.
33 lines
644 B
JavaScript
33 lines
644 B
JavaScript
import BaseAbility from 'consul-ui/abilities/base';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class PartitionAbility extends BaseAbility {
|
|
@service('env') env;
|
|
|
|
resource = 'operator';
|
|
segmented = false;
|
|
|
|
get isLinkable() {
|
|
return !this.item.DeletedAt;
|
|
}
|
|
|
|
get canManage() {
|
|
return this.canCreate;
|
|
}
|
|
|
|
get canDelete() {
|
|
return this.item.Name !== 'default' && super.canDelete;
|
|
}
|
|
|
|
get canChoose() {
|
|
if(typeof this.dc === 'undefined') {
|
|
return false;
|
|
}
|
|
return this.canUse && this.dc.Primary;
|
|
}
|
|
|
|
get canUse() {
|
|
return this.env.var('CONSUL_PARTITIONS_ENABLED');
|
|
}
|
|
}
|