diff --git a/changelog/10982.txt b/changelog/10982.txt
new file mode 100644
index 000000000..710247844
--- /dev/null
+++ b/changelog/10982.txt
@@ -0,0 +1,3 @@
+```release-note:feature
+ui: Adds the wizard to the Database Secret Engine
+```
diff --git a/ui/app/components/database-connection.js b/ui/app/components/database-connection.js
index 9eae92aca..efb13943c 100644
--- a/ui/app/components/database-connection.js
+++ b/ui/app/components/database-connection.js
@@ -19,6 +19,7 @@ export default class DatabaseConnectionEdit extends Component {
@service store;
@service router;
@service flashMessages;
+ @service wizard;
@tracked
showPasswordField = false; // used for edit mode
@@ -26,6 +27,13 @@ export default class DatabaseConnectionEdit extends Component {
@tracked
showSaveModal = false; // used for create mode
+ constructor() {
+ super(...arguments);
+ if (this.wizard.featureState === 'details' || this.wizard.featureState === 'connection') {
+ this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', 'database');
+ }
+ }
+
rotateCredentials(backend, name) {
let adapter = this.store.adapterFor('database/connection');
return adapter.rotateRootCredentials(backend, name);
diff --git a/ui/app/components/database-role-edit.js b/ui/app/components/database-role-edit.js
index cc3319bc5..fe87bebfb 100644
--- a/ui/app/components/database-role-edit.js
+++ b/ui/app/components/database-role-edit.js
@@ -9,6 +9,18 @@ const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
export default class DatabaseRoleEdit extends Component {
@service router;
@service flashMessages;
+ @service wizard;
+
+ constructor() {
+ super(...arguments);
+ console.log(this.wizard.featureState, 'featureSTate');
+ if (
+ this.wizard.featureState === 'displayConnection' ||
+ this.wizard.featureState === 'displayRoleDatabase'
+ ) {
+ this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', 'database');
+ }
+ }
@tracked loading = false;
diff --git a/ui/app/components/wizard/mounts-wizard.js b/ui/app/components/wizard/mounts-wizard.js
index 1a2fa74af..657ade04e 100644
--- a/ui/app/components/wizard/mounts-wizard.js
+++ b/ui/app/components/wizard/mounts-wizard.js
@@ -20,6 +20,7 @@ export default Component.extend({
nextStep: computed('fullNextStep', function() {
return this.fullNextStep.split('.').lastObject;
}),
+ needsConnection: equal('mountSubtype', 'database'),
needsEncryption: equal('mountSubtype', 'transit'),
stepComponent: alias('wizard.stepComponent'),
detailsComponent: computed('currentMachine', 'mountSubtype', function() {
diff --git a/ui/app/machines/secrets-machine.js b/ui/app/machines/secrets-machine.js
index 1a75282b5..e50f405f5 100644
--- a/ui/app/machines/secrets-machine.js
+++ b/ui/app/machines/secrets-machine.js
@@ -39,6 +39,9 @@ export default {
],
on: {
CONTINUE: {
+ connection: {
+ cond: type => type === 'database',
+ },
role: {
cond: type => ['pki', 'aws', 'ssh'].includes(type),
},
@@ -51,6 +54,15 @@ export default {
},
},
},
+ connection: {
+ onEntry: [
+ { type: 'render', level: 'step', component: 'wizard/secrets-connection' },
+ { type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
+ ],
+ on: {
+ CONTINUE: 'displayConnection',
+ },
+ },
encryption: {
onEntry: [
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
@@ -87,6 +99,24 @@ export default {
CONTINUE: 'credentials',
},
},
+ displayConnection: {
+ onEntry: [
+ { type: 'render', level: 'step', component: 'wizard/secrets-connection-show' },
+ { type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
+ ],
+ on: {
+ CONTINUE: 'displayRoleDatabase',
+ },
+ },
+ displayRoleDatabase: {
+ onEntry: [
+ { type: 'render', level: 'step', component: 'wizard/secrets-display-database-role' },
+ { type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
+ ],
+ on: {
+ CONTINUE: 'display',
+ },
+ },
secret: {
onEntry: [
{ type: 'render', level: 'step', component: 'wizard/secrets-secret' },
@@ -103,6 +133,10 @@ export default {
],
on: {
REPEAT: {
+ connection: {
+ cond: type => type === 'database',
+ actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
+ },
role: {
cond: type => ['pki', 'aws', 'ssh'].includes(type),
actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
diff --git a/ui/app/templates/components/database-connection.hbs b/ui/app/templates/components/database-connection.hbs
index d4ec905b9..0ecf92af4 100644
--- a/ui/app/templates/components/database-connection.hbs
+++ b/ui/app/templates/components/database-connection.hbs
@@ -16,212 +16,212 @@
{{#if (eq @mode "show")}}
-