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:
parent
b9acac050a
commit
774bf2241a
|
@ -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() {
|
init() {
|
||||||
this._super(...arguments);
|
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') {
|
if (this.mode === 'edit') {
|
||||||
// For validation to work in edit mode,
|
// For validation to work in edit mode,
|
||||||
// reconstruct the model values from field group
|
// reconstruct the model values from field group
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<Icon @name="info" class="auto-width" aria-label="help" />
|
<Icon @name="info" class="auto-width" aria-label="help" />
|
||||||
</d.Trigger>
|
</d.Trigger>
|
||||||
<d.Content @defaultClass="tool-tip">
|
<d.Content @defaultClass="tool-tip">
|
||||||
<div class="box">
|
<div class="box" data-test-info-tooltip-content>
|
||||||
{{yield}}
|
{{yield}}
|
||||||
</div>
|
</div>
|
||||||
</d.Content>
|
</d.Content>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
fillIn,
|
fillIn,
|
||||||
settled,
|
settled,
|
||||||
visit,
|
visit,
|
||||||
|
triggerEvent,
|
||||||
triggerKeyEvent,
|
triggerKeyEvent,
|
||||||
find,
|
find,
|
||||||
waitUntil,
|
waitUntil,
|
||||||
|
@ -69,6 +70,18 @@ module('Acceptance | auth backend list', function (hooks) {
|
||||||
await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65);
|
await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65);
|
||||||
await fillIn('[data-test-textarea]', user2);
|
await fillIn('[data-test-textarea]', user2);
|
||||||
await triggerKeyEvent('[data-test-textarea]', 'keyup', 65);
|
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"]');
|
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
|
//confirming that the user was created. There was a bug where the apiPath was not being updated when toggling between auth routes
|
||||||
|
|
Loading…
Reference in New Issue