Form field component ttl picker not initially enabling (#13177)
* fixes issue with ttl picker not initially enabling in form field component * adds changelog entry * updates test * updates initial ttl toggle state for default 0s value
This commit is contained in:
parent
dd11865597
commit
d9d9a7353e
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Fixes issue with automate secret deletion value not displaying initially if set in secret metadata edit view
|
||||||
|
```
|
|
@ -127,14 +127,17 @@
|
||||||
{{else if (eq attr.options.editType "ttl")}}
|
{{else if (eq attr.options.editType "ttl")}}
|
||||||
{{!-- TTL Picker --}}
|
{{!-- TTL Picker --}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<TtlPicker2
|
{{#let (or (get model valuePath) attr.options.setDefault) as |initialValue|}}
|
||||||
@onChange={{action (action "setAndBroadcastTtl" valuePath)}}
|
<TtlPicker2
|
||||||
@label={{labelString}}
|
@onChange={{action (action "setAndBroadcastTtl" valuePath)}}
|
||||||
@helperTextDisabled={{or attr.options.helperTextDisabled "Vault will use the default lease duration."}}
|
@label={{labelString}}
|
||||||
@helperTextEnabled={{or attr.options.helperTextEnabled "Lease will expire after"}}
|
@helperTextDisabled={{or attr.options.helperTextDisabled "Vault will use the default lease duration."}}
|
||||||
@description={{attr.helpText}}
|
@helperTextEnabled={{or attr.options.helperTextEnabled "Lease will expire after"}}
|
||||||
@initialValue={{or (get model valuePath) attr.options.setDefault}}
|
@description={{attr.helpText}}
|
||||||
/>
|
@initialValue={{initialValue}}
|
||||||
|
@initialEnabled={{if (eq initialValue "0s") false initialValue}}
|
||||||
|
/>
|
||||||
|
{{/let}}
|
||||||
</div>
|
</div>
|
||||||
{{else if (eq attr.options.editType "regex")}}
|
{{else if (eq attr.options.editType "regex")}}
|
||||||
{{!-- Regex Validated Input --}}
|
{{!-- Regex Validated Input --}}
|
||||||
|
|
|
@ -19,7 +19,6 @@ module('Acceptance | settings/configure/secrets/pki/crl', function(hooks) {
|
||||||
await page.visit({ backend: path, section: 'crl' });
|
await page.visit({ backend: path, section: 'crl' });
|
||||||
await settled();
|
await settled();
|
||||||
assert.equal(currentRouteName(), 'vault.cluster.settings.configure-secret-backend.section');
|
assert.equal(currentRouteName(), 'vault.cluster.settings.configure-secret-backend.section');
|
||||||
await page.form.enableTtl();
|
|
||||||
await page.form.fillInUnit('h');
|
await page.form.fillInUnit('h');
|
||||||
await page.form.fillInValue(3);
|
await page.form.fillInValue(3);
|
||||||
await page.form.submit();
|
await page.form.submit();
|
||||||
|
|
|
@ -160,4 +160,34 @@ module('Integration | Component | form field', function(hooks) {
|
||||||
await component.tooltipTrigger();
|
await component.tooltipTrigger();
|
||||||
assert.ok(component.hasTooltip, 'renders the tooltip component');
|
assert.ok(component.hasTooltip, 'renders the tooltip component');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('it should not expand and toggle ttl when default 0s value is present', async function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
this.setProperties({
|
||||||
|
model: EmberObject.create({ foo: '0s' }),
|
||||||
|
attr: createAttr('foo', null, { editType: 'ttl' }),
|
||||||
|
onChange: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
|
await render(hbs`{{form-field attr=attr model=model onChange=onChange}}`);
|
||||||
|
assert
|
||||||
|
.dom('[data-test-toggle-input="Foo"]')
|
||||||
|
.isNotChecked('Toggle is initially unchecked when given default value');
|
||||||
|
assert.dom('[data-test-ttl-picker-group="Foo"]').doesNotExist('Ttl input is hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('it should toggle and expand ttl when initial non default value is provided', async function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
this.setProperties({
|
||||||
|
model: EmberObject.create({ foo: '1s' }),
|
||||||
|
attr: createAttr('foo', null, { editType: 'ttl' }),
|
||||||
|
onChange: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
|
await render(hbs`{{form-field attr=attr model=model onChange=onChange}}`);
|
||||||
|
assert.dom('[data-test-toggle-input="Foo"]').isChecked('Toggle is initially checked when given value');
|
||||||
|
assert.dom('[data-test-ttl-value="Foo"]').hasValue('1', 'Ttl input displays with correct value');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue