Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Add the wizard to the database secret engine #10982

Merged
merged 6 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/10982.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
ui: Adds the wizard to the Database Secret Engine
```
8 changes: 8 additions & 0 deletions ui/app/components/database-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ export default class DatabaseConnectionEdit extends Component {
@service store;
@service router;
@service flashMessages;
@service wizard;

@tracked
showPasswordField = false; // used for edit mode

@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);
Expand Down
12 changes: 12 additions & 0 deletions ui/app/components/database-role-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions ui/app/components/wizard/mounts-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions ui/app/helpers/wizard-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const DEFAULTS = {

export const FEATURE_MACHINE_STEPS = {
secrets: {
connection: 4, // ARG TODO unsure just making this up for now
Monkeychip marked this conversation as resolved.
Show resolved Hide resolved
encryption: 5,
secret: {
list: 4,
Expand Down
34 changes: 34 additions & 0 deletions ui/app/machines/secrets-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export default {
],
on: {
CONTINUE: {
connection: {
cond: type => type === 'database',
},
role: {
cond: type => ['pki', 'aws', 'ssh'].includes(type),
},
Expand All @@ -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' },
Expand Down Expand Up @@ -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' },
Expand All @@ -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'] }],
Expand Down
Loading