From 2ba0e86d6d3f016f2d21d1977ebe7d800f1d0b8c Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 13 Dec 2021 15:42:10 +0000 Subject: [PATCH] ui: Disable setting wildcard partitions for intentions (#11804) --- .changelog/11804.txt | 4 ++++ .../consul/intention/form/fieldsets/index.hbs | 12 ++---------- .../app/components/consul/intention/form/index.js | 3 +-- .../consul-ui/app/services/repository/intention.js | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 .changelog/11804.txt diff --git a/.changelog/11804.txt b/.changelog/11804.txt new file mode 100644 index 0000000000..0b64ab02f0 --- /dev/null +++ b/.changelog/11804.txt @@ -0,0 +1,4 @@ +```release-note:bugfix +ui: Don't offer to save an intention with a source/destinatiojn wildcard +partition +``` diff --git a/ui/packages/consul-ui/app/components/consul/intention/form/fieldsets/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/form/fieldsets/index.hbs index 8150068323..e601bb5571 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/form/fieldsets/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/intention/form/fieldsets/index.hbs @@ -63,11 +63,7 @@ @showCreateWhen={{action "isUnique" partitions}} @onCreate={{action onchange "SourcePartition"}} @onChange={{action onchange "SourcePartition"}} as |partition|> - {{#if (eq partition.Name '*') }} - * (All Partitions) - {{else}} - {{partition.Name}} - {{/if}} + {{partition.Name}} {{#if create}} Search for an existing partition, or enter any Partition name. @@ -136,11 +132,7 @@ @showCreateWhen={{action "isUnique" partitions}} @onCreate={{action onchange "DestinationPartition"}} @onChange={{action onchange "DestinationPartition"}} as |partition|> - {{#if (eq partition.Name '*') }} - * (All Partitions) - {{else}} - {{partition.Name}} - {{/if}} + {{partition.Name}} {{#if create}} For the destination, you may choose any partition for which you have access. diff --git a/ui/packages/consul-ui/app/components/consul/intention/form/index.js b/ui/packages/consul-ui/app/components/consul/intention/form/index.js index 8e953602e5..c37ce52494 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/form/index.js +++ b/ui/packages/consul-ui/app/components/consul/intention/form/index.js @@ -122,10 +122,9 @@ export default class ConsulIntentionForm extends Component { @action createPartitions(item, e) { // Partitions in the menus should: - // 1. Include an 'All Partitions' option + // 1. NOT include an 'All Partitions' option // 2. Include the current SourcePartition and DestinationPartition incase they don't exist yet let items = e.data.toArray().sort((a, b) => a.Name.localeCompare(b.Name)); - items = [{ Name: '*' }].concat(items); let source = items.findBy('Name', item.SourcePartition); if (!source) { source = { Name: item.SourcePartition }; diff --git a/ui/packages/consul-ui/app/services/repository/intention.js b/ui/packages/consul-ui/app/services/repository/intention.js index aed23be75f..89b211e164 100644 --- a/ui/packages/consul-ui/app/services/repository/intention.js +++ b/ui/packages/consul-ui/app/services/repository/intention.js @@ -69,7 +69,7 @@ export default class IntentionRepository extends RepositoryService { let item; if (params.id === '') { const defaultNspace = this.env.var('CONSUL_NSPACES_ENABLED') ? '*' : 'default'; - const defaultPartition = this.env.var('CONSUL_PARTITIONS_ENABLED') ? '*' : 'default'; + const defaultPartition = 'default'; item = await this.create({ SourceNS: params.nspace || defaultNspace, DestinationNS: params.nspace || defaultNspace,