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>
This commit is contained in:
parent
5e316537f2
commit
5c2a08de6d
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:change
|
||||||
|
ui: Upgrade Ember to version 3.24
|
||||||
|
```
|
|
@ -0,0 +1,3 @@
|
||||||
|
defaults
|
||||||
|
not IE 11
|
||||||
|
maintained node versions
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
/coverage/
|
/coverage/
|
||||||
|
!.*
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
# ember-try
|
# ember-try
|
||||||
/.node_modules.ember-try/
|
/.node_modules.ember-try/
|
||||||
|
|
|
@ -12,21 +12,28 @@ module.exports = {
|
||||||
legacyDecorators: true,
|
legacyDecorators: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: ['ember', 'prettier'],
|
plugins: ['ember'],
|
||||||
extends: ['eslint:recommended', 'plugin:ember/recommended', 'prettier'],
|
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es6: true,
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
// TODO revisit once figure out how to replace, added during upgrade to 3.20
|
'no-console': 'warn',
|
||||||
'ember/no-new-mixins': 'off',
|
'ember/no-mixins': 'warn',
|
||||||
'ember/no-mixins': 'off',
|
'ember/no-new-mixins': 'off', // should be warn but then every line of the mixin is green
|
||||||
|
// need to be fully glimmerized before these rules can be turned on
|
||||||
|
'ember/no-classic-classes': 'off',
|
||||||
|
'ember/no-classic-components': 'off',
|
||||||
|
'ember/no-actions-hash': 'off',
|
||||||
|
'ember/require-tagless-components': 'off',
|
||||||
|
'ember/no-component-lifecycle-hooks': 'off',
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
// node files
|
// node files
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
|
'.eslintrc.js',
|
||||||
|
'.prettierrc.js',
|
||||||
'.template-lintrc.js',
|
'.template-lintrc.js',
|
||||||
'ember-cli-build.js',
|
'ember-cli-build.js',
|
||||||
'testem.js',
|
'testem.js',
|
||||||
|
@ -34,10 +41,10 @@ module.exports = {
|
||||||
'config/**/*.js',
|
'config/**/*.js',
|
||||||
'lib/*/index.js',
|
'lib/*/index.js',
|
||||||
'scripts/start-vault.js',
|
'scripts/start-vault.js',
|
||||||
|
'server/**/*.js',
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'script',
|
sourceType: 'script',
|
||||||
ecmaVersion: 2018,
|
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: false,
|
browser: false,
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
/.sass-cache
|
/.sass-cache
|
||||||
|
/.eslintcache
|
||||||
/connect.lock
|
/connect.lock
|
||||||
/coverage/
|
/coverage/
|
||||||
/libpeerconnection.log
|
/libpeerconnection.log
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# unconventional js
|
||||||
|
/blueprints/*/files/
|
||||||
|
/vendor/
|
||||||
|
|
||||||
|
# compiled output
|
||||||
|
/dist/
|
||||||
|
/tmp/
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/bower_components/
|
||||||
|
/node_modules/
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/coverage/
|
||||||
|
!.*
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# ember-try
|
||||||
|
/.node_modules.ember-try/
|
||||||
|
/bower.json.ember-try
|
||||||
|
/package.json.ember-try
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "es5",
|
|
||||||
"printWidth": 110
|
|
||||||
}
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
singleQuote: true,
|
||||||
|
trailingComma: 'es5',
|
||||||
|
printWidth: 110,
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: '*.hbs',
|
||||||
|
options: {
|
||||||
|
singleQuote: false,
|
||||||
|
printWidth: 125,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -7,8 +7,8 @@ function loadStories() {
|
||||||
// automatically import all files ending in *.stories.js
|
// automatically import all files ending in *.stories.js
|
||||||
const appStories = require.context('../stories', true, /.stories.js$/);
|
const appStories = require.context('../stories', true, /.stories.js$/);
|
||||||
const addonAndRepoStories = require.context('../lib', true, /.stories.js$/);
|
const addonAndRepoStories = require.context('../lib', true, /.stories.js$/);
|
||||||
appStories.keys().forEach(filename => appStories(filename));
|
appStories.keys().forEach((filename) => appStories(filename));
|
||||||
addonAndRepoStories.keys().forEach(filename => addonAndRepoStories(filename));
|
addonAndRepoStories.keys().forEach((filename) => addonAndRepoStories(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
addParameters({
|
addParameters({
|
||||||
|
@ -16,7 +16,7 @@ addParameters({
|
||||||
options: { theme },
|
options: { theme },
|
||||||
});
|
});
|
||||||
|
|
||||||
addDecorator(storyFn => {
|
addDecorator((storyFn) => {
|
||||||
const { template, context } = storyFn();
|
const { template, context } = storyFn();
|
||||||
|
|
||||||
// flight icon sprite must be inserted into dom for icon lookup via use element
|
// flight icon sprite must be inserted into dom for icon lookup via use element
|
||||||
|
|
|
@ -1,27 +1,17 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: 'recommended',
|
extends: ['octane', 'stylistic'],
|
||||||
rules: {
|
rules: {
|
||||||
// should definitely move to template only
|
'no-bare-strings': 'off',
|
||||||
// glimmer components for this one
|
'no-action': 'off',
|
||||||
'no-partial': false,
|
'no-duplicate-landmark-elements': 'warn',
|
||||||
|
'no-implicit-this': {
|
||||||
// these need to be looked into, but
|
allow: ['supported-auth-backends'],
|
||||||
// may be a bigger change
|
|
||||||
'no-invalid-interactive': false,
|
|
||||||
'simple-unless': false,
|
|
||||||
|
|
||||||
'self-closing-void-elements': false,
|
|
||||||
'no-unnecessary-concat': false,
|
|
||||||
'no-quoteless-attributes': false,
|
|
||||||
'no-nested-interactive': false,
|
|
||||||
|
|
||||||
// not sure we'll ever want these on,
|
|
||||||
// would be nice but if prettier isn't doing
|
|
||||||
// it for us, then not sure it's worth it
|
|
||||||
'attribute-indentation': false,
|
|
||||||
'block-indentation': false,
|
|
||||||
quotes: false,
|
|
||||||
},
|
},
|
||||||
|
'require-input-label': 'off',
|
||||||
|
'no-down-event-binding': 'warn',
|
||||||
|
'self-closing-void-elements': 'off',
|
||||||
|
},
|
||||||
|
ignore: ['lib/story-md', 'tests/**'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,90 @@
|
||||||
## Module Report
|
## Module Report
|
||||||
### Unknown Global
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `app/components/auth-jwt.js` at line 9
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
/* eslint-disable ember/no-ember-testing-in-module-scope */
|
||||||
|
const WAIT_TIME = Ember.testing ? 0 : 500;
|
||||||
|
const ERROR_WINDOW_CLOSED =
|
||||||
|
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `app/components/auth-form.js` at line 252
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
delayAuthMessageReminder: task(function*() {
|
||||||
|
if (Ember.testing) {
|
||||||
|
this.showLoading = true;
|
||||||
|
yield timeout(0);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `app/routes/vault/cluster/logout.js` at line 30
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.flashMessages.clearMessages();
|
||||||
|
this.permissions.reset();
|
||||||
|
if (Ember.testing) {
|
||||||
|
// Don't redirect on the test
|
||||||
|
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `app/components/mount-backend-form.js` at line 100
|
||||||
|
|
||||||
|
```js
|
||||||
|
capabilities = yield this.store.findRecord('capabilities', `${path}/config`);
|
||||||
|
} catch (err) {
|
||||||
|
if (Ember.testing) {
|
||||||
|
//captures mount-backend-form component test
|
||||||
|
yield mountModel.save();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `app/components/oidc-consent-block.js` at line 47
|
||||||
|
|
||||||
|
```js
|
||||||
|
let { redirect, ...params } = this.args;
|
||||||
|
let redirectUrl = this.buildUrl(redirect, params);
|
||||||
|
if (Ember.testing) {
|
||||||
|
this.args.testRedirect(redirectUrl.toString());
|
||||||
|
} else {
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
|
**Location**: `lib/core/addon/components/ttl-form.js` at line 82
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.set('time', parsedTime);
|
||||||
|
this.handleChange();
|
||||||
|
if (Ember.testing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Unknown Global
|
||||||
|
|
||||||
**Global**: `Ember.onerror`
|
**Global**: `Ember.onerror`
|
||||||
|
|
||||||
**Location**: `tests/helpers/wait-for-error.js` at line 5
|
**Location**: `tests/helpers/wait-for-error.js` at line 5
|
||||||
|
@ -143,34 +227,6 @@ export default function waitForError(opts) {
|
||||||
|
|
||||||
**Global**: `Ember.testing`
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
**Location**: `app/components/auth-jwt.js` at line 9
|
|
||||||
|
|
||||||
```js
|
|
||||||
|
|
||||||
/* eslint-disable ember/no-ember-testing-in-module-scope */
|
|
||||||
const WAIT_TIME = Ember.testing ? 0 : 500;
|
|
||||||
const ERROR_WINDOW_CLOSED =
|
|
||||||
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Unknown Global
|
|
||||||
|
|
||||||
**Global**: `Ember.testing`
|
|
||||||
|
|
||||||
**Location**: `app/components/auth-jwt.js` at line 119
|
|
||||||
|
|
||||||
```js
|
|
||||||
exchangeOIDC: task(function*(event, oidcWindow) {
|
|
||||||
// in non-incognito mode we need to use a timeout because it takes time before oidcState is written to local storage.
|
|
||||||
let oidcState = Ember.testing
|
|
||||||
? event.storageArea.getItem('oidcState')
|
|
||||||
: yield timeout(1000).then(() => event.storageArea.getItem('oidcState'));
|
|
||||||
```
|
|
||||||
|
|
||||||
### Unknown Global
|
|
||||||
|
|
||||||
**Global**: `Ember.testing`
|
|
||||||
|
|
||||||
**Location**: `app/routes/vault.js` at line 7
|
**Location**: `app/routes/vault.js` at line 7
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -185,7 +241,7 @@ export default Route.extend({
|
||||||
|
|
||||||
**Global**: `Ember.testing`
|
**Global**: `Ember.testing`
|
||||||
|
|
||||||
**Location**: `app/services/auth.js` at line 267
|
**Location**: `app/services/auth.js` at line 268
|
||||||
|
|
||||||
```js
|
```js
|
||||||
checkShouldRenew: task(function*() {
|
checkShouldRenew: task(function*() {
|
||||||
|
@ -194,17 +250,3 @@ export default Route.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Unknown Global
|
|
||||||
|
|
||||||
**Global**: `Ember.testing`
|
|
||||||
|
|
||||||
**Location**: `lib/core/addon/components/ttl-form.js` at line 82
|
|
||||||
|
|
||||||
```js
|
|
||||||
this.set('time', parsedTime);
|
|
||||||
this.handleChange();
|
|
||||||
if (Ember.testing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
|
@ -111,9 +111,8 @@ To run the tests locally in a browser other than IE11, swap out `launch_in_ci: [
|
||||||
|
|
||||||
### Linting
|
### Linting
|
||||||
|
|
||||||
- `yarn lint:hbs`
|
* `yarn lint`
|
||||||
- `yarn lint:js`
|
* `yarn lint:fix`
|
||||||
- `yarn lint:js -- --fix`
|
|
||||||
|
|
||||||
### Building Vault UI into a Vault Binary
|
### Building Vault UI into a Vault Binary
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default RESTAdapter.extend({
|
||||||
headers['X-Vault-Wrap-TTL'] = options.wrapTTL;
|
headers['X-Vault-Wrap-TTL'] = options.wrapTTL;
|
||||||
}
|
}
|
||||||
let namespace = typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace;
|
let namespace = typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace;
|
||||||
if (namespace && !NAMESPACE_ROOT_URLS.some(str => url.includes(str))) {
|
if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) {
|
||||||
headers['X-Vault-Namespace'] = namespace;
|
headers['X-Vault-Namespace'] = namespace;
|
||||||
}
|
}
|
||||||
options.headers = assign(options.headers || {}, headers);
|
options.headers = assign(options.headers || {}, headers);
|
||||||
|
@ -49,7 +49,7 @@ export default RESTAdapter.extend({
|
||||||
|
|
||||||
_preRequest(url, options) {
|
_preRequest(url, options) {
|
||||||
this.addHeaders(url, options);
|
this.addHeaders(url, options);
|
||||||
const isPolling = POLLING_URLS.some(str => url.includes(str));
|
const isPolling = POLLING_URLS.some((str) => url.includes(str));
|
||||||
if (!isPolling) {
|
if (!isPolling) {
|
||||||
this.auth.setLastFetch(Date.now());
|
this.auth.setLastFetch(Date.now());
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ export default RESTAdapter.extend({
|
||||||
const [resp] = args;
|
const [resp] = args;
|
||||||
if (resp && resp.warnings) {
|
if (resp && resp.warnings) {
|
||||||
let flash = this.flashMessages;
|
let flash = this.flashMessages;
|
||||||
resp.warnings.forEach(message => {
|
resp.warnings.forEach((message) => {
|
||||||
flash.info(message);
|
flash.info(message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ export default RESTAdapter.extend({
|
||||||
headers: opts.headers || {},
|
headers: opts.headers || {},
|
||||||
body: opts.body,
|
body: opts.body,
|
||||||
signal: opts.signal,
|
signal: opts.signal,
|
||||||
}).then(response => {
|
}).then((response) => {
|
||||||
if (response.status >= 200 && response.status < 300) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
return RSVP.resolve(response);
|
return RSVP.resolve(response);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default ApplicationAdapter.extend({
|
||||||
return this.ajax(url, 'GET', {
|
return this.ajax(url, 'GET', {
|
||||||
unauthenticated: true,
|
unauthenticated: true,
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
return {
|
return {
|
||||||
data: result.data.auth,
|
data: result.data.auth,
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ export default ApplicationAdapter.extend({
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this.ajax(this.url(), 'GET').catch(e => {
|
return this.ajax(this.url(), 'GET').catch((e) => {
|
||||||
if (e instanceof AdapterError) {
|
if (e instanceof AdapterError) {
|
||||||
set(e, 'policyPath', 'sys/auth');
|
set(e, 'policyPath', 'sys/auth');
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default ApplicationAdapter.extend({
|
||||||
let role = snapshot.attr('role');
|
let role = snapshot.attr('role');
|
||||||
let url = `/v1/${role.backend}/creds/${role.name}`;
|
let url = `/v1/${role.backend}/creds/${role.name}`;
|
||||||
|
|
||||||
return this.ajax(url, method, options).then(response => {
|
return this.ajax(url, method, options).then((response) => {
|
||||||
response.id = snapshot.id;
|
response.id = snapshot.id;
|
||||||
response.modelName = type.modelName;
|
response.modelName = type.modelName;
|
||||||
store.pushPayload(type.modelName, response);
|
store.pushPayload(type.modelName, response);
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
findRecord(store, type, id) {
|
findRecord(store, type, id) {
|
||||||
return this.ajax(this.buildURL(type), 'POST', { data: { paths: [id] } }).catch(e => {
|
return this.ajax(this.buildURL(type), 'POST', { data: { paths: [id] } }).catch((e) => {
|
||||||
if (e instanceof AdapterError) {
|
if (e instanceof AdapterError) {
|
||||||
set(e, 'policyPath', 'sys/capabilities-self');
|
set(e, 'policyPath', 'sys/capabilities-self');
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ export default ApplicationAdapter.extend({
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return this.findRecord(store, type, id).then(resp => {
|
return this.findRecord(store, type, id).then((resp) => {
|
||||||
resp.path = id;
|
resp.path = id;
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default Application.extend({
|
||||||
query = null;
|
query = null;
|
||||||
}
|
}
|
||||||
// API accepts start and end as query params
|
// API accepts start and end as query params
|
||||||
return this.ajax(url, 'GET', { data: query }).then(resp => {
|
return this.ajax(url, 'GET', { data: query }).then((resp) => {
|
||||||
let response = resp || {};
|
let response = resp || {};
|
||||||
// if the response is a 204 it has no request id
|
// if the response is a 204 it has no request id
|
||||||
response.id = response.request_id || 'no-data';
|
response.id = response.request_id || 'no-data';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Application from '../application';
|
||||||
|
|
||||||
export default Application.extend({
|
export default Application.extend({
|
||||||
queryRecord() {
|
queryRecord() {
|
||||||
return this.ajax(this.urlForQuery(), 'GET').then(resp => {
|
return this.ajax(this.urlForQuery(), 'GET').then((resp) => {
|
||||||
resp.id = resp.request_id;
|
resp.id = resp.request_id;
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,10 +40,10 @@ export default ApplicationAdapter.extend({
|
||||||
findRecord(store, type, id, snapshot) {
|
findRecord(store, type, id, snapshot) {
|
||||||
let fetches = {
|
let fetches = {
|
||||||
health: this.health(),
|
health: this.health(),
|
||||||
sealStatus: this.sealStatus().catch(e => e),
|
sealStatus: this.sealStatus().catch((e) => e),
|
||||||
};
|
};
|
||||||
if (this.version.isEnterprise && this.namespaceService.inRootNamespace) {
|
if (this.version.isEnterprise && this.namespaceService.inRootNamespace) {
|
||||||
fetches.replicationStatus = this.replicationStatus().catch(e => e);
|
fetches.replicationStatus = this.replicationStatus().catch((e) => e);
|
||||||
}
|
}
|
||||||
return hash(fetches).then(({ health, sealStatus, replicationStatus }) => {
|
return hash(fetches).then(({ health, sealStatus, replicationStatus }) => {
|
||||||
let ret = {
|
let ret = {
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default ApplicationAdapter.extend({
|
||||||
data: {
|
data: {
|
||||||
accessor: id,
|
accessor: id,
|
||||||
},
|
},
|
||||||
}).then(response => {
|
}).then((response) => {
|
||||||
response.id = id;
|
response.id = id;
|
||||||
return response;
|
return response;
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
fetchByQuery(store, query) {
|
fetchByQuery(store, query) {
|
||||||
const { backend, id } = query;
|
const { backend, id } = query;
|
||||||
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
resp.backend = backend;
|
resp.backend = backend;
|
||||||
if (id) {
|
if (id) {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
|
|
|
@ -9,14 +9,14 @@ export default ApplicationAdapter.extend({
|
||||||
return this.ajax(
|
return this.ajax(
|
||||||
`${this.buildURL()}/${encodeURIComponent(backend)}/static-creds/${encodeURIComponent(secret)}`,
|
`${this.buildURL()}/${encodeURIComponent(backend)}/static-creds/${encodeURIComponent(secret)}`,
|
||||||
'GET'
|
'GET'
|
||||||
).then(resp => ({ ...resp, roleType: 'static' }));
|
).then((resp) => ({ ...resp, roleType: 'static' }));
|
||||||
},
|
},
|
||||||
|
|
||||||
_dynamicCreds(backend, secret) {
|
_dynamicCreds(backend, secret) {
|
||||||
return this.ajax(
|
return this.ajax(
|
||||||
`${this.buildURL()}/${encodeURIComponent(backend)}/creds/${encodeURIComponent(secret)}`,
|
`${this.buildURL()}/${encodeURIComponent(backend)}/creds/${encodeURIComponent(secret)}`,
|
||||||
'GET'
|
'GET'
|
||||||
).then(resp => ({ ...resp, roleType: 'dynamic' }));
|
).then((resp) => ({ ...resp, roleType: 'dynamic' }));
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchByQuery(store, query) {
|
fetchByQuery(store, query) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
staticRoles(backend, id) {
|
staticRoles(backend, id) {
|
||||||
return this.ajax(this.urlFor(backend, id, 'static'), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlFor(backend, id, 'static'), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
if (id) {
|
if (id) {
|
||||||
return {
|
return {
|
||||||
...resp,
|
...resp,
|
||||||
|
@ -39,7 +39,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
dynamicRoles(backend, id) {
|
dynamicRoles(backend, id) {
|
||||||
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
if (id) {
|
if (id) {
|
||||||
return {
|
return {
|
||||||
...resp,
|
...resp,
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default ApplicationAdapter.extend({
|
||||||
yield this.getDynamicApiPath.perform(id);
|
yield this.getDynamicApiPath.perform(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ajax(this.urlForItem(id, isList, this.dynamicApiPath), 'GET', { data }).then(resp => {
|
return this.ajax(this.urlForItem(id, isList, this.dynamicApiPath), 'GET', { data }).then((resp) => {
|
||||||
const data = {
|
const data = {
|
||||||
id,
|
id,
|
||||||
method: id,
|
method: id,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import IdentityAdapter from './base';
|
||||||
export default IdentityAdapter.extend({
|
export default IdentityAdapter.extend({
|
||||||
lookup(store, data) {
|
lookup(store, data) {
|
||||||
let url = `/${this.urlPrefix()}/identity/lookup/entity`;
|
let url = `/${this.urlPrefix()}/identity/lookup/entity`;
|
||||||
return this.ajax(url, 'POST', { data }).then(response => {
|
return this.ajax(url, 'POST', { data }).then((response) => {
|
||||||
// unsuccessful lookup is a 204
|
// unsuccessful lookup is a 204
|
||||||
if (!response) return;
|
if (!response) return;
|
||||||
let modelName = 'identity/entity';
|
let modelName = 'identity/entity';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import IdentityAdapter from './base';
|
||||||
export default IdentityAdapter.extend({
|
export default IdentityAdapter.extend({
|
||||||
lookup(store, data) {
|
lookup(store, data) {
|
||||||
let url = `/${this.urlPrefix()}/identity/lookup/group`;
|
let url = `/${this.urlPrefix()}/identity/lookup/group`;
|
||||||
return this.ajax(url, 'POST', { data }).then(response => {
|
return this.ajax(url, 'POST', { data }).then((response) => {
|
||||||
// unsuccessful lookup is a 204
|
// unsuccessful lookup is a 204
|
||||||
if (!response) return;
|
if (!response) return;
|
||||||
let modelName = 'identity/group';
|
let modelName = 'identity/group';
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
query(store, type, query) {
|
query(store, type, query) {
|
||||||
return this.ajax(this.urlForQuery(query, type.modelName), 'GET').then(resp => {
|
return this.ajax(this.urlForQuery(query, type.modelName), 'GET').then((resp) => {
|
||||||
// remove pagination query items here
|
// remove pagination query items here
|
||||||
const { ...modelAttrs } = query;
|
const { ...modelAttrs } = query;
|
||||||
resp._requestQuery = modelAttrs;
|
resp._requestQuery = modelAttrs;
|
||||||
|
@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({
|
||||||
queryRecord(store, type, query) {
|
queryRecord(store, type, query) {
|
||||||
let id = query.id;
|
let id = query.id;
|
||||||
delete query.id;
|
delete query.id;
|
||||||
return this.ajax(this._url(type.modelName, query, id), 'GET').then(resp => {
|
return this.ajax(this._url(type.modelName, query, id), 'GET').then((resp) => {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
resp = { ...resp, ...query };
|
resp = { ...resp, ...query };
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default BaseAdapter.extend({
|
||||||
role: snapshot.record.role,
|
role: snapshot.record.role,
|
||||||
});
|
});
|
||||||
url = `${url}/generate`;
|
url = `${url}/generate`;
|
||||||
return this.ajax(url, 'POST', { data: snapshot.serialize() }).then(model => {
|
return this.ajax(url, 'POST', { data: snapshot.serialize() }).then((model) => {
|
||||||
model.data.id = model.data.serial_number;
|
model.data.id = model.data.serial_number;
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default ApplicationAdapter.extend({
|
||||||
data: {
|
data: {
|
||||||
list: true,
|
list: true,
|
||||||
},
|
},
|
||||||
}).then(resp => {
|
}).then((resp) => {
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
resp.prefix = prefix;
|
resp.prefix = prefix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
findRecord(store, type, id) {
|
findRecord(store, type, id) {
|
||||||
return this.ajax(this.url(id), 'GET').then(resp => {
|
return this.ajax(this.url(id), 'GET').then((resp) => {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default ApplicationAdapter.extend({
|
||||||
data = serializer.serialize(snapshot, requestType);
|
data = serializer.serialize(snapshot, requestType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ajax(this.url(snapshot, action), 'POST', { data }).then(response => {
|
return this.ajax(this.url(snapshot, action), 'POST', { data }).then((response) => {
|
||||||
// uploading CA, setting signed intermediate cert, and attempting to generate
|
// uploading CA, setting signed intermediate cert, and attempting to generate
|
||||||
// a new CA if one exists, all return a 204
|
// a new CA if one exists, all return a 204
|
||||||
if (!response) {
|
if (!response) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default Adapter.extend({
|
||||||
|
|
||||||
fetchByQuery(store, query) {
|
fetchByQuery(store, query) {
|
||||||
const { backend, id } = query;
|
const { backend, id } = query;
|
||||||
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlFor(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
const data = {
|
const data = {
|
||||||
backend,
|
backend,
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,7 @@ export default Adapter.extend({
|
||||||
const data = {
|
const data = {
|
||||||
serial_number: id,
|
serial_number: id,
|
||||||
};
|
};
|
||||||
return this.ajax(`${this.buildURL()}/${backend}/revoke`, 'POST', { data }).then(resp => {
|
return this.ajax(`${this.buildURL()}/${backend}/revoke`, 'POST', { data }).then((resp) => {
|
||||||
const data = {
|
const data = {
|
||||||
id,
|
id,
|
||||||
serial_number: id,
|
serial_number: id,
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default ApplicationAdapter.extend({
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}, {});
|
}, {});
|
||||||
return this.ajax(url, 'POST', { data }).then(resp => {
|
return this.ajax(url, 'POST', { data }).then((resp) => {
|
||||||
let response = resp || {};
|
let response = resp || {};
|
||||||
response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`;
|
response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`;
|
||||||
return response;
|
return response;
|
||||||
|
@ -69,9 +69,11 @@ export default ApplicationAdapter.extend({
|
||||||
return hash({
|
return hash({
|
||||||
backend: backendPath,
|
backend: backendPath,
|
||||||
id: this.id(backendPath),
|
id: this.id(backendPath),
|
||||||
der: this.rawRequest(derURL, 'GET', { unauthenticated: true }).then(response => response.blob()),
|
der: this.rawRequest(derURL, 'GET', { unauthenticated: true }).then((response) => response.blob()),
|
||||||
pem: this.rawRequest(pemURL, 'GET', { unauthenticated: true }).then(response => response.text()),
|
pem: this.rawRequest(pemURL, 'GET', { unauthenticated: true }).then((response) => response.text()),
|
||||||
ca_chain: this.rawRequest(chainURL, 'GET', { unauthenticated: true }).then(response => response.text()),
|
ca_chain: this.rawRequest(chainURL, 'GET', { unauthenticated: true }).then((response) =>
|
||||||
|
response.text()
|
||||||
|
),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -79,12 +81,12 @@ export default ApplicationAdapter.extend({
|
||||||
const url = `/v1/${backendPath}/config/urls`;
|
const url = `/v1/${backendPath}/config/urls`;
|
||||||
const id = this.id(backendPath);
|
const id = this.id(backendPath);
|
||||||
return this.ajax(url, 'GET')
|
return this.ajax(url, 'GET')
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
resp.backend = backendPath;
|
resp.backend = backendPath;
|
||||||
return resp;
|
return resp;
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
if (e.httpStatus === 404) {
|
if (e.httpStatus === 404) {
|
||||||
return resolve({ id });
|
return resolve({ id });
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,12 +99,12 @@ export default ApplicationAdapter.extend({
|
||||||
const url = `/v1/${backendPath}/config/crl`;
|
const url = `/v1/${backendPath}/config/crl`;
|
||||||
const id = this.id(backendPath);
|
const id = this.id(backendPath);
|
||||||
return this.ajax(url, 'GET')
|
return this.ajax(url, 'GET')
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
resp.backend = backendPath;
|
resp.backend = backendPath;
|
||||||
return resp;
|
return resp;
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
if (e.httpStatus === 404) {
|
if (e.httpStatus === 404) {
|
||||||
return { id };
|
return { id };
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,7 +120,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
queryRecord(store, type, query) {
|
queryRecord(store, type, query) {
|
||||||
const { backend, section } = query;
|
const { backend, section } = query;
|
||||||
return this.fetchSection(backend, section).then(resp => {
|
return this.fetchSection(backend, section).then((resp) => {
|
||||||
resp.backend = backend;
|
resp.backend = backend;
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default ApplicationAdapter.extend({
|
||||||
const data = serializer.serialize(snapshot, requestType);
|
const data = serializer.serialize(snapshot, requestType);
|
||||||
const role = snapshot.attr('role');
|
const role = snapshot.attr('role');
|
||||||
|
|
||||||
return this.ajax(this.url(role, snapshot), 'POST', { data }).then(response => {
|
return this.ajax(this.url(role, snapshot), 'POST', { data }).then((response) => {
|
||||||
response.id = snapshot.id;
|
response.id = snapshot.id;
|
||||||
response.modelName = type.modelName;
|
response.modelName = type.modelName;
|
||||||
store.pushPayload(type.modelName, response);
|
store.pushPayload(type.modelName, response);
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
fetchStatus(mode) {
|
fetchStatus(mode) {
|
||||||
let url = this.getStatusUrl(mode);
|
let url = this.getStatusUrl(mode);
|
||||||
return this.ajax(url, 'GET', { unauthenticated: true }).then(resp => {
|
return this.ajax(url, 'GET', { unauthenticated: true }).then((resp) => {
|
||||||
return resp.data;
|
return resp.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
fetchByQuery(store, query) {
|
fetchByQuery(store, query) {
|
||||||
const { id, backend } = query;
|
const { id, backend } = query;
|
||||||
return this.ajax(this.urlForRole(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlForRole(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
const data = {
|
const data = {
|
||||||
id,
|
id,
|
||||||
name: id,
|
name: id,
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
fetchByQuery(store, query) {
|
fetchByQuery(store, query) {
|
||||||
const { id, backend } = query;
|
const { id, backend } = query;
|
||||||
return this.ajax(this.urlForRole(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlForRole(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
const data = {
|
const data = {
|
||||||
id,
|
id,
|
||||||
name: id,
|
name: id,
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default ApplicationAdapter.extend({
|
||||||
zeroAddressAjax = this.findAllZeroAddress(store, query);
|
zeroAddressAjax = this.findAllZeroAddress(store, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return allSettled([queryAjax, zeroAddressAjax]).then(results => {
|
return allSettled([queryAjax, zeroAddressAjax]).then((results) => {
|
||||||
// query result 404d, so throw the adapterError
|
// query result 404d, so throw the adapterError
|
||||||
if (!results[0].value) {
|
if (!results[0].value) {
|
||||||
throw results[0].reason;
|
throw results[0].reason;
|
||||||
|
@ -70,7 +70,7 @@ export default ApplicationAdapter.extend({
|
||||||
data: {},
|
data: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
results.forEach(result => {
|
results.forEach((result) => {
|
||||||
if (result.value) {
|
if (result.value) {
|
||||||
if (result.value.data.roles) {
|
if (result.value.data.roles) {
|
||||||
resp.data = assign({}, resp.data, { zero_address_roles: result.value.data.roles });
|
resp.data = assign({}, resp.data, { zero_address_roles: result.value.data.roles });
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
queryRecord(store, type, query) {
|
queryRecord(store, type, query) {
|
||||||
if (query.type === 'aws') {
|
if (query.type === 'aws') {
|
||||||
return this.ajax(`/v1/${encodePath(query.backend)}/config/lease`, 'GET').then(resp => {
|
return this.ajax(`/v1/${encodePath(query.backend)}/config/lease`, 'GET').then((resp) => {
|
||||||
resp.path = query.backend + '/';
|
resp.path = query.backend + '/';
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
@ -135,11 +135,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
saveZeroAddressConfig(store, type, snapshot) {
|
saveZeroAddressConfig(store, type, snapshot) {
|
||||||
const path = encodePath(snapshot.id);
|
const path = encodePath(snapshot.id);
|
||||||
const roles = store
|
const roles = store.peekAll('role-ssh').filterBy('zeroAddress').mapBy('id').join(',');
|
||||||
.peekAll('role-ssh')
|
|
||||||
.filterBy('zeroAddress')
|
|
||||||
.mapBy('id')
|
|
||||||
.join(',');
|
|
||||||
const url = `/v1/${path}/config/zeroaddress`;
|
const url = `/v1/${path}/config/zeroaddress`;
|
||||||
const data = { roles };
|
const data = { roles };
|
||||||
if (roles === '') {
|
if (roles === '') {
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
findRecord() {
|
findRecord() {
|
||||||
return this._super(...arguments).catch(errorOrModel => {
|
return this._super(...arguments).catch((errorOrModel) => {
|
||||||
// if the response is a real 404 or if the secret is gated by a control group this will be an error,
|
// if the response is a real 404 or if the secret is gated by a control group this will be an error,
|
||||||
// otherwise the response will be the body of a deleted / destroyed version
|
// otherwise the response will be the body of a deleted / destroyed version
|
||||||
if (errorOrModel instanceof AdapterError) {
|
if (errorOrModel instanceof AdapterError) {
|
||||||
|
@ -44,7 +44,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
queryRecord(id, options) {
|
queryRecord(id, options) {
|
||||||
return this.ajax(this.urlForQueryRecord(id), 'GET', options).then(resp => {
|
return this.ajax(this.urlForQueryRecord(id), 'GET', options).then((resp) => {
|
||||||
if (options.wrapTTL) {
|
if (options.wrapTTL) {
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
querySecretDataByVersion(id) {
|
querySecretDataByVersion(id) {
|
||||||
return this.ajax(this.urlForQueryRecord(id), 'GET')
|
return this.ajax(this.urlForQueryRecord(id), 'GET')
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
return resp.data;
|
return resp.data;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
return error.data;
|
return error.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -73,7 +73,7 @@ export default ApplicationAdapter.extend({
|
||||||
createRecord(store, modelName, snapshot) {
|
createRecord(store, modelName, snapshot) {
|
||||||
let backend = snapshot.belongsTo('secret').belongsTo('engine').id;
|
let backend = snapshot.belongsTo('secret').belongsTo('engine').id;
|
||||||
let path = snapshot.attr('path');
|
let path = snapshot.attr('path');
|
||||||
return this._super(...arguments).then(resp => {
|
return this._super(...arguments).then((resp) => {
|
||||||
resp.id = JSON.stringify([backend, path, resp.version]);
|
resp.id = JSON.stringify([backend, path, resp.version]);
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default ApplicationAdapter.extend({
|
||||||
fetchByQuery(query, action) {
|
fetchByQuery(query, action) {
|
||||||
const { id, backend, wrapTTL } = query;
|
const { id, backend, wrapTTL } = query;
|
||||||
return this.ajax(this.urlForSecret(backend, id), 'GET', this.optionsForQuery(id, action, wrapTTL)).then(
|
return this.ajax(this.urlForSecret(backend, id), 'GET', this.optionsForQuery(id, action, wrapTTL)).then(
|
||||||
resp => {
|
(resp) => {
|
||||||
if (wrapTTL) {
|
if (wrapTTL) {
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export default ApplicationAdapter.extend({
|
||||||
const data = serializer.serialize(snapshot, requestType);
|
const data = serializer.serialize(snapshot, requestType);
|
||||||
const role = snapshot.attr('role');
|
const role = snapshot.attr('role');
|
||||||
|
|
||||||
return this.ajax(this.url(role), 'POST', { data }).then(response => {
|
return this.ajax(this.url(role), 'POST', { data }).then((response) => {
|
||||||
response.id = snapshot.id;
|
response.id = snapshot.id;
|
||||||
response.modelName = type.modelName;
|
response.modelName = type.modelName;
|
||||||
store.pushPayload(type.modelName, response);
|
store.pushPayload(type.modelName, response);
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default ApplicationAdapter.extend({
|
||||||
const { id, backend } = query;
|
const { id, backend } = query;
|
||||||
const queryAjax = this.ajax(this.urlForTransformations(backend, id), 'GET', this.optionsForQuery(id));
|
const queryAjax = this.ajax(this.urlForTransformations(backend, id), 'GET', this.optionsForQuery(id));
|
||||||
|
|
||||||
return allSettled([queryAjax]).then(results => {
|
return allSettled([queryAjax]).then((results) => {
|
||||||
// query result 404d, so throw the adapterError
|
// query result 404d, so throw the adapterError
|
||||||
if (!results[0].value) {
|
if (!results[0].value) {
|
||||||
throw results[0].reason;
|
throw results[0].reason;
|
||||||
|
@ -64,7 +64,7 @@ export default ApplicationAdapter.extend({
|
||||||
data: {},
|
data: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
results.forEach(result => {
|
results.forEach((result) => {
|
||||||
if (result.value) {
|
if (result.value) {
|
||||||
let d = result.value.data;
|
let d = result.value.data;
|
||||||
if (d.templates) {
|
if (d.templates) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
fetchByQuery(query) {
|
fetchByQuery(query) {
|
||||||
const { backend, modelName, id } = query;
|
const { backend, modelName, id } = query;
|
||||||
return this.ajax(this.url(backend, modelName, id), 'GET').then(resp => {
|
return this.ajax(this.url(backend, modelName, id), 'GET').then((resp) => {
|
||||||
return {
|
return {
|
||||||
...resp,
|
...resp,
|
||||||
backend,
|
backend,
|
||||||
|
@ -54,7 +54,7 @@ export default ApplicationAdapter.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
queryRecord(store, type, query) {
|
queryRecord(store, type, query) {
|
||||||
return this.ajax(this.url(query.backend, type.modelName, query.id), 'GET').then(result => {
|
return this.ajax(this.url(query.backend, type.modelName, query.id), 'GET').then((result) => {
|
||||||
// CBS TODO: Add name to response and unmap name <> id on models
|
// CBS TODO: Add name to response and unmap name <> id on models
|
||||||
return {
|
return {
|
||||||
id: query.id,
|
id: query.id,
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default ApplicationAdapter.extend({
|
||||||
url = url + '/config';
|
url = url + '/config';
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ajax(url, 'POST', { data }).then(resp => {
|
return this.ajax(url, 'POST', { data }).then((resp) => {
|
||||||
let response = resp || {};
|
let response = resp || {};
|
||||||
response.id = name;
|
response.id = name;
|
||||||
return response;
|
return response;
|
||||||
|
@ -86,7 +86,7 @@ export default ApplicationAdapter.extend({
|
||||||
|
|
||||||
fetchByQuery(query) {
|
fetchByQuery(query) {
|
||||||
const { id, backend } = query;
|
const { id, backend } = query;
|
||||||
return this.ajax(this.urlForSecret(backend, id), 'GET', this.optionsForQuery(id)).then(resp => {
|
return this.ajax(this.urlForSecret(backend, id), 'GET', this.optionsForQuery(id)).then((resp) => {
|
||||||
resp.id = id;
|
resp.id = id;
|
||||||
resp.backend = backend;
|
resp.backend = backend;
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
@ -2,9 +2,7 @@ import Application from '@ember/application';
|
||||||
import Resolver from 'ember-resolver';
|
import Resolver from 'ember-resolver';
|
||||||
import loadInitializers from 'ember-load-initializers';
|
import loadInitializers from 'ember-load-initializers';
|
||||||
import config from 'vault/config/environment';
|
import config from 'vault/config/environment';
|
||||||
import defineModifier from 'ember-concurrency-test-waiter/define-modifier';
|
|
||||||
|
|
||||||
defineModifier();
|
|
||||||
export default class App extends Application {
|
export default class App extends Application {
|
||||||
modulePrefix = config.modulePrefix;
|
modulePrefix = config.modulePrefix;
|
||||||
podModulePrefix = config.podModulePrefix;
|
podModulePrefix = config.podModulePrefix;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import AdapterError from '@ember-data/adapter/error';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module AuthConfigForm/Config
|
* @module AuthConfigForm/Config
|
||||||
|
@ -23,7 +24,8 @@ const AuthConfigBase = Component.extend({
|
||||||
flashMessages: service(),
|
flashMessages: service(),
|
||||||
router: service(),
|
router: service(),
|
||||||
wizard: service(),
|
wizard: service(),
|
||||||
saveModel: task(function*() {
|
saveModel: task(
|
||||||
|
waitFor(function* () {
|
||||||
try {
|
try {
|
||||||
yield this.model.save();
|
yield this.model.save();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -39,7 +41,8 @@ const AuthConfigBase = Component.extend({
|
||||||
}
|
}
|
||||||
this.router.transitionTo('vault.cluster.access.methods').followRedirects();
|
this.router.transitionTo('vault.cluster.access.methods').followRedirects();
|
||||||
this.flashMessages.success('The configuration was saved successfully.');
|
this.flashMessages.success('The configuration was saved successfully.');
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
AuthConfigBase.reopenClass({
|
AuthConfigBase.reopenClass({
|
||||||
|
|
|
@ -2,6 +2,7 @@ import AdapterError from '@ember-data/adapter/error';
|
||||||
import AuthConfigComponent from './config';
|
import AuthConfigComponent from './config';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module AuthConfigForm/Options
|
* @module AuthConfigForm/Options
|
||||||
|
@ -19,7 +20,8 @@ import { task } from 'ember-concurrency';
|
||||||
export default AuthConfigComponent.extend({
|
export default AuthConfigComponent.extend({
|
||||||
router: service(),
|
router: service(),
|
||||||
wizard: service(),
|
wizard: service(),
|
||||||
saveModel: task(function*() {
|
saveModel: task(
|
||||||
|
waitFor(function* () {
|
||||||
let data = this.model.config.serialize();
|
let data = this.model.config.serialize();
|
||||||
data.description = this.model.description;
|
data.description = this.model.description;
|
||||||
|
|
||||||
|
@ -50,5 +52,6 @@ export default AuthConfigComponent.extend({
|
||||||
}
|
}
|
||||||
this.router.transitionTo('vault.cluster.access.methods').followRedirects();
|
this.router.transitionTo('vault.cluster.access.methods').followRedirects();
|
||||||
this.flashMessages.success('The configuration was saved successfully.');
|
this.flashMessages.success('The configuration was saved successfully.');
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,8 @@ import Component from '@ember/component';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends';
|
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends';
|
||||||
import { task, timeout } from 'ember-concurrency';
|
import { task, timeout } from 'ember-concurrency';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
const BACKENDS = supportedAuthBackends();
|
const BACKENDS = supportedAuthBackends();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,11 +155,14 @@ export default Component.extend(DEFAULTS, {
|
||||||
}),
|
}),
|
||||||
methodsToShow: computed('methods', function () {
|
methodsToShow: computed('methods', function () {
|
||||||
let methods = this.methods || [];
|
let methods = this.methods || [];
|
||||||
let shownMethods = methods.filter(m => BACKENDS.find(b => b.type.toLowerCase() === m.type.toLowerCase()));
|
let shownMethods = methods.filter((m) =>
|
||||||
|
BACKENDS.find((b) => b.type.toLowerCase() === m.type.toLowerCase())
|
||||||
|
);
|
||||||
return shownMethods.length ? shownMethods : BACKENDS;
|
return shownMethods.length ? shownMethods : BACKENDS;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
unwrapToken: task(function*(token) {
|
unwrapToken: task(
|
||||||
|
waitFor(function* (token) {
|
||||||
// will be using the Token Auth Method, so set it here
|
// will be using the Token Auth Method, so set it here
|
||||||
this.set('selectedAuth', 'token');
|
this.set('selectedAuth', 'token');
|
||||||
let adapter = this.store.adapterFor('tools');
|
let adapter = this.store.adapterFor('tools');
|
||||||
|
@ -168,9 +173,11 @@ export default Component.extend(DEFAULTS, {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.set('error', `Token unwrap failed: ${e.errors[0]}`);
|
this.set('error', `Token unwrap failed: ${e.errors[0]}`);
|
||||||
}
|
}
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
fetchMethods: task(function*() {
|
fetchMethods: task(
|
||||||
|
waitFor(function* () {
|
||||||
let store = this.store;
|
let store = this.store;
|
||||||
try {
|
try {
|
||||||
let methods = yield store.findAll('auth-method', {
|
let methods = yield store.findAll('auth-method', {
|
||||||
|
@ -180,7 +187,7 @@ export default Component.extend(DEFAULTS, {
|
||||||
});
|
});
|
||||||
this.set(
|
this.set(
|
||||||
'methods',
|
'methods',
|
||||||
methods.map(m => {
|
methods.map((m) => {
|
||||||
const method = m.serialize({ includeId: true });
|
const method = m.serialize({ includeId: true });
|
||||||
return {
|
return {
|
||||||
...method,
|
...method,
|
||||||
|
@ -194,7 +201,8 @@ export default Component.extend(DEFAULTS, {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.set('error', `There was an error fetching Auth Methods: ${e.errors[0]}`);
|
this.set('error', `There was an error fetching Auth Methods: ${e.errors[0]}`);
|
||||||
}
|
}
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
showLoading: or('isLoading', 'authenticate.isRunning', 'fetchMethods.isRunning', 'unwrapToken.isRunning'),
|
showLoading: or('isLoading', 'authenticate.isRunning', 'fetchMethods.isRunning', 'unwrapToken.isRunning'),
|
||||||
|
|
||||||
|
@ -202,7 +210,7 @@ export default Component.extend(DEFAULTS, {
|
||||||
this.set('loading', false);
|
this.set('loading', false);
|
||||||
let errors;
|
let errors;
|
||||||
if (e.errors) {
|
if (e.errors) {
|
||||||
errors = e.errors.map(error => {
|
errors = e.errors.map((error) => {
|
||||||
if (error.detail) {
|
if (error.detail) {
|
||||||
return error.detail;
|
return error.detail;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +223,8 @@ export default Component.extend(DEFAULTS, {
|
||||||
this.set('error', `${message}${errors.join('.')}`);
|
this.set('error', `${message}${errors.join('.')}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
authenticate: task(function*(backendType, data) {
|
authenticate: task(
|
||||||
|
waitFor(function* (backendType, data) {
|
||||||
let clusterId = this.cluster.id;
|
let clusterId = this.cluster.id;
|
||||||
try {
|
try {
|
||||||
if (backendType === 'okta') {
|
if (backendType === 'okta') {
|
||||||
|
@ -246,7 +255,8 @@ export default Component.extend(DEFAULTS, {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.handleError(e);
|
this.handleError(e);
|
||||||
}
|
}
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
delayAuthMessageReminder: task(function* () {
|
delayAuthMessageReminder: task(function* () {
|
||||||
if (Ember.testing) {
|
if (Ember.testing) {
|
||||||
|
@ -274,7 +284,7 @@ export default Component.extend(DEFAULTS, {
|
||||||
});
|
});
|
||||||
let backend = this.selectedAuthBackend || {};
|
let backend = this.selectedAuthBackend || {};
|
||||||
let backendMeta = BACKENDS.find(
|
let backendMeta = BACKENDS.find(
|
||||||
b => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase()
|
(b) => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase()
|
||||||
);
|
);
|
||||||
let attributes = (backendMeta || {}).formAttributes || [];
|
let attributes = (backendMeta || {}).formAttributes || [];
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import Component from './outer-html';
|
||||||
import { later } from '@ember/runloop';
|
import { later } from '@ember/runloop';
|
||||||
import { task, timeout, waitForEvent } from 'ember-concurrency';
|
import { task, timeout, waitForEvent } from 'ember-concurrency';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
/* eslint-disable ember/no-ember-testing-in-module-scope */
|
const WAIT_TIME = 500;
|
||||||
const WAIT_TIME = Ember.testing ? 0 : 500;
|
|
||||||
const ERROR_WINDOW_CLOSED =
|
const ERROR_WINDOW_CLOSED =
|
||||||
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
|
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
|
||||||
const ERROR_MISSING_PARAMS =
|
const ERROR_MISSING_PARAMS =
|
||||||
|
@ -29,6 +29,7 @@ export default Component.extend({
|
||||||
onNamespace() {},
|
onNamespace() {},
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super();
|
||||||
let { oldSelectedAuthPath, selectedAuthPath } = this;
|
let { oldSelectedAuthPath, selectedAuthPath } = this;
|
||||||
let shouldDebounce = !oldSelectedAuthPath && !selectedAuthPath;
|
let shouldDebounce = !oldSelectedAuthPath && !selectedAuthPath;
|
||||||
if (oldSelectedAuthPath !== selectedAuthPath) {
|
if (oldSelectedAuthPath !== selectedAuthPath) {
|
||||||
|
@ -52,11 +53,12 @@ export default Component.extend({
|
||||||
return this.window || window;
|
return this.window || window;
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchRole: task(function*(roleName, options = { debounce: true }) {
|
fetchRole: task(
|
||||||
|
waitFor(function* (roleName, options = { debounce: true }) {
|
||||||
if (options.debounce) {
|
if (options.debounce) {
|
||||||
this.onRoleName(roleName);
|
this.onRoleName(roleName);
|
||||||
// debounce
|
// debounce
|
||||||
yield timeout(WAIT_TIME);
|
yield timeout(Ember.testing ? 0 : WAIT_TIME);
|
||||||
}
|
}
|
||||||
let path = this.selectedAuthPath || this.selectedAuthType;
|
let path = this.selectedAuthPath || this.selectedAuthType;
|
||||||
let id = JSON.stringify([path, roleName]);
|
let id = JSON.stringify([path, roleName]);
|
||||||
|
@ -64,7 +66,8 @@ export default Component.extend({
|
||||||
try {
|
try {
|
||||||
role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } });
|
role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!e.httpStatus || e.httpStatus !== 400) {
|
// throwing here causes failures in tests
|
||||||
|
if ((!e.httpStatus || e.httpStatus !== 400) && !Ember.testing) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
if (e.errors && e.errors.length > 0) {
|
if (e.errors && e.errors.length > 0) {
|
||||||
|
@ -73,8 +76,7 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
this.set('role', role);
|
this.set('role', role);
|
||||||
})
|
})
|
||||||
.restartable()
|
).restartable(),
|
||||||
.withTestWaiter(),
|
|
||||||
|
|
||||||
handleOIDCError(err) {
|
handleOIDCError(err) {
|
||||||
this.onLoading(false);
|
this.onLoading(false);
|
||||||
|
|
|
@ -99,6 +99,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super();
|
||||||
// if there's no value, reset encoding
|
// if there's no value, reset encoding
|
||||||
if (this.value === '') {
|
if (this.value === '') {
|
||||||
set(this, 'currentEncoding', UTF8);
|
set(this, 'currentEncoding', UTF8);
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default class HistoryComponent extends Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let dataList = this.args.model.activity.byNamespace;
|
let dataList = this.args.model.activity.byNamespace;
|
||||||
return dataList.map(d => {
|
return dataList.map((d) => {
|
||||||
return {
|
return {
|
||||||
name: d['namespace_id'],
|
name: d['namespace_id'],
|
||||||
id: d['namespace_path'] === '' ? 'root' : d['namespace_path'],
|
id: d['namespace_path'] === '' ? 'root' : d['namespace_path'],
|
||||||
|
@ -48,7 +48,7 @@ export default class HistoryComponent extends Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let dataset = this.args.model.activity.byNamespace.slice(0, this.max_namespaces);
|
let dataset = this.args.model.activity.byNamespace.slice(0, this.max_namespaces);
|
||||||
return dataset.map(d => {
|
return dataset.map((d) => {
|
||||||
return {
|
return {
|
||||||
label: d['namespace_path'] === '' ? 'root' : d['namespace_path'],
|
label: d['namespace_path'] === '' ? 'root' : d['namespace_path'],
|
||||||
non_entity_tokens: d['counts']['non_entity_tokens'],
|
non_entity_tokens: d['counts']['non_entity_tokens'],
|
||||||
|
@ -95,7 +95,7 @@ export default class HistoryComponent extends Component {
|
||||||
|
|
||||||
// Get the namespace by matching the path from the namespace list
|
// Get the namespace by matching the path from the namespace list
|
||||||
getNamespace(path) {
|
getNamespace(path) {
|
||||||
return this.args.model.activity.byNamespace.find(ns => {
|
return this.args.model.activity.byNamespace.find((ns) => {
|
||||||
if (path === 'root') {
|
if (path === 'root') {
|
||||||
return ns.namespace_path === '';
|
return ns.namespace_path === '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ export default Component.extend({
|
||||||
const isUpload = this.model.uploadPemBundle;
|
const isUpload = this.model.uploadPemBundle;
|
||||||
model
|
model
|
||||||
.save({ adapterOptions: { method } })
|
.save({ adapterOptions: { method } })
|
||||||
.then(m => {
|
.then((m) => {
|
||||||
if (method === 'setSignedIntermediate' || isUpload) {
|
if (method === 'setSignedIntermediate' || isUpload) {
|
||||||
this.send('refresh');
|
this.send('refresh');
|
||||||
this.flashMessages.success('The certificate for this backend has been updated.');
|
this.flashMessages.success('The certificate for this backend has been updated.');
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default Component.extend({
|
||||||
.save({
|
.save({
|
||||||
adapterOptions: {
|
adapterOptions: {
|
||||||
method: section,
|
method: section,
|
||||||
fields: get(config, `${section}Attrs`).map(attr => attr.name),
|
fields: get(config, `${section}Attrs`).map((attr) => attr.name),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({});
|
|
|
@ -1,3 +0,0 @@
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({});
|
|
|
@ -1,3 +0,0 @@
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({});
|
|
|
@ -4,7 +4,7 @@ import { computed } from '@ember/object';
|
||||||
import columnify from 'columnify';
|
import columnify from 'columnify';
|
||||||
|
|
||||||
export function stringifyObjectValues(data) {
|
export function stringifyObjectValues(data) {
|
||||||
Object.keys(data).forEach(item => {
|
Object.keys(data).forEach((item) => {
|
||||||
let val = data[item];
|
let val = data[item];
|
||||||
if (typeof val !== 'string') {
|
if (typeof val !== 'string') {
|
||||||
val = JSON.stringify(val);
|
val = JSON.stringify(val);
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({});
|
|
|
@ -45,7 +45,7 @@ export default Component.extend({
|
||||||
let serviceArgs;
|
let serviceArgs;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
executeUICommand(command, args => this.logAndOutput(args), {
|
executeUICommand(command, (args) => this.logAndOutput(args), {
|
||||||
api: () => this.routeToExplore.perform(command),
|
api: () => this.routeToExplore.perform(command),
|
||||||
clearall: () => service.clearLog(true),
|
clearall: () => service.clearLog(true),
|
||||||
clear: () => service.clearLog(),
|
clear: () => service.clearLog(),
|
||||||
|
@ -134,7 +134,7 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shiftCommandIndex(keyCode) {
|
shiftCommandIndex(keyCode) {
|
||||||
this.console.shiftCommandIndex(keyCode, val => {
|
this.console.shiftCommandIndex(keyCode, (val) => {
|
||||||
this.set('inputValue', val);
|
this.set('inputValue', val);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { action } from '@ember/object';
|
||||||
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
|
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
|
||||||
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
|
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
|
||||||
|
|
||||||
const getErrorMessage = errors => {
|
const getErrorMessage = (errors) => {
|
||||||
let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.';
|
let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.';
|
||||||
if (errorMessage.indexOf('failed to verify') >= 0) {
|
if (errorMessage.indexOf('failed to verify') >= 0) {
|
||||||
errorMessage =
|
errorMessage =
|
||||||
|
@ -69,7 +69,7 @@ export default class DatabaseConnectionEdit extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.showSaveModal = true;
|
this.showSaveModal = true;
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errorMessage = getErrorMessage(e.errors);
|
const errorMessage = getErrorMessage(e.errors);
|
||||||
this.flashMessages.danger(errorMessage);
|
this.flashMessages.danger(errorMessage);
|
||||||
});
|
});
|
||||||
|
@ -91,7 +91,7 @@ export default class DatabaseConnectionEdit extends Component {
|
||||||
this.flashMessages.success(`Successfully rotated root credentials for connection "${name}"`);
|
this.flashMessages.success(`Successfully rotated root credentials for connection "${name}"`);
|
||||||
this.transitionToRoute(SHOW_ROUTE, name);
|
this.transitionToRoute(SHOW_ROUTE, name);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.danger(`Error rotating root credentials: ${e.errors}`);
|
this.flashMessages.danger(`Error rotating root credentials: ${e.errors}`);
|
||||||
this.transitionToRoute(SHOW_ROUTE, name);
|
this.transitionToRoute(SHOW_ROUTE, name);
|
||||||
});
|
});
|
||||||
|
@ -107,7 +107,7 @@ export default class DatabaseConnectionEdit extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.transitionToRoute(SHOW_ROUTE, secretId);
|
this.transitionToRoute(SHOW_ROUTE, secretId);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errorMessage = getErrorMessage(e.errors);
|
const errorMessage = getErrorMessage(e.errors);
|
||||||
this.flashMessages.danger(errorMessage);
|
this.flashMessages.danger(errorMessage);
|
||||||
});
|
});
|
||||||
|
@ -133,7 +133,7 @@ export default class DatabaseConnectionEdit extends Component {
|
||||||
// TODO: Why isn't the confirmAction closing?
|
// TODO: Why isn't the confirmAction closing?
|
||||||
this.flashMessages.success('Successfully reset connection');
|
this.flashMessages.success('Successfully reset connection');
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errorMessage = getErrorMessage(e.errors);
|
const errorMessage = getErrorMessage(e.errors);
|
||||||
this.flashMessages.danger(errorMessage);
|
this.flashMessages.danger(errorMessage);
|
||||||
});
|
});
|
||||||
|
@ -147,7 +147,7 @@ export default class DatabaseConnectionEdit extends Component {
|
||||||
// TODO: Why isn't the confirmAction closing?
|
// TODO: Why isn't the confirmAction closing?
|
||||||
this.flashMessages.success('Successfully rotated credentials');
|
this.flashMessages.success('Successfully rotated credentials');
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errorMessage = getErrorMessage(e.errors);
|
const errorMessage = getErrorMessage(e.errors);
|
||||||
this.flashMessages.danger(errorMessage);
|
this.flashMessages.danger(errorMessage);
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default class DatabaseRoleEdit extends Component {
|
||||||
}
|
}
|
||||||
return this.store
|
return this.store
|
||||||
.queryRecord('database/connection', { id: dbs[0], backend })
|
.queryRecord('database/connection', { id: dbs[0], backend })
|
||||||
.then(record => record.plugin_name)
|
.then((record) => record.plugin_name)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ export default class DatabaseRoleEdit extends Component {
|
||||||
console.debug(e);
|
console.debug(e);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.danger(e.errors?.join('. '));
|
this.flashMessages.danger(e.errors?.join('. '));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ export default class DatabaseRoleEdit extends Component {
|
||||||
console.debug(e);
|
console.debug(e);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errorMessage = e.errors?.join('. ') || e.message;
|
const errorMessage = e.errors?.join('. ') || e.message;
|
||||||
this.flashMessages.danger(
|
this.flashMessages.danger(
|
||||||
errorMessage || 'Could not save the role. Please check Vault logs for more information.'
|
errorMessage || 'Could not save the role. Please check Vault logs for more information.'
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default class DatabaseRoleSettingForm extends Component {
|
||||||
get settingFields() {
|
get settingFields() {
|
||||||
if (!this.args.roleType) return null;
|
if (!this.args.roleType) return null;
|
||||||
let dbValidFields = getRoleFields(this.args.roleType);
|
let dbValidFields = getRoleFields(this.args.roleType);
|
||||||
return this.args.attrs.filter(a => {
|
return this.args.attrs.filter((a) => {
|
||||||
return dbValidFields.includes(a.name);
|
return dbValidFields.includes(a.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export default class DatabaseRoleSettingForm extends Component {
|
||||||
const plugin = this.args.dbType;
|
const plugin = this.args.dbType;
|
||||||
if (!type) return null;
|
if (!type) return null;
|
||||||
let dbValidFields = getStatementFields(type, plugin);
|
let dbValidFields = getStatementFields(type, plugin);
|
||||||
return this.args.attrs.filter(a => {
|
return this.args.attrs.filter((a) => {
|
||||||
return dbValidFields.includes(a.name);
|
return dbValidFields.includes(a.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,14 +35,14 @@ export default class DiffVersionSelector extends Component {
|
||||||
let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.args.model.currentVersion}"]`;
|
let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.args.model.currentVersion}"]`;
|
||||||
return this.adapter
|
return this.adapter
|
||||||
.querySecretDataByVersion(string)
|
.querySecretDataByVersion(string)
|
||||||
.then(response => response.data)
|
.then((response) => response.data)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
}
|
}
|
||||||
get rightSideDataInit() {
|
get rightSideDataInit() {
|
||||||
let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`;
|
let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`;
|
||||||
return this.adapter
|
return this.adapter
|
||||||
.querySecretDataByVersion(string)
|
.querySecretDataByVersion(string)
|
||||||
.then(response => response.data)
|
.then((response) => response.data)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
}
|
}
|
||||||
get rightSideVersionInit() {
|
get rightSideVersionInit() {
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
/**
|
|
||||||
* @module FormFieldGroupsLoop
|
|
||||||
* FormFieldGroupsLoop components are used to show optional form fields, generally when setting up a secret engine.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```js
|
|
||||||
* <FormFieldGroupsLoop @model={{model}} @mode={{mode}}/>
|
|
||||||
* ```
|
|
||||||
* @param {object} model - the data model of the parent component
|
|
||||||
* @param {object} model - the mode: create show or edit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Component from '@glimmer/component';
|
|
||||||
|
|
||||||
export default class FormFieldGroupsLoop extends Component {}
|
|
|
@ -59,6 +59,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super();
|
||||||
if (this.wizard.featureState === 'displayRole') {
|
if (this.wizard.featureState === 'displayRole') {
|
||||||
this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', this.backendType);
|
this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', this.backendType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { computed, set } from '@ember/object';
|
import { computed, set } from '@ember/object';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module GeneratedItem
|
* @module GeneratedItem
|
||||||
|
@ -29,7 +30,8 @@ export default Component.extend({
|
||||||
props: computed('model', function () {
|
props: computed('model', function () {
|
||||||
return this.model.serialize();
|
return this.model.serialize();
|
||||||
}),
|
}),
|
||||||
saveModel: task(function*() {
|
saveModel: task(
|
||||||
|
waitFor(function* () {
|
||||||
try {
|
try {
|
||||||
yield this.model.save();
|
yield this.model.save();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -42,16 +44,17 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
this.router.transitionTo('vault.cluster.access.method.item.list').followRedirects();
|
this.router.transitionTo('vault.cluster.access.method.item.list').followRedirects();
|
||||||
this.flashMessages.success(`Successfully saved ${this.itemType} ${this.model.id}.`);
|
this.flashMessages.success(`Successfully saved ${this.itemType} ${this.model.id}.`);
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.set('validationMessages', {});
|
this.set('validationMessages', {});
|
||||||
if (this.mode === 'edit') {
|
if (this.mode === 'edit') {
|
||||||
// For validation to work in edit mode,
|
// For validation to work in edit mode,
|
||||||
// reconstruct the model values from field group
|
// reconstruct the model values from field group
|
||||||
this.model.fieldGroups.forEach(element => {
|
this.model.fieldGroups.forEach((element) => {
|
||||||
if (element.default) {
|
if (element.default) {
|
||||||
element.default.forEach(attr => {
|
element.default.forEach((attr) => {
|
||||||
let fieldValue = attr.options && attr.options.fieldValue;
|
let fieldValue = attr.options && attr.options.fieldValue;
|
||||||
if (fieldValue) {
|
if (fieldValue) {
|
||||||
this.model[attr.name] = this.model[fieldValue];
|
this.model[attr.name] = this.model[fieldValue];
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default Component.extend({
|
||||||
this.onSuccess();
|
this.onSuccess();
|
||||||
this.flashMessages.success(this.successMessage(...messageArgs));
|
this.flashMessages.success(this.successMessage(...messageArgs));
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.onError(...messageArgs);
|
this.onError(...messageArgs);
|
||||||
this.flashMessages.success(this.errorMessage(e, ...messageArgs));
|
this.flashMessages.success(this.errorMessage(e, ...messageArgs));
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ import Component from '@ember/component';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
import { humanize } from 'vault/helpers/humanize';
|
import { humanize } from 'vault/helpers/humanize';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
flashMessages: service(),
|
flashMessages: service(),
|
||||||
|
@ -49,7 +50,8 @@ export default Component.extend({
|
||||||
return `Successfully ${action} ${typeDisplay}.`;
|
return `Successfully ${action} ${typeDisplay}.`;
|
||||||
},
|
},
|
||||||
|
|
||||||
save: task(function*() {
|
save: task(
|
||||||
|
waitFor(function* () {
|
||||||
let model = this.model;
|
let model = this.model;
|
||||||
let message = this.getMessage(model);
|
let message = this.getMessage(model);
|
||||||
|
|
||||||
|
@ -62,10 +64,10 @@ export default Component.extend({
|
||||||
this.flashMessages.success(message);
|
this.flashMessages.success(message);
|
||||||
yield this.onSave({ saveType: 'save', model });
|
yield this.onSave({ saveType: 'save', model });
|
||||||
})
|
})
|
||||||
.drop()
|
).drop(),
|
||||||
.withTestWaiter(),
|
|
||||||
|
|
||||||
willDestroy() {
|
willDestroy() {
|
||||||
|
this._super(...arguments);
|
||||||
let model = this.model;
|
let model = this.model;
|
||||||
if (!model) return;
|
if (!model) return;
|
||||||
if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) {
|
if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default Component.extend({
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.flashMessages.success(`Successfully enabled entity: ${model.id}`);
|
this.flashMessages.success(`Successfully enabled entity: ${model.id}`);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.success(
|
this.flashMessages.success(
|
||||||
`There was a problem enabling the entity: ${model.id} - ${e.errors.join(' ') || e.message}`
|
`There was a problem enabling the entity: ${model.id} - ${e.errors.join(' ') || e.message}`
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default Component.extend({
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.store.findAll('auth-method').then(methods => {
|
this.store.findAll('auth-method').then((methods) => {
|
||||||
this.set('authMethods', methods);
|
this.set('authMethods', methods);
|
||||||
this.set('aliasMountAccessor', methods.get('firstObject.accessor'));
|
this.set('aliasMountAccessor', methods.get('firstObject.accessor'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { allFeatures } from 'vault/helpers/all-features';
|
||||||
*/
|
*/
|
||||||
export default class LicenseInfoComponent extends Component {
|
export default class LicenseInfoComponent extends Component {
|
||||||
get featuresInfo() {
|
get featuresInfo() {
|
||||||
return allFeatures().map(feature => {
|
return allFeatures().map((feature) => {
|
||||||
let active = this.args.features.includes(feature);
|
let active = this.args.features.includes(feature);
|
||||||
if (active && feature === 'Performance Standby') {
|
if (active && feature === 'Performance Standby') {
|
||||||
let count = this.args.performanceStandbyCount;
|
let count = this.args.performanceStandbyCount;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Component from '@ember/component';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
import { methods } from 'vault/helpers/mountable-auth-methods';
|
import { methods } from 'vault/helpers/mountable-auth-methods';
|
||||||
import { engines, KMIP, TRANSFORM } from 'vault/helpers/mountable-secret-engines';
|
import { engines, KMIP, TRANSFORM } from 'vault/helpers/mountable-secret-engines';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
const METHODS = methods();
|
const METHODS = methods();
|
||||||
const ENGINES = engines();
|
const ENGINES = engines();
|
||||||
|
@ -74,6 +75,7 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
willDestroy() {
|
willDestroy() {
|
||||||
|
this._super(...arguments);
|
||||||
// if unsaved, we want to unload so it doesn't show up in the auth mount list
|
// if unsaved, we want to unload so it doesn't show up in the auth mount list
|
||||||
this.mountModel.rollbackAttributes();
|
this.mountModel.rollbackAttributes();
|
||||||
},
|
},
|
||||||
|
@ -90,7 +92,8 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mountBackend: task(function*() {
|
mountBackend: task(
|
||||||
|
waitFor(function* () {
|
||||||
const mountModel = this.mountModel;
|
const mountModel = this.mountModel;
|
||||||
const { type, path } = mountModel;
|
const { type, path } = mountModel;
|
||||||
let capabilities = null;
|
let capabilities = null;
|
||||||
|
@ -142,8 +145,7 @@ export default Component.extend({
|
||||||
yield this.onMountSuccess(type, path);
|
yield this.onMountSuccess(type, path);
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
.drop()
|
).drop(),
|
||||||
.withTestWaiter(),
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onKeyUp(name, value) {
|
onKeyUp(name, value) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class OidcConsentBlockComponent extends Component {
|
||||||
buildUrl(urlString, params) {
|
buildUrl(urlString, params) {
|
||||||
try {
|
try {
|
||||||
let url = new URL(urlString);
|
let url = new URL(urlString);
|
||||||
Object.keys(params).forEach(key => {
|
Object.keys(params).forEach((key) => {
|
||||||
if (params[key] && validParameters.includes(key)) {
|
if (params[key] && validParameters.includes(key)) {
|
||||||
url.searchParams.append(key, params[key]);
|
url.searchParams.append(key, params[key]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
import { waitFor } from '@ember/test-waiters';
|
||||||
|
|
||||||
const BASE_64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gi;
|
const BASE_64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gi;
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
@ -41,7 +43,8 @@ export default Component.extend({
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
},
|
},
|
||||||
|
|
||||||
setPGPKey: task(function*(dataURL, filename) {
|
setPGPKey: task(
|
||||||
|
waitFor(function* (dataURL, filename) {
|
||||||
const b64File = dataURL.split(',')[1].trim();
|
const b64File = dataURL.split(',')[1].trim();
|
||||||
const decoded = atob(b64File).trim();
|
const decoded = atob(b64File).trim();
|
||||||
|
|
||||||
|
@ -51,7 +54,8 @@ export default Component.extend({
|
||||||
// the original as it was only encoded when we used `readAsDataURL`.
|
// the original as it was only encoded when we used `readAsDataURL`.
|
||||||
const fileData = decoded.match(BASE_64_REGEX) ? decoded : b64File;
|
const fileData = decoded.match(BASE_64_REGEX) ? decoded : b64File;
|
||||||
yield this.onChange(this.index, { value: fileData, fileName: filename });
|
yield this.onChange(this.index, { value: fileData, fileName: filename });
|
||||||
}).withTestWaiter(),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
pickedFile(e) {
|
pickedFile(e) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default Component.extend({
|
||||||
list = [...this.listData, ...this.newList(this.listLength - this.listData.length)];
|
list = [...this.listData, ...this.newList(this.listLength - this.listData.length)];
|
||||||
}
|
}
|
||||||
this.set('listData', list || this.listData);
|
this.set('listData', list || this.listData);
|
||||||
this.onDataUpdate((list || this.listData).compact().map(k => k.value));
|
this.onDataUpdate((list || this.listData).compact().map((k) => k.value));
|
||||||
},
|
},
|
||||||
|
|
||||||
newList(length) {
|
newList(length) {
|
||||||
|
@ -47,7 +47,7 @@ export default Component.extend({
|
||||||
setKey(index, key) {
|
setKey(index, key) {
|
||||||
let { listData } = this;
|
let { listData } = this;
|
||||||
listData.splice(index, 1, key);
|
listData.splice(index, 1, key);
|
||||||
this.onDataUpdate(listData.compact().map(k => k.value));
|
this.onDataUpdate(listData.compact().map((k) => k.value));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="regex-label-wrapper">
|
<div class="regex-label-wrapper">
|
||||||
<div class="regex-label">
|
<div class="regex-label">
|
||||||
<label for="{{@attr.name}}" class="is-label">
|
<label for={{@attr.name}} class="is-label">
|
||||||
{{@labelString}}
|
{{@labelString}}
|
||||||
{{#if @attr.options.helpText}}
|
{{#if @attr.options.helpText}}
|
||||||
{{#info-tooltip}}
|
<InfoTooltip>
|
||||||
<span data-test-help-text>
|
<span data-test-help-text>
|
||||||
{{@attr.options.helpText}}
|
{{@attr.options.helpText}}
|
||||||
</span>
|
</span>
|
||||||
{{/info-tooltip}}
|
</InfoTooltip>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</label>
|
</label>
|
||||||
{{#if @attr.options.subText}}
|
{{#if @attr.options.subText}}
|
||||||
<p class="sub-text">{{@attr.options.subText}} {{#if @attr.options.docLink}}<a href="{{@attr.options.docLink}}" target="_blank" rel="noopener noreferrer">See our documentation</a> for help.{{/if}}</p>
|
<p class="sub-text">
|
||||||
|
{{@attr.options.subText}}
|
||||||
|
{{#if @attr.options.docLink}}
|
||||||
|
<a href={{@attr.options.docLink}} target="_blank" rel="noopener noreferrer">
|
||||||
|
See our documentation
|
||||||
|
</a>
|
||||||
|
for help.
|
||||||
|
{{/if}}
|
||||||
|
</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -32,14 +40,14 @@
|
||||||
data-test-input={{@attr.name}}
|
data-test-input={{@attr.name}}
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
{{on 'change' @onChange}}
|
{{on "change" @onChange}}
|
||||||
value={{@value}}
|
value={{@value}}
|
||||||
class="input"
|
class="input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{{#if this.showTestValue}}
|
{{#if this.showTestValue}}
|
||||||
<div data-test-regex-validator-test-string>
|
<div data-test-regex-validator-test-string>
|
||||||
<label for="{{@attr.name}}" class="is-label">
|
<label for={{@attr.name}} class="is-label">
|
||||||
Test string
|
Test string
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
|
@ -48,8 +56,9 @@
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
value={{this.testValue}}
|
value={{this.testValue}}
|
||||||
{{on 'change' this.updateTestValue}}
|
{{on "change" this.updateTestValue}}
|
||||||
class="input {{if this.regexError 'has-error'}}" />
|
class="input {{if this.regexError "has-error"}}"
|
||||||
|
/>
|
||||||
|
|
||||||
{{#if (and this.testValue @value)}}
|
{{#if (and this.testValue @value)}}
|
||||||
<div data-test-regex-validation-message>
|
<div data-test-regex-validation-message>
|
||||||
|
@ -65,4 +74,3 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,8 @@ import ControlGroupError from 'vault/lib/control-group-error';
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import keys from 'vault/lib/keycodes';
|
import keys from 'vault/lib/keycodes';
|
||||||
|
|
||||||
import { action } from '@ember/object';
|
import { action, set } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { set } from '@ember/object';
|
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
|
|
||||||
import { isBlank, isNone } from '@ember/utils';
|
import { isBlank, isNone } from '@ember/utils';
|
||||||
|
@ -66,7 +65,7 @@ export default class SecretCreateOrUpdate extends Component {
|
||||||
let adapter = this.store.adapterFor('secret-v2');
|
let adapter = this.store.adapterFor('secret-v2');
|
||||||
let type = { modelName: 'secret-v2' };
|
let type = { modelName: 'secret-v2' };
|
||||||
let query = { backend: this.args.model.backend };
|
let query = { backend: this.args.model.backend };
|
||||||
adapter.query(this.store, type, query).then(result => {
|
adapter.query(this.store, type, query).then((result) => {
|
||||||
this.secretPaths = result.data.keys;
|
this.secretPaths = result.data.keys;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -143,7 +142,7 @@ export default class SecretCreateOrUpdate extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.saveComplete(successCallback, key);
|
this.saveComplete(successCallback, key);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
// when mode is not create the metadata error is handled in secret-edit-metadata
|
// when mode is not create the metadata error is handled in secret-edit-metadata
|
||||||
if (this.args.mode === 'create') {
|
if (this.args.mode === 'create') {
|
||||||
this.error = e.errors.join(' ');
|
this.error = e.errors.join(' ');
|
||||||
|
@ -155,7 +154,7 @@ export default class SecretCreateOrUpdate extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
if (error instanceof ControlGroupError) {
|
if (error instanceof ControlGroupError) {
|
||||||
let errorMessage = this.controlGroup.logFromError(error);
|
let errorMessage = this.controlGroup.logFromError(error);
|
||||||
this.error = errorMessage.content;
|
this.error = errorMessage.content;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint ember/no-computed-properties-in-native-classes: 'warn' */
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
|
@ -6,7 +7,7 @@ import { action } from '@ember/object';
|
||||||
import { alias } from '@ember/object/computed';
|
import { alias } from '@ember/object/computed';
|
||||||
import { maybeQueryRecord } from 'vault/macros/maybe-query-record';
|
import { maybeQueryRecord } from 'vault/macros/maybe-query-record';
|
||||||
|
|
||||||
const getErrorMessage = errors => {
|
const getErrorMessage = (errors) => {
|
||||||
let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.';
|
let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.';
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
};
|
};
|
||||||
|
@ -19,7 +20,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
|
|
||||||
@maybeQueryRecord(
|
@maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return;
|
if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return;
|
||||||
let [backend, id] = JSON.parse(context.args.modelForData.id);
|
let [backend, id] = JSON.parse(context.args.modelForData.id);
|
||||||
return {
|
return {
|
||||||
|
@ -33,7 +34,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
|
|
||||||
@maybeQueryRecord(
|
@maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return;
|
if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return;
|
||||||
let [backend, id] = JSON.parse(context.args.modelForData.id);
|
let [backend, id] = JSON.parse(context.args.modelForData.id);
|
||||||
return {
|
return {
|
||||||
|
@ -47,7 +48,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
|
|
||||||
@maybeQueryRecord(
|
@maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.args.model || !context.args.model.engine || !context.args.model.id) return;
|
if (!context.args.model || !context.args.model.engine || !context.args.model.id) return;
|
||||||
let backend = context.args.model.engine.id;
|
let backend = context.args.model.engine.id;
|
||||||
let id = context.args.model.id;
|
let id = context.args.model.id;
|
||||||
|
@ -64,7 +65,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
|
|
||||||
@maybeQueryRecord(
|
@maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.args.model || context.args.mode === 'create') {
|
if (!context.args.model || context.args.mode === 'create') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +86,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
|
|
||||||
@maybeQueryRecord(
|
@maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.args.model || context.args.mode === 'create') {
|
if (!context.args.model || context.args.mode === 'create') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ export default class SecretDeleteMenu extends Component {
|
||||||
return this.store
|
return this.store
|
||||||
.adapterFor('secret-v2-version')
|
.adapterFor('secret-v2-version')
|
||||||
.v2DeleteOperation(this.store, this.args.modelForData.id, deleteType, currentVersionForNoReadMetadata)
|
.v2DeleteOperation(this.store, this.args.modelForData.id, deleteType, currentVersionForNoReadMetadata)
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
if (Ember.testing) {
|
if (Ember.testing) {
|
||||||
this.showDeleteModal = false;
|
this.showDeleteModal = false;
|
||||||
// we don't want a refresh otherwise test loop will rerun in a loop
|
// we don't want a refresh otherwise test loop will rerun in a loop
|
||||||
|
|
|
@ -16,9 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import { action } from '@ember/object';
|
import { action, set } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { set } from '@ember/object';
|
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
|
|
||||||
export default class SecretEditMetadata extends Component {
|
export default class SecretEditMetadata extends Component {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
* @param {object} wrappedData - when copy the data it's the token of the secret returned.
|
* @param {object} wrappedData - when copy the data it's the token of the secret returned.
|
||||||
* @param {object} editActions - actions passed from parent to child
|
* @param {object} editActions - actions passed from parent to child
|
||||||
*/
|
*/
|
||||||
|
/* eslint ember/no-computed-properties-in-native-classes: 'warn' */
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { not } from '@ember/object/computed';
|
import { not } from '@ember/object/computed';
|
||||||
|
@ -75,7 +75,7 @@ export default class SecretEditToolbar extends Component {
|
||||||
this.store
|
this.store
|
||||||
.adapterFor('secret-v2-version')
|
.adapterFor('secret-v2-version')
|
||||||
.queryRecord(this.args.modelForData.id, { wrapTTL: 1800 })
|
.queryRecord(this.args.modelForData.id, { wrapTTL: 1800 })
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
this.wrappedData = resp.wrap_info.token;
|
this.wrappedData = resp.wrap_info.token;
|
||||||
this.flashMessages.success('Secret Successfully Wrapped!');
|
this.flashMessages.success('Secret Successfully Wrapped!');
|
||||||
})
|
})
|
||||||
|
@ -93,7 +93,7 @@ export default class SecretEditToolbar extends Component {
|
||||||
id: this.args.modelForData.id,
|
id: this.args.modelForData.id,
|
||||||
wrapTTL: 1800,
|
wrapTTL: 1800,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then((resp) => {
|
||||||
this.wrappedData = resp.wrap_info.token;
|
this.wrappedData = resp.wrap_info.token;
|
||||||
this.flashMessages.success('Secret Successfully Wrapped!');
|
this.flashMessages.success('Secret Successfully Wrapped!');
|
||||||
})
|
})
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||||
|
|
||||||
checkSecretCapabilities: maybeQueryRecord(
|
checkSecretCapabilities: maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.model || context.mode === 'create') {
|
if (!context.model || context.mode === 'create') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||||
|
|
||||||
checkMetadataCapabilities: maybeQueryRecord(
|
checkMetadataCapabilities: maybeQueryRecord(
|
||||||
'capabilities',
|
'capabilities',
|
||||||
context => {
|
(context) => {
|
||||||
if (!context.model || !context.isV2) {
|
if (!context.model || !context.isV2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,11 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||||
|
|
||||||
showAdvancedMode: or('secretDataIsAdvanced', 'preferAdvancedEdit'),
|
showAdvancedMode: or('secretDataIsAdvanced', 'preferAdvancedEdit'),
|
||||||
|
|
||||||
isWriteWithoutRead: computed('model.failedServerRead', 'modelForData.failedServerRead', 'isV2', function() {
|
isWriteWithoutRead: computed(
|
||||||
|
'model.failedServerRead',
|
||||||
|
'modelForData.failedServerRead',
|
||||||
|
'isV2',
|
||||||
|
function () {
|
||||||
if (!this.model) return;
|
if (!this.model) return;
|
||||||
// if the version couldn't be read from the server
|
// if the version couldn't be read from the server
|
||||||
if (this.isV2 && this.modelForData.failedServerRead) {
|
if (this.isV2 && this.modelForData.failedServerRead) {
|
||||||
|
@ -148,7 +152,8 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
refresh() {
|
refresh() {
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default class SecretListHeaderTab extends Component {
|
||||||
let checkCapabilities = function (object) {
|
let checkCapabilities = function (object) {
|
||||||
let array = [];
|
let array = [];
|
||||||
// we only want to look at the canList, canCreate and canUpdate on the capabilities record
|
// we only want to look at the canList, canCreate and canUpdate on the capabilities record
|
||||||
capabilitiesArray.forEach(item => {
|
capabilitiesArray.forEach((item) => {
|
||||||
// object is sometimes null
|
// object is sometimes null
|
||||||
if (object) {
|
if (object) {
|
||||||
array.push(object[item]);
|
array.push(object[item]);
|
||||||
|
@ -47,7 +47,7 @@ export default class SecretListHeaderTab extends Component {
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
};
|
};
|
||||||
let checker = arr => arr.every(item => !item); // same things as listing every item as !item && !item, etc.
|
let checker = (arr) => arr.every((item) => !item); // same things as listing every item as !item && !item, etc.
|
||||||
// For now only check capabilities for the Database Secrets Engine
|
// For now only check capabilities for the Database Secrets Engine
|
||||||
if (this.args.displayName === 'Database') {
|
if (this.args.displayName === 'Database') {
|
||||||
let peekRecordRoles = this.store.peekRecord('capabilities', 'database/roles/');
|
let peekRecordRoles = this.store.peekRecord('capabilities', 'database/roles/');
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default class DatabaseListItem extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.flashMessages.success(`Success: ${id} connection was reset`);
|
this.flashMessages.success(`Success: ${id} connection was reset`);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.danger(e.errors);
|
this.flashMessages.danger(e.errors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export default class DatabaseListItem extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.flashMessages.success(`Success: ${id} connection was rotated`);
|
this.flashMessages.success(`Success: ${id} connection was rotated`);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.danger(e.errors);
|
this.flashMessages.danger(e.errors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import { set } from '@ember/object';
|
import { set, action } from '@ember/object';
|
||||||
import { action } from '@ember/object';
|
|
||||||
import { tracked } from '@glimmer/tracking';
|
import { tracked } from '@glimmer/tracking';
|
||||||
import { guidFor } from '@ember/object/internals';
|
import { guidFor } from '@ember/object/internals';
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,12 @@ import { inject as service } from '@ember/service';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { setProperties, computed, set } from '@ember/object';
|
import { setProperties, computed, set } from '@ember/object';
|
||||||
import { addSeconds, parseISO } from 'date-fns';
|
import { addSeconds, parseISO } from 'date-fns';
|
||||||
|
import { A } from '@ember/array';
|
||||||
|
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
token: null,
|
token: null,
|
||||||
rewrap_token: null,
|
rewrap_token: null,
|
||||||
errors: [],
|
errors: A(),
|
||||||
wrap_info: null,
|
wrap_info: null,
|
||||||
creation_time: null,
|
creation_time: null,
|
||||||
creation_ttl: null,
|
creation_ttl: null,
|
||||||
|
@ -127,7 +128,10 @@ export default Component.extend(DEFAULTS, {
|
||||||
this.store
|
this.store
|
||||||
.adapterFor('tools')
|
.adapterFor('tools')
|
||||||
.toolAction(action, data, { wrapTTL })
|
.toolAction(action, data, { wrapTTL })
|
||||||
.then(resp => this.handleSuccess(resp, action), (...errArgs) => this.handleError(...errArgs));
|
.then(
|
||||||
|
(resp) => this.handleSuccess(resp, action),
|
||||||
|
(...errArgs) => this.handleError(...errArgs)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onClear() {
|
onClear() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ export default Component.extend(FocusOnInsertMixin, {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
successCallback(model);
|
successCallback(model);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
model.set('displayErrors', e.errors);
|
model.set('displayErrors', e.errors);
|
||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default TransformBase.extend({
|
||||||
handleUpdateTransformations(updateTransformations, roleId, type = 'update') {
|
handleUpdateTransformations(updateTransformations, roleId, type = 'update') {
|
||||||
if (!updateTransformations) return;
|
if (!updateTransformations) return;
|
||||||
const backend = this.model.backend;
|
const backend = this.model.backend;
|
||||||
const promises = updateTransformations.map(transform => {
|
const promises = updateTransformations.map((transform) => {
|
||||||
return this.store
|
return this.store
|
||||||
.queryRecord('transform', {
|
.queryRecord('transform', {
|
||||||
backend,
|
backend,
|
||||||
|
@ -30,17 +30,17 @@ export default TransformBase.extend({
|
||||||
allowed_roles: roles,
|
allowed_roles: roles,
|
||||||
});
|
});
|
||||||
|
|
||||||
return transformation.save().catch(e => {
|
return transformation.save().catch((e) => {
|
||||||
return { errorStatus: e.httpStatus, ...transform };
|
return { errorStatus: e.httpStatus, ...transform };
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(promises).then(res => {
|
Promise.all(promises).then((res) => {
|
||||||
let hasError = res.find(r => !!r.errorStatus);
|
let hasError = res.find((r) => !!r.errorStatus);
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
let errorAdding = res.find(r => r.errorStatus === 403 && r.action === 'ADD');
|
let errorAdding = res.find((r) => r.errorStatus === 403 && r.action === 'ADD');
|
||||||
let errorRemoving = res.find(r => r.errorStatus === 403 && r.action === 'REMOVE');
|
let errorRemoving = res.find((r) => r.errorStatus === 403 && r.action === 'REMOVE');
|
||||||
|
|
||||||
let message =
|
let message =
|
||||||
'The edits to this role were successful, but allowed_roles for its transformations was not edited due to a lack of permissions.';
|
'The edits to this role were successful, but allowed_roles for its transformations was not edited due to a lack of permissions.';
|
||||||
|
@ -72,7 +72,7 @@ export default TransformBase.extend({
|
||||||
|
|
||||||
if (!this.initialTransformations) {
|
if (!this.initialTransformations) {
|
||||||
this.handleUpdateTransformations(
|
this.handleUpdateTransformations(
|
||||||
newModelTransformations.map(t => ({
|
newModelTransformations.map((t) => ({
|
||||||
id: t,
|
id: t,
|
||||||
action: 'ADD',
|
action: 'ADD',
|
||||||
})),
|
})),
|
||||||
|
@ -83,7 +83,7 @@ export default TransformBase.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateTransformations = [...newModelTransformations, ...this.initialTransformations]
|
const updateTransformations = [...newModelTransformations, ...this.initialTransformations]
|
||||||
.map(t => {
|
.map((t) => {
|
||||||
if (this.initialTransformations.indexOf(t) < 0) {
|
if (this.initialTransformations.indexOf(t) < 0) {
|
||||||
return {
|
return {
|
||||||
id: t,
|
id: t,
|
||||||
|
@ -98,7 +98,7 @@ export default TransformBase.extend({
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.filter(t => !!t);
|
.filter((t) => !!t);
|
||||||
this.handleUpdateTransformations(updateTransformations, roleId);
|
this.handleUpdateTransformations(updateTransformations, roleId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -106,7 +106,7 @@ export default TransformBase.extend({
|
||||||
delete() {
|
delete() {
|
||||||
const roleId = this.model?.id;
|
const roleId = this.model?.id;
|
||||||
const roleTransformations = this.model?.transformations || [];
|
const roleTransformations = this.model?.transformations || [];
|
||||||
const updateTransformations = roleTransformations.map(t => ({
|
const updateTransformations = roleTransformations.map((t) => ({
|
||||||
id: t,
|
id: t,
|
||||||
action: 'REMOVE',
|
action: 'REMOVE',
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default TransformBase.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
let { type, allowed_roles, tweak_source, name } = this.model;
|
let { type, allowed_roles, tweak_source, name } = this.model;
|
||||||
let wildCardRole = allowed_roles.find(role => role.includes('*'));
|
let wildCardRole = allowed_roles.find((role) => role.includes('*'));
|
||||||
|
|
||||||
// values to be returned
|
// values to be returned
|
||||||
let role = '<choose a role>';
|
let role = '<choose a role>';
|
||||||
|
|
|
@ -15,7 +15,7 @@ export default TransformBase.extend({
|
||||||
backend,
|
backend,
|
||||||
id: role.id,
|
id: role.id,
|
||||||
})
|
})
|
||||||
.then(roleStore => {
|
.then((roleStore) => {
|
||||||
let transformations = roleStore.transformations;
|
let transformations = roleStore.transformations;
|
||||||
if (role.action === 'ADD') {
|
if (role.action === 'ADD') {
|
||||||
transformations = addToList(transformations, transformationId);
|
transformations = addToList(transformations, transformationId);
|
||||||
|
@ -26,14 +26,14 @@ export default TransformBase.extend({
|
||||||
backend,
|
backend,
|
||||||
transformations,
|
transformations,
|
||||||
});
|
});
|
||||||
return roleStore.save().catch(e => {
|
return roleStore.save().catch((e) => {
|
||||||
return {
|
return {
|
||||||
errorStatus: e.httpStatus,
|
errorStatus: e.httpStatus,
|
||||||
...role,
|
...role,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
if (e.httpStatus !== 403 && role.action === 'ADD') {
|
if (e.httpStatus !== 403 && role.action === 'ADD') {
|
||||||
// If role doesn't yet exist, create it with this transformation attached
|
// If role doesn't yet exist, create it with this transformation attached
|
||||||
var newRole = this.store.createRecord('transform/role', {
|
var newRole = this.store.createRecord('transform/role', {
|
||||||
|
@ -42,7 +42,7 @@ export default TransformBase.extend({
|
||||||
transformations: [transformationId],
|
transformations: [transformationId],
|
||||||
backend,
|
backend,
|
||||||
});
|
});
|
||||||
return newRole.save().catch(e => {
|
return newRole.save().catch((e) => {
|
||||||
return {
|
return {
|
||||||
errorStatus: e.httpStatus,
|
errorStatus: e.httpStatus,
|
||||||
...role,
|
...role,
|
||||||
|
@ -61,15 +61,15 @@ export default TransformBase.extend({
|
||||||
handleUpdateRoles(updateRoles, transformationId) {
|
handleUpdateRoles(updateRoles, transformationId) {
|
||||||
if (!updateRoles) return;
|
if (!updateRoles) return;
|
||||||
const backend = this.model.backend;
|
const backend = this.model.backend;
|
||||||
const promises = updateRoles.map(r => this.updateOrCreateRole(r, transformationId, backend));
|
const promises = updateRoles.map((r) => this.updateOrCreateRole(r, transformationId, backend));
|
||||||
|
|
||||||
Promise.all(promises).then(results => {
|
Promise.all(promises).then((results) => {
|
||||||
let hasError = results.find(role => !!role.errorStatus);
|
let hasError = results.find((role) => !!role.errorStatus);
|
||||||
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
let message =
|
let message =
|
||||||
'The edits to this transformation were successful, but transformations for its roles was not edited due to a lack of permissions.';
|
'The edits to this transformation were successful, but transformations for its roles was not edited due to a lack of permissions.';
|
||||||
if (results.find(e => !!e.errorStatus && e.errorStatus !== 403)) {
|
if (results.find((e) => !!e.errorStatus && e.errorStatus !== 403)) {
|
||||||
// if the errors weren't all due to permissions show generic message
|
// if the errors weren't all due to permissions show generic message
|
||||||
// eg. trying to update a role with empty array as transformations
|
// eg. trying to update a role with empty array as transformations
|
||||||
message = `You've edited the allowed_roles for this transformation. However, the corresponding edits to some roles' transformations were not made`;
|
message = `You've edited the allowed_roles for this transformation. However, the corresponding edits to some roles' transformations were not made`;
|
||||||
|
@ -99,8 +99,8 @@ export default TransformBase.extend({
|
||||||
const initialRoles = this.initialRoles || [];
|
const initialRoles = this.initialRoles || [];
|
||||||
|
|
||||||
const updateRoles = [...newModelRoles, ...initialRoles]
|
const updateRoles = [...newModelRoles, ...initialRoles]
|
||||||
.filter(r => !this.isWildcard(r)) // CBS TODO: expand wildcards into included roles instead
|
.filter((r) => !this.isWildcard(r)) // CBS TODO: expand wildcards into included roles instead
|
||||||
.map(role => {
|
.map((role) => {
|
||||||
if (initialRoles.indexOf(role) < 0) {
|
if (initialRoles.indexOf(role) < 0) {
|
||||||
return {
|
return {
|
||||||
id: role,
|
id: role,
|
||||||
|
@ -115,7 +115,7 @@ export default TransformBase.extend({
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.filter(r => !!r);
|
.filter((r) => !!r);
|
||||||
this.handleUpdateRoles(updateRoles, transformationId);
|
this.handleUpdateRoles(updateRoles, transformationId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -134,7 +134,7 @@ export default Component.extend(TRANSIT_PARAMS, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsToKeep) {
|
if (paramsToKeep) {
|
||||||
paramsToKeep.forEach(param => delete params[param]);
|
paramsToKeep.forEach((param) => delete params[param]);
|
||||||
}
|
}
|
||||||
//resets params still left in the object to defaults
|
//resets params still left in the object to defaults
|
||||||
this.clearErrors();
|
this.clearErrors();
|
||||||
|
@ -170,8 +170,10 @@ export default Component.extend(TRANSIT_PARAMS, {
|
||||||
if (options.wrapTTL) {
|
if (options.wrapTTL) {
|
||||||
props = assign({}, props, { wrappedToken: resp.wrap_info.token });
|
props = assign({}, props, { wrappedToken: resp.wrap_info.token });
|
||||||
}
|
}
|
||||||
|
if (!this.isDestroyed && !this.isDestroying) {
|
||||||
this.toggleProperty('isModalActive');
|
this.toggleProperty('isModalActive');
|
||||||
this.setProperties(props);
|
this.setProperties(props);
|
||||||
|
}
|
||||||
if (action === 'rotate') {
|
if (action === 'rotate') {
|
||||||
this.onRefresh();
|
this.onRefresh();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +206,7 @@ export default Component.extend(TRANSIT_PARAMS, {
|
||||||
|
|
||||||
clearParams(params) {
|
clearParams(params) {
|
||||||
const arr = Array.isArray(params) ? params : [params];
|
const arr = Array.isArray(params) ? params : [params];
|
||||||
arr.forEach(param => this.set(param, null));
|
arr.forEach((param) => this.set(param, null));
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleModal(successMessage) {
|
toggleModal(successMessage) {
|
||||||
|
@ -235,7 +237,7 @@ export default Component.extend(TRANSIT_PARAMS, {
|
||||||
.adapterFor('transit-key')
|
.adapterFor('transit-key')
|
||||||
.keyAction(action, { backend, id, payload }, options)
|
.keyAction(action, { backend, id, payload }, options)
|
||||||
.then(
|
.then(
|
||||||
resp => this.handleSuccess(resp, options, action),
|
(resp) => this.handleSuccess(resp, options, action),
|
||||||
(...errArgs) => this.handleError(...errArgs)
|
(...errArgs) => this.handleError(...errArgs)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,7 +32,11 @@ export default Component.extend({
|
||||||
completedFeatures: computed('wizard.currentMachine', function () {
|
completedFeatures: computed('wizard.currentMachine', function () {
|
||||||
return this.wizard.getCompletedFeatures();
|
return this.wizard.getCompletedFeatures();
|
||||||
}),
|
}),
|
||||||
currentFeatureProgress: computed('currentMachine', 'featureMachineHistory.[]', 'tutorialState', function() {
|
currentFeatureProgress: computed(
|
||||||
|
'currentMachine',
|
||||||
|
'featureMachineHistory.[]',
|
||||||
|
'tutorialState',
|
||||||
|
function () {
|
||||||
if (this.tutorialState.includes('active.feature')) {
|
if (this.tutorialState.includes('active.feature')) {
|
||||||
let totalSteps = FEATURE_MACHINE_STEPS[this.currentMachine];
|
let totalSteps = FEATURE_MACHINE_STEPS[this.currentMachine];
|
||||||
if (this.currentMachine === 'secrets') {
|
if (this.currentMachine === 'secrets') {
|
||||||
|
@ -56,7 +60,8 @@ export default Component.extend({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
currentTutorialProgress: computed('tutorialState', function () {
|
currentTutorialProgress: computed('tutorialState', function () {
|
||||||
if (this.tutorialState.includes('init.active')) {
|
if (this.tutorialState.includes('init.active')) {
|
||||||
let currentStepName = this.tutorialState.split('.')[2];
|
let currentStepName = this.tutorialState.split('.')[2];
|
||||||
|
@ -85,10 +90,10 @@ export default Component.extend({
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (this.currentFeatureProgress) {
|
if (this.currentFeatureProgress) {
|
||||||
this.completedFeatures.forEach(feature => {
|
this.completedFeatures.forEach((feature) => {
|
||||||
bar.push({ style: htmlSafe('width:100%;'), completed: true, feature: feature, showIcon: true });
|
bar.push({ style: htmlSafe('width:100%;'), completed: true, feature: feature, showIcon: true });
|
||||||
});
|
});
|
||||||
this.wizard.featureList.forEach(feature => {
|
this.wizard.featureList.forEach((feature) => {
|
||||||
if (feature === this.currentMachine) {
|
if (feature === this.currentMachine) {
|
||||||
bar.push({
|
bar.push({
|
||||||
style: htmlSafe(`width:${this.currentFeatureProgress.percentage}%;`),
|
style: htmlSafe(`width:${this.currentFeatureProgress.percentage}%;`),
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default Component.extend({
|
||||||
|
|
||||||
maybeHideFeatures() {
|
maybeHideFeatures() {
|
||||||
let features = this.allFeatures;
|
let features = this.allFeatures;
|
||||||
features.forEach(feat => {
|
features.forEach((feat) => {
|
||||||
feat.disabled = this.doesNotHavePermission(feat.requiredPermissions);
|
feat.disabled = this.doesNotHavePermission(feat.requiredPermissions);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export default Component.extend({
|
||||||
// 'example/path': ['capability'],
|
// 'example/path': ['capability'],
|
||||||
// 'second/example/path': ['update', 'sudo'],
|
// 'second/example/path': ['update', 'sudo'],
|
||||||
// }
|
// }
|
||||||
return !Object.keys(requiredPermissions).every(path => {
|
return !Object.keys(requiredPermissions).every((path) => {
|
||||||
return this.permissions.hasPermission(path, requiredPermissions[path]);
|
return this.permissions.hasPermission(path, requiredPermissions[path]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -49,7 +49,7 @@ export default Component.extend({
|
||||||
return time;
|
return time;
|
||||||
}),
|
}),
|
||||||
selectProgress: computed('selectedFeatures', function () {
|
selectProgress: computed('selectedFeatures', function () {
|
||||||
let bar = this.selectedFeatures.map(feature => {
|
let bar = this.selectedFeatures.map((feature) => {
|
||||||
return { style: htmlSafe('width:0%;'), completed: false, showIcon: true, feature: feature };
|
return { style: htmlSafe('width:0%;'), completed: false, showIcon: true, feature: feature };
|
||||||
});
|
});
|
||||||
if (bar.length === 0) {
|
if (bar.length === 0) {
|
||||||
|
|
|
@ -36,14 +36,14 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
mountName: computed('currentMachine', 'mountSubtype', function () {
|
mountName: computed('currentMachine', 'mountSubtype', function () {
|
||||||
if (this.currentMachine === 'secrets') {
|
if (this.currentMachine === 'secrets') {
|
||||||
var secret = engines().find(engine => {
|
var secret = engines().find((engine) => {
|
||||||
return engine.type === this.mountSubtype;
|
return engine.type === this.mountSubtype;
|
||||||
});
|
});
|
||||||
if (secret) {
|
if (secret) {
|
||||||
return secret.displayName;
|
return secret.displayName;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var auth = methods().find(method => {
|
var auth = methods().find((method) => {
|
||||||
return method.type === this.mountSubtype;
|
return method.type === this.mountSubtype;
|
||||||
});
|
});
|
||||||
if (auth) {
|
if (auth) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export default Controller.extend(ListController, {
|
||||||
this.send('reload');
|
this.send('reload');
|
||||||
this.flashMessages.success(`Successfully deleted ${type}: ${id}`);
|
this.flashMessages.success(`Successfully deleted ${type}: ${id}`);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.success(
|
this.flashMessages.success(
|
||||||
`There was a problem deleting ${type}: ${id} - ${e.errors.join(' ') || e.message}`
|
`There was a problem deleting ${type}: ${id} - ${e.errors.join(' ') || e.message}`
|
||||||
);
|
);
|
||||||
|
@ -33,7 +33,7 @@ export default Controller.extend(ListController, {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.flashMessages.success(`Successfully ${action[0]} ${type}: ${id}`);
|
this.flashMessages.success(`Successfully ${action[0]} ${type}: ${id}`);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.flashMessages.success(
|
this.flashMessages.success(
|
||||||
`There was a problem ${action[1]} ${type}: ${id} - ${e.errors.join(' ') || e.message}`
|
`There was a problem ${action[1]} ${type}: ${id} - ${e.errors.join(' ') || e.message}`
|
||||||
);
|
);
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default Controller.extend(ListController, {
|
||||||
this.flashMessages.success(`All of the leases under ${prefix} will be revoked.`);
|
this.flashMessages.success(`All of the leases under ${prefix} will be revoked.`);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errString = e.errors.join('.');
|
const errString = e.errors.join('.');
|
||||||
this.flashMessages.danger(
|
this.flashMessages.danger(
|
||||||
`There was an error attempting to revoke the prefix: ${prefix}. ${errString}.`
|
`There was an error attempting to revoke the prefix: ${prefix}. ${errString}.`
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default Controller.extend({
|
||||||
flash.success(`The lease ${model.id} was successfully renewed.`);
|
flash.success(`The lease ${model.id} was successfully renewed.`);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
const errString = e.errors.join('.');
|
const errString = e.errors.join('.');
|
||||||
flash.danger(`There was an error renewing the lease: ${errString}`);
|
flash.danger(`There was an error renewing the lease: ${errString}`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -78,7 +78,10 @@ export default Controller.extend(DEFAULTS, {
|
||||||
store
|
store
|
||||||
.adapterFor('cluster')
|
.adapterFor('cluster')
|
||||||
.initCluster(data)
|
.initCluster(data)
|
||||||
.then(resp => this.initSuccess(resp), (...errArgs) => this.initError(...errArgs));
|
.then(
|
||||||
|
(resp) => this.initSuccess(resp),
|
||||||
|
(...errArgs) => this.initError(...errArgs)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
setKeys(data) {
|
setKeys(data) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ export default Controller.extend({
|
||||||
this.wizard.transitionFeatureMachine('delete', 'CONTINUE', policyType);
|
this.wizard.transitionFeatureMachine('delete', 'CONTINUE', policyType);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
let errors = e.errors ? e.errors.join('') : e.message;
|
let errors = e.errors ? e.errors.join('') : e.message;
|
||||||
flash.danger(
|
flash.danger(
|
||||||
`There was an error deleting the ${policyType.toUpperCase()} policy "${name}": ${errors}.`
|
`There was an error deleting the ${policyType.toUpperCase()} policy "${name}": ${errors}.`
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default Controller.extend(ListController, BackendCrumbMixin, WithNavToNea
|
||||||
this.set('loading-' + item.id, true);
|
this.set('loading-' + item.id, true);
|
||||||
backend
|
backend
|
||||||
.saveZeroAddressConfig()
|
.saveZeroAddressConfig()
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
item.set('zeroAddress', false);
|
item.set('zeroAddress', false);
|
||||||
this.flashMessages.danger(e.message);
|
this.flashMessages.danger(e.message);
|
||||||
})
|
})
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue