2021-05-06 18:29:39 +00:00
import Ember from 'ember' ;
2019-02-14 15:39:19 +00:00
import { next } from '@ember/runloop' ;
2018-09-25 16:28:26 +00:00
import { inject as service } from '@ember/service' ;
import { match , alias , or } from '@ember/object/computed' ;
import { assign } from '@ember/polyfills' ;
import { dasherize } from '@ember/string' ;
import Component from '@ember/component' ;
2021-04-26 16:23:57 +00:00
import { computed } from '@ember/object' ;
2018-04-03 14:16:57 +00:00
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends' ;
2021-05-06 18:29:39 +00:00
import { task , timeout } from 'ember-concurrency' ;
2021-12-17 03:44:29 +00:00
import { waitFor } from '@ember/test-waiters' ;
2018-04-03 14:16:57 +00:00
const BACKENDS = supportedAuthBackends ( ) ;
2018-04-17 22:04:34 +00:00
2019-04-03 21:06:20 +00:00
/ * *
* @ module AuthForm
* The ` AuthForm ` is used to sign users into Vault .
*
* @ example ` ` ` js
* // All properties are passed in via query params.
2022-02-17 22:40:25 +00:00
* < AuthForm @ wrappedToken = { { wrappedToken } } @ cluster = { { model } } @ namespace = { { namespaceQueryParam } } @ selectedAuth = { { authMethod } } @ onSuccess = { { action this . onSuccess } } / > ` ` `
2019-04-03 21:06:20 +00:00
*
2022-02-17 22:40:25 +00:00
* @ param { string } wrappedToken - The auth method that is currently selected in the dropdown .
* @ param { object } cluster - The auth method that is currently selected in the dropdown . This corresponds to an Ember Model .
* @ param { string } namespace - The currently active namespace .
* @ param { string } selectedAuth - The auth method that is currently selected in the dropdown .
* @ param { function } onSuccess - Fired on auth success
2019-04-03 21:06:20 +00:00
* /
2018-04-17 22:04:34 +00:00
const DEFAULTS = {
token : null ,
username : null ,
password : null ,
2018-07-20 21:48:25 +00:00
customPath : null ,
2018-04-17 22:04:34 +00:00
} ;
2018-09-25 16:28:26 +00:00
export default Component . extend ( DEFAULTS , {
router : service ( ) ,
auth : service ( ) ,
flashMessages : service ( ) ,
store : service ( ) ,
csp : service ( 'csp-event' ) ,
2018-07-05 18:28:12 +00:00
2019-02-14 15:39:19 +00:00
// passed in via a query param
2018-07-05 18:28:12 +00:00
selectedAuth : null ,
methods : null ,
cluster : null ,
2018-08-16 17:48:24 +00:00
namespace : null ,
2018-09-25 16:28:26 +00:00
wrappedToken : null ,
2018-08-16 17:48:24 +00:00
// internal
oldNamespace : null ,
2022-03-17 22:41:41 +00:00
authMethods : BACKENDS ,
2019-10-01 20:30:56 +00:00
2018-08-16 17:48:24 +00:00
didReceiveAttrs ( ) {
this . _super ( ... arguments ) ;
2019-10-01 20:30:56 +00:00
let {
wrappedToken : token ,
oldWrappedToken : oldToken ,
oldNamespace : oldNS ,
namespace : ns ,
selectedAuth : newMethod ,
oldSelectedAuth : oldMethod ,
} = this ;
2018-08-16 17:48:24 +00:00
2019-10-01 20:30:56 +00:00
next ( ( ) => {
if ( ! token && ( oldNS === null || oldNS !== ns ) ) {
this . fetchMethods . perform ( ) ;
}
this . set ( 'oldNamespace' , ns ) ;
// we only want to trigger this once
if ( token && ! oldToken ) {
this . unwrapToken . perform ( token ) ;
this . set ( 'oldWrappedToken' , token ) ;
}
if ( oldMethod && oldMethod !== newMethod ) {
this . resetDefaults ( ) ;
}
this . set ( 'oldSelectedAuth' , newMethod ) ;
} ) ;
2018-08-16 17:48:24 +00:00
} ,
2018-07-05 18:28:12 +00:00
2018-04-03 14:16:57 +00:00
didRender ( ) {
2018-07-05 18:28:12 +00:00
this . _super ( ... arguments ) ;
2018-04-03 14:16:57 +00:00
// on very narrow viewports the active tab may be overflowed, so we scroll it into view here
2018-07-05 18:28:12 +00:00
let activeEle = this . element . querySelector ( 'li.is-active' ) ;
if ( activeEle ) {
activeEle . scrollIntoView ( ) ;
}
2019-10-01 20:30:56 +00:00
next ( ( ) => {
let firstMethod = this . firstMethod ( ) ;
// set `with` to the first method
if (
! this . wrappedToken &&
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 . fetchMethods . isIdle && firstMethod && ! this . selectedAuth ) ||
( this . selectedAuth && ! this . selectedAuthBackend ) )
2019-10-01 20:30:56 +00:00
) {
this . set ( 'selectedAuth' , firstMethod ) ;
}
} ) ;
2018-07-05 18:28:12 +00:00
} ,
firstMethod ( ) {
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 firstMethod = this . methodsToShow . firstObject ;
2018-09-25 16:28:26 +00:00
if ( ! firstMethod ) return ;
2018-07-05 18:28:12 +00:00
// prefer backends with a path over those with a type
2021-04-26 16:23:57 +00:00
return firstMethod . path || firstMethod . type ;
2018-04-03 14:16:57 +00:00
} ,
2018-04-17 22:04:34 +00:00
resetDefaults ( ) {
this . setProperties ( DEFAULTS ) ;
} ,
2018-09-25 16:28:26 +00:00
selectedAuthIsPath : match ( 'selectedAuth' , /\/$/ ) ,
2019-10-01 20:30:56 +00:00
selectedAuthBackend : computed (
'wrappedToken' ,
'methods' ,
'methods.[]' ,
'selectedAuth' ,
'selectedAuthIsPath' ,
2021-12-17 03:44:29 +00:00
function ( ) {
2019-10-01 20:30:56 +00:00
let { wrappedToken , methods , selectedAuth , selectedAuthIsPath : keyIsPath } = this ;
if ( ! methods && ! wrappedToken ) {
return { } ;
}
if ( keyIsPath ) {
return methods . findBy ( 'path' , selectedAuth ) ;
}
return BACKENDS . findBy ( 'type' , selectedAuth ) ;
2018-09-25 16:28:26 +00:00
}
2019-10-01 20:30:56 +00:00
) ,
2018-04-03 14:16:57 +00:00
2021-12-17 03:44:29 +00:00
providerName : computed ( 'selectedAuthBackend.type' , function ( ) {
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
if ( ! this . selectedAuthBackend ) {
return ;
}
let type = this . selectedAuthBackend . type || 'token' ;
2018-07-05 18:28:12 +00:00
type = type . toLowerCase ( ) ;
2018-09-25 16:28:26 +00:00
let templateName = dasherize ( type ) ;
2021-05-25 17:31:48 +00:00
return templateName ;
2018-04-03 14:16:57 +00:00
} ) ,
2018-09-25 16:28:26 +00:00
hasCSPError : alias ( 'csp.connectionViolations.firstObject' ) ,
2018-04-05 21:36:33 +00:00
cspErrorText : ` This is a standby Vault node but can't communicate with the active node via request forwarding. Sign in at the active node to use the Vault UI. ` ,
2021-12-17 03:44:29 +00:00
allSupportedMethods : computed ( 'methodsToShow' , 'hasMethodsWithPath' , function ( ) {
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 hasMethodsWithPath = this . hasMethodsWithPath ;
let methodsToShow = this . methodsToShow ;
2018-07-05 18:28:12 +00:00
return hasMethodsWithPath ? methodsToShow . concat ( BACKENDS ) : methodsToShow ;
} ) ,
2021-12-17 03:44:29 +00:00
hasMethodsWithPath : computed ( 'methodsToShow' , function ( ) {
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
return this . methodsToShow . isAny ( 'path' ) ;
2018-07-05 18:28:12 +00:00
} ) ,
2021-12-17 03:44:29 +00:00
methodsToShow : computed ( 'methods' , function ( ) {
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 methods = this . methods || [ ] ;
2021-12-17 03:44:29 +00:00
let shownMethods = methods . filter ( ( m ) =>
BACKENDS . find ( ( b ) => b . type . toLowerCase ( ) === m . type . toLowerCase ( ) )
) ;
2018-07-05 18:28:12 +00:00
return shownMethods . length ? shownMethods : BACKENDS ;
} ) ,
2021-12-17 03:44:29 +00:00
unwrapToken : task (
waitFor ( function * ( token ) {
// will be using the Token Auth Method, so set it here
this . set ( 'selectedAuth' , 'token' ) ;
let adapter = this . store . adapterFor ( 'tools' ) ;
try {
let response = yield adapter . toolAction ( 'unwrap' , null , { clientToken : token } ) ;
this . set ( 'token' , response . auth . client _token ) ;
this . send ( 'doSubmit' ) ;
} catch ( e ) {
this . set ( 'error' , ` Token unwrap failed: ${ e . errors [ 0 ] } ` ) ;
}
} )
) ,
2018-07-05 18:28:12 +00:00
2021-12-17 03:44:29 +00:00
fetchMethods : task (
waitFor ( function * ( ) {
let store = this . store ;
try {
let methods = yield store . findAll ( 'auth-method' , {
adapterOptions : {
unauthenticated : true ,
} ,
} ) ;
this . set (
'methods' ,
methods . map ( ( m ) => {
const method = m . serialize ( { includeId : true } ) ;
return {
... method ,
mountDescription : method . description ,
} ;
} )
) ;
next ( ( ) => {
store . unloadAll ( 'auth-method' ) ;
} ) ;
} catch ( e ) {
this . set ( 'error' , ` There was an error fetching Auth Methods: ${ e . errors [ 0 ] } ` ) ;
}
} )
) ,
2018-08-16 17:48:24 +00:00
2019-02-14 15:39:19 +00:00
showLoading : or ( 'isLoading' , 'authenticate.isRunning' , 'fetchMethods.isRunning' , 'unwrapToken.isRunning' ) ,
2018-08-16 17:48:24 +00:00
2021-12-17 03:44:29 +00:00
authenticate : task (
waitFor ( function * ( backendType , data ) {
let clusterId = this . cluster . id ;
try {
2022-02-17 22:40:25 +00:00
this . delayAuthMessageReminder . perform ( ) ;
const authResponse = yield this . auth . authenticate ( { clusterId , backend : backendType , data } ) ;
this . onSuccess ( authResponse , backendType , data ) ;
2022-02-17 20:17:59 +00:00
} catch ( e ) {
2022-02-17 22:40:25 +00:00
this . set ( 'loading' , false ) ;
if ( ! this . auth . mfaError ) {
this . set ( 'error' , ` Authentication failed: ${ this . auth . handleError ( e ) } ` ) ;
}
2021-12-17 03:44:29 +00:00
}
} )
) ,
2018-10-02 13:53:39 +00:00
2021-12-17 03:44:29 +00:00
delayAuthMessageReminder : task ( function * ( ) {
2021-05-06 18:29:39 +00:00
if ( Ember . testing ) {
this . showLoading = true ;
yield timeout ( 0 ) ;
2022-02-17 22:40:25 +00:00
} else {
yield timeout ( 5000 ) ;
2021-05-06 18:29:39 +00:00
}
} ) ,
2018-04-03 14:16:57 +00:00
actions : {
2018-04-17 22:04:34 +00:00
doSubmit ( ) {
2019-02-14 15:39:19 +00:00
let passedData , e ;
if ( arguments . length > 1 ) {
[ passedData , e ] = arguments ;
} else {
[ e ] = arguments ;
}
if ( e ) {
e . preventDefault ( ) ;
}
2018-04-17 22:04:34 +00:00
let data = { } ;
2018-04-03 14:16:57 +00:00
this . setProperties ( {
error : null ,
} ) ;
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 backend = this . selectedAuthBackend || { } ;
2018-07-05 18:28:12 +00:00
let backendMeta = BACKENDS . find (
2021-12-17 03:44:29 +00:00
( b ) => ( b . type || '' ) . toLowerCase ( ) === ( backend . type || '' ) . toLowerCase ( )
2018-07-05 18:28:12 +00:00
) ;
2021-04-26 16:23:57 +00:00
let attributes = ( backendMeta || { } ) . formAttributes || [ ] ;
2018-04-17 22:04:34 +00:00
2018-09-25 16:28:26 +00:00
data = assign ( data , this . getProperties ( ... attributes ) ) ;
2019-02-14 15:39:19 +00:00
if ( passedData ) {
data = assign ( data , passedData ) ;
}
2021-04-26 16:23:57 +00:00
if ( this . customPath || backend . id ) {
data . path = this . customPath || backend . id ;
2018-04-03 14:16:57 +00:00
}
2019-02-14 15:39:19 +00:00
return this . authenticate . unlinked ( ) . perform ( backend . type , data ) ;
2018-04-03 14:16:57 +00:00
} ,
2019-04-09 17:42:51 +00:00
handleError ( e ) {
2022-02-17 22:40:25 +00:00
this . setProperties ( {
loading : false ,
error : e ? this . auth . handleError ( e ) : null ,
} ) ;
2019-04-09 17:42:51 +00:00
} ,
2018-04-03 14:16:57 +00:00
} ,
} ) ;