mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Custom tooltip for Generated Token Policies form field on auth methods (#15046)
* the conditional fix * add test coverage * changelog * add possesive * fix language * fix * fix * change quotes * fix * replace with find
This commit is contained in:
		
							
								
								
									
										4
									
								
								changelog/15046.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								changelog/15046.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| ```release-note:bug | ||||
| ui: Fix Generated Token's Policies helpText to clarify that comma separated values are not accepted in this field.  | ||||
| ``` | ||||
|  | ||||
| @@ -48,6 +48,16 @@ export default Component.extend({ | ||||
|   ), | ||||
|   init() { | ||||
|     this._super(...arguments); | ||||
|     this.model.fieldGroups.forEach((element) => { | ||||
|       // overwriting the helpText for Token Polices. | ||||
|       // HelpText from the backend says add a comma separated list, which works on the CLI but not here on the UI. | ||||
|       // This effects TLS Certificates, Userpass, and Kubernetes. https://github.com/hashicorp/vault/issues/10346 | ||||
|       if (element.Tokens) { | ||||
|         element.Tokens.find((attr) => attr.name === 'tokenPolicies').options.helpText = | ||||
|           'Add policies that will apply to the generated token for this user. One policy per row.'; | ||||
|       } | ||||
|     }); | ||||
|  | ||||
|     if (this.mode === 'edit') { | ||||
|       // For validation to work in edit mode, | ||||
|       // reconstruct the model values from field group | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|     <Icon @name="info" class="auto-width" aria-label="help" /> | ||||
|   </d.Trigger> | ||||
|   <d.Content @defaultClass="tool-tip"> | ||||
|     <div class="box"> | ||||
|     <div class="box" data-test-info-tooltip-content> | ||||
|       {{yield}} | ||||
|     </div> | ||||
|   </d.Content> | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import { | ||||
|   fillIn, | ||||
|   settled, | ||||
|   visit, | ||||
|   triggerEvent, | ||||
|   triggerKeyEvent, | ||||
|   find, | ||||
|   waitUntil, | ||||
| @@ -69,6 +70,18 @@ module('Acceptance | auth backend list', function (hooks) { | ||||
|     await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65); | ||||
|     await fillIn('[data-test-textarea]', user2); | ||||
|     await triggerKeyEvent('[data-test-textarea]', 'keyup', 65); | ||||
|     // test for modified helpText on generated token policies | ||||
|     await click('[data-test-toggle-group="Tokens"]'); | ||||
|     let policyFormField = document.querySelector('[data-test-input="tokenPolicies"]'); | ||||
|     let tooltipTrigger = policyFormField.querySelector('[data-test-tool-tip-trigger]'); | ||||
|     await triggerEvent(tooltipTrigger, 'mouseenter'); | ||||
|     assert | ||||
|       .dom('[data-test-info-tooltip-content]') | ||||
|       .hasText( | ||||
|         'Add policies that will apply to the generated token for this user. One policy per row.', | ||||
|         'Overwritten tooltip text displays in token form field.' | ||||
|       ); | ||||
|  | ||||
|     await click('[data-test-save-config="true"]'); | ||||
|  | ||||
|     //confirming that the user was created.  There was a bug where the apiPath was not being updated when toggling between auth routes | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Angel Garbarino
					Angel Garbarino