UI/fix kvv2 version (#11258)
* Update default form values for kv * Group kv version option in 'Method Options' group * Fix tests, explicitly set if select input does not have default * Handle array of objects from adapterError.errors in MessageError component * Add changelog
This commit is contained in:
parent
1da8f859d5
commit
f9ade25674
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Fix bug where the UI does not recognize version 2 KV until refresh, and fix [object Object] error message
|
||||||
|
```
|
|
@ -31,6 +31,7 @@ export default Model.extend({
|
||||||
plugin_name: attr('string', {
|
plugin_name: attr('string', {
|
||||||
label: 'Database plugin',
|
label: 'Database plugin',
|
||||||
possibleValues: AVAILABLE_PLUGIN_TYPES,
|
possibleValues: AVAILABLE_PLUGIN_TYPES,
|
||||||
|
noDefault: true,
|
||||||
}),
|
}),
|
||||||
verify_connection: attr('boolean', {
|
verify_connection: attr('boolean', {
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default Fragment.extend({
|
||||||
helpText:
|
helpText:
|
||||||
'The KV Secrets Engine can operate in different modes. Version 1 is the original generic Secrets Engine the allows for storing of static key/value pairs. Version 2 added more features including data versioning, TTLs, and check and set.',
|
'The KV Secrets Engine can operate in different modes. Version 1 is the original generic Secrets Engine the allows for storing of static key/value pairs. Version 2 added more features including data versioning, TTLs, and check and set.',
|
||||||
possibleValues: [2, 1],
|
possibleValues: [2, 1],
|
||||||
defaultFormValue: 2,
|
// This shouldn't be defaultValue because if no version comes back from API we should assume it's v1
|
||||||
|
defaultFormValue: 2, // Set the form to 2 by default
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,8 +60,17 @@ export default Model.extend({
|
||||||
formFieldGroups: computed('engineType', function() {
|
formFieldGroups: computed('engineType', function() {
|
||||||
let type = this.engineType;
|
let type = this.engineType;
|
||||||
let defaultGroup = { default: ['path'] };
|
let defaultGroup = { default: ['path'] };
|
||||||
|
let optionsGroup = {
|
||||||
|
'Method Options': [
|
||||||
|
'description',
|
||||||
|
'config.listingVisibility',
|
||||||
|
'local',
|
||||||
|
'sealWrap',
|
||||||
|
'config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
|
||||||
|
],
|
||||||
|
};
|
||||||
if (type === 'kv' || type === 'generic') {
|
if (type === 'kv' || type === 'generic') {
|
||||||
defaultGroup.default.push('options.{version}');
|
optionsGroup['Method Options'].unshift('options.{version}');
|
||||||
}
|
}
|
||||||
if (type === 'database') {
|
if (type === 'database') {
|
||||||
// For the Database Secret Engine we want to highlight the defaultLeaseTtl and maxLeaseTtl, removing them from the options object
|
// For the Database Secret Engine we want to highlight the defaultLeaseTtl and maxLeaseTtl, removing them from the options object
|
||||||
|
@ -79,18 +88,7 @@ export default Model.extend({
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return [
|
return [defaultGroup, optionsGroup];
|
||||||
defaultGroup,
|
|
||||||
{
|
|
||||||
'Method Options': [
|
|
||||||
'description',
|
|
||||||
'config.listingVisibility',
|
|
||||||
'local',
|
|
||||||
'sealWrap',
|
|
||||||
'config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
attrs: computed('formFields', function() {
|
attrs: computed('formFields', function() {
|
||||||
|
|
|
@ -44,7 +44,10 @@ export default Component.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.model.adapterError.errors.length > 0) {
|
if (this.model.adapterError.errors.length > 0) {
|
||||||
return this.model.adapterError.errors;
|
return this.model.adapterError.errors.map(e => {
|
||||||
|
if (typeof e === 'object') return e.title || e.message || JSON.stringify(e);
|
||||||
|
return e;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return [this.model.adapterError.message];
|
return [this.model.adapterError.message];
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
(action "setAndBroadcast" valuePath)
|
(action "setAndBroadcast" valuePath)
|
||||||
value="target.value"
|
value="target.value"
|
||||||
}} data-test-input={{attr.name}}>
|
}} data-test-input={{attr.name}}>
|
||||||
{{#unless attr.options.defaultValue}}
|
{{#if attr.options.noDefault}}
|
||||||
<option value="">
|
<option value="">
|
||||||
Select one
|
Select one
|
||||||
</option>
|
</option>
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
{{#each (path-or-array attr.options.possibleValues model) as |val|}}
|
{{#each (path-or-array attr.options.possibleValues model) as |val|}}
|
||||||
<option selected={{eq (get model valuePath) (or val.value val)}} value={{or val.value val}}>
|
<option selected={{eq (get model valuePath) (or val.value val)}} value={{or val.value val}}>
|
||||||
{{or val.displayName val}}
|
{{or val.displayName val}}
|
||||||
|
|
|
@ -65,6 +65,7 @@ module('Acceptance | secrets/secret/create', function(hooks) {
|
||||||
await mountSecrets
|
await mountSecrets
|
||||||
.next()
|
.next()
|
||||||
.path(enginePath)
|
.path(enginePath)
|
||||||
|
.toggleOptions()
|
||||||
.version(1)
|
.version(1)
|
||||||
.submit();
|
.submit();
|
||||||
await listPage.create();
|
await listPage.create();
|
||||||
|
@ -83,6 +84,7 @@ module('Acceptance | secrets/secret/create', function(hooks) {
|
||||||
await mountSecrets
|
await mountSecrets
|
||||||
.next()
|
.next()
|
||||||
.path(enginePath)
|
.path(enginePath)
|
||||||
|
.toggleOptions()
|
||||||
.version(1)
|
.version(1)
|
||||||
.submit();
|
.submit();
|
||||||
await listPage.create();
|
await listPage.create();
|
||||||
|
@ -137,6 +139,7 @@ module('Acceptance | secrets/secret/create', function(hooks) {
|
||||||
await mountSecrets
|
await mountSecrets
|
||||||
.next()
|
.next()
|
||||||
.path(enginePath)
|
.path(enginePath)
|
||||||
|
.toggleOptions()
|
||||||
.version(1)
|
.version(1)
|
||||||
.submit();
|
.submit();
|
||||||
await listPage.create();
|
await listPage.create();
|
||||||
|
|
Loading…
Reference in New Issue