diff --git a/changelog/11258.txt b/changelog/11258.txt
new file mode 100644
index 000000000..49d936f5a
--- /dev/null
+++ b/changelog/11258.txt
@@ -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
+```
diff --git a/ui/app/models/database/connection.js b/ui/app/models/database/connection.js
index f5b2bf23b..e80610fa4 100644
--- a/ui/app/models/database/connection.js
+++ b/ui/app/models/database/connection.js
@@ -31,6 +31,7 @@ export default Model.extend({
plugin_name: attr('string', {
label: 'Database plugin',
possibleValues: AVAILABLE_PLUGIN_TYPES,
+ noDefault: true,
}),
verify_connection: attr('boolean', {
defaultValue: true,
diff --git a/ui/app/models/mount-options.js b/ui/app/models/mount-options.js
index 17a89e10c..f0212be11 100644
--- a/ui/app/models/mount-options.js
+++ b/ui/app/models/mount-options.js
@@ -7,6 +7,7 @@ export default Fragment.extend({
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.',
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
}),
});
diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js
index 5d9147f8c..f5a050924 100644
--- a/ui/app/models/secret-engine.js
+++ b/ui/app/models/secret-engine.js
@@ -60,8 +60,17 @@ export default Model.extend({
formFieldGroups: computed('engineType', function() {
let type = this.engineType;
let defaultGroup = { default: ['path'] };
+ let optionsGroup = {
+ 'Method Options': [
+ 'description',
+ 'config.listingVisibility',
+ 'local',
+ 'sealWrap',
+ 'config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
+ ],
+ };
if (type === 'kv' || type === 'generic') {
- defaultGroup.default.push('options.{version}');
+ optionsGroup['Method Options'].unshift('options.{version}');
}
if (type === 'database') {
// 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 [
- defaultGroup,
- {
- 'Method Options': [
- 'description',
- 'config.listingVisibility',
- 'local',
- 'sealWrap',
- 'config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
- ],
- },
- ];
+ return [defaultGroup, optionsGroup];
}),
attrs: computed('formFields', function() {
diff --git a/ui/lib/core/addon/components/message-error.js b/ui/lib/core/addon/components/message-error.js
index 887108af0..67cc7876d 100644
--- a/ui/lib/core/addon/components/message-error.js
+++ b/ui/lib/core/addon/components/message-error.js
@@ -44,7 +44,10 @@ export default Component.extend({
return;
}
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];
}
diff --git a/ui/lib/core/addon/templates/components/form-field.hbs b/ui/lib/core/addon/templates/components/form-field.hbs
index 9a58dcddc..e97f842b5 100644
--- a/ui/lib/core/addon/templates/components/form-field.hbs
+++ b/ui/lib/core/addon/templates/components/form-field.hbs
@@ -38,11 +38,11 @@
(action "setAndBroadcast" valuePath)
value="target.value"
}} data-test-input={{attr.name}}>
- {{#unless attr.options.defaultValue}}
+ {{#if attr.options.noDefault}}
- {{/unless}}
+ {{/if}}
{{#each (path-or-array attr.options.possibleValues model) as |val|}}