open-vault/ui/app/services/wizard.js

357 lines
11 KiB
JavaScript
Raw Normal View History

import { next } from '@ember/runloop';
import { typeOf } from '@ember/utils';
import Service, { inject as service } from '@ember/service';
2018-08-28 05:03:55 +00:00
import { Machine } from 'xstate';
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
import { capitalize } from '@ember/string';
2018-08-28 05:03:55 +00:00
import getStorage from 'vault/lib/token-storage';
import { STORAGE_KEYS, DEFAULTS, MACHINES } from 'vault/helpers/wizard-constants';
const {
TUTORIAL_STATE,
COMPONENT_STATE,
FEATURE_STATE,
FEATURE_LIST,
FEATURE_STATE_HISTORY,
COMPLETED_FEATURES,
RESUME_URL,
RESUME_ROUTE,
} = STORAGE_KEYS;
const TutorialMachine = Machine(MACHINES.tutorial);
2018-08-28 05:03:55 +00:00
let FeatureMachine = null;
export default Service.extend(DEFAULTS, {
router: service(),
2018-08-28 05:03:55 +00:00
showWhenUnauthenticated: false,
featureMachineHistory: null,
2018-08-28 05:03:55 +00:00
init() {
this._super(...arguments);
this.initializeMachines();
},
initializeMachines() {
if (!this.storageHasKey(TUTORIAL_STATE)) {
2018-08-28 05:03:55 +00:00
let state = TutorialMachine.initialState;
this.saveState('currentState', state.value);
this.saveExtState(TUTORIAL_STATE, state.value);
2018-08-28 05:03:55 +00:00
}
this.saveState('currentState', this.getExtState(TUTORIAL_STATE));
if (this.storageHasKey(COMPONENT_STATE)) {
this.set('componentState', this.getExtState(COMPONENT_STATE));
2018-08-28 05:03:55 +00:00
}
let stateNodes = TutorialMachine.getStateNodes(this.currentState);
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
this.executeActions(
stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []),
null,
'tutorial'
);
if (this.storageHasKey(FEATURE_LIST)) {
this.set('featureList', this.getExtState(FEATURE_LIST));
if (this.storageHasKey(FEATURE_STATE_HISTORY)) {
this.set('featureMachineHistory', this.getExtState(FEATURE_STATE_HISTORY));
2018-08-28 05:03:55 +00:00
}
this.saveState(
'featureState',
this.getExtState(FEATURE_STATE) || (FeatureMachine ? FeatureMachine.initialState : null)
);
this.saveExtState(FEATURE_STATE, this.featureState);
2018-08-28 05:03:55 +00:00
this.buildFeatureMachine();
}
},
clearFeatureData() {
let storage = this.storage();
// empty storage
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
[FEATURE_LIST, FEATURE_STATE, FEATURE_STATE_HISTORY, COMPLETED_FEATURES].forEach((key) =>
storage.removeItem(key)
);
this.set('currentMachine', null);
this.set('featureMachineHistory', null);
this.set('featureState', null);
this.set('featureList', null);
},
2018-08-28 05:03:55 +00:00
restartGuide() {
this.clearFeatureData();
2018-08-28 05:03:55 +00:00
let storage = this.storage();
// empty storage
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
[TUTORIAL_STATE, COMPONENT_STATE, RESUME_URL, RESUME_ROUTE].forEach((key) => storage.removeItem(key));
2018-08-28 05:03:55 +00:00
// reset wizard state
this.setProperties(DEFAULTS);
// restart machines from blank state
this.initializeMachines();
// progress machine to 'active.select'
this.transitionTutorialMachine('idle', 'AUTH');
},
saveFeatureHistory(state) {
if (
this.getCompletedFeatures().length === 0 &&
this.featureMachineHistory === null &&
(state === 'idle' || state === 'wrap')
) {
let newHistory = [state];
this.set('featureMachineHistory', newHistory);
} else {
if (this.featureMachineHistory) {
if (!this.featureMachineHistory.includes(state)) {
let newHistory = this.featureMachineHistory.addObject(state);
this.set('featureMachineHistory', newHistory);
} else {
//we're repeating steps
let stepIndex = this.featureMachineHistory.indexOf(state);
let newHistory = this.featureMachineHistory.splice(0, stepIndex + 1);
this.set('featureMachineHistory', newHistory);
}
}
}
if (this.featureMachineHistory) {
this.saveExtState(FEATURE_STATE_HISTORY, this.featureMachineHistory);
}
},
2018-08-28 05:03:55 +00:00
saveState(stateType, state) {
if (state.value) {
state = state.value;
}
let stateKey = '';
while (typeOf(state) === 'object') {
2018-08-28 05:03:55 +00:00
let newState = Object.keys(state);
stateKey += newState + '.';
state = state[newState];
}
stateKey += state;
this.set(stateType, stateKey);
if (stateType === 'featureState') {
//only track progress if we are on the first step of the first feature
this.saveFeatureHistory(state);
}
2018-08-28 05:03:55 +00:00
},
transitionTutorialMachine(currentState, event, extendedState) {
if (extendedState) {
this.set('componentState', extendedState);
this.saveExtState(COMPONENT_STATE, extendedState);
2018-08-28 05:03:55 +00:00
}
let { actions, value } = TutorialMachine.transition(currentState, event);
this.saveState('currentState', value);
this.saveExtState(TUTORIAL_STATE, this.currentState);
2018-08-28 05:03:55 +00:00
this.executeActions(actions, event, 'tutorial');
},
transitionFeatureMachine(currentState, event, extendedState) {
if (!FeatureMachine || !this.currentState.includes('active')) {
2018-08-28 05:03:55 +00:00
return;
}
if (extendedState) {
this.set('componentState', extendedState);
this.saveExtState(COMPONENT_STATE, extendedState);
2018-08-28 05:03:55 +00:00
}
Ember-cli upgrade from ~3.8 to ~3.20 (#9972) * Update ember-cli to ~3.20 * Remove bad optional-feature * Remove ember-fetch dep * re-install ember-fetch * update model fragments pr * update ember model fragments correct package name * update ember composable helpers to solve array helper error * update ember-concurrency * add back engine dependencies, automatically removed during ember-cli-upgrade * make author-form-options component js file otherwise error * for now comment out withTestWaiter * add eslint-node and fix if not with unless in templates * fix linting for tab index of false is now -1 and add type button to all buttons without types * fix href errors for linting, likely have to come back and fix * using eslint fix flag to fix all this.gets * ember modules codemode removed files that had module twice, will fix in next commit * finish codemode ember-data-codemod needed to rename const model * more this.get removal codemode did not work * cont. removal of this.get * stop mixin rules until figure out how to reconfig them all * smaller eslint ignores * get codemode * testing app small fixes to bring it back after all the changes * small changes to eslint * test removal of getProperties * fix issue with baseKey because value could be unknown needed to add a question mark in nested get * smaller linting fixes * get nested fixes * small linting error fixes * small linting changes * working through more small linting changes * another round of linting modifications * liniting fixes * ember module codemod * quinit dom codemod * angle bracket codemod * discovered that components must have js files * ran all codemods this is all that's left * small changes to fix get needs two object, should not have been using get. * fix issue with one input in form field * fun times with set and onChange from oninput * fix issue with model not being passed through on secret-edit-display * fix issue with yarn run test not working, revert without npm run all * linting and small fix when loading without a selectAuthBackend * fix failing test with ui-wizard issue * fix test failure due to model not being asked for correctly with new changes, probably run into this more. * fix issue with component helper and at props specific to wizard * rename log to clilog due to conflict with new eslint rule * small changes for test failures * component helper at fixes * Revert to old component style something with new one broke this and can't figure it out for now * small fishy smelling test fixes will revisit * small test changes * more small test changes, appears upgrade treats spaces differently * comment out code and test that no longer seems relevant but confirm * clean run on component test though still some potential timing issues on ui-console test * fixing one auth test issue and timing issue on enable-test * small mods * fix this conditional check from upgrade * linting fixes after master merge * package updates using yarn upgrade-interactive * update libraries that did not effect any of the test failures. * update ember truth helpers library * settling tests * Fix ui-panel control group output * fix features selection test failures * Fix auth tests (x-vault-token) * fix shared test * fix issue with data null on backend * Revert "Fix auth tests (x-vault-token)" This reverts commit 89cb174b2f1998efa56d9604d14131415ae65d6f. * Fix auth tests (x-vault-token) without updating this.set * Update redirect-to tests * fix wrapped token test * skip some flaky test * fix issue with href and a tags vs buttons * fix linting * updates to get tests running (#10409) * yarn isntall * increasing resource_class * whoops * trying large * back to xlarge * Fix param issue on transform item routes * test fixes * settle on policies (old) test * fix browserstack test warning and skips of test confirmed worked * Fix redirect-to test * skips * fix transformation test and skip some kmip * Skip tests * Add meep marker to remaining failing tests * Skip test with failing component * rever skip on secret-create test * Skip piece of test that fails due to navigation-input * fix settings test where can and skip in others after confirming * fix circle ci test failures * ssh role settle * Fix navigate-input and add settled to test * Remove extra import * secret cubbyhole and alicloud * Add settled to gcpkms test * settles on redirect to test * Bump browserstack test resource to large * Update browserstack resource size to xlarge * update todos * add back in withTestWaiter * try and fix credentials conditional action added comment instead * Update volatile computed properies to get functions * this step was never reached and we never defined secretType anywhere so I removed * add settled to policy old test * Fix navigate-input on policies and leases * replace ssh test with no var hoping that helps and add settled to other failing tests, unskip console tests * kmip, transit, role test remove a skip and add in settled * fix hover copy button, had to remove some testing functionality * Remove private router service * remove skip on control ssh and ui panel, fix search select by restructuring how to read the error * final bit of working through skipped test * Replace clearNonGlobalModels by linking directly to namespace with href-to * Remove unused var * Fix role-ssh id bug by updating form-field-from-model to form-field-group-loop * Fix transit create id would not update * Update option toggle selector for ssh-role * Fix ssh selector * cleanup pt1 * small clean up * cleanup part2 * Fix computed on pricing-metrics-form * small cleanup based on chelseas comments. Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
2020-12-03 23:00:22 +00:00
let { actions, value } = FeatureMachine.transition(currentState, event, this.componentState);
2018-08-28 05:03:55 +00:00
this.saveState('featureState', value);
this.saveExtState(FEATURE_STATE, value);
2018-08-28 05:03:55 +00:00
this.executeActions(actions, event, 'feature');
// if all features were completed, the FeatureMachine gets nulled
// out and won't exist here as there is no next step
if (FeatureMachine) {
let next;
if (this.currentMachine === 'secrets' && value === 'display') {
next = FeatureMachine.transition(value, 'REPEAT', this.componentState);
2018-08-28 05:03:55 +00:00
} else {
next = FeatureMachine.transition(value, 'CONTINUE', this.componentState);
2018-08-28 05:03:55 +00:00
}
this.saveState('nextStep', next.value);
}
},
saveExtState(key, value) {
this.storage().setItem(key, value);
},
getExtState(key) {
return this.storage().getItem(key);
},
storageHasKey(key) {
return Boolean(this.getExtState(key));
},
executeActions(actions, event, machineType) {
let transitionURL;
let expectedRouteName;
let router = this.router;
2018-08-28 05:03:55 +00:00
for (let action of actions) {
let type = action;
if (action.type) {
type = action.type;
}
switch (type) {
case 'render':
this.set(`${action.level}Component`, action.component);
break;
case 'routeTransition':
expectedRouteName = action.params[0];
transitionURL = router.urlFor(...action.params).replace(/^\/ui/, '');
next(() => {
2018-08-28 05:03:55 +00:00
router.transitionTo(...action.params);
});
break;
case 'saveFeatures':
this.saveFeatures(event.features);
break;
case 'completeFeature':
this.completeFeature();
break;
case 'handleDismissed':
this.handleDismissed();
break;
case 'handlePaused':
this.handlePaused();
return;
case 'handleResume':
this.handleResume();
break;
case 'showTutorialWhenAuthenticated':
this.set('showWhenUnauthenticated', false);
break;
case 'showTutorialAlways':
this.set('showWhenUnauthenticated', true);
break;
case 'clearFeatureData':
this.clearFeatureData();
break;
2018-08-28 05:03:55 +00:00
case 'continueFeature':
this.transitionFeatureMachine(this.featureState, 'CONTINUE', this.componentState);
2018-08-28 05:03:55 +00:00
break;
default:
break;
}
}
if (machineType === 'tutorial') {
return;
}
// if we're transitioning in the actions, we want that url,
// else we want the URL we land on in didTransition in the
// application route - we'll notify the application route to
// update the route
if (transitionURL) {
this.set('expectedURL', transitionURL);
this.set('expectedRouteName', expectedRouteName);
this.set('setURLAfterTransition', false);
} else {
this.set('setURLAfterTransition', true);
}
},
handlePaused() {
let expected = this.expectedURL;
2018-08-28 05:03:55 +00:00
if (expected) {
this.saveExtState(RESUME_URL, this.expectedURL);
this.saveExtState(RESUME_ROUTE, this.expectedRouteName);
2018-08-28 05:03:55 +00:00
}
},
handleResume() {
let resumeURL = this.storage().getItem(RESUME_URL);
2018-08-28 05:03:55 +00:00
if (!resumeURL) {
return;
}
Ember-cli upgrade from ~3.8 to ~3.20 (#9972) * Update ember-cli to ~3.20 * Remove bad optional-feature * Remove ember-fetch dep * re-install ember-fetch * update model fragments pr * update ember model fragments correct package name * update ember composable helpers to solve array helper error * update ember-concurrency * add back engine dependencies, automatically removed during ember-cli-upgrade * make author-form-options component js file otherwise error * for now comment out withTestWaiter * add eslint-node and fix if not with unless in templates * fix linting for tab index of false is now -1 and add type button to all buttons without types * fix href errors for linting, likely have to come back and fix * using eslint fix flag to fix all this.gets * ember modules codemode removed files that had module twice, will fix in next commit * finish codemode ember-data-codemod needed to rename const model * more this.get removal codemode did not work * cont. removal of this.get * stop mixin rules until figure out how to reconfig them all * smaller eslint ignores * get codemode * testing app small fixes to bring it back after all the changes * small changes to eslint * test removal of getProperties * fix issue with baseKey because value could be unknown needed to add a question mark in nested get * smaller linting fixes * get nested fixes * small linting error fixes * small linting changes * working through more small linting changes * another round of linting modifications * liniting fixes * ember module codemod * quinit dom codemod * angle bracket codemod * discovered that components must have js files * ran all codemods this is all that's left * small changes to fix get needs two object, should not have been using get. * fix issue with one input in form field * fun times with set and onChange from oninput * fix issue with model not being passed through on secret-edit-display * fix issue with yarn run test not working, revert without npm run all * linting and small fix when loading without a selectAuthBackend * fix failing test with ui-wizard issue * fix test failure due to model not being asked for correctly with new changes, probably run into this more. * fix issue with component helper and at props specific to wizard * rename log to clilog due to conflict with new eslint rule * small changes for test failures * component helper at fixes * Revert to old component style something with new one broke this and can't figure it out for now * small fishy smelling test fixes will revisit * small test changes * more small test changes, appears upgrade treats spaces differently * comment out code and test that no longer seems relevant but confirm * clean run on component test though still some potential timing issues on ui-console test * fixing one auth test issue and timing issue on enable-test * small mods * fix this conditional check from upgrade * linting fixes after master merge * package updates using yarn upgrade-interactive * update libraries that did not effect any of the test failures. * update ember truth helpers library * settling tests * Fix ui-panel control group output * fix features selection test failures * Fix auth tests (x-vault-token) * fix shared test * fix issue with data null on backend * Revert "Fix auth tests (x-vault-token)" This reverts commit 89cb174b2f1998efa56d9604d14131415ae65d6f. * Fix auth tests (x-vault-token) without updating this.set * Update redirect-to tests * fix wrapped token test * skip some flaky test * fix issue with href and a tags vs buttons * fix linting * updates to get tests running (#10409) * yarn isntall * increasing resource_class * whoops * trying large * back to xlarge * Fix param issue on transform item routes * test fixes * settle on policies (old) test * fix browserstack test warning and skips of test confirmed worked * Fix redirect-to test * skips * fix transformation test and skip some kmip * Skip tests * Add meep marker to remaining failing tests * Skip test with failing component * rever skip on secret-create test * Skip piece of test that fails due to navigation-input * fix settings test where can and skip in others after confirming * fix circle ci test failures * ssh role settle * Fix navigate-input and add settled to test * Remove extra import * secret cubbyhole and alicloud * Add settled to gcpkms test * settles on redirect to test * Bump browserstack test resource to large * Update browserstack resource size to xlarge * update todos * add back in withTestWaiter * try and fix credentials conditional action added comment instead * Update volatile computed properies to get functions * this step was never reached and we never defined secretType anywhere so I removed * add settled to policy old test * Fix navigate-input on policies and leases * replace ssh test with no var hoping that helps and add settled to other failing tests, unskip console tests * kmip, transit, role test remove a skip and add in settled * fix hover copy button, had to remove some testing functionality * Remove private router service * remove skip on control ssh and ui panel, fix search select by restructuring how to read the error * final bit of working through skipped test * Replace clearNonGlobalModels by linking directly to namespace with href-to * Remove unused var * Fix role-ssh id bug by updating form-field-from-model to form-field-group-loop * Fix transit create id would not update * Update option toggle selector for ssh-role * Fix ssh selector * cleanup pt1 * small clean up * cleanup part2 * Fix computed on pricing-metrics-form * small cleanup based on chelseas comments. Co-authored-by: Chelsea Shaw <chelshaw.dev@gmail.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
2020-12-03 23:00:22 +00:00
this.router
.transitionTo(resumeURL)
.followRedirects()
.then(() => {
this.set('expectedRouteName', this.storage().getItem(RESUME_ROUTE));
this.set('expectedURL', resumeURL);
this.initializeMachines();
this.storage().removeItem(RESUME_URL);
});
2018-08-28 05:03:55 +00:00
},
handleDismissed() {
this.storage().removeItem(FEATURE_STATE);
this.storage().removeItem(FEATURE_LIST);
this.storage().removeItem(FEATURE_STATE_HISTORY);
this.storage().removeItem(COMPONENT_STATE);
2018-08-28 05:03:55 +00:00
},
saveFeatures(features) {
this.set('featureList', features);
this.saveExtState(FEATURE_LIST, this.featureList);
2018-08-28 05:03:55 +00:00
this.buildFeatureMachine();
},
buildFeatureMachine() {
if (this.featureList === null) {
2018-08-28 05:03:55 +00:00
return;
}
this.startFeature();
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
let nextFeature = this.featureList.length > 1 ? capitalize(this.featureList.objectAt(1)) : 'Finish';
2018-08-28 05:03:55 +00:00
this.set('nextFeature', nextFeature);
let next;
if (this.currentMachine === 'secrets' && this.featureState === 'display') {
next = FeatureMachine.transition(this.featureState, 'REPEAT', this.componentState);
2018-08-28 05:03:55 +00:00
} else {
next = FeatureMachine.transition(this.featureState, 'CONTINUE', this.componentState);
2018-08-28 05:03:55 +00:00
}
this.saveState('nextStep', next.value);
let stateNodes = FeatureMachine.getStateNodes(this.featureState);
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
this.executeActions(
stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []),
null,
'feature'
);
2018-08-28 05:03:55 +00:00
},
startFeature() {
const FeatureMachineConfig = MACHINES[this.featureList.objectAt(0)];
2018-08-28 05:03:55 +00:00
FeatureMachine = Machine(FeatureMachineConfig);
this.set('currentMachine', this.featureList.objectAt(0));
if (this.storageHasKey(FEATURE_STATE)) {
this.saveState('featureState', this.getExtState(FEATURE_STATE));
} else {
this.saveState('featureState', FeatureMachine.initialState);
}
this.saveExtState(FEATURE_STATE, this.featureState);
},
getCompletedFeatures() {
if (this.storageHasKey(COMPLETED_FEATURES)) {
return this.getExtState(COMPLETED_FEATURES).toArray();
}
return [];
2018-08-28 05:03:55 +00:00
},
completeFeature() {
let features = this.featureList;
2018-08-28 05:03:55 +00:00
let done = features.shift();
if (!this.getExtState(COMPLETED_FEATURES)) {
2018-08-28 05:03:55 +00:00
let completed = [];
completed.push(done);
this.saveExtState(COMPLETED_FEATURES, completed);
2018-08-28 05:03:55 +00:00
} else {
Ember Upgrade to 3.24 (#13443) * Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-17 03:44:29 +00:00
this.saveExtState(COMPLETED_FEATURES, this.getExtState(COMPLETED_FEATURES).toArray().addObject(done));
2018-08-28 05:03:55 +00:00
}
this.saveExtState(FEATURE_LIST, features.length ? features : null);
this.storage().removeItem(FEATURE_STATE);
if (this.featureMachineHistory) {
this.set('featureMachineHistory', []);
this.saveExtState(FEATURE_STATE_HISTORY, []);
}
2018-08-28 05:03:55 +00:00
if (features.length > 0) {
this.buildFeatureMachine();
} else {
this.storage().removeItem(FEATURE_LIST);
2018-08-28 05:03:55 +00:00
FeatureMachine = null;
this.transitionTutorialMachine(this.currentState, 'DONE');
2018-08-28 05:03:55 +00:00
}
},
storage() {
return getStorage();
},
});