ui: Disable setting wildcard partitions for intentions (#11804)

This commit is contained in:
John Cowen 2021-12-13 15:42:10 +00:00 committed by GitHub
parent 79b25901d7
commit 2ba0e86d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 13 deletions

4
.changelog/11804.txt Normal file
View File

@ -0,0 +1,4 @@
```release-note:bugfix
ui: Don't offer to save an intention with a source/destinatiojn wildcard
partition
```

View File

@ -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}}
</PowerSelectWithCreate>
{{#if create}}
<em>Search for an existing partition, or enter any Partition name.</em>
@ -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}}
</PowerSelectWithCreate>
{{#if create}}
<em>For the destination, you may choose any partition for which you have access.</em>

View File

@ -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 };

View File

@ -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,