When protecting a branch, clicking 'Create wildcard' will not create a wildcard rule if no asterisk has been entered

Summary

When typing in a branch name in the Protect a branch flow, option `Create wildcard <BRANCH_NAME> will display. Clicking this option when an asterisk has not been added will create an exact match rule, not a wildcard rule.

Steps to reproduce

  1. Navigate to Settings -> Repository -> Protected branches -> Protect a branch
  2. Click Select branch...
  3. Enter am-i-a-wildcard
  4. Click Create wildcard am-i-a-wildcard at the bottom of the dropdown
  5. Finish remainder of settings and click Protect
  6. New rule will have message Branch was deleted. because this is an exact-match rule, not a wildcard

Example Project

https://gitlab.com/wchandler/default-branch-click

What is the current bug behavior?

Clicking Create wildcard does not create a wildcard rule if no asterisk is entered.

What is the expected correct behavior?

This option should not be active until an asterisk has been entered in the input box.

Relevant logs and/or screenshots

Video of this occurring on GitLab.com:

wildcard

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
```
System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.6
Redis Version:	6.0.14
Git Version:	2.32.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	14.2.1-ee
Revision:	018e6242bd5
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.6
Elasticsearch:	yes
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.19.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
- remote: 	/var/opt/gitlab/git-data/repositories
- nfs: 	/mnt/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git
```

Results of GitLab application Check

Expand for output related to the GitLab application check
System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.6
Redis Version:	6.0.14
Git Version:	2.32.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	14.2.1-ee
Revision:	018e6242bd5
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.6
Elasticsearch:	yes
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.19.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
- remote: 	/var/opt/gitlab/git-data/repositories
- nfs: 	/mnt/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git
Edited by Will Chandler (ex-GitLab)