Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
01a8428
add xstate
meirish Jul 17, 2018
c9e3d7a
wizard-view
meirish Jul 18, 2018
2f97694
tweak the statechart
meirish Jul 19, 2018
c7aa2c9
preliminary functions and states for main wizard and secrets wizard
Aug 7, 2018
e9cbc3a
transition into feature machine properly, save selected features
Aug 8, 2018
da96f15
add some styles, flesh out secrets
Aug 10, 2018
4fe492c
update guard methods on secrets machine, add init steps
Aug 13, 2018
9f6f17d
add routing action and handle it in the service
meirish Aug 13, 2018
35895bc
start moving init stuff into separate template, add logic to determin…
Aug 16, 2018
aa5632a
add hooks for unseal and setting component state on the service
meirish Aug 17, 2018
da5fd54
use components for each machine state
meirish Aug 21, 2018
d6fd202
move more things into templates
meirish Aug 21, 2018
8fac4b5
apply onEntry for all states on init so template rendering works, and…
meirish Aug 21, 2018
a28a23a
more events to go to nested states
meirish Aug 22, 2018
b20d653
fix state transitions from idle for init
meirish Aug 22, 2018
d3f068c
initial positioning of UI wizard
meirish Aug 22, 2018
adf1dc5
init guide workflow working
meirish Aug 22, 2018
d834740
add SVGs
meirish Aug 23, 2018
0efaf40
move the ui-wizard component to the splash page component for the 'gu…
meirish Aug 23, 2018
7795908
tweak styling on doc link a bit
meirish Aug 23, 2018
89b115b
add styles for wizards
meirish Aug 23, 2018
ed9da83
add WizardContent component
meirish Aug 23, 2018
2753bef
use WizardContent component for init and tutorial components
meirish Aug 23, 2018
8831321
fix init completion flow and route transitioning in machines
meirish Aug 23, 2018
57ac54c
tweak layout
meirish Aug 23, 2018
1c1234a
add dismiss to wizard content and actually fix layout of the drawer
meirish Aug 23, 2018
e5f6a6a
add xstate
meirish Jul 17, 2018
bc23b0e
wizard-view
meirish Jul 18, 2018
66b5834
tweak the statechart
meirish Jul 19, 2018
aa0dd69
preliminary functions and states for main wizard and secrets wizard
Aug 7, 2018
ac220e4
transition into feature machine properly, save selected features
Aug 8, 2018
22033d9
add some styles, flesh out secrets
Aug 10, 2018
b0ae372
update guard methods on secrets machine, add init steps
Aug 13, 2018
0623602
add routing action and handle it in the service
meirish Aug 13, 2018
d623ff9
start moving init stuff into separate template, add logic to determin…
Aug 16, 2018
f2f9f9e
add hooks for unseal and setting component state on the service
meirish Aug 17, 2018
2765521
use components for each machine state
meirish Aug 21, 2018
4545668
move more things into templates
meirish Aug 21, 2018
6700991
apply onEntry for all states on init so template rendering works, and…
meirish Aug 21, 2018
684feb4
more events to go to nested states
meirish Aug 22, 2018
1aa32d8
fix state transitions from idle for init
meirish Aug 22, 2018
d2baeeb
initial positioning of UI wizard
meirish Aug 22, 2018
531ac87
init guide workflow working
meirish Aug 22, 2018
af6464e
add SVGs
meirish Aug 23, 2018
088adc2
move the ui-wizard component to the splash page component for the 'gu…
meirish Aug 23, 2018
280d3db
tweak styling on doc link a bit
meirish Aug 23, 2018
9683b15
add styles for wizards
meirish Aug 23, 2018
e1cd3ba
add WizardContent component
meirish Aug 23, 2018
034fb4a
use WizardContent component for init and tutorial components
meirish Aug 23, 2018
91f3c5b
fix init completion flow and route transitioning in machines
meirish Aug 23, 2018
4b91462
tweak layout
meirish Aug 23, 2018
86b0535
add policies machine with templates and transitions
Aug 22, 2018
cedca4d
lay groundwork for replication
Aug 22, 2018
93b1d6b
hook up tools machine transitions
Aug 23, 2018
9fa7c4c
only transition feature machine if we are active
Aug 23, 2018
5c05a24
update templates to use new WizardContent hotness
Aug 23, 2018
0b2c9ef
update templates to use new WizardContent hotness
Aug 23, 2018
a3d361e
update templates to use new WizardContent hotness
Aug 23, 2018
1c37437
fix conflict
Aug 23, 2018
e84a275
accidentally a bracket
Aug 23, 2018
da21b60
refactor machine building to actually work, hook up policies transitions
Aug 23, 2018
dffb4aa
add new wizard section template and use it to simplify wizard components
Aug 23, 2018
dbefe68
reconfigure secrets machine, add secrets templates
Aug 24, 2018
17a778b
reconfigure secrets machine, add secrets templates (#5181)
madalynrose Aug 24, 2018
c5d4ecc
fix control groups for pro users
meirish Aug 23, 2018
d7dc93d
fix style for dismiss link
meirish Aug 23, 2018
8411ad6
update mount-backend-form to also work for enabling secret engines
meirish Aug 24, 2018
12c21b0
move help text to models and use mount-backend-form on the enable sec…
meirish Aug 24, 2018
23591ba
move secret engine to application serializer
meirish Aug 24, 2018
5fe262f
add partner icon svgs and change i-con component to render them at 48px
meirish Aug 24, 2018
5ad1570
add categories to helpers and render icons on the enable form
meirish Aug 24, 2018
4b8b1ac
two step mount-backend-form component
meirish Aug 24, 2018
d134040
fix sass compilation
meirish Aug 24, 2018
90077f6
fix wizard
meirish Aug 24, 2018
b147aab
stray debugger
meirish Aug 24, 2018
57b624f
remove duplicate wizard
meirish Aug 24, 2018
45bd81e
start building auth machine
Aug 24, 2018
592cbb4
hooking up secrets flow
Aug 24, 2018
034ca61
finish styling new enable form
meirish Aug 24, 2018
4274b41
list by category on the mount-backend-form
meirish Aug 24, 2018
e3a5c06
a little more progress on secrets
Aug 24, 2018
8855fe0
address conflicts
Aug 25, 2018
f5f524e
get secrets (minus roles) working
Aug 25, 2018
992bde5
add complete state
Aug 25, 2018
e425422
Wizards secrets (#5185)
madalynrose Aug 25, 2018
678cc18
style sidebar divider and add logo to engine detail templates
meirish Aug 25, 2018
fd27ccb
add database-engine component
meirish Aug 25, 2018
641a015
simplify features-selection component
meirish Aug 25, 2018
4f4301c
fix secrets machine flow
Aug 25, 2018
a7b0697
fix role advancement
Aug 25, 2018
f02cf86
address conflicts
Aug 25, 2018
7cd9624
add auth templates, work on roles flow
Aug 25, 2018
161830f
fix getting started button
meirish Aug 25, 2018
5cfb88b
style sidebar and hide replication if it's not available
meirish Aug 25, 2018
618e746
disambiguate DONE on tutorial from DONE on init
meirish Aug 25, 2018
8916cf6
add error state for machines, fix secrets flow
Aug 25, 2018
8ee2470
Merge branch 'ui-wizards' into flow-polish
Aug 25, 2018
29408e8
add back classes that were on secrets-wizard
meirish Aug 25, 2018
294862a
remove unused secrets-wizard
meirish Aug 26, 2018
581e8d4
add restart guide functionality
meirish Aug 26, 2018
6c20fa8
fix replication text
meirish Aug 26, 2018
79df179
fix link on replication summary page
meirish Aug 26, 2018
9be891e
hook up replication machine
meirish Aug 26, 2018
e220f88
remove debugger
meirish Aug 26, 2018
aa78cfa
rework enable helpers for tests to work with the new mount-form-backe…
meirish Aug 27, 2018
2f1132a
hook up auth buttons/routes to transition machine
Aug 27, 2018
3768040
Merge branch 'ui-wizards' of github.com:hashicorp/vault into auth-polish
Aug 27, 2018
f015d2a
use something less expensive than toJSON
Aug 27, 2018
7b8586a
Add steps copy
joshuaogle Aug 27, 2018
87729a4
add new step for unsupported secrets, persist componentState, style b…
Aug 27, 2018
6ca733f
oops we want onAdvance, not onDone
Aug 27, 2018
2f8178f
onAdvance for tools too
Aug 27, 2018
a68c639
Hide wizard on mobile for now
joshuaogle Aug 27, 2018
9ed1921
Use tablet breakpoint for hiding wizard
joshuaogle Aug 27, 2018
31bfdb9
Merge pull request #5194 from hashicorp/ui-wizards-mobile
joshuaogle Aug 27, 2018
7a1c2d6
Wizard positioning on mobile
joshuaogle Aug 27, 2018
d316f9f
just kidding we want onAdvance, also add transit flow
Aug 27, 2018
c1602fa
Adjust spacing from viewport
joshuaogle Aug 27, 2018
92cb9ff
update wording for secrets display
Aug 27, 2018
e93b6c8
Merge branch 'ui-wizards' of github.com:hashicorp/vault into wizard-s…
Aug 27, 2018
104af27
omg it works
Aug 27, 2018
4bef355
Styling for select form
joshuaogle Aug 27, 2018
2235ef4
Active state for radio-box
joshuaogle Aug 27, 2018
b3ff629
Alignment for wizard header
joshuaogle Aug 27, 2018
a2dfa79
Merge pull request #5198 from hashicorp/ui-wizards-mobile
joshuaogle Aug 27, 2018
02269f4
Prettier code snippet in wizard
joshuaogle Aug 27, 2018
f48e6b4
handle enable properly
Aug 27, 2018
271642f
Merge branch 'ui-wizards' of github.com:hashicorp/vault into ui-wizards
Aug 27, 2018
ce976cc
remember to remove component state if dismissed
Aug 27, 2018
9a7115d
fix secrets error transition
Aug 27, 2018
9b4d1f9
Text updates
joshuaogle Aug 27, 2018
51796ab
Fix replication summary index
joshuaogle Aug 27, 2018
30207d0
Merge pull request #5199 from hashicorp/ui-wizards-copy
joshuaogle Aug 28, 2018
aa6e5bf
Merge branch 'oss-master' into ui-wizards
meirish Aug 28, 2018
474e7b8
UI wizard pause (#5204)
meirish Aug 28, 2018
b38c390
Merge branch 'master' into ui-wizards
meirish Aug 28, 2018
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
16 changes: 10 additions & 6 deletions ui/app/components/auth-info.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Ember from 'ember';

export default Ember.Component.extend({
auth: Ember.inject.service(),

routing: Ember.inject.service('-routing'),
const { Component, inject, computed, run } = Ember;
export default Component.extend({
auth: inject.service(),
wizard: inject.service(),
routing: inject.service('-routing'),

transitionToRoute: function() {
var router = this.get('routing.router');
Expand All @@ -12,12 +13,15 @@ export default Ember.Component.extend({

classNames: 'user-menu auth-info',

isRenewing: Ember.computed.or('fakeRenew', 'auth.isRenewing'),
isRenewing: computed.or('fakeRenew', 'auth.isRenewing'),

actions: {
restartGuide() {
this.get('wizard').restartGuide();
},
renewToken() {
this.set('fakeRenew', true);
Ember.run.later(() => {
run.later(() => {
this.set('fakeRenew', false);
this.get('auth').renew();
}, 200);
Expand Down
3 changes: 2 additions & 1 deletion ui/app/components/doc-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { Component, computed } = Ember;

export default Component.extend({
tagName: 'a',
classNames: ['doc-link'],
attributeBindings: ['target', 'rel', 'href'],

layout: hbs`{{yield}}`,
Expand All @@ -14,6 +15,6 @@ export default Component.extend({

path: '/',
href: computed('path', function() {
return `https://www.vaultproject.io/docs${this.get('path')}`;
return `https://www.vaultproject.io${this.get('path')}`;
}),
});
30 changes: 26 additions & 4 deletions ui/app/components/generate-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const MODEL_TYPES = {
};

export default Component.extend({
wizard: inject.service(),
store: inject.service(),
routing: inject.service('-routing'),
// set on the component
Expand Down Expand Up @@ -57,6 +58,16 @@ export default Component.extend({
this.createOrReplaceModel();
},

didReceiveAttrs() {
if (this.get('wizard.featureState') === 'displayRole') {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('backend.type')
);
}
},

willDestroy() {
this.get('model').unloadRecord();
this._super(...arguments);
Expand Down Expand Up @@ -84,10 +95,21 @@ export default Component.extend({
create() {
let model = this.get('model');
this.set('loading', true);
model.save().finally(() => {
model.set('hasGenerated', true);
this.set('loading', false);
});
this.model
.save()
.catch(() => {
if (this.get('wizard.featureState') === 'credentials') {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'ERROR',
this.get('backend.type')
);
}
})
.finally(() => {
model.set('hasGenerated', true);
this.set('loading', false);
});
},

codemirrorUpdated(attr, val, codemirror) {
Expand Down
13 changes: 9 additions & 4 deletions ui/app/components/i-con.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import hbs from 'htmlbars-inline-precompile';

const { computed } = Ember;
const GLYPHS_WITH_SVG_TAG = [
'learn',
'video',
'tour',
'stopwatch',
'download',
'folder',
'file',
Expand All @@ -16,7 +20,7 @@ const GLYPHS_WITH_SVG_TAG = [
'upload',
'control-lock',
'edition-enterprise',
'edition-oss'
'edition-oss',
];

export default Ember.Component.extend({
Expand All @@ -40,11 +44,12 @@ export default Ember.Component.extend({
glyph: null,

excludeSVG: computed('glyph', function() {
return GLYPHS_WITH_SVG_TAG.includes(this.get('glyph'));
let glyph = this.get('glyph');
return glyph.startsWith('enable/') || GLYPHS_WITH_SVG_TAG.includes(glyph);
}),

size: computed(function() {
return 12;
size: computed('glyph', function() {
return this.get('glyph').startsWith('enable/') ? 48 : 12;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This strikes me as surprising. I wouldn't expect certain icons to get special treatment implicitly.

}),

partialName: computed('glyph', function() {
Expand Down
69 changes: 55 additions & 14 deletions ui/app/components/mount-backend-form.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import Ember from 'ember';
import { task } from 'ember-concurrency';
import { methods } from 'vault/helpers/mountable-auth-methods';
import { engines } from 'vault/helpers/mountable-secret-engines';

const { inject } = Ember;
const { inject, computed, Component } = Ember;
const METHODS = methods();
const ENGINES = engines();

export default Ember.Component.extend({
export default Component.extend({
store: inject.service(),
wizard: inject.service(),
flashMessages: inject.service(),
routing: inject.service('-routing'),

Expand Down Expand Up @@ -38,23 +41,29 @@ export default Ember.Component.extend({
*/
mountModel: null,

showConfig: false,

init() {
this._super(...arguments);
const type = this.get('mountType');
const modelType = type === 'secret' ? 'secret-engine' : 'auth-method';
const model = this.get('store').createRecord(modelType);
this.set('mountModel', model);
this.changeConfigModel(model.get('type'));
},

mountTypes: computed('mountType', function() {
return this.get('mountType') === 'secret' ? ENGINES : METHODS;
}),

willDestroy() {
// if unsaved, we want to unload so it doesn't show up in the auth mount list
this.get('mountModel').rollbackAttributes();
},

getConfigModelType(methodType) {
let mountType = this.get('mountType');
let noConfig = ['approle'];
if (noConfig.includes(methodType)) {
if (mountType === 'secret' || noConfig.includes(methodType)) {
return;
}
if (methodType === 'aws') {
Expand All @@ -64,27 +73,32 @@ export default Ember.Component.extend({
},

changeConfigModel(methodType) {
const mount = this.get('mountModel');
const configRef = mount.hasMany('authConfigs').value();
const currentConfig = configRef.get('firstObject');
let mount = this.get('mountModel');
if (this.get('mountType') === 'secret') {
return;
}
let configRef = mount.hasMany('authConfigs').value();
let currentConfig = configRef.get('firstObject');
if (currentConfig) {
// rollbackAttributes here will remove the the config model from the store
// because `isNew` will be true
currentConfig.rollbackAttributes();
currentConfig.unloadRecord();
}
const configType = this.getConfigModelType(methodType);
let configType = this.getConfigModelType(methodType);
if (!configType) return;
const config = this.get('store').createRecord(configType);
let config = this.get('store').createRecord(configType);
config.set('backend', mount);
},

checkPathChange(type) {
const mount = this.get('mountModel');
const currentPath = mount.get('path');
let mount = this.get('mountModel');
let currentPath = mount.get('path');
let list = this.get('mountTypes');
// if the current path matches a type (meaning the user hasn't altered it),
// change it here to match the new type
const isUnchanged = METHODS.findBy('type', currentPath);
if (isUnchanged) {
let isUnchanged = list.findBy('type', currentPath);
if (!currentPath || isUnchanged) {
mount.set('path', type);
}
},
Expand All @@ -101,6 +115,10 @@ export default Ember.Component.extend({
this.get('flashMessages').success(
`Successfully mounted ${type} ${this.get('mountType')} method at ${path}.`
);
if (this.get('mountType') === 'secret') {
yield this.get('onMountSuccess')(type, path);
return;
}
yield this.get('saveConfig').perform(mountModel);
}).drop(),

Expand All @@ -111,11 +129,16 @@ export default Ember.Component.extend({
try {
if (config && Object.keys(config.changedAttributes()).length) {
yield config.save();
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('mountModel').get('type')
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to make a special method for this pattern? Something like...

// wizard.js
next(extendedState) {
  return this.transitionFeatureMachine(this.get('featureState'), 'CONTINUE', extendedState);
}

// this-file.js
try {
  if (config && Object.keys(config.changedAttributes()).length) {
    yield config.save()
    this.get('wizard').next(this.get('mountModel').get('type'));
  }
} catch (err) {
  // ...
}

this.get('flashMessages').success(
`The config for ${type} ${this.get('mountType')} method at ${path} was saved successfully.`
);
}
yield this.get('onMountSuccess')();
yield this.get('onMountSuccess')(type, path);
} catch (err) {
this.get('flashMessages').danger(
`There was an error saving the configuration for ${type} ${this.get(
Expand All @@ -129,9 +152,27 @@ export default Ember.Component.extend({
actions: {
onTypeChange(path, value) {
if (path === 'type') {
this.get('wizard').set('componentState', value);
this.changeConfigModel(value);
this.checkPathChange(value);
}
},

toggleShowConfig(value) {
this.set('showConfig', value);
if (value === true && this.get('wizard.featureState') === 'idle') {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('mountModel').get('type')
);
} else {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'RESET',
this.get('mountModel').get('type')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another one! Maybe it also makes sense to "curry" this for two arguments as well as three and one?

// wizard.js

// Total control
transitionFeatureMachine(currentState, event, extendedState) {},

// Assume internally tracked state
transition(event, extendedState) {
  this.transitionFeatureMachine(this.get('wizard.featureState'), event, extendedState);
},

// Convenience methods for common event types 
next(extendedState) { this.transition('CONTINUE', extendedState); },
reset(extendedState) { this.transition('RESET', extendedState); },

Just looking for ways to reduce boilerplate and abstract away some internals.

);
}
},
},
});
11 changes: 11 additions & 0 deletions ui/app/components/outer-html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// THIS COMPONENT IS ONLY FOR EXTENDING
// You should use this component if you want to use outerHTML symantics

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/symantics/semantics

// in your components - this is the default for upcoming Glimmer components
import Ember from 'ember';

export default Ember.Component.extend({
tagName: '',
});

// yep! that's it, it's more of a way to keep track of what components
// use tagless semantics to make the upgrade to glimmer components easier

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 helpful comment!

2 changes: 1 addition & 1 deletion ui/app/components/popup-menu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: '',
tagName: 'span',
});
15 changes: 10 additions & 5 deletions ui/app/components/replication-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
import decodeConfigFromJWT from 'vault/utils/decode-config-from-jwt';
import ReplicationActions from 'vault/mixins/replication-actions';

const { computed, get } = Ember;
const { computed, get, Component, inject } = Ember;

const DEFAULTS = {
mode: 'primary',
Expand All @@ -17,7 +17,9 @@ const DEFAULTS = {
replicationMode: 'dr',
};

export default Ember.Component.extend(ReplicationActions, DEFAULTS, {
export default Component.extend(ReplicationActions, DEFAULTS, {
wizard: inject.service(),
version: inject.service(),
didReceiveAttrs() {
this._super(...arguments);
const initialReplicationMode = this.get('initialReplicationMode');
Expand All @@ -28,7 +30,6 @@ export default Ember.Component.extend(ReplicationActions, DEFAULTS, {
showModeSummary: false,
initialReplicationMode: null,
cluster: null,
version: Ember.inject.service(),

replicationAttrs: computed.alias('cluster.replicationAttrs'),

Expand All @@ -55,7 +56,6 @@ export default Ember.Component.extend(ReplicationActions, DEFAULTS, {
) {
return false;
}

return true;
}
),
Expand All @@ -66,7 +66,12 @@ export default Ember.Component.extend(ReplicationActions, DEFAULTS, {

actions: {
onSubmit(/*action, mode, data, event*/) {
return this.submitHandler(...arguments);
let promise = this.submitHandler(...arguments);
let wizard = this.get('wizard');
promise.then(() => {
wizard.transitionFeatureMachine(wizard.get('featureState'), 'ENABLEREPLICATION');
});
return promise;
},

clear() {
Expand Down
10 changes: 3 additions & 7 deletions ui/app/components/role-aws-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ const { get, set } = Ember;
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';

export default RoleEdit.extend({
init() {
this._super(...arguments);
},

actions: {
createOrUpdate(type, event) {
event.preventDefault();
Expand All @@ -21,13 +17,13 @@ export default RoleEdit.extend({
}

var credential_type = get(this, 'model.credential_type');
if (credential_type == "iam_user") {
if (credential_type == 'iam_user') {
set(this, 'model.role_arns', []);
}
if (credential_type == "assumed_role") {
if (credential_type == 'assumed_role') {
set(this, 'model.policy_arns', []);
}
if (credential_type == "federation_token") {
if (credential_type == 'federation_token') {
set(this, 'model.role_arns', []);
set(this, 'model.policy_arns', []);
}
Expand Down
Loading