diff --git a/changelog/13443.txt b/changelog/13443.txt new file mode 100644 index 000000000..74a995c38 --- /dev/null +++ b/changelog/13443.txt @@ -0,0 +1,3 @@ +```release-note:change +ui: Upgrade Ember to version 3.24 +``` \ No newline at end of file diff --git a/ui/.browserslistrc b/ui/.browserslistrc new file mode 100644 index 000000000..d6104e665 --- /dev/null +++ b/ui/.browserslistrc @@ -0,0 +1,3 @@ +defaults +not IE 11 +maintained node versions diff --git a/ui/.eslintignore b/ui/.eslintignore index a5750d5ea..7fc1479f0 100644 --- a/ui/.eslintignore +++ b/ui/.eslintignore @@ -16,6 +16,8 @@ # misc /coverage/ +!.* +.eslintcache # ember-try /.node_modules.ember-try/ diff --git a/ui/.eslintrc.js b/ui/.eslintrc.js index 7d2c1fe58..5beeccf83 100644 --- a/ui/.eslintrc.js +++ b/ui/.eslintrc.js @@ -12,21 +12,28 @@ module.exports = { legacyDecorators: true, }, }, - plugins: ['ember', 'prettier'], - extends: ['eslint:recommended', 'plugin:ember/recommended', 'prettier'], + plugins: ['ember'], + extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'], env: { browser: true, - es6: true, }, rules: { - // TODO revisit once figure out how to replace, added during upgrade to 3.20 - 'ember/no-new-mixins': 'off', - 'ember/no-mixins': 'off', + 'no-console': 'warn', + 'ember/no-mixins': 'warn', + '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: [ // node files { files: [ + '.eslintrc.js', + '.prettierrc.js', '.template-lintrc.js', 'ember-cli-build.js', 'testem.js', @@ -34,10 +41,10 @@ module.exports = { 'config/**/*.js', 'lib/*/index.js', 'scripts/start-vault.js', + 'server/**/*.js', ], parserOptions: { sourceType: 'script', - ecmaVersion: 2018, }, env: { browser: false, diff --git a/ui/.gitignore b/ui/.gitignore index 1eba99c91..a0c8bd962 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -11,6 +11,7 @@ # misc /.sass-cache +/.eslintcache /connect.lock /coverage/ /libpeerconnection.log diff --git a/ui/.prettierignore b/ui/.prettierignore new file mode 100644 index 000000000..922165552 --- /dev/null +++ b/ui/.prettierignore @@ -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 diff --git a/ui/.prettierrc b/ui/.prettierrc deleted file mode 100644 index f7aa09f41..000000000 --- a/ui/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "es5", - "printWidth": 110 -} diff --git a/ui/.prettierrc.js b/ui/.prettierrc.js new file mode 100644 index 000000000..8f507fd9b --- /dev/null +++ b/ui/.prettierrc.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = { + singleQuote: true, + trailingComma: 'es5', + printWidth: 110, + overrides: [ + { + files: '*.hbs', + options: { + singleQuote: false, + printWidth: 125, + }, + }, + ], +}; diff --git a/ui/.storybook/config.js b/ui/.storybook/config.js index 23f4116d6..e43ef8cc3 100644 --- a/ui/.storybook/config.js +++ b/ui/.storybook/config.js @@ -7,8 +7,8 @@ function loadStories() { // automatically import all files ending in *.stories.js const appStories = require.context('../stories', true, /.stories.js$/); const addonAndRepoStories = require.context('../lib', true, /.stories.js$/); - appStories.keys().forEach(filename => appStories(filename)); - addonAndRepoStories.keys().forEach(filename => addonAndRepoStories(filename)); + appStories.keys().forEach((filename) => appStories(filename)); + addonAndRepoStories.keys().forEach((filename) => addonAndRepoStories(filename)); } addParameters({ @@ -16,7 +16,7 @@ addParameters({ options: { theme }, }); -addDecorator(storyFn => { +addDecorator((storyFn) => { const { template, context } = storyFn(); // flight icon sprite must be inserted into dom for icon lookup via use element diff --git a/ui/.template-lintrc.js b/ui/.template-lintrc.js index dede57c2c..e74aa69c8 100644 --- a/ui/.template-lintrc.js +++ b/ui/.template-lintrc.js @@ -1,27 +1,17 @@ 'use strict'; module.exports = { - extends: 'recommended', + extends: ['octane', 'stylistic'], rules: { - // should definitely move to template only - // glimmer components for this one - 'no-partial': false, - - // these need to be looked into, but - // 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, + 'no-bare-strings': 'off', + 'no-action': 'off', + 'no-duplicate-landmark-elements': 'warn', + 'no-implicit-this': { + allow: ['supported-auth-backends'], + }, + 'require-input-label': 'off', + 'no-down-event-binding': 'warn', + 'self-closing-void-elements': 'off', }, + ignore: ['lib/story-md', 'tests/**'], }; diff --git a/ui/MODULE_REPORT.md b/ui/MODULE_REPORT.md index f4c4bb0c6..f513f0dca 100644 --- a/ui/MODULE_REPORT.md +++ b/ui/MODULE_REPORT.md @@ -1,6 +1,90 @@ ## Module Report ### 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` **Location**: `tests/helpers/wait-for-error.js` at line 5 @@ -143,34 +227,6 @@ export default function waitForError(opts) { **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 ```js @@ -185,7 +241,7 @@ export default Route.extend({ **Global**: `Ember.testing` -**Location**: `app/services/auth.js` at line 267 +**Location**: `app/services/auth.js` at line 268 ```js checkShouldRenew: task(function*() { @@ -194,17 +250,3 @@ export default Route.extend({ 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; - } -``` diff --git a/ui/README.md b/ui/README.md index ad8e1763d..d8b8a72aa 100644 --- a/ui/README.md +++ b/ui/README.md @@ -111,9 +111,8 @@ To run the tests locally in a browser other than IE11, swap out `launch_in_ci: [ ### Linting -- `yarn lint:hbs` -- `yarn lint:js` -- `yarn lint:js -- --fix` +* `yarn lint` +* `yarn lint:fix` ### Building Vault UI into a Vault Binary diff --git a/ui/app/adapters/application.js b/ui/app/adapters/application.js index 6cb3662f7..4d3e4e9f4 100644 --- a/ui/app/adapters/application.js +++ b/ui/app/adapters/application.js @@ -41,7 +41,7 @@ export default RESTAdapter.extend({ headers['X-Vault-Wrap-TTL'] = options.wrapTTL; } 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; } options.headers = assign(options.headers || {}, headers); @@ -49,7 +49,7 @@ export default RESTAdapter.extend({ _preRequest(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) { this.auth.setLastFetch(Date.now()); } @@ -86,7 +86,7 @@ export default RESTAdapter.extend({ const [resp] = args; if (resp && resp.warnings) { let flash = this.flashMessages; - resp.warnings.forEach(message => { + resp.warnings.forEach((message) => { flash.info(message); }); } @@ -102,7 +102,7 @@ export default RESTAdapter.extend({ headers: opts.headers || {}, body: opts.body, signal: opts.signal, - }).then(response => { + }).then((response) => { if (response.status >= 200 && response.status < 300) { return RSVP.resolve(response); } else { diff --git a/ui/app/adapters/auth-method.js b/ui/app/adapters/auth-method.js index 074838282..1e772c99c 100644 --- a/ui/app/adapters/auth-method.js +++ b/ui/app/adapters/auth-method.js @@ -22,7 +22,7 @@ export default ApplicationAdapter.extend({ return this.ajax(url, 'GET', { unauthenticated: true, }) - .then(result => { + .then((result) => { return { 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) { set(e, 'policyPath', 'sys/auth'); } diff --git a/ui/app/adapters/aws-credential.js b/ui/app/adapters/aws-credential.js index 638a4ed5f..ff8309973 100644 --- a/ui/app/adapters/aws-credential.js +++ b/ui/app/adapters/aws-credential.js @@ -22,7 +22,7 @@ export default ApplicationAdapter.extend({ let role = snapshot.attr('role'); 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.modelName = type.modelName; store.pushPayload(type.modelName, response); diff --git a/ui/app/adapters/capabilities.js b/ui/app/adapters/capabilities.js index 3bb3b63bf..51144d0f8 100644 --- a/ui/app/adapters/capabilities.js +++ b/ui/app/adapters/capabilities.js @@ -8,7 +8,7 @@ export default ApplicationAdapter.extend({ }, 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) { set(e, 'policyPath', 'sys/capabilities-self'); } @@ -21,7 +21,7 @@ export default ApplicationAdapter.extend({ if (!id) { return; } - return this.findRecord(store, type, id).then(resp => { + return this.findRecord(store, type, id).then((resp) => { resp.path = id; return resp; }); diff --git a/ui/app/adapters/clients/activity.js b/ui/app/adapters/clients/activity.js index df54b0ea4..1ea29d766 100644 --- a/ui/app/adapters/clients/activity.js +++ b/ui/app/adapters/clients/activity.js @@ -11,7 +11,7 @@ export default Application.extend({ query = null; } // 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 || {}; // if the response is a 204 it has no request id response.id = response.request_id || 'no-data'; diff --git a/ui/app/adapters/clients/config.js b/ui/app/adapters/clients/config.js index 73e3010e1..d5594f56b 100644 --- a/ui/app/adapters/clients/config.js +++ b/ui/app/adapters/clients/config.js @@ -2,7 +2,7 @@ import Application from '../application'; export default Application.extend({ queryRecord() { - return this.ajax(this.urlForQuery(), 'GET').then(resp => { + return this.ajax(this.urlForQuery(), 'GET').then((resp) => { resp.id = resp.request_id; return resp; }); diff --git a/ui/app/adapters/cluster.js b/ui/app/adapters/cluster.js index 032b77c75..4b52350b1 100644 --- a/ui/app/adapters/cluster.js +++ b/ui/app/adapters/cluster.js @@ -40,10 +40,10 @@ export default ApplicationAdapter.extend({ findRecord(store, type, id, snapshot) { let fetches = { health: this.health(), - sealStatus: this.sealStatus().catch(e => e), + sealStatus: this.sealStatus().catch((e) => e), }; 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 }) => { let ret = { diff --git a/ui/app/adapters/control-group.js b/ui/app/adapters/control-group.js index 451322e9a..9b88ab50d 100644 --- a/ui/app/adapters/control-group.js +++ b/ui/app/adapters/control-group.js @@ -11,7 +11,7 @@ export default ApplicationAdapter.extend({ data: { accessor: id, }, - }).then(response => { + }).then((response) => { response.id = id; return response; }); diff --git a/ui/app/adapters/database/connection.js b/ui/app/adapters/database/connection.js index 174fd6e3d..477458dc5 100644 --- a/ui/app/adapters/database/connection.js +++ b/ui/app/adapters/database/connection.js @@ -24,7 +24,7 @@ export default ApplicationAdapter.extend({ }, fetchByQuery(store, 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; if (id) { resp.id = id; diff --git a/ui/app/adapters/database/credential.js b/ui/app/adapters/database/credential.js index 62838bc05..6f7763e2e 100644 --- a/ui/app/adapters/database/credential.js +++ b/ui/app/adapters/database/credential.js @@ -9,14 +9,14 @@ export default ApplicationAdapter.extend({ return this.ajax( `${this.buildURL()}/${encodeURIComponent(backend)}/static-creds/${encodeURIComponent(secret)}`, 'GET' - ).then(resp => ({ ...resp, roleType: 'static' })); + ).then((resp) => ({ ...resp, roleType: 'static' })); }, _dynamicCreds(backend, secret) { return this.ajax( `${this.buildURL()}/${encodeURIComponent(backend)}/creds/${encodeURIComponent(secret)}`, 'GET' - ).then(resp => ({ ...resp, roleType: 'dynamic' })); + ).then((resp) => ({ ...resp, roleType: 'dynamic' })); }, fetchByQuery(store, query) { diff --git a/ui/app/adapters/database/role.js b/ui/app/adapters/database/role.js index 550537469..cb7a81cbd 100644 --- a/ui/app/adapters/database/role.js +++ b/ui/app/adapters/database/role.js @@ -25,7 +25,7 @@ export default ApplicationAdapter.extend({ }, 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) { return { ...resp, @@ -39,7 +39,7 @@ export default ApplicationAdapter.extend({ }, 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) { return { ...resp, diff --git a/ui/app/adapters/generated-item-list.js b/ui/app/adapters/generated-item-list.js index c2009fd3e..be9b01402 100644 --- a/ui/app/adapters/generated-item-list.js +++ b/ui/app/adapters/generated-item-list.js @@ -6,14 +6,14 @@ export default ApplicationAdapter.extend({ namespace: 'v1', urlForItem() {}, dynamicApiPath: '', - getDynamicApiPath: task(function*(id) { + getDynamicApiPath: task(function* (id) { // TODO: remove yield at some point. let result = yield this.store.peekRecord('auth-method', id); this.dynamicApiPath = result.apiPath; return; }), - fetchByQuery: task(function*(store, query, isList) { + fetchByQuery: task(function* (store, query, isList) { const { id } = query; let data = {}; if (isList) { @@ -21,7 +21,7 @@ export default ApplicationAdapter.extend({ 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 = { id, method: id, diff --git a/ui/app/adapters/identity/entity.js b/ui/app/adapters/identity/entity.js index 7aecbfcd9..3449b48b4 100644 --- a/ui/app/adapters/identity/entity.js +++ b/ui/app/adapters/identity/entity.js @@ -3,7 +3,7 @@ import IdentityAdapter from './base'; export default IdentityAdapter.extend({ lookup(store, data) { 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 if (!response) return; let modelName = 'identity/entity'; diff --git a/ui/app/adapters/identity/group.js b/ui/app/adapters/identity/group.js index bd12d8ceb..6f4ffbc82 100644 --- a/ui/app/adapters/identity/group.js +++ b/ui/app/adapters/identity/group.js @@ -3,7 +3,7 @@ import IdentityAdapter from './base'; export default IdentityAdapter.extend({ lookup(store, data) { 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 if (!response) return; let modelName = 'identity/group'; diff --git a/ui/app/adapters/kmip/base.js b/ui/app/adapters/kmip/base.js index 3a25ff9dc..d6dcbe202 100644 --- a/ui/app/adapters/kmip/base.js +++ b/ui/app/adapters/kmip/base.js @@ -38,7 +38,7 @@ export default ApplicationAdapter.extend({ }, 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 const { ...modelAttrs } = query; resp._requestQuery = modelAttrs; @@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({ queryRecord(store, type, query) { let id = 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 = { ...resp, ...query }; return resp; diff --git a/ui/app/adapters/kmip/credential.js b/ui/app/adapters/kmip/credential.js index d6c6bb8d7..741aa3e90 100644 --- a/ui/app/adapters/kmip/credential.js +++ b/ui/app/adapters/kmip/credential.js @@ -8,7 +8,7 @@ export default BaseAdapter.extend({ role: snapshot.record.role, }); 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; return model; }); diff --git a/ui/app/adapters/lease.js b/ui/app/adapters/lease.js index 4911864c7..37426f818 100644 --- a/ui/app/adapters/lease.js +++ b/ui/app/adapters/lease.js @@ -48,7 +48,7 @@ export default ApplicationAdapter.extend({ data: { list: true, }, - }).then(resp => { + }).then((resp) => { if (prefix) { resp.prefix = prefix; } diff --git a/ui/app/adapters/path-filter-config.js b/ui/app/adapters/path-filter-config.js index d46739715..8f703e40a 100644 --- a/ui/app/adapters/path-filter-config.js +++ b/ui/app/adapters/path-filter-config.js @@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({ }, 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; return resp; }); diff --git a/ui/app/adapters/pki-ca-certificate.js b/ui/app/adapters/pki-ca-certificate.js index 52c4f9272..736a2bd90 100644 --- a/ui/app/adapters/pki-ca-certificate.js +++ b/ui/app/adapters/pki-ca-certificate.js @@ -34,7 +34,7 @@ export default ApplicationAdapter.extend({ 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 // a new CA if one exists, all return a 204 if (!response) { diff --git a/ui/app/adapters/pki-certificate.js b/ui/app/adapters/pki-certificate.js index 8954a0ff6..6e587cedf 100644 --- a/ui/app/adapters/pki-certificate.js +++ b/ui/app/adapters/pki-certificate.js @@ -23,7 +23,7 @@ export default Adapter.extend({ fetchByQuery(store, 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 = { backend, }; @@ -53,7 +53,7 @@ export default Adapter.extend({ const data = { 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 = { id, serial_number: id, diff --git a/ui/app/adapters/pki-config.js b/ui/app/adapters/pki-config.js index 42e8e9e06..efc908929 100644 --- a/ui/app/adapters/pki-config.js +++ b/ui/app/adapters/pki-config.js @@ -31,7 +31,7 @@ export default ApplicationAdapter.extend({ } return data; }, {}); - return this.ajax(url, 'POST', { data }).then(resp => { + return this.ajax(url, 'POST', { data }).then((resp) => { let response = resp || {}; response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`; return response; @@ -69,9 +69,11 @@ export default ApplicationAdapter.extend({ return hash({ backend: backendPath, id: this.id(backendPath), - der: this.rawRequest(derURL, 'GET', { unauthenticated: true }).then(response => response.blob()), - pem: this.rawRequest(pemURL, 'GET', { unauthenticated: true }).then(response => response.text()), - ca_chain: this.rawRequest(chainURL, 'GET', { unauthenticated: true }).then(response => response.text()), + der: this.rawRequest(derURL, 'GET', { unauthenticated: true }).then((response) => response.blob()), + pem: this.rawRequest(pemURL, '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 id = this.id(backendPath); return this.ajax(url, 'GET') - .then(resp => { + .then((resp) => { resp.id = id; resp.backend = backendPath; return resp; }) - .catch(e => { + .catch((e) => { if (e.httpStatus === 404) { return resolve({ id }); } else { @@ -97,12 +99,12 @@ export default ApplicationAdapter.extend({ const url = `/v1/${backendPath}/config/crl`; const id = this.id(backendPath); return this.ajax(url, 'GET') - .then(resp => { + .then((resp) => { resp.id = id; resp.backend = backendPath; return resp; }) - .catch(e => { + .catch((e) => { if (e.httpStatus === 404) { return { id }; } else { @@ -118,7 +120,7 @@ export default ApplicationAdapter.extend({ queryRecord(store, type, query) { const { backend, section } = query; - return this.fetchSection(backend, section).then(resp => { + return this.fetchSection(backend, section).then((resp) => { resp.backend = backend; return resp; }); diff --git a/ui/app/adapters/pki.js b/ui/app/adapters/pki.js index 2e150c0f7..1c4c348e2 100644 --- a/ui/app/adapters/pki.js +++ b/ui/app/adapters/pki.js @@ -13,7 +13,7 @@ export default ApplicationAdapter.extend({ const data = serializer.serialize(snapshot, requestType); 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.modelName = type.modelName; store.pushPayload(type.modelName, response); diff --git a/ui/app/adapters/replication-mode.js b/ui/app/adapters/replication-mode.js index baa09570f..ed2134d52 100644 --- a/ui/app/adapters/replication-mode.js +++ b/ui/app/adapters/replication-mode.js @@ -7,7 +7,7 @@ export default ApplicationAdapter.extend({ fetchStatus(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; }); }, diff --git a/ui/app/adapters/role-aws.js b/ui/app/adapters/role-aws.js index da9b818e1..ad40d848b 100644 --- a/ui/app/adapters/role-aws.js +++ b/ui/app/adapters/role-aws.js @@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({ fetchByQuery(store, 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 = { id, name: id, diff --git a/ui/app/adapters/role-pki.js b/ui/app/adapters/role-pki.js index da9b818e1..ad40d848b 100644 --- a/ui/app/adapters/role-pki.js +++ b/ui/app/adapters/role-pki.js @@ -49,7 +49,7 @@ export default ApplicationAdapter.extend({ fetchByQuery(store, 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 = { id, name: id, diff --git a/ui/app/adapters/role-ssh.js b/ui/app/adapters/role-ssh.js index b0390be52..53d73f162 100644 --- a/ui/app/adapters/role-ssh.js +++ b/ui/app/adapters/role-ssh.js @@ -58,7 +58,7 @@ export default ApplicationAdapter.extend({ zeroAddressAjax = this.findAllZeroAddress(store, query); } - return allSettled([queryAjax, zeroAddressAjax]).then(results => { + return allSettled([queryAjax, zeroAddressAjax]).then((results) => { // query result 404d, so throw the adapterError if (!results[0].value) { throw results[0].reason; @@ -70,7 +70,7 @@ export default ApplicationAdapter.extend({ data: {}, }; - results.forEach(result => { + results.forEach((result) => { if (result.value) { if (result.value.data.roles) { resp.data = assign({}, resp.data, { zero_address_roles: result.value.data.roles }); diff --git a/ui/app/adapters/secret-engine.js b/ui/app/adapters/secret-engine.js index 945240510..1d75aae42 100644 --- a/ui/app/adapters/secret-engine.js +++ b/ui/app/adapters/secret-engine.js @@ -100,7 +100,7 @@ export default ApplicationAdapter.extend({ queryRecord(store, type, query) { 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 + '/'; return resp; }); @@ -135,11 +135,7 @@ export default ApplicationAdapter.extend({ saveZeroAddressConfig(store, type, snapshot) { const path = encodePath(snapshot.id); - const roles = store - .peekAll('role-ssh') - .filterBy('zeroAddress') - .mapBy('id') - .join(','); + const roles = store.peekAll('role-ssh').filterBy('zeroAddress').mapBy('id').join(','); const url = `/v1/${path}/config/zeroaddress`; const data = { roles }; if (roles === '') { diff --git a/ui/app/adapters/secret-v2-version.js b/ui/app/adapters/secret-v2-version.js index a11ae1dc2..1d51a41bc 100644 --- a/ui/app/adapters/secret-v2-version.js +++ b/ui/app/adapters/secret-v2-version.js @@ -26,7 +26,7 @@ export default ApplicationAdapter.extend({ }, 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, // otherwise the response will be the body of a deleted / destroyed version if (errorOrModel instanceof AdapterError) { @@ -44,7 +44,7 @@ export default ApplicationAdapter.extend({ }, 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) { return resp; } @@ -56,10 +56,10 @@ export default ApplicationAdapter.extend({ querySecretDataByVersion(id) { return this.ajax(this.urlForQueryRecord(id), 'GET') - .then(resp => { + .then((resp) => { return resp.data; }) - .catch(error => { + .catch((error) => { return error.data; }); }, @@ -73,7 +73,7 @@ export default ApplicationAdapter.extend({ createRecord(store, modelName, snapshot) { let backend = snapshot.belongsTo('secret').belongsTo('engine').id; 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]); return resp; }); diff --git a/ui/app/adapters/secret.js b/ui/app/adapters/secret.js index b77b62be8..be9ac495f 100644 --- a/ui/app/adapters/secret.js +++ b/ui/app/adapters/secret.js @@ -56,7 +56,7 @@ export default ApplicationAdapter.extend({ fetchByQuery(query, action) { const { id, backend, wrapTTL } = query; return this.ajax(this.urlForSecret(backend, id), 'GET', this.optionsForQuery(id, action, wrapTTL)).then( - resp => { + (resp) => { if (wrapTTL) { return resp; } diff --git a/ui/app/adapters/ssh.js b/ui/app/adapters/ssh.js index 5c3784ab6..b2c6f6203 100644 --- a/ui/app/adapters/ssh.js +++ b/ui/app/adapters/ssh.js @@ -15,7 +15,7 @@ export default ApplicationAdapter.extend({ const data = serializer.serialize(snapshot, requestType); 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.modelName = type.modelName; store.pushPayload(type.modelName, response); diff --git a/ui/app/adapters/transform.js b/ui/app/adapters/transform.js index cc81eeae7..351b5551c 100644 --- a/ui/app/adapters/transform.js +++ b/ui/app/adapters/transform.js @@ -52,7 +52,7 @@ export default ApplicationAdapter.extend({ const { id, backend } = query; 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 if (!results[0].value) { throw results[0].reason; @@ -64,7 +64,7 @@ export default ApplicationAdapter.extend({ data: {}, }; - results.forEach(result => { + results.forEach((result) => { if (result.value) { let d = result.value.data; if (d.templates) { diff --git a/ui/app/adapters/transform/base.js b/ui/app/adapters/transform/base.js index 4cac36605..7673085a4 100644 --- a/ui/app/adapters/transform/base.js +++ b/ui/app/adapters/transform/base.js @@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({ fetchByQuery(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 { ...resp, backend, @@ -54,7 +54,7 @@ export default ApplicationAdapter.extend({ }, 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 return { id: query.id, diff --git a/ui/app/adapters/transit-key.js b/ui/app/adapters/transit-key.js index c664f60e2..c88babb0c 100644 --- a/ui/app/adapters/transit-key.js +++ b/ui/app/adapters/transit-key.js @@ -14,7 +14,7 @@ export default ApplicationAdapter.extend({ url = url + '/config'; } - return this.ajax(url, 'POST', { data }).then(resp => { + return this.ajax(url, 'POST', { data }).then((resp) => { let response = resp || {}; response.id = name; return response; @@ -86,7 +86,7 @@ export default ApplicationAdapter.extend({ fetchByQuery(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.backend = backend; return resp; diff --git a/ui/app/app.js b/ui/app/app.js index f84033f0d..23f2396ed 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -2,9 +2,7 @@ import Application from '@ember/application'; import Resolver from 'ember-resolver'; import loadInitializers from 'ember-load-initializers'; import config from 'vault/config/environment'; -import defineModifier from 'ember-concurrency-test-waiter/define-modifier'; -defineModifier(); export default class App extends Application { modulePrefix = config.modulePrefix; podModulePrefix = config.podModulePrefix; diff --git a/ui/app/components/auth-config-form/config.js b/ui/app/components/auth-config-form/config.js index 49f692a7a..0e21139f2 100644 --- a/ui/app/components/auth-config-form/config.js +++ b/ui/app/components/auth-config-form/config.js @@ -2,6 +2,7 @@ import AdapterError from '@ember-data/adapter/error'; import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { task } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; /** * @module AuthConfigForm/Config @@ -23,23 +24,25 @@ const AuthConfigBase = Component.extend({ flashMessages: service(), router: service(), wizard: service(), - saveModel: task(function*() { - try { - yield this.model.save(); - } catch (err) { - // AdapterErrors are handled by the error-message component - // in the form - if (err instanceof AdapterError === false) { - throw err; + saveModel: task( + waitFor(function* () { + try { + yield this.model.save(); + } catch (err) { + // AdapterErrors are handled by the error-message component + // in the form + if (err instanceof AdapterError === false) { + throw err; + } + return; } - return; - } - if (this.wizard.currentMachine === 'authentication' && this.wizard.featureState === 'config') { - this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE'); - } - this.router.transitionTo('vault.cluster.access.methods').followRedirects(); - this.flashMessages.success('The configuration was saved successfully.'); - }).withTestWaiter(), + if (this.wizard.currentMachine === 'authentication' && this.wizard.featureState === 'config') { + this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE'); + } + this.router.transitionTo('vault.cluster.access.methods').followRedirects(); + this.flashMessages.success('The configuration was saved successfully.'); + }) + ), }); AuthConfigBase.reopenClass({ diff --git a/ui/app/components/auth-config-form/options.js b/ui/app/components/auth-config-form/options.js index 9ce654e48..31951f5b4 100644 --- a/ui/app/components/auth-config-form/options.js +++ b/ui/app/components/auth-config-form/options.js @@ -2,6 +2,7 @@ import AdapterError from '@ember-data/adapter/error'; import AuthConfigComponent from './config'; import { inject as service } from '@ember/service'; import { task } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; /** * @module AuthConfigForm/Options @@ -19,36 +20,38 @@ import { task } from 'ember-concurrency'; export default AuthConfigComponent.extend({ router: service(), wizard: service(), - saveModel: task(function*() { - let data = this.model.config.serialize(); - data.description = this.model.description; + saveModel: task( + waitFor(function* () { + let data = this.model.config.serialize(); + data.description = this.model.description; - // token_type should not be tuneable for the token auth method, default is 'default-service' - if (this.model.type === 'token') { - delete data.token_type; - } - - try { - yield this.model.tune(data); - } catch (err) { - // AdapterErrors are handled by the error-message component - // in the form - if (err instanceof AdapterError === false) { - throw err; + // token_type should not be tuneable for the token auth method, default is 'default-service' + if (this.model.type === 'token') { + delete data.token_type; } - // because we're not calling model.save the model never updates with - // the error. Forcing the error message by manually setting the errorMessage + try { - this.model.set('errorMessage', err.errors.firstObject); - } catch { - // do nothing + yield this.model.tune(data); + } catch (err) { + // AdapterErrors are handled by the error-message component + // in the form + if (err instanceof AdapterError === false) { + throw err; + } + // because we're not calling model.save the model never updates with + // the error. Forcing the error message by manually setting the errorMessage + try { + this.model.set('errorMessage', err.errors.firstObject); + } catch { + // do nothing + } + return; } - return; - } - if (this.wizard.currentMachine === 'authentication' && this.wizard.featureState === 'config') { - this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE'); - } - this.router.transitionTo('vault.cluster.access.methods').followRedirects(); - this.flashMessages.success('The configuration was saved successfully.'); - }).withTestWaiter(), + if (this.wizard.currentMachine === 'authentication' && this.wizard.featureState === 'config') { + this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE'); + } + this.router.transitionTo('vault.cluster.access.methods').followRedirects(); + this.flashMessages.success('The configuration was saved successfully.'); + }) + ), }); diff --git a/ui/app/components/auth-form.js b/ui/app/components/auth-form.js index 9e24fc3c9..5e7f8a7fc 100644 --- a/ui/app/components/auth-form.js +++ b/ui/app/components/auth-form.js @@ -8,6 +8,8 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends'; import { task, timeout } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; + const BACKENDS = supportedAuthBackends(); /** @@ -116,7 +118,7 @@ export default Component.extend(DEFAULTS, { 'methods.[]', 'selectedAuth', 'selectedAuthIsPath', - function() { + function () { let { wrappedToken, methods, selectedAuth, selectedAuthIsPath: keyIsPath } = this; if (!methods && !wrappedToken) { return {}; @@ -128,7 +130,7 @@ export default Component.extend(DEFAULTS, { } ), - providerName: computed('selectedAuthBackend.type', function() { + providerName: computed('selectedAuthBackend.type', function () { if (!this.selectedAuthBackend) { return; } @@ -142,59 +144,65 @@ export default Component.extend(DEFAULTS, { cspErrorText: `This is a standby Vault node but can't communicate with the active node via request forwarding. Sign in at the active node to use the Vault UI.`, - allSupportedMethods: computed('methodsToShow', 'hasMethodsWithPath', function() { + allSupportedMethods: computed('methodsToShow', 'hasMethodsWithPath', function () { let hasMethodsWithPath = this.hasMethodsWithPath; let methodsToShow = this.methodsToShow; return hasMethodsWithPath ? methodsToShow.concat(BACKENDS) : methodsToShow; }), - hasMethodsWithPath: computed('methodsToShow', function() { + hasMethodsWithPath: computed('methodsToShow', function () { return this.methodsToShow.isAny('path'); }), - methodsToShow: computed('methods', function() { + methodsToShow: computed('methods', function () { 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; }), - unwrapToken: task(function*(token) { - // will be using the Token Auth Method, so set it here - this.set('selectedAuth', 'token'); - let adapter = this.store.adapterFor('tools'); - try { - let response = yield adapter.toolAction('unwrap', null, { clientToken: token }); - this.set('token', response.auth.client_token); - this.send('doSubmit'); - } catch (e) { - this.set('error', `Token unwrap failed: ${e.errors[0]}`); - } - }).withTestWaiter(), + unwrapToken: task( + waitFor(function* (token) { + // will be using the Token Auth Method, so set it here + this.set('selectedAuth', 'token'); + let adapter = this.store.adapterFor('tools'); + try { + let response = yield adapter.toolAction('unwrap', null, { clientToken: token }); + this.set('token', response.auth.client_token); + this.send('doSubmit'); + } catch (e) { + this.set('error', `Token unwrap failed: ${e.errors[0]}`); + } + }) + ), - fetchMethods: task(function*() { - let store = this.store; - try { - let methods = yield store.findAll('auth-method', { - adapterOptions: { - unauthenticated: true, - }, - }); - this.set( - 'methods', - methods.map(m => { - const method = m.serialize({ includeId: true }); - return { - ...method, - mountDescription: method.description, - }; - }) - ); - next(() => { - store.unloadAll('auth-method'); - }); - } catch (e) { - this.set('error', `There was an error fetching Auth Methods: ${e.errors[0]}`); - } - }).withTestWaiter(), + fetchMethods: task( + waitFor(function* () { + let store = this.store; + try { + let methods = yield store.findAll('auth-method', { + adapterOptions: { + unauthenticated: true, + }, + }); + this.set( + 'methods', + methods.map((m) => { + const method = m.serialize({ includeId: true }); + return { + ...method, + mountDescription: method.description, + }; + }) + ); + next(() => { + store.unloadAll('auth-method'); + }); + } catch (e) { + this.set('error', `There was an error fetching Auth Methods: ${e.errors[0]}`); + } + }) + ), showLoading: or('isLoading', 'authenticate.isRunning', 'fetchMethods.isRunning', 'unwrapToken.isRunning'), @@ -202,7 +210,7 @@ export default Component.extend(DEFAULTS, { this.set('loading', false); let errors; if (e.errors) { - errors = e.errors.map(error => { + errors = e.errors.map((error) => { if (error.detail) { return error.detail; } @@ -215,40 +223,42 @@ export default Component.extend(DEFAULTS, { this.set('error', `${message}${errors.join('.')}`); }, - authenticate: task(function*(backendType, data) { - let clusterId = this.cluster.id; - try { - if (backendType === 'okta') { - this.delayAuthMessageReminder.perform(); - } - let authResponse = yield this.auth.authenticate({ clusterId, backend: backendType, data }); - - let { isRoot, namespace } = authResponse; - let transition; - let { redirectTo } = this; - if (redirectTo) { - // reset the value on the controller because it's bound here - this.set('redirectTo', ''); - // here we don't need the namespace because it will be encoded in redirectTo - transition = this.router.transitionTo(redirectTo); - } else { - transition = this.router.transitionTo('vault.cluster', { queryParams: { namespace } }); - } - // returning this w/then because if we keep it - // in the task, it will get cancelled when the component in un-rendered - yield transition.followRedirects().then(() => { - if (isRoot) { - this.flashMessages.warning( - 'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.' - ); + authenticate: task( + waitFor(function* (backendType, data) { + let clusterId = this.cluster.id; + try { + if (backendType === 'okta') { + this.delayAuthMessageReminder.perform(); } - }); - } catch (e) { - this.handleError(e); - } - }).withTestWaiter(), + let authResponse = yield this.auth.authenticate({ clusterId, backend: backendType, data }); - delayAuthMessageReminder: task(function*() { + let { isRoot, namespace } = authResponse; + let transition; + let { redirectTo } = this; + if (redirectTo) { + // reset the value on the controller because it's bound here + this.set('redirectTo', ''); + // here we don't need the namespace because it will be encoded in redirectTo + transition = this.router.transitionTo(redirectTo); + } else { + transition = this.router.transitionTo('vault.cluster', { queryParams: { namespace } }); + } + // returning this w/then because if we keep it + // in the task, it will get cancelled when the component in un-rendered + yield transition.followRedirects().then(() => { + if (isRoot) { + this.flashMessages.warning( + 'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.' + ); + } + }); + } catch (e) { + this.handleError(e); + } + }) + ), + + delayAuthMessageReminder: task(function* () { if (Ember.testing) { this.showLoading = true; yield timeout(0); @@ -274,7 +284,7 @@ export default Component.extend(DEFAULTS, { }); let backend = this.selectedAuthBackend || {}; let backendMeta = BACKENDS.find( - b => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase() + (b) => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase() ); let attributes = (backendMeta || {}).formAttributes || []; diff --git a/ui/app/components/auth-jwt.js b/ui/app/components/auth-jwt.js index 2417754ed..cb288b011 100644 --- a/ui/app/components/auth-jwt.js +++ b/ui/app/components/auth-jwt.js @@ -4,9 +4,9 @@ import Component from './outer-html'; import { later } from '@ember/runloop'; import { task, timeout, waitForEvent } from 'ember-concurrency'; import { computed } from '@ember/object'; +import { waitFor } from '@ember/test-waiters'; -/* eslint-disable ember/no-ember-testing-in-module-scope */ -const WAIT_TIME = Ember.testing ? 0 : 500; +const WAIT_TIME = 500; const ERROR_WINDOW_CLOSED = 'The provider window was closed before authentication was complete. Please click Sign In to try again.'; const ERROR_MISSING_PARAMS = @@ -29,6 +29,7 @@ export default Component.extend({ onNamespace() {}, didReceiveAttrs() { + this._super(); let { oldSelectedAuthPath, selectedAuthPath } = this; let shouldDebounce = !oldSelectedAuthPath && !selectedAuthPath; if (oldSelectedAuthPath !== selectedAuthPath) { @@ -44,7 +45,7 @@ export default Component.extend({ // Assumes authentication using OIDC until it's known that the mount is // configured for JWT authentication via static keys, JWKS, or OIDC discovery. - isOIDC: computed('errorMessage', function() { + isOIDC: computed('errorMessage', function () { return this.errorMessage !== ERROR_JWT_LOGIN; }), @@ -52,29 +53,30 @@ export default Component.extend({ return this.window || window; }, - fetchRole: task(function*(roleName, options = { debounce: true }) { - if (options.debounce) { - this.onRoleName(roleName); - // debounce - yield timeout(WAIT_TIME); - } - let path = this.selectedAuthPath || this.selectedAuthType; - let id = JSON.stringify([path, roleName]); - let role = null; - try { - role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } }); - } catch (e) { - if (!e.httpStatus || e.httpStatus !== 400) { - throw e; + fetchRole: task( + waitFor(function* (roleName, options = { debounce: true }) { + if (options.debounce) { + this.onRoleName(roleName); + // debounce + yield timeout(Ember.testing ? 0 : WAIT_TIME); } - if (e.errors && e.errors.length > 0) { - this.set('errorMessage', e.errors[0]); + let path = this.selectedAuthPath || this.selectedAuthType; + let id = JSON.stringify([path, roleName]); + let role = null; + try { + role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } }); + } catch (e) { + // throwing here causes failures in tests + if ((!e.httpStatus || e.httpStatus !== 400) && !Ember.testing) { + throw e; + } + if (e.errors && e.errors.length > 0) { + this.set('errorMessage', e.errors[0]); + } } - } - this.set('role', role); - }) - .restartable() - .withTestWaiter(), + this.set('role', role); + }) + ).restartable(), handleOIDCError(err) { this.onLoading(false); @@ -82,7 +84,7 @@ export default Component.extend({ this.onError(err); }, - prepareForOIDC: task(function*(oidcWindow) { + prepareForOIDC: task(function* (oidcWindow) { const thisWindow = this.getWindow(); // show the loading animation in the parent this.onLoading(true); @@ -104,7 +106,7 @@ export default Component.extend({ } }), - watchPopup: task(function*(oidcWindow) { + watchPopup: task(function* (oidcWindow) { while (true) { yield timeout(WAIT_TIME); if (!oidcWindow || oidcWindow.closed) { @@ -113,7 +115,7 @@ export default Component.extend({ } }), - watchCurrent: task(function*(oidcWindow) { + watchCurrent: task(function* (oidcWindow) { // when user is about to change pages, close the popup window yield waitForEvent(this.getWindow(), 'beforeunload'); oidcWindow.close(); @@ -125,7 +127,7 @@ export default Component.extend({ oidcWindow.close(); }, - exchangeOIDC: task(function*(oidcState, oidcWindow) { + exchangeOIDC: task(function* (oidcState, oidcWindow) { if (oidcState === null || oidcState === undefined) { return; } diff --git a/ui/app/components/b64-toggle.js b/ui/app/components/b64-toggle.js index a556b7aa6..1db074e3e 100644 --- a/ui/app/components/b64-toggle.js +++ b/ui/app/components/b64-toggle.js @@ -82,7 +82,7 @@ export default Component.extend({ * @private * @type boolean */ - valuesMatch: computed('value', '_value', function() { + valuesMatch: computed('value', '_value', function () { const { value, _value } = this; const anyBlank = isBlank(value) || isBlank(_value); return !anyBlank && value === _value; @@ -99,6 +99,7 @@ export default Component.extend({ }, didReceiveAttrs() { + this._super(); // if there's no value, reset encoding if (this.value === '') { set(this, 'currentEncoding', UTF8); diff --git a/ui/app/components/clients/config.js b/ui/app/components/clients/config.js index 9b093ecae..dca86dfbc 100644 --- a/ui/app/components/clients/config.js +++ b/ui/app/components/clients/config.js @@ -50,7 +50,7 @@ export default class ConfigComponent extends Component { return content; } - @(task(function*() { + @(task(function* () { try { yield this.args.model.save(); } catch (err) { diff --git a/ui/app/components/clients/history.js b/ui/app/components/clients/history.js index b1ce2536d..024357449 100644 --- a/ui/app/components/clients/history.js +++ b/ui/app/components/clients/history.js @@ -34,7 +34,7 @@ export default class HistoryComponent extends Component { return null; } let dataList = this.args.model.activity.byNamespace; - return dataList.map(d => { + return dataList.map((d) => { return { name: d['namespace_id'], id: d['namespace_path'] === '' ? 'root' : d['namespace_path'], @@ -48,7 +48,7 @@ export default class HistoryComponent extends Component { return null; } let dataset = this.args.model.activity.byNamespace.slice(0, this.max_namespaces); - return dataset.map(d => { + return dataset.map((d) => { return { label: d['namespace_path'] === '' ? 'root' : d['namespace_path'], non_entity_tokens: d['counts']['non_entity_tokens'], @@ -69,7 +69,7 @@ export default class HistoryComponent extends Component { results = fields.join(',') + '\n'; - namespaces.forEach(function(item) { + namespaces.forEach(function (item) { let path = item.namespace_path !== '' ? item.namespace_path : 'root', total = item.counts.clients, unique = item.counts.distinct_entities, @@ -95,7 +95,7 @@ export default class HistoryComponent extends Component { // Get the namespace by matching the path from the namespace list getNamespace(path) { - return this.args.model.activity.byNamespace.find(ns => { + return this.args.model.activity.byNamespace.find((ns) => { if (path === 'root') { return ns.namespace_path === ''; } diff --git a/ui/app/components/config-pki-ca.js b/ui/app/components/config-pki-ca.js index 981ccef6a..c5814bd70 100644 --- a/ui/app/components/config-pki-ca.js +++ b/ui/app/components/config-pki-ca.js @@ -100,7 +100,7 @@ export default Component.extend({ * This array provides the text and download hrefs for those links. * */ - downloadHrefs: computed('config', 'config.{backend,pem,caChain,der}', function() { + downloadHrefs: computed('config', 'config.{backend,pem,caChain,der}', function () { const config = this.config; const { backend, pem, caChain, der } = config; @@ -139,7 +139,7 @@ export default Component.extend({ const isUpload = this.model.uploadPemBundle; model .save({ adapterOptions: { method } }) - .then(m => { + .then((m) => { if (method === 'setSignedIntermediate' || isUpload) { this.send('refresh'); this.flashMessages.success('The certificate for this backend has been updated.'); diff --git a/ui/app/components/config-pki.js b/ui/app/components/config-pki.js index a91cead04..1a45d6fa4 100644 --- a/ui/app/components/config-pki.js +++ b/ui/app/components/config-pki.js @@ -44,7 +44,7 @@ export default Component.extend({ .save({ adapterOptions: { method: section, - fields: get(config, `${section}Attrs`).map(attr => attr.name), + fields: get(config, `${section}Attrs`).map((attr) => attr.name), }, }) .then(() => { diff --git a/ui/app/components/console/log-command.js b/ui/app/components/console/log-command.js deleted file mode 100644 index 557064773..000000000 --- a/ui/app/components/console/log-command.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/app/components/console/log-error-with-html.js b/ui/app/components/console/log-error-with-html.js deleted file mode 100644 index 557064773..000000000 --- a/ui/app/components/console/log-error-with-html.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/app/components/console/log-error.js b/ui/app/components/console/log-error.js deleted file mode 100644 index 557064773..000000000 --- a/ui/app/components/console/log-error.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/app/components/console/log-object.js b/ui/app/components/console/log-object.js index 654fbbdf9..20ee00a3d 100644 --- a/ui/app/components/console/log-object.js +++ b/ui/app/components/console/log-object.js @@ -4,7 +4,7 @@ import { computed } from '@ember/object'; import columnify from 'columnify'; export function stringifyObjectValues(data) { - Object.keys(data).forEach(item => { + Object.keys(data).forEach((item) => { let val = data[item]; if (typeof val !== 'string') { val = JSON.stringify(val); @@ -15,13 +15,13 @@ export function stringifyObjectValues(data) { export default Component.extend({ content: null, - columns: computed('content', function() { + columns: computed('content', function () { let data = this.content; stringifyObjectValues(data); return columnify(data, { preserveNewLines: true, - headingTransform: function(heading) { + headingTransform: function (heading) { return capitalize(heading); }, }); diff --git a/ui/app/components/console/log-success.js b/ui/app/components/console/log-success.js deleted file mode 100644 index 557064773..000000000 --- a/ui/app/components/console/log-success.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/app/components/console/ui-panel.js b/ui/app/components/console/ui-panel.js index 5ed193c6a..74b052405 100644 --- a/ui/app/components/console/ui-panel.js +++ b/ui/app/components/console/ui-panel.js @@ -39,13 +39,13 @@ export default Component.extend({ isRunning: or('executeCommand.isRunning', 'refreshRoute.isRunning'), - executeCommand: task(function*(command, shouldThrow = false) { + executeCommand: task(function* (command, shouldThrow = false) { this.set('inputValue', ''); let service = this.console; let serviceArgs; if ( - executeUICommand(command, args => this.logAndOutput(args), { + executeUICommand(command, (args) => this.logAndOutput(args), { api: () => this.routeToExplore.perform(command), clearall: () => service.clearLog(true), clear: () => service.clearLog(), @@ -90,7 +90,7 @@ export default Component.extend({ } }), - refreshRoute: task(function*() { + refreshRoute: task(function* () { let owner = getOwner(this); let currentRoute = owner.lookup(`router:main`).get('currentRouteName'); @@ -103,7 +103,7 @@ export default Component.extend({ } }), - routeToExplore: task(function*(command) { + routeToExplore: task(function* (command) { let filter = command.replace('api', '').trim(); let content = 'Welcome to the Vault API explorer! \nYou can search for endpoints, see what parameters they accept, and even execute requests with your current token.'; @@ -134,7 +134,7 @@ export default Component.extend({ }), shiftCommandIndex(keyCode) { - this.console.shiftCommandIndex(keyCode, val => { + this.console.shiftCommandIndex(keyCode, (val) => { this.set('inputValue', val); }); }, diff --git a/ui/app/components/control-group-success.js b/ui/app/components/control-group-success.js index 1278f277b..6c64cab57 100644 --- a/ui/app/components/control-group-success.js +++ b/ui/app/components/control-group-success.js @@ -15,7 +15,7 @@ export default Component.extend({ error: null, unwrapData: null, - unwrap: task(function*(token) { + unwrap: task(function* (token) { let adapter = this.store.adapterFor('tools'); this.set('error', null); try { @@ -27,7 +27,7 @@ export default Component.extend({ } }).drop(), - markAndNavigate: task(function*() { + markAndNavigate: task(function* () { this.controlGroup.markTokenForUnwrap(this.model.id); let { url } = this.controlGroupResponse.uiParams; yield this.router.transitionTo(url); diff --git a/ui/app/components/control-group.js b/ui/app/components/control-group.js index faad2cec9..50f10e180 100644 --- a/ui/app/components/control-group.js +++ b/ui/app/components/control-group.js @@ -21,18 +21,18 @@ export default Component.extend({ currentUserEntityId: alias('auth.authData.entity_id'), - currentUserIsRequesting: computed('currentUserEntityId', 'model.requestEntity.id', function() { + currentUserIsRequesting: computed('currentUserEntityId', 'model.requestEntity.id', function () { if (!this.model.requestEntity) return false; return this.currentUserEntityId === this.model.requestEntity.id; }), - currentUserHasAuthorized: computed('currentUserEntityId', 'model.authorizations.@each.id', function() { + currentUserHasAuthorized: computed('currentUserEntityId', 'model.authorizations.@each.id', function () { let authorizations = this.model.authorizations || []; return Boolean(authorizations.findBy('id', this.currentUserEntityId)); }), isSuccess: or('currentUserHasAuthorized', 'model.approved'), - requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function() { + requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function () { let entity = this.model.requestEntity; if (this.currentUserIsRequesting) { @@ -44,7 +44,7 @@ export default Component.extend({ return 'Someone'; }), - bannerPrefix: computed('model.approved', 'currentUserHasAuthorized', function() { + bannerPrefix: computed('model.approved', 'currentUserHasAuthorized', function () { if (this.currentUserHasAuthorized) { return 'Thanks!'; } @@ -54,7 +54,7 @@ export default Component.extend({ return 'Locked'; }), - bannerText: computed('model.approved', 'currentUserIsRequesting', 'currentUserHasAuthorized', function() { + bannerText: computed('model.approved', 'currentUserIsRequesting', 'currentUserHasAuthorized', function () { let isApproved = this.model.approved; let { currentUserHasAuthorized, currentUserIsRequesting } = this; if (currentUserHasAuthorized) { @@ -72,7 +72,7 @@ export default Component.extend({ return 'Someone is requesting access to a path locked by a Control Group'; }), - refresh: task(function*() { + refresh: task(function* () { try { yield this.model.reload(); } catch (e) { @@ -80,7 +80,7 @@ export default Component.extend({ } }).drop(), - authorize: task(function*() { + authorize: task(function* () { try { yield this.model.save(); yield this.refresh.perform(); diff --git a/ui/app/components/database-connection.js b/ui/app/components/database-connection.js index b6b3c0da2..c34507c74 100644 --- a/ui/app/components/database-connection.js +++ b/ui/app/components/database-connection.js @@ -6,7 +6,7 @@ import { action } from '@ember/object'; const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root'; 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.'; if (errorMessage.indexOf('failed to verify') >= 0) { errorMessage = @@ -69,7 +69,7 @@ export default class DatabaseConnectionEdit extends Component { .then(() => { this.showSaveModal = true; }) - .catch(e => { + .catch((e) => { const errorMessage = getErrorMessage(e.errors); 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.transitionToRoute(SHOW_ROUTE, name); }) - .catch(e => { + .catch((e) => { this.flashMessages.danger(`Error rotating root credentials: ${e.errors}`); this.transitionToRoute(SHOW_ROUTE, name); }); @@ -107,7 +107,7 @@ export default class DatabaseConnectionEdit extends Component { .then(() => { this.transitionToRoute(SHOW_ROUTE, secretId); }) - .catch(e => { + .catch((e) => { const errorMessage = getErrorMessage(e.errors); this.flashMessages.danger(errorMessage); }); @@ -133,7 +133,7 @@ export default class DatabaseConnectionEdit extends Component { // TODO: Why isn't the confirmAction closing? this.flashMessages.success('Successfully reset connection'); }) - .catch(e => { + .catch((e) => { const errorMessage = getErrorMessage(e.errors); this.flashMessages.danger(errorMessage); }); @@ -147,7 +147,7 @@ export default class DatabaseConnectionEdit extends Component { // TODO: Why isn't the confirmAction closing? this.flashMessages.success('Successfully rotated credentials'); }) - .catch(e => { + .catch((e) => { const errorMessage = getErrorMessage(e.errors); this.flashMessages.danger(errorMessage); }); diff --git a/ui/app/components/database-role-edit.js b/ui/app/components/database-role-edit.js index cda7b7a9c..988396b52 100644 --- a/ui/app/components/database-role-edit.js +++ b/ui/app/components/database-role-edit.js @@ -49,7 +49,7 @@ export default class DatabaseRoleEdit extends Component { } return this.store .queryRecord('database/connection', { id: dbs[0], backend }) - .then(record => record.plugin_name) + .then((record) => record.plugin_name) .catch(() => null); } @@ -73,7 +73,7 @@ export default class DatabaseRoleEdit extends Component { console.debug(e); } }) - .catch(e => { + .catch((e) => { this.flashMessages.danger(e.errors?.join('. ')); }); } @@ -100,7 +100,7 @@ export default class DatabaseRoleEdit extends Component { console.debug(e); } }) - .catch(e => { + .catch((e) => { const errorMessage = e.errors?.join('. ') || e.message; this.flashMessages.danger( errorMessage || 'Could not save the role. Please check Vault logs for more information.' diff --git a/ui/app/components/database-role-setting-form.js b/ui/app/components/database-role-setting-form.js index d7504de12..01b6170da 100644 --- a/ui/app/components/database-role-setting-form.js +++ b/ui/app/components/database-role-setting-form.js @@ -20,7 +20,7 @@ export default class DatabaseRoleSettingForm extends Component { get settingFields() { if (!this.args.roleType) return null; let dbValidFields = getRoleFields(this.args.roleType); - return this.args.attrs.filter(a => { + return this.args.attrs.filter((a) => { return dbValidFields.includes(a.name); }); } @@ -30,7 +30,7 @@ export default class DatabaseRoleSettingForm extends Component { const plugin = this.args.dbType; if (!type) return null; let dbValidFields = getStatementFields(type, plugin); - return this.args.attrs.filter(a => { + return this.args.attrs.filter((a) => { return dbValidFields.includes(a.name); }); } diff --git a/ui/app/components/diff-version-selector.js b/ui/app/components/diff-version-selector.js index 30df62e45..76a43a0f0 100644 --- a/ui/app/components/diff-version-selector.js +++ b/ui/app/components/diff-version-selector.js @@ -35,14 +35,14 @@ export default class DiffVersionSelector extends Component { let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.args.model.currentVersion}"]`; return this.adapter .querySecretDataByVersion(string) - .then(response => response.data) + .then((response) => response.data) .catch(() => null); } get rightSideDataInit() { let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`; return this.adapter .querySecretDataByVersion(string) - .then(response => response.data) + .then((response) => response.data) .catch(() => null); } get rightSideVersionInit() { diff --git a/ui/app/components/form-field-groups-loop.js b/ui/app/components/form-field-groups-loop.js deleted file mode 100644 index 797b2e307..000000000 --- a/ui/app/components/form-field-groups-loop.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module FormFieldGroupsLoop - * FormFieldGroupsLoop components are used to show optional form fields, generally when setting up a secret engine. - * - * @example - * ```js - * - * ``` - * @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 {} diff --git a/ui/app/components/generate-credentials.js b/ui/app/components/generate-credentials.js index 353849540..f71f62ecb 100644 --- a/ui/app/components/generate-credentials.js +++ b/ui/app/components/generate-credentials.js @@ -48,7 +48,7 @@ export default Component.extend({ this.router.transitionTo('vault.cluster.secrets.backend.list-root', this.backendPath); }, - options: computed('action', 'backendType', function() { + options: computed('action', 'backendType', function () { const action = this.action || 'creds'; return MODEL_TYPES[`${this.backendType}-${action}`]; }), @@ -59,6 +59,7 @@ export default Component.extend({ }, didReceiveAttrs() { + this._super(); if (this.wizard.featureState === 'displayRole') { this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', this.backendType); } diff --git a/ui/app/components/generated-item.js b/ui/app/components/generated-item.js index 4152e7f09..9b82a7e8a 100644 --- a/ui/app/components/generated-item.js +++ b/ui/app/components/generated-item.js @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { computed, set } from '@ember/object'; import { task } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; /** * @module GeneratedItem @@ -26,32 +27,34 @@ export default Component.extend({ router: service(), validationMessages: null, isFormInvalid: false, - props: computed('model', function() { + props: computed('model', function () { return this.model.serialize(); }), - saveModel: task(function*() { - try { - yield this.model.save(); - } catch (err) { - // AdapterErrors are handled by the error-message component - // in the form - if (err instanceof AdapterError === false) { - throw err; + saveModel: task( + waitFor(function* () { + try { + yield this.model.save(); + } catch (err) { + // AdapterErrors are handled by the error-message component + // in the form + if (err instanceof AdapterError === false) { + throw err; + } + return; } - return; - } - this.router.transitionTo('vault.cluster.access.method.item.list').followRedirects(); - this.flashMessages.success(`Successfully saved ${this.itemType} ${this.model.id}.`); - }).withTestWaiter(), + this.router.transitionTo('vault.cluster.access.method.item.list').followRedirects(); + this.flashMessages.success(`Successfully saved ${this.itemType} ${this.model.id}.`); + }) + ), init() { this._super(...arguments); this.set('validationMessages', {}); if (this.mode === 'edit') { // For validation to work in edit mode, // reconstruct the model values from field group - this.model.fieldGroups.forEach(element => { + this.model.fieldGroups.forEach((element) => { if (element.default) { - element.default.forEach(attr => { + element.default.forEach((attr) => { let fieldValue = attr.options && attr.options.fieldValue; if (fieldValue) { this.model[attr.name] = this.model[fieldValue]; diff --git a/ui/app/components/home-link.js b/ui/app/components/home-link.js index 7b70bf5e9..b9b700c55 100644 --- a/ui/app/components/home-link.js +++ b/ui/app/components/home-link.js @@ -19,11 +19,11 @@ import { computed } from '@ember/object'; export default Component.extend({ tagName: '', - text: computed(function() { + text: computed(function () { return 'home'; }), - computedClasses: computed('classNames', function() { + computedClasses: computed('classNames', function () { return this.classNames.join(' '); }), }); diff --git a/ui/app/components/identity/_popup-base.js b/ui/app/components/identity/_popup-base.js index febe721e7..eeda69e0d 100644 --- a/ui/app/components/identity/_popup-base.js +++ b/ui/app/components/identity/_popup-base.js @@ -32,7 +32,7 @@ export default Component.extend({ this.onSuccess(); this.flashMessages.success(this.successMessage(...messageArgs)); }) - .catch(e => { + .catch((e) => { this.onError(...messageArgs); this.flashMessages.success(this.errorMessage(e, ...messageArgs)); }); diff --git a/ui/app/components/identity/edit-form.js b/ui/app/components/identity/edit-form.js index 673f66934..b4e4bfde2 100644 --- a/ui/app/components/identity/edit-form.js +++ b/ui/app/components/identity/edit-form.js @@ -3,6 +3,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { task } from 'ember-concurrency'; import { humanize } from 'vault/helpers/humanize'; +import { waitFor } from '@ember/test-waiters'; export default Component.extend({ flashMessages: service(), @@ -19,7 +20,7 @@ export default Component.extend({ */ onSave: () => {}, - cancelLink: computed('mode', 'model.identityType', function() { + cancelLink: computed('mode', 'model.identityType', function () { let { model, mode } = this; let routes = { 'create-entity': 'vault.cluster.access.identity', @@ -49,23 +50,24 @@ export default Component.extend({ return `Successfully ${action} ${typeDisplay}.`; }, - save: task(function*() { - let model = this.model; - let message = this.getMessage(model); + save: task( + waitFor(function* () { + let model = this.model; + let message = this.getMessage(model); - try { - yield model.save(); - } catch (err) { - // err will display via model state - return; - } - this.flashMessages.success(message); - yield this.onSave({ saveType: 'save', model }); - }) - .drop() - .withTestWaiter(), + try { + yield model.save(); + } catch (err) { + // err will display via model state + return; + } + this.flashMessages.success(message); + yield this.onSave({ saveType: 'save', model }); + }) + ).drop(), willDestroy() { + this._super(...arguments); let model = this.model; if (!model) return; if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) { diff --git a/ui/app/components/identity/item-details.js b/ui/app/components/identity/item-details.js index cfa2dd928..be4495673 100644 --- a/ui/app/components/identity/item-details.js +++ b/ui/app/components/identity/item-details.js @@ -13,7 +13,7 @@ export default Component.extend({ .then(() => { this.flashMessages.success(`Successfully enabled entity: ${model.id}`); }) - .catch(e => { + .catch((e) => { this.flashMessages.success( `There was a problem enabling the entity: ${model.id} - ${e.errors.join(' ') || e.message}` ); diff --git a/ui/app/components/identity/lookup-input.js b/ui/app/components/identity/lookup-input.js index 475fdbf76..b974b9a8f 100644 --- a/ui/app/components/identity/lookup-input.js +++ b/ui/app/components/identity/lookup-input.js @@ -20,7 +20,7 @@ export default Component.extend({ init() { this._super(...arguments); - this.store.findAll('auth-method').then(methods => { + this.store.findAll('auth-method').then((methods) => { this.set('authMethods', methods); this.set('aliasMountAccessor', methods.get('firstObject.accessor')); }); @@ -43,7 +43,7 @@ export default Component.extend({ return data; }, - lookup: task(function*() { + lookup: task(function* () { let flash = this.flashMessages; let type = this.type; let store = this.store; diff --git a/ui/app/components/identity/popup-members.js b/ui/app/components/identity/popup-members.js index 36fe4f86b..de724f987 100644 --- a/ui/app/components/identity/popup-members.js +++ b/ui/app/components/identity/popup-members.js @@ -5,11 +5,11 @@ import Base from './_popup-base'; export default Base.extend({ model: alias('params.firstObject'), - groupArray: computed('params', function() { + groupArray: computed('params', function () { return this.params.objectAt(1); }), - memberId: computed('params', function() { + memberId: computed('params', function () { return this.params.objectAt(2); }), diff --git a/ui/app/components/identity/popup-metadata.js b/ui/app/components/identity/popup-metadata.js index 1198368d7..6afc27e64 100644 --- a/ui/app/components/identity/popup-metadata.js +++ b/ui/app/components/identity/popup-metadata.js @@ -4,7 +4,7 @@ import { alias } from '@ember/object/computed'; export default Base.extend({ model: alias('params.firstObject'), - key: computed('params', function() { + key: computed('params', function () { return this.params.objectAt(1); }), diff --git a/ui/app/components/identity/popup-policy.js b/ui/app/components/identity/popup-policy.js index b77429363..7e3385e7a 100644 --- a/ui/app/components/identity/popup-policy.js +++ b/ui/app/components/identity/popup-policy.js @@ -4,7 +4,7 @@ import Base from './_popup-base'; export default Base.extend({ model: alias('params.firstObject'), - policyName: computed('params', function() { + policyName: computed('params', function () { return this.params.objectAt(1); }), diff --git a/ui/app/components/kv-object-editor.js b/ui/app/components/kv-object-editor.js index 46e45d204..d7577cc4e 100644 --- a/ui/app/components/kv-object-editor.js +++ b/ui/app/components/kv-object-editor.js @@ -51,15 +51,15 @@ export default Component.extend({ kvData: null, - kvDataAsJSON: computed('kvData', 'kvData.[]', function() { + kvDataAsJSON: computed('kvData', 'kvData.[]', function () { return this.kvData.toJSON(); }), - kvDataIsAdvanced: computed('kvData', 'kvData.[]', function() { + kvDataIsAdvanced: computed('kvData', 'kvData.[]', function () { return this.kvData.isAdvanced(); }), - kvHasDuplicateKeys: computed('kvData', 'kvData.@each.name', function() { + kvHasDuplicateKeys: computed('kvData', 'kvData.@each.name', function () { let data = this.kvData; return data.uniqBy('name').length !== data.get('length'); }), diff --git a/ui/app/components/license-info.js b/ui/app/components/license-info.js index 45cf74340..2b82403b8 100644 --- a/ui/app/components/license-info.js +++ b/ui/app/components/license-info.js @@ -23,7 +23,7 @@ import { allFeatures } from 'vault/helpers/all-features'; */ export default class LicenseInfoComponent extends Component { get featuresInfo() { - return allFeatures().map(feature => { + return allFeatures().map((feature) => { let active = this.args.features.includes(feature); if (active && feature === 'Performance Standby') { let count = this.args.performanceStandbyCount; diff --git a/ui/app/components/mount-accessor-select.js b/ui/app/components/mount-accessor-select.js index 73e775f47..3e95fd29b 100644 --- a/ui/app/components/mount-accessor-select.js +++ b/ui/app/components/mount-accessor-select.js @@ -15,7 +15,7 @@ export default Component.extend({ this.authMethods.perform(); }, - authMethods: task(function*() { + authMethods: task(function* () { let methods = yield this.store.findAll('auth-method'); if (!this.value) { this.set('value', methods.get('firstObject.accessor')); diff --git a/ui/app/components/mount-backend-form.js b/ui/app/components/mount-backend-form.js index 8ee89c081..2433af9bc 100644 --- a/ui/app/components/mount-backend-form.js +++ b/ui/app/components/mount-backend-form.js @@ -5,6 +5,7 @@ import Component from '@ember/component'; import { task } from 'ember-concurrency'; import { methods } from 'vault/helpers/mountable-auth-methods'; import { engines, KMIP, TRANSFORM } from 'vault/helpers/mountable-secret-engines'; +import { waitFor } from '@ember/test-waiters'; const METHODS = methods(); const ENGINES = engines(); @@ -62,11 +63,11 @@ export default Component.extend({ }); }, - mountTypes: computed('engines', 'mountType', function() { + mountTypes: computed('engines', 'mountType', function () { return this.mountType === 'secret' ? this.engines : METHODS; }), - engines: computed('version.{features[],isEnterprise}', function() { + engines: computed('version.{features[],isEnterprise}', function () { if (this.version.isEnterprise) { return ENGINES.concat([KMIP, TRANSFORM]); } @@ -74,6 +75,7 @@ export default Component.extend({ }), willDestroy() { + this._super(...arguments); // if unsaved, we want to unload so it doesn't show up in the auth mount list this.mountModel.rollbackAttributes(); }, @@ -90,60 +92,60 @@ export default Component.extend({ } }, - mountBackend: task(function*() { - const mountModel = this.mountModel; - const { type, path } = mountModel; - let capabilities = null; - try { - capabilities = yield this.store.findRecord('capabilities', `${path}/config`); - } catch (err) { - if (Ember.testing) { - //captures mount-backend-form component test - yield mountModel.save(); - let mountType = this.mountType; - mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`; - this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`); - yield this.onMountSuccess(type, path); - return; - } else { - throw err; + mountBackend: task( + waitFor(function* () { + const mountModel = this.mountModel; + const { type, path } = mountModel; + let capabilities = null; + try { + capabilities = yield this.store.findRecord('capabilities', `${path}/config`); + } catch (err) { + if (Ember.testing) { + //captures mount-backend-form component test + yield mountModel.save(); + let mountType = this.mountType; + mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`; + this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`); + yield this.onMountSuccess(type, path); + return; + } else { + throw err; + } } - } - if (!capabilities.get('canUpdate')) { - // if there is no sys/mount issue then error is config endpoint. - this.flashMessages.warning( - 'You do not have access to the config endpoint. The secret engine was mounted, but the configuration settings were not saved.' - ); - // remove the config data from the model otherwise it will save it even if the network request failed. - [this.mountModel.maxVersions, this.mountModel.casRequired, this.mountModel.deleteVersionAfter] = [ - 0, - false, - 0, - ]; - } - try { - yield mountModel.save(); - } catch (err) { - if (err.message === 'mountIssue') { - this.mountIssue = true; - this.set('isFormInvalid', this.mountIssue); - this.flashMessages.danger( - 'You do not have access to the sys/mounts endpoint. The secret engine was not mounted.' + if (!capabilities.get('canUpdate')) { + // if there is no sys/mount issue then error is config endpoint. + this.flashMessages.warning( + 'You do not have access to the config endpoint. The secret engine was mounted, but the configuration settings were not saved.' ); + // remove the config data from the model otherwise it will save it even if the network request failed. + [this.mountModel.maxVersions, this.mountModel.casRequired, this.mountModel.deleteVersionAfter] = [ + 0, + false, + 0, + ]; + } + try { + yield mountModel.save(); + } catch (err) { + if (err.message === 'mountIssue') { + this.mountIssue = true; + this.set('isFormInvalid', this.mountIssue); + this.flashMessages.danger( + 'You do not have access to the sys/mounts endpoint. The secret engine was not mounted.' + ); + return; + } + this.set('errorMessage', 'This mount path already exist.'); return; } - this.set('errorMessage', 'This mount path already exist.'); + let mountType = this.mountType; + mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`; + this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`); + yield this.onMountSuccess(type, path); return; - } - let mountType = this.mountType; - mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`; - this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`); - yield this.onMountSuccess(type, path); - return; - }) - .drop() - .withTestWaiter(), + }) + ).drop(), actions: { onKeyUp(name, value) { diff --git a/ui/app/components/namespace-link.js b/ui/app/components/namespace-link.js index 954a5f0b6..fc62cd8b0 100644 --- a/ui/app/components/namespace-link.js +++ b/ui/app/components/namespace-link.js @@ -12,12 +12,12 @@ export default Component.extend({ targetNamespace: null, showLastSegment: false, - normalizedNamespace: computed('targetNamespace', function() { + normalizedNamespace: computed('targetNamespace', function () { let ns = this.targetNamespace; return (ns || '').replace(/\.+/g, '/').replace(/☃/g, '.'); }), - namespaceDisplay: computed('normalizedNamespace', 'showLastSegment', function() { + namespaceDisplay: computed('normalizedNamespace', 'showLastSegment', function () { let ns = this.normalizedNamespace; if (!ns) return 'root'; let showLastSegment = this.showLastSegment; @@ -25,7 +25,7 @@ export default Component.extend({ return showLastSegment ? parts[parts.length - 1] : ns; }), - isCurrentNamespace: computed('targetNamespace', 'currentNamespace', function() { + isCurrentNamespace: computed('targetNamespace', 'currentNamespace', function () { return this.currentNamespace === this.targetNamespace; }), diff --git a/ui/app/components/namespace-picker.js b/ui/app/components/namespace-picker.js index 834f33836..23705e1f4 100644 --- a/ui/app/components/namespace-picker.js +++ b/ui/app/components/namespace-picker.js @@ -36,7 +36,7 @@ export default Component.extend({ this.set('oldNamespace', ns); }, - fetchListCapability: task(function*() { + fetchListCapability: task(function* () { try { let capability = yield this.store.findRecord('capabilities', 'sys/namespaces/'); this.set('listCapability', capability); @@ -47,7 +47,7 @@ export default Component.extend({ this.set('canList', false); } }), - setForAnimation: task(function*() { + setForAnimation: task(function* () { let leaves = this.menuLeaves; let lastLeaves = this.lastMenuLeaves; if (!lastLeaves) { @@ -81,7 +81,7 @@ export default Component.extend({ accessibleNamespaces: alias('namespaceService.accessibleNamespaces'), inRootNamespace: alias('namespaceService.inRootNamespace'), - namespaceTree: computed('accessibleNamespaces', function() { + namespaceTree: computed('accessibleNamespaces', function () { let nsList = this.accessibleNamespaces; if (!nsList) { @@ -123,7 +123,7 @@ export default Component.extend({ // to render the nodes of each leaf // gets set as 'lastMenuLeaves' in the ember concurrency task above - menuLeaves: computed('namespacePath', 'namespaceTree', 'pathToLeaf', function() { + menuLeaves: computed('namespacePath', 'namespaceTree', 'pathToLeaf', function () { let ns = this.namespacePath; ns = (ns || '').replace(/^\//, ''); let leaves = ancestorKeysForKey(ns); @@ -136,7 +136,7 @@ export default Component.extend({ // the nodes at the root of the namespace tree // these will get rendered as the bottom layer - rootLeaves: computed('namespaceTree', function() { + rootLeaves: computed('namespaceTree', function () { let tree = this.namespaceTree; let leaves = Object.keys(tree); return leaves; @@ -144,11 +144,11 @@ export default Component.extend({ currentLeaf: alias('lastMenuLeaves.lastObject'), canAccessMultipleNamespaces: gt('accessibleNamespaces.length', 1), - isUserRootNamespace: computed('auth.authData.userRootNamespace', 'namespacePath', function() { + isUserRootNamespace: computed('auth.authData.userRootNamespace', 'namespacePath', function () { return this.auth.authData.userRootNamespace === this.namespacePath; }), - namespaceDisplay: computed('namespacePath', 'accessibleNamespaces', 'accessibleNamespaces.[]', function() { + namespaceDisplay: computed('namespacePath', 'accessibleNamespaces', 'accessibleNamespaces.[]', function () { let namespace = this.namespacePath; if (!namespace) return ''; let parts = namespace?.split('/'); diff --git a/ui/app/components/nav-header.js b/ui/app/components/nav-header.js index 4ce646d8c..3726af4a3 100644 --- a/ui/app/components/nav-header.js +++ b/ui/app/components/nav-header.js @@ -9,7 +9,7 @@ export default Component.extend({ tagName: 'header', navDrawerOpen: false, consoleFullscreen: false, - hideLinks: computed('router.currentRouteName', function() { + hideLinks: computed('router.currentRouteName', function () { let currentRoute = this.router.currentRouteName; if ('vault.cluster.oidc-provider' === currentRoute) { return true; diff --git a/ui/app/components/oidc-consent-block.js b/ui/app/components/oidc-consent-block.js index b5a9e6fbd..fe497cd81 100644 --- a/ui/app/components/oidc-consent-block.js +++ b/ui/app/components/oidc-consent-block.js @@ -27,7 +27,7 @@ export default class OidcConsentBlockComponent extends Component { buildUrl(urlString, params) { try { let url = new URL(urlString); - Object.keys(params).forEach(key => { + Object.keys(params).forEach((key) => { if (params[key] && validParameters.includes(key)) { url.searchParams.append(key, params[key]); } diff --git a/ui/app/components/pgp-file.js b/ui/app/components/pgp-file.js index 920846360..e3ff78675 100644 --- a/ui/app/components/pgp-file.js +++ b/ui/app/components/pgp-file.js @@ -1,6 +1,8 @@ import Component from '@ember/component'; import { set } from '@ember/object'; 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; export default Component.extend({ @@ -41,17 +43,19 @@ export default Component.extend({ reader.readAsDataURL(file); }, - setPGPKey: task(function*(dataURL, filename) { - const b64File = dataURL.split(',')[1].trim(); - const decoded = atob(b64File).trim(); + setPGPKey: task( + waitFor(function* (dataURL, filename) { + const b64File = dataURL.split(',')[1].trim(); + const decoded = atob(b64File).trim(); - // If a b64-encoded file was uploaded, then after decoding, it - // will still be b64. - // If after decoding it's not b64, we want - // the original as it was only encoded when we used `readAsDataURL`. - const fileData = decoded.match(BASE_64_REGEX) ? decoded : b64File; - yield this.onChange(this.index, { value: fileData, fileName: filename }); - }).withTestWaiter(), + // If a b64-encoded file was uploaded, then after decoding, it + // will still be b64. + // If after decoding it's not b64, we want + // the original as it was only encoded when we used `readAsDataURL`. + const fileData = decoded.match(BASE_64_REGEX) ? decoded : b64File; + yield this.onChange(this.index, { value: fileData, fileName: filename }); + }) + ), actions: { pickedFile(e) { diff --git a/ui/app/components/pgp-list.js b/ui/app/components/pgp-list.js index 29f3fad04..4f7100430 100644 --- a/ui/app/components/pgp-list.js +++ b/ui/app/components/pgp-list.js @@ -34,7 +34,7 @@ export default Component.extend({ list = [...this.listData, ...this.newList(this.listLength - this.listData.length)]; } 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) { @@ -47,7 +47,7 @@ export default Component.extend({ setKey(index, key) { let { listData } = this; listData.splice(index, 1, key); - this.onDataUpdate(listData.compact().map(k => k.value)); + this.onDataUpdate(listData.compact().map((k) => k.value)); }, }, }); diff --git a/ui/app/components/pricing-metrics-dates.js b/ui/app/components/pricing-metrics-dates.js index 0cc7a3b76..a1d1a5c12 100644 --- a/ui/app/components/pricing-metrics-dates.js +++ b/ui/app/components/pricing-metrics-dates.js @@ -37,7 +37,7 @@ export default Component.extend({ defaultSpan: 12, retentionMonths: 24, - startDate: computed('start', function() { + startDate: computed('start', function () { if (!this.start) return null; let date; try { @@ -48,7 +48,7 @@ export default Component.extend({ return null; } }), - endDate: computed('end', function() { + endDate: computed('end', function () { if (!this.end) return null; let date; try { @@ -60,7 +60,7 @@ export default Component.extend({ } }), - error: computed('end', 'endDate', 'retentionMonths', 'start', 'startDate', function() { + error: computed('end', 'endDate', 'retentionMonths', 'start', 'startDate', function () { if (!this.startDate) { return 'Start date is invalid. Please use format MM/yyyy'; } diff --git a/ui/app/components/radial-progress.js b/ui/app/components/radial-progress.js index ea221a460..e3bec6380 100644 --- a/ui/app/components/radial-progress.js +++ b/ui/app/components/radial-progress.js @@ -10,20 +10,20 @@ export default Component.extend({ size: 20, strokeWidth: 1, - viewBox: computed('size', function() { + viewBox: computed('size', function () { let s = this.size; return `0 0 ${s} ${s}`; }), - centerValue: computed('size', function() { + centerValue: computed('size', function () { return this.size / 2; }), - r: computed('size', 'strokeWidth', function() { + r: computed('size', 'strokeWidth', function () { return (this.size - this.strokeWidth) / 2; }), - c: computed('r', function() { + c: computed('r', function () { return 2 * Math.PI * this.r; }), - dashArrayOffset: computed('c', 'progressDecimal', function() { + dashArrayOffset: computed('c', 'progressDecimal', function () { return this.c * (1 - this.progressDecimal); }), }); diff --git a/ui/app/components/raft-storage-restore.js b/ui/app/components/raft-storage-restore.js index 726432636..226217cc5 100644 --- a/ui/app/components/raft-storage-restore.js +++ b/ui/app/components/raft-storage-restore.js @@ -12,7 +12,7 @@ export default Component.extend({ flashMessages: service(), isUploading: alias('restore.isRunning'), abortController: null, - restore: task(function*() { + restore: task(function* () { this.set('errors', null); let adapter = getOwner(this).lookup('adapter:application'); try { diff --git a/ui/app/components/regex-validator.hbs b/ui/app/components/regex-validator.hbs index 4b38e7a67..a16cda211 100644 --- a/ui/app/components/regex-validator.hbs +++ b/ui/app/components/regex-validator.hbs @@ -1,18 +1,26 @@
-
@@ -22,7 +30,7 @@ @size="small" @checked={{this.showTestValue}} @onChange={{this.toggleTestValue}} - > + > Validation
@@ -32,37 +40,37 @@ data-test-input={{@attr.name}} autocomplete="off" spellcheck="false" - {{on 'change' @onChange}} + {{on "change" @onChange}} value={{@value}} class="input" />
{{#if this.showTestValue}} -
- - - - {{#if (and this.testValue @value)}} -
- {{#if this.regexError}} - - {{else}} -
- -

Your regex matches the subject string

-
- {{/if}} -
- {{/if}} -
-{{/if}} +
+ + + {{#if (and this.testValue @value)}} +
+ {{#if this.regexError}} + + {{else}} +
+ +

Your regex matches the subject string

+
+ {{/if}} +
+ {{/if}} +
+{{/if}} \ No newline at end of file diff --git a/ui/app/components/role-edit.js b/ui/app/components/role-edit.js index 2ed008b33..3c222836d 100644 --- a/ui/app/components/role-edit.js +++ b/ui/app/components/role-edit.js @@ -41,7 +41,7 @@ export default Component.extend(FocusOnInsertMixin, { } }, - waitForKeyUp: task(function*() { + waitForKeyUp: task(function* () { while (true) { let event = yield waitForEvent(document.body, 'keyup'); this.onEscape(event); diff --git a/ui/app/components/secret-create-or-update.js b/ui/app/components/secret-create-or-update.js index 310996389..05f97327e 100644 --- a/ui/app/components/secret-create-or-update.js +++ b/ui/app/components/secret-create-or-update.js @@ -28,9 +28,8 @@ import ControlGroupError from 'vault/lib/control-group-error'; import Ember from 'ember'; 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 { set } from '@ember/object'; import { tracked } from '@glimmer/tracking'; import { isBlank, isNone } from '@ember/utils'; @@ -66,7 +65,7 @@ export default class SecretCreateOrUpdate extends Component { let adapter = this.store.adapterFor('secret-v2'); let type = { modelName: 'secret-v2' }; 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; }); } @@ -143,7 +142,7 @@ export default class SecretCreateOrUpdate extends Component { .then(() => { this.saveComplete(successCallback, key); }) - .catch(e => { + .catch((e) => { // when mode is not create the metadata error is handled in secret-edit-metadata if (this.args.mode === 'create') { this.error = e.errors.join(' '); @@ -155,7 +154,7 @@ export default class SecretCreateOrUpdate extends Component { } } }) - .catch(error => { + .catch((error) => { if (error instanceof ControlGroupError) { let errorMessage = this.controlGroup.logFromError(error); this.error = errorMessage.content; @@ -188,7 +187,7 @@ export default class SecretCreateOrUpdate extends Component { return false; } - @(task(function*(name, value) { + @(task(function* (name, value) { this.checkValidation(name, value); while (true) { let event = yield waitForEvent(document.body, 'keyup'); diff --git a/ui/app/components/secret-delete-menu.js b/ui/app/components/secret-delete-menu.js index f5c563428..cc9ae6bf9 100644 --- a/ui/app/components/secret-delete-menu.js +++ b/ui/app/components/secret-delete-menu.js @@ -1,3 +1,4 @@ +/* eslint ember/no-computed-properties-in-native-classes: 'warn' */ import Ember from 'ember'; import { inject as service } from '@ember/service'; import Component from '@glimmer/component'; @@ -6,7 +7,7 @@ import { action } from '@ember/object'; import { alias } from '@ember/object/computed'; 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.'; return errorMessage; }; @@ -19,7 +20,7 @@ export default class SecretDeleteMenu extends Component { @maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; let [backend, id] = JSON.parse(context.args.modelForData.id); return { @@ -33,7 +34,7 @@ export default class SecretDeleteMenu extends Component { @maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; let [backend, id] = JSON.parse(context.args.modelForData.id); return { @@ -47,7 +48,7 @@ export default class SecretDeleteMenu extends Component { @maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.args.model || !context.args.model.engine || !context.args.model.id) return; let backend = context.args.model.engine.id; let id = context.args.model.id; @@ -64,7 +65,7 @@ export default class SecretDeleteMenu extends Component { @maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.args.model || context.args.mode === 'create') { return; } @@ -85,7 +86,7 @@ export default class SecretDeleteMenu extends Component { @maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.args.model || context.args.mode === 'create') { return; } @@ -136,7 +137,7 @@ export default class SecretDeleteMenu extends Component { return this.store .adapterFor('secret-v2-version') .v2DeleteOperation(this.store, this.args.modelForData.id, deleteType, currentVersionForNoReadMetadata) - .then(resp => { + .then((resp) => { if (Ember.testing) { this.showDeleteModal = false; // we don't want a refresh otherwise test loop will rerun in a loop diff --git a/ui/app/components/secret-edit-metadata.js b/ui/app/components/secret-edit-metadata.js index e62e1e924..88b09dfb2 100644 --- a/ui/app/components/secret-edit-metadata.js +++ b/ui/app/components/secret-edit-metadata.js @@ -16,9 +16,8 @@ */ import Component from '@glimmer/component'; -import { action } from '@ember/object'; +import { action, set } from '@ember/object'; import { inject as service } from '@ember/service'; -import { set } from '@ember/object'; import { tracked } from '@glimmer/tracking'; export default class SecretEditMetadata extends Component { diff --git a/ui/app/components/secret-edit-toolbar.js b/ui/app/components/secret-edit-toolbar.js index 09e2433f1..f2bfb44c5 100644 --- a/ui/app/components/secret-edit-toolbar.js +++ b/ui/app/components/secret-edit-toolbar.js @@ -36,7 +36,7 @@ * @param {object} wrappedData - when copy the data it's the token of the secret returned. * @param {object} editActions - actions passed from parent to child */ - +/* eslint ember/no-computed-properties-in-native-classes: 'warn' */ import Component from '@glimmer/component'; import { action } from '@ember/object'; import { not } from '@ember/object/computed'; @@ -75,7 +75,7 @@ export default class SecretEditToolbar extends Component { this.store .adapterFor('secret-v2-version') .queryRecord(this.args.modelForData.id, { wrapTTL: 1800 }) - .then(resp => { + .then((resp) => { this.wrappedData = resp.wrap_info.token; this.flashMessages.success('Secret Successfully Wrapped!'); }) @@ -93,7 +93,7 @@ export default class SecretEditToolbar extends Component { id: this.args.modelForData.id, wrapTTL: 1800, }) - .then(resp => { + .then((resp) => { this.wrappedData = resp.wrap_info.token; this.flashMessages.success('Secret Successfully Wrapped!'); }) diff --git a/ui/app/components/secret-edit.js b/ui/app/components/secret-edit.js index 5a7affadc..5e968a715 100644 --- a/ui/app/components/secret-edit.js +++ b/ui/app/components/secret-edit.js @@ -73,7 +73,7 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, { checkSecretCapabilities: maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.model || context.mode === 'create') { return; } @@ -94,7 +94,7 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, { checkMetadataCapabilities: maybeQueryRecord( 'capabilities', - context => { + (context) => { if (!context.model || !context.isV2) { return; } @@ -117,38 +117,43 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, { buttonDisabled: or('requestInFlight', 'model.isFolder', 'model.flagsIsInvalid'), - modelForData: computed('isV2', 'model', function() { + modelForData: computed('isV2', 'model', function () { let { model } = this; if (!model) return null; return this.isV2 ? model.belongsTo('selectedVersion').value() : model; }), - basicModeDisabled: computed('secretDataIsAdvanced', 'showAdvancedMode', function() { + basicModeDisabled: computed('secretDataIsAdvanced', 'showAdvancedMode', function () { return this.secretDataIsAdvanced || this.showAdvancedMode === false; }), - secretDataAsJSON: computed('secretData', 'secretData.[]', function() { + secretDataAsJSON: computed('secretData', 'secretData.[]', function () { return this.secretData.toJSON(); }), - secretDataIsAdvanced: computed('secretData', 'secretData.[]', function() { + secretDataIsAdvanced: computed('secretData', 'secretData.[]', function () { return this.secretData.isAdvanced(); }), showAdvancedMode: or('secretDataIsAdvanced', 'preferAdvancedEdit'), - isWriteWithoutRead: computed('model.failedServerRead', 'modelForData.failedServerRead', 'isV2', function() { - if (!this.model) return; - // if the version couldn't be read from the server - if (this.isV2 && this.modelForData.failedServerRead) { - return true; + isWriteWithoutRead: computed( + 'model.failedServerRead', + 'modelForData.failedServerRead', + 'isV2', + function () { + if (!this.model) return; + // if the version couldn't be read from the server + if (this.isV2 && this.modelForData.failedServerRead) { + return true; + } + // if the model couldn't be read from the server + if (!this.isV2 && this.model.failedServerRead) { + return true; + } + return false; } - // if the model couldn't be read from the server - if (!this.isV2 && this.model.failedServerRead) { - return true; - } - return false; - }), + ), actions: { refresh() { diff --git a/ui/app/components/secret-link.js b/ui/app/components/secret-link.js index fd400d293..d3b05afac 100644 --- a/ui/app/components/secret-link.js +++ b/ui/app/components/secret-link.js @@ -30,7 +30,7 @@ export default Component.extend({ queryParams: null, ariaLabel: null, - linkParams: computed('mode', 'secret', 'queryParams', function() { + linkParams: computed('mode', 'secret', 'queryParams', function () { let data = { mode: this.mode, secret: this.secret, queryParams: this.queryParams }; return linkParams(data); }), diff --git a/ui/app/components/secret-list-header-tab.js b/ui/app/components/secret-list-header-tab.js index 3627a2505..a6cf27396 100644 --- a/ui/app/components/secret-list-header-tab.js +++ b/ui/app/components/secret-list-header-tab.js @@ -36,10 +36,10 @@ export default class SecretListHeaderTab extends Component { async fetchCapabilities() { let capabilitiesArray = ['canList', 'canCreate', 'canUpdate']; - let checkCapabilities = function(object) { + let checkCapabilities = function (object) { let array = []; // 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 if (object) { array.push(object[item]); @@ -47,7 +47,7 @@ export default class SecretListHeaderTab extends Component { }); 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 if (this.args.displayName === 'Database') { let peekRecordRoles = this.store.peekRecord('capabilities', 'database/roles/'); diff --git a/ui/app/components/secret-list/database-list-item.js b/ui/app/components/secret-list/database-list-item.js index 410f18652..76663617c 100644 --- a/ui/app/components/secret-list/database-list-item.js +++ b/ui/app/components/secret-list/database-list-item.js @@ -41,7 +41,7 @@ export default class DatabaseListItem extends Component { .then(() => { this.flashMessages.success(`Success: ${id} connection was reset`); }) - .catch(e => { + .catch((e) => { this.flashMessages.danger(e.errors); }); } @@ -54,7 +54,7 @@ export default class DatabaseListItem extends Component { .then(() => { this.flashMessages.success(`Success: ${id} connection was rotated`); }) - .catch(e => { + .catch((e) => { this.flashMessages.danger(e.errors); }); } diff --git a/ui/app/components/secret-list/transform-list-item.js b/ui/app/components/secret-list/transform-list-item.js index 9df9fddd1..f9c3e0ff8 100644 --- a/ui/app/components/secret-list/transform-list-item.js +++ b/ui/app/components/secret-list/transform-list-item.js @@ -20,7 +20,7 @@ export default Component.extend({ itemPath: '', itemType: '', - isBuiltin: computed('item', 'itemType', function() { + isBuiltin: computed('item', 'itemType', function () { const item = this.item; if (this.itemType === 'alphabet' || this.itemType === 'template') { return item.get('id').startsWith('builtin/'); diff --git a/ui/app/components/selectable-card.js b/ui/app/components/selectable-card.js index aa94a9704..d1f6edc8f 100644 --- a/ui/app/components/selectable-card.js +++ b/ui/app/components/selectable-card.js @@ -24,7 +24,7 @@ export default Component.extend({ actionText: '', gridContainer: false, tagName: '', // do not wrap component with div - formattedCardTitle: computed('total', function() { + formattedCardTitle: computed('total', function () { const { cardTitle, total } = this; if (cardTitle === 'Tokens') { diff --git a/ui/app/components/shamir-progress.js b/ui/app/components/shamir-progress.js index 817ada1ba..c4f5cb6b8 100644 --- a/ui/app/components/shamir-progress.js +++ b/ui/app/components/shamir-progress.js @@ -5,7 +5,7 @@ export default Component.extend({ threshold: null, progress: null, classNames: ['shamir-progress'], - progressDecimal: computed('threshold', 'progress', function() { + progressDecimal: computed('threshold', 'progress', function () { const { threshold, progress } = this; if (threshold && progress) { return progress / threshold; diff --git a/ui/app/components/splash-page.js b/ui/app/components/splash-page.js index 578f8894c..a8966ae67 100644 --- a/ui/app/components/splash-page.js +++ b/ui/app/components/splash-page.js @@ -8,7 +8,7 @@ export default Component.extend({ store: service(), tagName: '', - activeCluster: computed('auth.activeCluster', function() { + activeCluster: computed('auth.activeCluster', function () { return this.store.peekRecord('cluster', this.auth.activeCluster); }), }); diff --git a/ui/app/components/status-menu.js b/ui/app/components/status-menu.js index 8aa4e182e..cf80c6970 100644 --- a/ui/app/components/status-menu.js +++ b/ui/app/components/status-menu.js @@ -10,7 +10,7 @@ export default Component.extend({ media: service(), type: 'cluster', itemTag: null, - glyphName: computed('type', function() { + glyphName: computed('type', function () { return { cluster: 'circle-dot', user: 'user', diff --git a/ui/app/components/text-file.js b/ui/app/components/text-file.js index 0f82d11cb..e94b69299 100644 --- a/ui/app/components/text-file.js +++ b/ui/app/components/text-file.js @@ -1,6 +1,5 @@ import Component from '@glimmer/component'; -import { set } from '@ember/object'; -import { action } from '@ember/object'; +import { set, action } from '@ember/object'; import { tracked } from '@glimmer/tracking'; import { guidFor } from '@ember/object/internals'; diff --git a/ui/app/components/tool-actions-form.js b/ui/app/components/tool-actions-form.js index f57fc1bf4..0bfd6171f 100644 --- a/ui/app/components/tool-actions-form.js +++ b/ui/app/components/tool-actions-form.js @@ -4,11 +4,12 @@ import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { setProperties, computed, set } from '@ember/object'; import { addSeconds, parseISO } from 'date-fns'; +import { A } from '@ember/array'; const DEFAULTS = { token: null, rewrap_token: null, - errors: [], + errors: A(), wrap_info: null, creation_time: null, creation_ttl: null, @@ -62,7 +63,7 @@ export default Component.extend(DEFAULTS, { dataIsEmpty: match('data', new RegExp(DEFAULTS.data)), - expirationDate: computed('creation_time', 'creation_ttl', function() { + expirationDate: computed('creation_time', 'creation_ttl', function () { const { creation_time, creation_ttl } = this; if (!(creation_time && creation_ttl)) { return null; @@ -127,7 +128,10 @@ export default Component.extend(DEFAULTS, { this.store .adapterFor('tools') .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() { diff --git a/ui/app/components/toolbar-secret-link.js b/ui/app/components/toolbar-secret-link.js index 08318b86f..e1c6347dc 100644 --- a/ui/app/components/toolbar-secret-link.js +++ b/ui/app/components/toolbar-secret-link.js @@ -21,7 +21,7 @@ import OuterHTML from './outer-html'; import { computed } from '@ember/object'; export default OuterHTML.extend({ - glyph: computed('type', function() { + glyph: computed('type', function () { if (this.type == 'add') { return 'plus'; } else { diff --git a/ui/app/components/transform-edit-base.js b/ui/app/components/transform-edit-base.js index 694925c66..252b8ac3e 100644 --- a/ui/app/components/transform-edit-base.js +++ b/ui/app/components/transform-edit-base.js @@ -71,7 +71,7 @@ export default Component.extend(FocusOnInsertMixin, { .then(() => { successCallback(model); }) - .catch(e => { + .catch((e) => { model.set('displayErrors', e.errors); throw e; }); diff --git a/ui/app/components/transform-role-edit.js b/ui/app/components/transform-role-edit.js index 45d70e80d..aff09afe3 100644 --- a/ui/app/components/transform-role-edit.js +++ b/ui/app/components/transform-role-edit.js @@ -11,13 +11,13 @@ export default TransformBase.extend({ handleUpdateTransformations(updateTransformations, roleId, type = 'update') { if (!updateTransformations) return; const backend = this.model.backend; - const promises = updateTransformations.map(transform => { + const promises = updateTransformations.map((transform) => { return this.store .queryRecord('transform', { backend, id: transform.id, }) - .then(function(transformation) { + .then(function (transformation) { let roles = transformation.allowed_roles; if (transform.action === 'ADD') { roles = addToList(roles, roleId); @@ -30,17 +30,17 @@ export default TransformBase.extend({ allowed_roles: roles, }); - return transformation.save().catch(e => { + return transformation.save().catch((e) => { return { errorStatus: e.httpStatus, ...transform }; }); }); }); - Promise.all(promises).then(res => { - let hasError = res.find(r => !!r.errorStatus); + Promise.all(promises).then((res) => { + let hasError = res.find((r) => !!r.errorStatus); if (hasError) { - let errorAdding = res.find(r => r.errorStatus === 403 && r.action === 'ADD'); - let errorRemoving = res.find(r => r.errorStatus === 403 && r.action === 'REMOVE'); + let errorAdding = res.find((r) => r.errorStatus === 403 && r.action === 'ADD'); + let errorRemoving = res.find((r) => r.errorStatus === 403 && r.action === 'REMOVE'); let message = '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) { this.handleUpdateTransformations( - newModelTransformations.map(t => ({ + newModelTransformations.map((t) => ({ id: t, action: 'ADD', })), @@ -83,7 +83,7 @@ export default TransformBase.extend({ } const updateTransformations = [...newModelTransformations, ...this.initialTransformations] - .map(t => { + .map((t) => { if (this.initialTransformations.indexOf(t) < 0) { return { id: t, @@ -98,7 +98,7 @@ export default TransformBase.extend({ } return null; }) - .filter(t => !!t); + .filter((t) => !!t); this.handleUpdateTransformations(updateTransformations, roleId); }); }, @@ -106,7 +106,7 @@ export default TransformBase.extend({ delete() { const roleId = this.model?.id; const roleTransformations = this.model?.transformations || []; - const updateTransformations = roleTransformations.map(t => ({ + const updateTransformations = roleTransformations.map((t) => ({ id: t, action: 'REMOVE', })); diff --git a/ui/app/components/transform-show-transformation.js b/ui/app/components/transform-show-transformation.js index 836ae3d19..a00970c99 100644 --- a/ui/app/components/transform-show-transformation.js +++ b/ui/app/components/transform-show-transformation.js @@ -2,13 +2,13 @@ import TransformBase from './transform-edit-base'; import { computed } from '@ember/object'; export default TransformBase.extend({ - cliCommand: computed('model.{allowed_roles,type,tweak_source}', function() { + cliCommand: computed('model.{allowed_roles,type,tweak_source}', function () { if (!this.model) { return; } 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 let role = ''; diff --git a/ui/app/components/transformation-edit.js b/ui/app/components/transformation-edit.js index 269c251cb..a8bb726b8 100644 --- a/ui/app/components/transformation-edit.js +++ b/ui/app/components/transformation-edit.js @@ -15,7 +15,7 @@ export default TransformBase.extend({ backend, id: role.id, }) - .then(roleStore => { + .then((roleStore) => { let transformations = roleStore.transformations; if (role.action === 'ADD') { transformations = addToList(transformations, transformationId); @@ -26,14 +26,14 @@ export default TransformBase.extend({ backend, transformations, }); - return roleStore.save().catch(e => { + return roleStore.save().catch((e) => { return { errorStatus: e.httpStatus, ...role, }; }); }) - .catch(e => { + .catch((e) => { if (e.httpStatus !== 403 && role.action === 'ADD') { // If role doesn't yet exist, create it with this transformation attached var newRole = this.store.createRecord('transform/role', { @@ -42,7 +42,7 @@ export default TransformBase.extend({ transformations: [transformationId], backend, }); - return newRole.save().catch(e => { + return newRole.save().catch((e) => { return { errorStatus: e.httpStatus, ...role, @@ -61,15 +61,15 @@ export default TransformBase.extend({ handleUpdateRoles(updateRoles, transformationId) { if (!updateRoles) return; 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 => { - let hasError = results.find(role => !!role.errorStatus); + Promise.all(promises).then((results) => { + let hasError = results.find((role) => !!role.errorStatus); if (hasError) { let message = '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 // 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`; @@ -99,8 +99,8 @@ export default TransformBase.extend({ const initialRoles = this.initialRoles || []; const updateRoles = [...newModelRoles, ...initialRoles] - .filter(r => !this.isWildcard(r)) // CBS TODO: expand wildcards into included roles instead - .map(role => { + .filter((r) => !this.isWildcard(r)) // CBS TODO: expand wildcards into included roles instead + .map((role) => { if (initialRoles.indexOf(role) < 0) { return { id: role, @@ -115,7 +115,7 @@ export default TransformBase.extend({ } return null; }) - .filter(r => !!r); + .filter((r) => !!r); this.handleUpdateRoles(updateRoles, transformationId); }); }, diff --git a/ui/app/components/transit-edit.js b/ui/app/components/transit-edit.js index c854a2095..a317dacdc 100644 --- a/ui/app/components/transit-edit.js +++ b/ui/app/components/transit-edit.js @@ -27,7 +27,7 @@ export default Component.extend(FocusOnInsertMixin, { } }, - waitForKeyUp: task(function*() { + waitForKeyUp: task(function* () { while (true) { let event = yield waitForEvent(document.body, 'keyup'); this.onEscape(event); diff --git a/ui/app/components/transit-key-actions.js b/ui/app/components/transit-key-actions.js index 6872e5390..1fd389492 100644 --- a/ui/app/components/transit-key-actions.js +++ b/ui/app/components/transit-key-actions.js @@ -92,7 +92,7 @@ export default Component.extend(TRANSIT_PARAMS, { }); }, - keyIsRSA: computed('key.type', function() { + keyIsRSA: computed('key.type', function () { let type = this.key.type; return type === 'rsa-2048' || type === 'rsa-3072' || type === 'rsa-4096'; }), @@ -134,7 +134,7 @@ export default Component.extend(TRANSIT_PARAMS, { } if (paramsToKeep) { - paramsToKeep.forEach(param => delete params[param]); + paramsToKeep.forEach((param) => delete params[param]); } //resets params still left in the object to defaults this.clearErrors(); @@ -170,8 +170,10 @@ export default Component.extend(TRANSIT_PARAMS, { if (options.wrapTTL) { props = assign({}, props, { wrappedToken: resp.wrap_info.token }); } - this.toggleProperty('isModalActive'); - this.setProperties(props); + if (!this.isDestroyed && !this.isDestroying) { + this.toggleProperty('isModalActive'); + this.setProperties(props); + } if (action === 'rotate') { this.onRefresh(); } @@ -204,7 +206,7 @@ export default Component.extend(TRANSIT_PARAMS, { clearParams(params) { const arr = Array.isArray(params) ? params : [params]; - arr.forEach(param => this.set(param, null)); + arr.forEach((param) => this.set(param, null)); }, toggleModal(successMessage) { @@ -235,7 +237,7 @@ export default Component.extend(TRANSIT_PARAMS, { .adapterFor('transit-key') .keyAction(action, { backend, id, payload }, options) .then( - resp => this.handleSuccess(resp, options, action), + (resp) => this.handleSuccess(resp, options, action), (...errArgs) => this.handleError(...errArgs) ); }, diff --git a/ui/app/components/wizard-content.js b/ui/app/components/wizard-content.js index a257e4dd3..98ec13b33 100644 --- a/ui/app/components/wizard-content.js +++ b/ui/app/components/wizard-content.js @@ -18,7 +18,7 @@ export default Component.extend({ 'tutorialComponent', 'tutorialState', 'wizard.{featureComponent,featureMachineHistory}', - function() { + function () { if (!this.tutorialComponent) return; return ( this.tutorialComponent.includes('active') && @@ -29,35 +29,40 @@ export default Component.extend({ ), featureMachineHistory: alias('wizard.featureMachineHistory'), totalFeatures: reads('wizard.featureList.length'), - completedFeatures: computed('wizard.currentMachine', function() { + completedFeatures: computed('wizard.currentMachine', function () { return this.wizard.getCompletedFeatures(); }), - currentFeatureProgress: computed('currentMachine', 'featureMachineHistory.[]', 'tutorialState', function() { - if (this.tutorialState.includes('active.feature')) { - let totalSteps = FEATURE_MACHINE_STEPS[this.currentMachine]; - if (this.currentMachine === 'secrets') { - if (this.featureMachineHistory.includes('secret')) { - totalSteps = totalSteps['secret']['secret']; - } - if (this.featureMachineHistory.includes('list')) { - totalSteps = totalSteps['secret']['list']; - } - if (this.featureMachineHistory.includes('encryption')) { - totalSteps = totalSteps['encryption']; - } - if (this.featureMachineHistory.includes('role') || typeof totalSteps === 'object') { - totalSteps = totalSteps['role']; + currentFeatureProgress: computed( + 'currentMachine', + 'featureMachineHistory.[]', + 'tutorialState', + function () { + if (this.tutorialState.includes('active.feature')) { + let totalSteps = FEATURE_MACHINE_STEPS[this.currentMachine]; + if (this.currentMachine === 'secrets') { + if (this.featureMachineHistory.includes('secret')) { + totalSteps = totalSteps['secret']['secret']; + } + if (this.featureMachineHistory.includes('list')) { + totalSteps = totalSteps['secret']['list']; + } + if (this.featureMachineHistory.includes('encryption')) { + totalSteps = totalSteps['encryption']; + } + if (this.featureMachineHistory.includes('role') || typeof totalSteps === 'object') { + totalSteps = totalSteps['role']; + } } + return { + percentage: (this.featureMachineHistory.length / totalSteps) * 100, + feature: this.currentMachine, + text: `Step ${this.featureMachineHistory.length} of ${totalSteps}`, + }; } - return { - percentage: (this.featureMachineHistory.length / totalSteps) * 100, - feature: this.currentMachine, - text: `Step ${this.featureMachineHistory.length} of ${totalSteps}`, - }; + return null; } - return null; - }), - currentTutorialProgress: computed('tutorialState', function() { + ), + currentTutorialProgress: computed('tutorialState', function () { if (this.tutorialState.includes('init.active')) { let currentStepName = this.tutorialState.split('.')[2]; let currentStepNumber = INIT_STEPS.indexOf(currentStepName) + 1; @@ -75,7 +80,7 @@ export default Component.extend({ 'currentMachine', 'currentTutorialProgress.percentage', 'wizard.featureList', - function() { + function () { let bar = []; if (this.currentTutorialProgress) { bar.push({ @@ -85,10 +90,10 @@ export default Component.extend({ }); } else { if (this.currentFeatureProgress) { - this.completedFeatures.forEach(feature => { + this.completedFeatures.forEach((feature) => { 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) { bar.push({ style: htmlSafe(`width:${this.currentFeatureProgress.percentage}%;`), diff --git a/ui/app/components/wizard/features-selection.js b/ui/app/components/wizard/features-selection.js index acd16cd0f..4f7a528fa 100644 --- a/ui/app/components/wizard/features-selection.js +++ b/ui/app/components/wizard/features-selection.js @@ -17,7 +17,7 @@ export default Component.extend({ maybeHideFeatures() { let features = this.allFeatures; - features.forEach(feat => { + features.forEach((feat) => { feat.disabled = this.doesNotHavePermission(feat.requiredPermissions); }); @@ -34,12 +34,12 @@ export default Component.extend({ // 'example/path': ['capability'], // 'second/example/path': ['update', 'sudo'], // } - return !Object.keys(requiredPermissions).every(path => { + return !Object.keys(requiredPermissions).every((path) => { return this.permissions.hasPermission(path, requiredPermissions[path]); }); }, - estimatedTime: computed('selectedFeatures', function() { + estimatedTime: computed('selectedFeatures', function () { let time = 0; for (let feature of Object.keys(FEATURE_MACHINE_TIME)) { if (this.selectedFeatures.includes(feature)) { @@ -48,8 +48,8 @@ export default Component.extend({ } return time; }), - selectProgress: computed('selectedFeatures', function() { - let bar = this.selectedFeatures.map(feature => { + selectProgress: computed('selectedFeatures', function () { + let bar = this.selectedFeatures.map((feature) => { return { style: htmlSafe('width:0%;'), completed: false, showIcon: true, feature: feature }; }); if (bar.length === 0) { @@ -57,7 +57,7 @@ export default Component.extend({ } return bar; }), - allFeatures: computed(function() { + allFeatures: computed(function () { return [ { key: 'secrets', @@ -129,7 +129,7 @@ export default Component.extend({ showReplication: or('version.hasPerfReplication', 'version.hasDRReplication'), - selectedFeatures: computed('allFeatures.@each.selected', function() { + selectedFeatures: computed('allFeatures.@each.selected', function () { return this.allFeatures.filterBy('selected').mapBy('key'); }), diff --git a/ui/app/components/wizard/mounts-wizard.js b/ui/app/components/wizard/mounts-wizard.js index 657ade04e..8e76528aa 100644 --- a/ui/app/components/wizard/mounts-wizard.js +++ b/ui/app/components/wizard/mounts-wizard.js @@ -17,33 +17,33 @@ export default Component.extend({ mountSubtype: alias('wizard.componentState'), fullNextStep: alias('wizard.nextStep'), nextFeature: alias('wizard.nextFeature'), - nextStep: computed('fullNextStep', function() { + nextStep: computed('fullNextStep', function () { return this.fullNextStep.split('.').lastObject; }), needsConnection: equal('mountSubtype', 'database'), needsEncryption: equal('mountSubtype', 'transit'), stepComponent: alias('wizard.stepComponent'), - detailsComponent: computed('currentMachine', 'mountSubtype', function() { + detailsComponent: computed('currentMachine', 'mountSubtype', function () { let suffix = this.currentMachine === 'secrets' ? 'engine' : 'method'; return this.mountSubtype ? `wizard/${this.mountSubtype}-${suffix}` : null; }), - isSupported: computed('currentMachine', 'mountSubtype', function() { + isSupported: computed('currentMachine', 'mountSubtype', function () { if (this.currentMachine === 'secrets') { return supportedSecrets.includes(this.mountSubtype); } else { return supportedAuth.includes(this.mountSubtype); } }), - mountName: computed('currentMachine', 'mountSubtype', function() { + mountName: computed('currentMachine', 'mountSubtype', function () { if (this.currentMachine === 'secrets') { - var secret = engines().find(engine => { + var secret = engines().find((engine) => { return engine.type === this.mountSubtype; }); if (secret) { return secret.displayName; } } else { - var auth = methods().find(method => { + var auth = methods().find((method) => { return method.type === this.mountSubtype; }); if (auth) { @@ -52,7 +52,7 @@ export default Component.extend({ } return null; }), - actionText: computed('mountSubtype', function() { + actionText: computed('mountSubtype', function () { switch (this.mountSubtype) { case 'aws': return 'Generate credential'; diff --git a/ui/app/components/wrap-ttl.js b/ui/app/components/wrap-ttl.js index 1b6a625c1..19b5afb74 100644 --- a/ui/app/components/wrap-ttl.js +++ b/ui/app/components/wrap-ttl.js @@ -10,7 +10,7 @@ export default Component.extend({ ttl: '30m', - wrapTTL: computed('wrapResponse', 'ttl', function() { + wrapTTL: computed('wrapResponse', 'ttl', function () { const { wrapResponse, ttl } = this; return wrapResponse ? ttl : null; }), diff --git a/ui/app/controllers/application.js b/ui/app/controllers/application.js index c800ccf48..22643644c 100644 --- a/ui/app/controllers/application.js +++ b/ui/app/controllers/application.js @@ -7,11 +7,11 @@ export default Controller.extend({ env: config.environment, auth: service(), store: service(), - activeCluster: computed('auth.activeCluster', function() { + activeCluster: computed('auth.activeCluster', function () { let id = this.auth.activeCluster; return id ? this.store.peekRecord('cluster', id) : null; }), - activeClusterName: computed('activeCluster', function() { + activeClusterName: computed('activeCluster', function () { const activeCluster = this.activeCluster; return activeCluster ? activeCluster.get('name') : null; }), diff --git a/ui/app/controllers/vault.js b/ui/app/controllers/vault.js index 4189d0b20..827eace50 100644 --- a/ui/app/controllers/vault.js +++ b/ui/app/controllers/vault.js @@ -15,11 +15,11 @@ export default Controller.extend({ env: config.environment, auth: service(), store: service(), - activeCluster: computed('auth.activeCluster', function() { + activeCluster: computed('auth.activeCluster', function () { let id = this.auth.activeCluster; return id ? this.store.peekRecord('cluster', id) : null; }), - activeClusterName: computed('activeCluster', function() { + activeClusterName: computed('activeCluster', function () { const activeCluster = this.activeCluster; return activeCluster ? activeCluster.get('name') : null; }), diff --git a/ui/app/controllers/vault/cluster.js b/ui/app/controllers/vault/cluster.js index fd3d32463..8528655e8 100644 --- a/ui/app/controllers/vault/cluster.js +++ b/ui/app/controllers/vault/cluster.js @@ -25,17 +25,17 @@ export default Controller.extend({ namespaceQueryParam: '', - onQPChange: observer('namespaceQueryParam', function() { + onQPChange: observer('namespaceQueryParam', function () { this.namespaceService.setNamespace(this.namespaceQueryParam); }), consoleOpen: alias('console.isOpen'), - activeCluster: computed('auth.activeCluster', function() { + activeCluster: computed('auth.activeCluster', function () { return this.store.peekRecord('cluster', this.auth.activeCluster); }), - activeClusterName: computed('activeCluster', function() { + activeClusterName: computed('activeCluster', function () { const activeCluster = this.activeCluster; return activeCluster ? activeCluster.get('name') : null; }), @@ -45,7 +45,7 @@ export default Controller.extend({ 'activeClusterName', 'auth.currentToken', 'activeCluster.{dr.isSecondary,needsInit,sealed}', - function() { + function () { if (this.activeCluster.dr?.isSecondary || this.activeCluster.needsInit || this.activeCluster.sealed) { return false; } diff --git a/ui/app/controllers/vault/cluster/access/identity/create.js b/ui/app/controllers/vault/cluster/access/identity/create.js index 0c6a1a89c..704c26294 100644 --- a/ui/app/controllers/vault/cluster/access/identity/create.js +++ b/ui/app/controllers/vault/cluster/access/identity/create.js @@ -4,7 +4,7 @@ import { task } from 'ember-concurrency'; export default Controller.extend({ showRoute: 'vault.cluster.access.identity.show', showTab: 'details', - navAfterSave: task(function*({ saveType, model }) { + navAfterSave: task(function* ({ saveType, model }) { let isDelete = saveType === 'delete'; let type = model.get('identityType'); let listRoutes = { diff --git a/ui/app/controllers/vault/cluster/access/identity/index.js b/ui/app/controllers/vault/cluster/access/identity/index.js index 155d3b162..bd00ce7c6 100644 --- a/ui/app/controllers/vault/cluster/access/identity/index.js +++ b/ui/app/controllers/vault/cluster/access/identity/index.js @@ -15,7 +15,7 @@ export default Controller.extend(ListController, { this.send('reload'); this.flashMessages.success(`Successfully deleted ${type}: ${id}`); }) - .catch(e => { + .catch((e) => { this.flashMessages.success( `There was a problem deleting ${type}: ${id} - ${e.errors.join(' ') || e.message}` ); @@ -33,7 +33,7 @@ export default Controller.extend(ListController, { .then(() => { this.flashMessages.success(`Successfully ${action[0]} ${type}: ${id}`); }) - .catch(e => { + .catch((e) => { this.flashMessages.success( `There was a problem ${action[1]} ${type}: ${id} - ${e.errors.join(' ') || e.message}` ); diff --git a/ui/app/controllers/vault/cluster/access/leases/list.js b/ui/app/controllers/vault/cluster/access/leases/list.js index 80232bb52..5fa6c5cbb 100644 --- a/ui/app/controllers/vault/cluster/access/leases/list.js +++ b/ui/app/controllers/vault/cluster/access/leases/list.js @@ -9,7 +9,7 @@ export default Controller.extend(ListController, { store: service(), clusterController: controller('vault.cluster'), - backendCrumb: computed('clusterController.model.name', function() { + backendCrumb: computed('clusterController.model.name', function () { return { label: 'leases', text: 'leases', @@ -20,11 +20,11 @@ export default Controller.extend(ListController, { isLoading: false, - filterIsFolder: computed('filter', function() { + filterIsFolder: computed('filter', function () { return !!utils.keyIsFolder(this.filter); }), - emptyTitle: computed('baseKey.id', 'filter', 'filterIsFolder', function() { + emptyTitle: computed('baseKey.id', 'filter', 'filterIsFolder', function () { let id = this.baseKey.id; let filter = this.filter; if (id === '') { @@ -51,7 +51,7 @@ export default Controller.extend(ListController, { this.flashMessages.success(`All of the leases under ${prefix} will be revoked.`); }); }) - .catch(e => { + .catch((e) => { const errString = e.errors.join('.'); this.flashMessages.danger( `There was an error attempting to revoke the prefix: ${prefix}. ${errString}.` diff --git a/ui/app/controllers/vault/cluster/access/leases/show.js b/ui/app/controllers/vault/cluster/access/leases/show.js index 45ab19adc..5ce78487c 100644 --- a/ui/app/controllers/vault/cluster/access/leases/show.js +++ b/ui/app/controllers/vault/cluster/access/leases/show.js @@ -6,7 +6,7 @@ import Controller, { inject as controller } from '@ember/controller'; export default Controller.extend({ clusterController: controller('vault.cluster'), - backendCrumb: computed('clusterController.model.name', function() { + backendCrumb: computed('clusterController.model.name', function () { return { label: 'leases', text: 'leases', @@ -36,7 +36,7 @@ export default Controller.extend({ flash.success(`The lease ${model.id} was successfully renewed.`); }); }) - .catch(e => { + .catch((e) => { const errString = e.errors.join('.'); flash.danger(`There was an error renewing the lease: ${errString}`); }); diff --git a/ui/app/controllers/vault/cluster/access/methods.js b/ui/app/controllers/vault/cluster/access/methods.js index 15d47023f..222874afc 100644 --- a/ui/app/controllers/vault/cluster/access/methods.js +++ b/ui/app/controllers/vault/cluster/access/methods.js @@ -11,7 +11,7 @@ export default Controller.extend({ pageFilter: null, filter: null, - disableMethod: task(function*(method) { + disableMethod: task(function* (method) { const { type, path } = method; try { yield method.destroyRecord(); diff --git a/ui/app/controllers/vault/cluster/auth.js b/ui/app/controllers/vault/cluster/auth.js index 7bd0726c0..103fff827 100644 --- a/ui/app/controllers/vault/cluster/auth.js +++ b/ui/app/controllers/vault/cluster/auth.js @@ -26,7 +26,7 @@ export default Controller.extend({ return ''; }, - updateManagedNamespace: task(function*(value) { + updateManagedNamespace: task(function* (value) { // debounce yield timeout(500); // TODO: Move this to shared fn @@ -35,7 +35,7 @@ export default Controller.extend({ this.set('namespaceQueryParam', newNamespace); }).restartable(), - updateNamespace: task(function*(value) { + updateNamespace: task(function* (value) { // debounce yield timeout(500); this.namespaceService.setNamespace(value, true); diff --git a/ui/app/controllers/vault/cluster/init.js b/ui/app/controllers/vault/cluster/init.js index 41f2dee36..6f5d488bb 100644 --- a/ui/app/controllers/vault/cluster/init.js +++ b/ui/app/controllers/vault/cluster/init.js @@ -35,7 +35,7 @@ export default Controller.extend(DEFAULTS, { } }, - keyFilename: computed('model.name', function() { + keyFilename: computed('model.name', function () { return `vault-cluster-${this.model.name}`; }), @@ -78,7 +78,10 @@ export default Controller.extend(DEFAULTS, { store .adapterFor('cluster') .initCluster(data) - .then(resp => this.initSuccess(resp), (...errArgs) => this.initError(...errArgs)); + .then( + (resp) => this.initSuccess(resp), + (...errArgs) => this.initError(...errArgs) + ); }, setKeys(data) { diff --git a/ui/app/controllers/vault/cluster/policies/index.js b/ui/app/controllers/vault/cluster/policies/index.js index f7060a76b..c079e39bc 100644 --- a/ui/app/controllers/vault/cluster/policies/index.js +++ b/ui/app/controllers/vault/cluster/policies/index.js @@ -20,13 +20,13 @@ export default Controller.extend({ // set via the route `loading` action isLoading: false, - filterMatchesKey: computed('filter', 'model', 'model.[]', function() { + filterMatchesKey: computed('filter', 'model', 'model.[]', function () { var filter = this.filter; var content = this.model; return !!(content && content.length && content.findBy('id', filter)); }), - firstPartialMatch: computed('filter', 'model', 'model.[]', 'filterMatchesKey', function() { + firstPartialMatch: computed('filter', 'model', 'model.[]', 'filterMatchesKey', function () { var filter = this.filter; var content = this.model; if (!content) { @@ -36,16 +36,16 @@ export default Controller.extend({ var re = new RegExp('^' + filter); return filterMatchesKey ? null - : content.find(function(key) { + : content.find(function (key) { return re.test(key.get('id')); }); }), actions: { - setFilter: function(val) { + setFilter: function (val) { this.set('filter', val); }, - setFilterFocus: function(bool) { + setFilterFocus: function (bool) { this.set('filterFocused', bool); }, deletePolicy(model) { @@ -62,7 +62,7 @@ export default Controller.extend({ this.wizard.transitionFeatureMachine('delete', 'CONTINUE', policyType); } }) - .catch(e => { + .catch((e) => { let errors = e.errors ? e.errors.join('') : e.message; flash.danger( `There was an error deleting the ${policyType.toUpperCase()} policy "${name}": ${errors}.` diff --git a/ui/app/controllers/vault/cluster/secrets/backend/actions.js b/ui/app/controllers/vault/cluster/secrets/backend/actions.js index 17f11291f..b272f7ca4 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/actions.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/actions.js @@ -7,7 +7,7 @@ export default Controller.extend(BackendCrumbMixin, { }, actions: { - refresh: function() { + refresh: function () { // closure actions don't bubble to routes, // so we have to manually bubble here this.send('refreshModel'); diff --git a/ui/app/controllers/vault/cluster/secrets/backend/configuration.js b/ui/app/controllers/vault/cluster/secrets/backend/configuration.js index 2f27f26bc..84f7cdeac 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/configuration.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/configuration.js @@ -2,7 +2,7 @@ import { computed } from '@ember/object'; import Controller from '@ember/controller'; export default Controller.extend({ - isConfigurable: computed('model.type', function() { + isConfigurable: computed('model.type', function () { const configurableEngines = ['aws', 'ssh', 'pki']; return configurableEngines.includes(this.model.type); }), diff --git a/ui/app/controllers/vault/cluster/secrets/backend/create.js b/ui/app/controllers/vault/cluster/secrets/backend/create.js index 0cb8fd2ab..5002b9b30 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/create.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/create.js @@ -9,7 +9,7 @@ export default Controller.extend(BackendCrumbMixin, { itemType: '', actions: { - refresh: function() { + refresh: function () { this.send('refreshModel'); }, toggleAdvancedEdit(bool) { diff --git a/ui/app/controllers/vault/cluster/secrets/backend/edit.js b/ui/app/controllers/vault/cluster/secrets/backend/edit.js index cd99bfbe7..f7eb5bd84 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/edit.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/edit.js @@ -9,7 +9,7 @@ export default Controller.extend(BackendCrumbMixin, { this.set('version', ''); }, actions: { - refresh: function() { + refresh: function () { // closure actions don't bubble to routes, // so we have to manually bubble here this.send('refreshModel'); diff --git a/ui/app/controllers/vault/cluster/secrets/backend/list.js b/ui/app/controllers/vault/cluster/secrets/backend/list.js index 77261d496..a48f1edaf 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/list.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/list.js @@ -13,7 +13,7 @@ export default Controller.extend(ListController, BackendCrumbMixin, WithNavToNea tab: '', - filterIsFolder: computed('filter', function() { + filterIsFolder: computed('filter', function () { return !!utils.keyIsFolder(this.filter); }), @@ -29,7 +29,7 @@ export default Controller.extend(ListController, BackendCrumbMixin, WithNavToNea this.set('loading-' + item.id, true); backend .saveZeroAddressConfig() - .catch(e => { + .catch((e) => { item.set('zeroAddress', false); this.flashMessages.danger(e.message); }) diff --git a/ui/app/controllers/vault/cluster/secrets/backend/show.js b/ui/app/controllers/vault/cluster/secrets/backend/show.js index 6f7ab2c06..b96ff32dc 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/show.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/show.js @@ -13,7 +13,7 @@ export default Controller.extend(BackendCrumbMixin, { this.set('type', ''); }, actions: { - refresh: function() { + refresh: function () { // closure actions don't bubble to routes, // so we have to manually bubble here this.send('refreshModel'); diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index 474cabdba..d3daf5013 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -8,9 +8,9 @@ const LINKED_BACKENDS = supportedSecretBackends(); export default Controller.extend({ displayableBackends: filterBy('model', 'shouldIncludeInList'), - supportedBackends: computed('displayableBackends', 'displayableBackends.[]', function() { + supportedBackends: computed('displayableBackends', 'displayableBackends.[]', function () { return (this.displayableBackends || []) - .filter(backend => LINKED_BACKENDS.includes(backend.get('engineType'))) + .filter((backend) => LINKED_BACKENDS.includes(backend.get('engineType'))) .sortBy('id'); }), @@ -19,15 +19,12 @@ export default Controller.extend({ 'displayableBackends.[]', 'supportedBackends', 'supportedBackends.[]', - function() { - return (this.displayableBackends || []) - .slice() - .removeObjects(this.supportedBackends) - .sortBy('id'); + function () { + return (this.displayableBackends || []).slice().removeObjects(this.supportedBackends).sortBy('id'); } ), - disableEngine: task(function*(engine) { + disableEngine: task(function* (engine) { const { engineType, path } = engine; try { yield engine.destroyRecord(); diff --git a/ui/app/controllers/vault/cluster/settings/auth/enable.js b/ui/app/controllers/vault/cluster/settings/auth/enable.js index 9d3153678..4d236128d 100644 --- a/ui/app/controllers/vault/cluster/settings/auth/enable.js +++ b/ui/app/controllers/vault/cluster/settings/auth/enable.js @@ -4,7 +4,7 @@ import Controller from '@ember/controller'; export default Controller.extend({ wizard: service(), actions: { - onMountSuccess: function(type, path) { + onMountSuccess: function (type, path) { this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', type); let transition = this.transitionToRoute('vault.cluster.settings.auth.configure', path); return transition.followRedirects(); diff --git a/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js b/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js index 2e488fc6d..9ce582a1d 100644 --- a/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js +++ b/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js @@ -43,7 +43,7 @@ export default Controller.extend(CONFIG_ATTRS, { save(method, data) { this.set('loading', true); - const hasData = Object.keys(data).some(key => { + const hasData = Object.keys(data).some((key) => { return isPresent(data[key]); }); if (!hasData) { diff --git a/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js b/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js index db37aa2ca..a2d756233 100644 --- a/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js +++ b/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js @@ -7,7 +7,7 @@ const SUPPORTED_BACKENDS = supportedSecretBackends(); export default Controller.extend({ wizard: service(), actions: { - onMountSuccess: function(type, path) { + onMountSuccess: function (type, path) { let transition; if (SUPPORTED_BACKENDS.includes(type)) { if (type === 'kmip') { diff --git a/ui/app/helpers/filter-wildcard.js b/ui/app/helpers/filter-wildcard.js index b7cf0c72b..bb3f4ab15 100644 --- a/ui/app/helpers/filter-wildcard.js +++ b/ui/app/helpers/filter-wildcard.js @@ -8,8 +8,8 @@ export function filterWildcard([string, array]) { string = { id: string }; } let stringId = string.id; - const filterBy = stringId => - array.filter(item => new RegExp('^' + stringId.replace(/\*/g, '.*') + '$').test(item)); + const filterBy = (stringId) => + array.filter((item) => new RegExp('^' + stringId.replace(/\*/g, '.*') + '$').test(item)); return filterBy(stringId).length; } diff --git a/ui/app/helpers/has-permission.js b/ui/app/helpers/has-permission.js index 091285dcd..e528dfaaf 100644 --- a/ui/app/helpers/has-permission.js +++ b/ui/app/helpers/has-permission.js @@ -9,7 +9,7 @@ export default Helper.extend({ 'permissions.exactPaths', 'permissions.globPaths', 'permissions.canViewAll', - function() { + function () { this.recompute(); } ), diff --git a/ui/app/helpers/is-after.js b/ui/app/helpers/is-after.js index e6e21ee43..4916659d7 100644 --- a/ui/app/helpers/is-after.js +++ b/ui/app/helpers/is-after.js @@ -2,7 +2,7 @@ import DateBase from './-date-base'; import { isAfter } from 'date-fns'; export default DateBase.extend({ - compute: function([date1, date2]) { + compute: function ([date1, date2]) { this._super(...arguments); return isAfter(date1, date2); diff --git a/ui/app/helpers/is-before.js b/ui/app/helpers/is-before.js index 440f12c8d..334c3c962 100644 --- a/ui/app/helpers/is-before.js +++ b/ui/app/helpers/is-before.js @@ -2,7 +2,7 @@ import DateBase from './-date-base'; import { isBefore } from 'date-fns'; export default DateBase.extend({ - compute: function([date1, date2]) { + compute: function ([date1, date2]) { this._super(...arguments); return isBefore(date1, date2); diff --git a/ui/app/helpers/is-wildcard-string.js b/ui/app/helpers/is-wildcard-string.js index 8ba9752f4..f10357414 100644 --- a/ui/app/helpers/is-wildcard-string.js +++ b/ui/app/helpers/is-wildcard-string.js @@ -1,6 +1,6 @@ import { helper as buildHelper } from '@ember/component/helper'; -export function isWildcardString(string) { +export function isWildcardString([string]) { if (!string) { return false; } diff --git a/ui/app/helpers/split-object.js b/ui/app/helpers/split-object.js index 8da0401f1..6a7cbfaa8 100644 --- a/ui/app/helpers/split-object.js +++ b/ui/app/helpers/split-object.js @@ -19,7 +19,7 @@ export function splitObject(originalObject, array) { let object2 = {}; // convert object to key's array let keys = Object.keys(originalObject); - keys.forEach(key => { + keys.forEach((key) => { if (array.includes(key)) { object1[key] = originalObject[key]; } else { diff --git a/ui/app/helpers/tabs-for-auth-section.js b/ui/app/helpers/tabs-for-auth-section.js index 7f08e0b41..8bd32885f 100644 --- a/ui/app/helpers/tabs-for-auth-section.js +++ b/ui/app/helpers/tabs-for-auth-section.js @@ -87,12 +87,12 @@ export function tabsForAuthSection([model, sectionType = 'authSettings', paths]) } if (paths || model.paths) { if (model.paths) { - paths = model.paths.paths.filter(path => path.navigation); + paths = model.paths.paths.filter((path) => path.navigation); } // TODO: we're unsure if we actually need compact here // but are leaving it just in case OpenAPI ever returns an empty thing - tabs = paths.compact().map(path => { + tabs = paths.compact().map((path) => { return { label: capitalize(pluralize(path.itemName)), routeParams: ['vault.cluster.access.method.item.list', path.itemType], diff --git a/ui/app/initializers/deprecation-filter.js b/ui/app/initializers/deprecation-filter.js new file mode 100644 index 000000000..a5c6fdb37 --- /dev/null +++ b/ui/app/initializers/deprecation-filter.js @@ -0,0 +1,15 @@ +import { registerDeprecationHandler } from '@ember/debug'; + +// https://guides.emberjs.com/release/configuring-ember/handling-deprecations/#toc_filtering-deprecations +export function initialize() { + registerDeprecationHandler((message, options, next) => { + // filter deprecations that are scheduled to be removed in a specific version + // when upgrading or addressing deprecation warnings be sure to update this or remove if not needed + if (options?.until !== '4.0.0') { + next(message, options); + } + return; + }); +} + +export default { initialize }; diff --git a/ui/app/initializers/disable-ember-inspector.js b/ui/app/initializers/disable-ember-inspector.js index 7cb22c3bd..739e10b7c 100644 --- a/ui/app/initializers/disable-ember-inspector.js +++ b/ui/app/initializers/disable-ember-inspector.js @@ -2,7 +2,7 @@ import config from '../config/environment'; export default { name: 'ember-inspect-disable', - initialize: function() { + initialize: function () { if (config.environment === 'production') { // disables ember inspector window.NO_EMBER_DEBUG = true; diff --git a/ui/app/initializers/enable-engines.js b/ui/app/initializers/enable-engines.js index 858f36b06..1c4408db7 100644 --- a/ui/app/initializers/enable-engines.js +++ b/ui/app/initializers/enable-engines.js @@ -3,7 +3,7 @@ import config from '../config/environment'; export function initialize(/* application */) { // attach mount hooks to the environment config // context will be the router DSL - config.addRootMounts = function() { + config.addRootMounts = function () { this.mount('replication'); }; } diff --git a/ui/app/lib/arg-tokenizer.js b/ui/app/lib/arg-tokenizer.js new file mode 100644 index 000000000..4a36d0c6f --- /dev/null +++ b/ui/app/lib/arg-tokenizer.js @@ -0,0 +1,40 @@ +// taken from https://github.com/yargs/yargs-parser/blob/v13.1.0/lib/tokenize-arg-string.js to get around import issue +// take an un-split argv string and tokenize it. +export default function (argString) { + if (Array.isArray(argString)) return argString; + + argString = argString.trim(); + + var i = 0; + var prevC = null; + var c = null; + var opening = null; + var args = []; + + for (var ii = 0; ii < argString.length; ii++) { + prevC = c; + c = argString.charAt(ii); + + // split on spaces unless we're in quotes. + if (c === ' ' && !opening) { + if (!(prevC === ' ')) { + i++; + } + continue; + } + + // don't split the string if we're in matching + // opening or closing single and double quotes. + if (c === opening) { + if (!args[i]) args[i] = ''; + opening = null; + } else if ((c === "'" || c === '"') && !opening) { + opening = c; + } + + if (!args[i]) args[i] = ''; + args[i] += c; + } + + return args; +} diff --git a/ui/app/lib/console-helpers.js b/ui/app/lib/console-helpers.js index 139fff99e..4fdbf38eb 100644 --- a/ui/app/lib/console-helpers.js +++ b/ui/app/lib/console-helpers.js @@ -1,5 +1,5 @@ import keys from 'vault/lib/keycodes'; -import argTokenizer from 'yargs-parser/lib/tokenize-arg-string.js'; +import argTokenizer from './arg-tokenizer'; import { parse } from 'shell-quote'; const supportedCommands = ['read', 'write', 'list', 'delete']; @@ -56,7 +56,7 @@ export function parseCommand(command, shouldThrow) { let flags = []; let data = []; - rest.forEach(arg => { + rest.forEach((arg) => { if (arg.startsWith('-')) { flags.push(arg); } else { @@ -66,7 +66,7 @@ export function parseCommand(command, shouldThrow) { .split(/=(.+)/) // if there were quotes, there's an empty string as the last member in the array that we don't want, // so filter it out - .filter(str => str !== '') + .filter((str) => str !== '') // glue the data back together .join('='); data.push(strippedArg); diff --git a/ui/app/lib/kv-object.js b/ui/app/lib/kv-object.js index 27207ee64..9e44eb2b5 100644 --- a/ui/app/lib/kv-object.js +++ b/ui/app/lib/kv-object.js @@ -7,7 +7,7 @@ export default ArrayProxy.extend({ if (json && typeOf(json) !== 'object') { throw new Error('Vault expects data to be formatted as an JSON object.'); } - let contents = Object.keys(json || []).map(key => { + let contents = Object.keys(json || []).map((key) => { let obj = { name: key, value: json[key], @@ -49,6 +49,6 @@ export default ArrayProxy.extend({ }, isAdvanced() { - return this.any(item => typeof item.value !== 'string'); + return this.any((item) => typeof item.value !== 'string'); }, }); diff --git a/ui/app/lib/path-to-tree.js b/ui/app/lib/path-to-tree.js index 05423c4df..aac81b1fd 100644 --- a/ui/app/lib/path-to-tree.js +++ b/ui/app/lib/path-to-tree.js @@ -20,7 +20,7 @@ const DOT_REPLACEMENT = '☃'; // }, // foo1: null, // } -export default function(paths) { +export default function (paths) { // first sort the list by length, then alphanumeric let list = paths.slice(0).sort((a, b) => b.length - a.length || b.localeCompare(a)); // then reduce to an array @@ -29,7 +29,7 @@ export default function(paths) { // so if we have "foo/bar/baz", both "foo" and "foo/bar" // won't be included in the list let tree = list.reduce((accumulator, ns) => { - let nsWithPrefix = accumulator.find(path => path.startsWith(ns)); + let nsWithPrefix = accumulator.find((path) => path.startsWith(ns)); // we need to make sure it's a match for the full path part let isFullMatch = nsWithPrefix && nsWithPrefix.charAt(ns.length) === '/'; if (!isFullMatch) { @@ -44,7 +44,7 @@ export default function(paths) { // we'll replace the dots in the paths, then expand the path // to a nested object that we can then query with Ember.get return deepmerge.all( - tree.map(p => { + tree.map((p) => { p = p.replace(/\.+/g, DOT_REPLACEMENT); return unflatten({ [p]: null }, { delimiter: '/', object: true }); }) diff --git a/ui/app/lib/token-storage.js b/ui/app/lib/token-storage.js index 69ee4deb7..a50a5a1c3 100644 --- a/ui/app/lib/token-storage.js +++ b/ui/app/lib/token-storage.js @@ -1,7 +1,7 @@ import localStorageWrapper from './local-storage'; import memoryStorage from './memory-storage'; -export default function(type) { +export default function (type) { if (type === 'memory') { return memoryStorage; } diff --git a/ui/app/machines/secrets-machine.js b/ui/app/machines/secrets-machine.js index e50f405f5..4a40da87b 100644 --- a/ui/app/machines/secrets-machine.js +++ b/ui/app/machines/secrets-machine.js @@ -27,8 +27,8 @@ export default { ], on: { CONTINUE: { - details: { cond: type => supportedBackends.includes(type) }, - list: { cond: type => !supportedBackends.includes(type) }, + details: { cond: (type) => supportedBackends.includes(type) }, + list: { cond: (type) => !supportedBackends.includes(type) }, }, }, }, @@ -40,16 +40,16 @@ export default { on: { CONTINUE: { connection: { - cond: type => type === 'database', + cond: (type) => type === 'database', }, role: { - cond: type => ['pki', 'aws', 'ssh'].includes(type), + cond: (type) => ['pki', 'aws', 'ssh'].includes(type), }, secret: { - cond: type => ['kv'].includes(type), + cond: (type) => ['kv'].includes(type), }, encryption: { - cond: type => type === 'transit', + cond: (type) => type === 'transit', }, }, }, @@ -134,19 +134,19 @@ export default { on: { REPEAT: { connection: { - cond: type => type === 'database', + cond: (type) => type === 'database', actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }], }, role: { - cond: type => ['pki', 'aws', 'ssh'].includes(type), + cond: (type) => ['pki', 'aws', 'ssh'].includes(type), actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }], }, secret: { - cond: type => ['kv'].includes(type), + cond: (type) => ['kv'].includes(type), actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }], }, encryption: { - cond: type => type === 'transit', + cond: (type) => type === 'transit', actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }], }, }, diff --git a/ui/app/macros/identity-capabilities.js b/ui/app/macros/identity-capabilities.js index f36eb2905..91bb68d67 100644 --- a/ui/app/macros/identity-capabilities.js +++ b/ui/app/macros/identity-capabilities.js @@ -1,5 +1,5 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; -export default function() { +export default function () { return lazyCapabilities(apiPath`identity/${'identityType'}/id/${'id'}`, 'id', 'identityType'); } diff --git a/ui/app/macros/lazy-capabilities.js b/ui/app/macros/lazy-capabilities.js index a20fb88ea..5a4bf376d 100644 --- a/ui/app/macros/lazy-capabilities.js +++ b/ui/app/macros/lazy-capabilities.js @@ -14,7 +14,7 @@ import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; export function apiPath(strings, ...keys) { - return function(data) { + return function (data) { let dict = data || {}; let result = [strings[0]]; keys.forEach((key, i) => { @@ -24,11 +24,11 @@ export function apiPath(strings, ...keys) { }; } -export default function() { +export default function () { let [templateFn, ...keys] = arguments; return maybeQueryRecord( 'capabilities', - context => { + (context) => { // pull all context attrs let contextObject = context.getProperties(...keys); // remove empty ones diff --git a/ui/app/mixins/backend-crumb.js b/ui/app/mixins/backend-crumb.js index f1dfc42ea..1f82d2d72 100644 --- a/ui/app/mixins/backend-crumb.js +++ b/ui/app/mixins/backend-crumb.js @@ -2,7 +2,7 @@ import { computed } from '@ember/object'; import Mixin from '@ember/object/mixin'; export default Mixin.create({ - backendCrumb: computed('backend', function() { + backendCrumb: computed('backend', function () { const backend = this.backend; if (backend === undefined) { diff --git a/ui/app/mixins/focus-on-insert.js b/ui/app/mixins/focus-on-insert.js index 0743de576..5b989ed52 100644 --- a/ui/app/mixins/focus-on-insert.js +++ b/ui/app/mixins/focus-on-insert.js @@ -10,7 +10,7 @@ export default Mixin.create({ // uses Ember.on so that we don't have to worry about calling _super if // didInsertElement is overridden - focusOnInsert: on('didInsertElement', function() { + focusOnInsert: on('didInsertElement', function () { schedule('afterRender', this, 'focusOnInsertFocus'); }), diff --git a/ui/app/mixins/key-mixin.js b/ui/app/mixins/key-mixin.js index c32601fba..9a88470db 100644 --- a/ui/app/mixins/key-mixin.js +++ b/ui/app/mixins/key-mixin.js @@ -10,7 +10,7 @@ export default Mixin.create({ initialParentKey: null, - isCreating: computed('initialParentKey', function() { + isCreating: computed('initialParentKey', function () { return this.initialParentKey != null; }), @@ -20,29 +20,29 @@ export default Mixin.create({ // rather than using defineProperty for all of these, // we're just going to hardcode the known keys for the path ('id' and 'path') - isFolder: computed('id', 'path', function() { + isFolder: computed('id', 'path', function () { return utils.keyIsFolder(this.pathVal()); }), - keyParts: computed('id', 'path', function() { + keyParts: computed('id', 'path', function () { return utils.keyPartsForKey(this.pathVal()); }), parentKey: computed('id', 'path', 'isCreating', { - get: function() { + get: function () { return this.isCreating ? this.initialParentKey : utils.parentKeyForKey(this.pathVal()); }, - set: function(_, value) { + set: function (_, value) { return value; }, }), keyWithoutParent: computed('id', 'path', 'parentKey', { - get: function() { + get: function () { var key = this.pathVal(); return key ? key.replace(this.parentKey, '') : null; }, - set: function(_, value) { + set: function (_, value) { if (value && value.trim()) { this.set(this.pathAttr, this.parentKey + value); } else { diff --git a/ui/app/mixins/model-boundary-route.js b/ui/app/mixins/model-boundary-route.js index 9166d1bf1..6461ef9fa 100644 --- a/ui/app/mixins/model-boundary-route.js +++ b/ui/app/mixins/model-boundary-route.js @@ -19,7 +19,7 @@ export default Mixin.create({ modelType: null, modelTypes: null, - verifyProps: on('init', function() { + verifyProps: on('init', function () { var modelType = this.modelType; var modelTypes = this.modelTypes; warn( @@ -37,7 +37,7 @@ export default Mixin.create({ ); }), - clearModelCache: on('deactivate', function() { + clearModelCache: on('deactivate', function () { var modelType = this.modelType; var modelTypes = this.modelTypes; @@ -55,7 +55,7 @@ export default Mixin.create({ this.store.unloadAll(modelType); } if (modelTypes) { - modelTypes.forEach(type => { + modelTypes.forEach((type) => { this.store.unloadAll(type); }); } diff --git a/ui/app/mixins/policy-edit-controller.js b/ui/app/mixins/policy-edit-controller.js index 1bc31e573..85fefea65 100644 --- a/ui/app/mixins/policy-edit-controller.js +++ b/ui/app/mixins/policy-edit-controller.js @@ -15,7 +15,7 @@ export default Mixin.create({ flash.success(`${policyType.toUpperCase()} policy "${name}" was successfully deleted.`); return this.transitionToRoute('vault.cluster.policies', policyType); }) - .catch(e => { + .catch((e) => { let errors = e.errors ? e.errors.join('') : e.message; flash.danger( `There was an error deleting the ${policyType.toUpperCase()} policy "${name}": ${errors}.` @@ -29,7 +29,7 @@ export default Mixin.create({ let name = model.get('name'); model .save() - .then(m => { + .then((m) => { flash.success(`${policyType.toUpperCase()} policy "${name}" was successfully saved.`); if (this.wizard.featureState === 'create') { this.wizard.transitionFeatureMachine('create', 'CONTINUE', policyType); diff --git a/ui/app/mixins/unload-model-route.js b/ui/app/mixins/unload-model-route.js index fb4ecdb03..ce5c37019 100644 --- a/ui/app/mixins/unload-model-route.js +++ b/ui/app/mixins/unload-model-route.js @@ -9,7 +9,8 @@ export default Mixin.create({ let { modelPath } = this; /* eslint-disable-next-line ember/no-controller-access-in-routes */ let model = this.controller.get(modelPath); - if (!model || !model.unloadRecord) { + // error is thrown when you attempt to unload a record that is inFlight (isSaving) + if (!model || !model.unloadRecord || model.isSaving) { return; } removeRecord(this.store, model); diff --git a/ui/app/mixins/with-nav-to-nearest-ancestor.js b/ui/app/mixins/with-nav-to-nearest-ancestor.js index ce1a38c49..9ecb51888 100644 --- a/ui/app/mixins/with-nav-to-nearest-ancestor.js +++ b/ui/app/mixins/with-nav-to-nearest-ancestor.js @@ -12,7 +12,7 @@ import { task } from 'ember-concurrency'; // and we're catching any 404s, the loop continues until the transtion succeeds, or exhausts // the ancestors array and transitions to the root export default Mixin.create({ - navToNearestAncestor: task(function*(key) { + navToNearestAncestor: task(function* (key) { let ancestors = utils.ancestorKeysForKey(key); let errored = false; let nearest = ancestors.pop(); diff --git a/ui/app/models/auth-config.js b/ui/app/models/auth-config.js index 90819e70f..49c576316 100644 --- a/ui/app/models/auth-config.js +++ b/ui/app/models/auth-config.js @@ -2,7 +2,7 @@ import Model, { belongsTo } from '@ember-data/model'; export default Model.extend({ backend: belongsTo('auth-method', { inverse: 'authConfigs', readOnly: true, async: false }), - getHelpUrl: function(backend) { + getHelpUrl: function (backend) { return `/v1/auth/${backend}/config?help=1`; }, }); diff --git a/ui/app/models/auth-config/aws/client.js b/ui/app/models/auth-config/aws/client.js index ebcc4e507..37b73167c 100644 --- a/ui/app/models/auth-config/aws/client.js +++ b/ui/app/models/auth-config/aws/client.js @@ -19,7 +19,7 @@ export default AuthConfig.extend({ label: 'IAM Server ID Header Value', }), - fieldGroups: computed(function() { + fieldGroups: computed(function () { const groups = [ { default: ['accessKey', 'secretKey'] }, { 'AWS Options': ['endpoint', 'iamEndpoint', 'stsEndpoint', 'iamServerIdHeaderValue'] }, diff --git a/ui/app/models/auth-config/aws/tidy.js b/ui/app/models/auth-config/aws/tidy.js index 5643ec7f3..c395901ae 100644 --- a/ui/app/models/auth-config/aws/tidy.js +++ b/ui/app/models/auth-config/aws/tidy.js @@ -13,7 +13,7 @@ export default AuthConfig.extend({ defaultValue: false, }), - attrs: computed(function() { + attrs: computed(function () { return expandAttributeMeta(this, ['safetyBuffer', 'disablePeriodicTidy']); }), }); diff --git a/ui/app/models/auth-config/azure.js b/ui/app/models/auth-config/azure.js index cfab61013..72f5b2678 100644 --- a/ui/app/models/auth-config/azure.js +++ b/ui/app/models/auth-config/azure.js @@ -24,7 +24,7 @@ export default AuthConfig.extend({ googleCertsEndpoint: attr('string'), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['tenantId', 'resource'] }, { diff --git a/ui/app/models/auth-config/gcp.js b/ui/app/models/auth-config/gcp.js index d931ac4de..c1fb0b18b 100644 --- a/ui/app/models/auth-config/gcp.js +++ b/ui/app/models/auth-config/gcp.js @@ -13,7 +13,7 @@ export default AuthConfig.extend({ googleCertsEndpoint: attr('string'), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['credentials'] }, { diff --git a/ui/app/models/auth-config/github.js b/ui/app/models/auth-config/github.js index 436c050c5..5dc48cd06 100644 --- a/ui/app/models/auth-config/github.js +++ b/ui/app/models/auth-config/github.js @@ -11,7 +11,7 @@ export default AuthConfig.extend({ label: 'Base URL', }), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['organization'] }, { diff --git a/ui/app/models/auth-config/jwt.js b/ui/app/models/auth-config/jwt.js index 7eecbb26e..6926c6b10 100644 --- a/ui/app/models/auth-config/jwt.js +++ b/ui/app/models/auth-config/jwt.js @@ -36,7 +36,7 @@ export default AuthConfig.extend({ boundIssuer: attr('string', { helpText: 'The value against which to match the iss claim in a JWT', }), - fieldGroups: computed('constructor.modelName', 'newFields', function() { + fieldGroups: computed('constructor.modelName', 'newFields', function () { let type = this.constructor.modelName.split('/')[1].toUpperCase(); let groups = [ { diff --git a/ui/app/models/auth-config/kubernetes.js b/ui/app/models/auth-config/kubernetes.js index 8afaa6c11..e9312c416 100644 --- a/ui/app/models/auth-config/kubernetes.js +++ b/ui/app/models/auth-config/kubernetes.js @@ -26,7 +26,7 @@ export default AuthConfig.extend({ editType: 'stringArray', }), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['kubernetesHost', 'kubernetesCaCert'], diff --git a/ui/app/models/auth-config/ldap.js b/ui/app/models/auth-config/ldap.js index 1f220be1b..a7b68774a 100644 --- a/ui/app/models/auth-config/ldap.js +++ b/ui/app/models/auth-config/ldap.js @@ -11,7 +11,7 @@ export default AuthConfig.extend({ label: 'Certificate', editType: 'file', }), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['url'], diff --git a/ui/app/models/auth-config/okta.js b/ui/app/models/auth-config/okta.js index d87073d8a..a8024e83a 100644 --- a/ui/app/models/auth-config/okta.js +++ b/ui/app/models/auth-config/okta.js @@ -23,7 +23,7 @@ export default AuthConfig.extend({ "Useful if using Vault's built-in MFA mechanisms. Will also cause certain other statuses to be ignored, such as PASSWORD_EXPIRED", }), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['orgName'], diff --git a/ui/app/models/auth-config/radius.js b/ui/app/models/auth-config/radius.js index d4c2b9337..db098c965 100644 --- a/ui/app/models/auth-config/radius.js +++ b/ui/app/models/auth-config/radius.js @@ -9,7 +9,7 @@ export default AuthConfig.extend({ host: attr('string'), secret: attr('string'), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['host', 'secret'], diff --git a/ui/app/models/auth-method.js b/ui/app/models/auth-method.js index 2214a7595..de82302c8 100644 --- a/ui/app/models/auth-method.js +++ b/ui/app/models/auth-method.js @@ -24,7 +24,7 @@ let ModelExport = Model.extend(Validations, { type: attr('string'), // namespaces introduced types with a `ns_` prefix for built-in engines // so we need to strip that to normalize the type - methodType: computed('type', function() { + methodType: computed('type', function () { return this.type.replace(/^ns_/, ''); }), description: attr('string', { @@ -42,14 +42,14 @@ let ModelExport = Model.extend(Validations, { // used when the `auth` prefix is important, // currently only when setting perf mount filtering - apiPath: computed('path', function() { + apiPath: computed('path', function () { return `auth/${this.path}`; }), - localDisplay: computed('local', function() { + localDisplay: computed('local', function () { return this.local ? 'local' : 'replicated'; }), - tuneAttrs: computed('path', function() { + tuneAttrs: computed('path', function () { let { methodType } = this; let tuneAttrs; // token_type should not be tuneable for the token auth method @@ -74,7 +74,7 @@ let ModelExport = Model.extend(Validations, { urlType: 'updateRecord', }), - formFields: computed(function() { + formFields: computed(function () { return [ 'type', 'path', @@ -86,7 +86,7 @@ let ModelExport = Model.extend(Validations, { ]; }), - formFieldGroups: computed(function() { + formFieldGroups: computed(function () { return [ { default: ['path'] }, { @@ -101,11 +101,11 @@ let ModelExport = Model.extend(Validations, { ]; }), - attrs: computed('formFields', function() { + attrs: computed('formFields', function () { return expandAttributeMeta(this, this.formFields); }), - fieldGroups: computed('formFieldGroups', function() { + fieldGroups: computed('formFieldGroups', function () { return fieldToAttrs(this, this.formFieldGroups); }), canDisable: alias('deletePath.canDelete'), @@ -114,7 +114,7 @@ let ModelExport = Model.extend(Validations, { export default attachCapabilities(ModelExport, { deletePath: apiPath`sys/auth/${'id'}`, - configPath: function(context) { + configPath: function (context) { if (context.type === 'aws') { return apiPath`auth/${'id'}/config/client`; } else { diff --git a/ui/app/models/aws-credential.js b/ui/app/models/aws-credential.js index 8ce389aa4..2b8b64f85 100644 --- a/ui/app/models/aws-credential.js +++ b/ui/app/models/aws-credential.js @@ -51,7 +51,7 @@ export default Model.extend({ secretKey: attr('string'), securityToken: attr('string'), - attrs: computed('credentialType', 'accessKey', 'securityToken', function() { + attrs: computed('credentialType', 'accessKey', 'securityToken', function () { let type = this.credentialType; let fieldsForType = { iam_user: ['credentialType'], @@ -64,7 +64,7 @@ export default Model.extend({ return expandAttributeMeta(this, fieldsForType[type].slice(0)); }), - toCreds: computed('accessKey', 'secretKey', 'securityToken', 'leaseId', function() { + toCreds: computed('accessKey', 'secretKey', 'securityToken', 'leaseId', function () { const props = { accessKey: this.accessKey, secretKey: this.secretKey, diff --git a/ui/app/models/capabilities.js b/ui/app/models/capabilities.js index 0a755febc..920eebf93 100644 --- a/ui/app/models/capabilities.js +++ b/ui/app/models/capabilities.js @@ -18,8 +18,8 @@ const SUDO_PATH_PREFIXES = ['sys/leases/revoke-prefix', 'sys/leases/revoke-force export { SUDO_PATHS, SUDO_PATH_PREFIXES }; -const computedCapability = function(capability) { - return computed('path', 'capabilities', 'capabilities.[]', function() { +const computedCapability = function (capability) { + return computed('path', 'capabilities', 'capabilities.[]', function () { const capabilities = this.capabilities; const path = this.path; if (!capabilities) { @@ -32,7 +32,7 @@ const computedCapability = function(capability) { return false; } // if the path is sudo protected, they'll need sudo + the appropriate capability - if (SUDO_PATHS.includes(path) || SUDO_PATH_PREFIXES.find(item => path.startsWith(item))) { + if (SUDO_PATHS.includes(path) || SUDO_PATH_PREFIXES.find((item) => path.startsWith(item))) { return capabilities.includes('sudo') && capabilities.includes(capability); } return capabilities.includes(capability); diff --git a/ui/app/models/clients/config.js b/ui/app/models/clients/config.js index 58de31293..919c0f2cf 100644 --- a/ui/app/models/clients/config.js +++ b/ui/app/models/clients/config.js @@ -23,7 +23,7 @@ const M = Model.extend({ 'Enable or disable client tracking. Keep in mind that disabling tracking will delete the data for the current month.', }), - configAttrs: computed(function() { + configAttrs: computed(function () { let keys = ['enabled', 'defaultReportMonths', 'retentionMonths']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/cluster.js b/ui/app/models/cluster.js index a7799583f..07e259a28 100644 --- a/ui/app/models/cluster.js +++ b/ui/app/models/cluster.js @@ -18,19 +18,19 @@ export default Model.extend({ licenseExpiry: alias('license.expiry_time'), licenseState: alias('license.state'), - needsInit: computed('nodes', 'nodes.@each.initialized', function() { + needsInit: computed('nodes', 'nodes.@each.initialized', function () { // needs init if no nodes are initialized return this.nodes.isEvery('initialized', false); }), - unsealed: computed('nodes', 'nodes.{[],@each.sealed}', function() { + unsealed: computed('nodes', 'nodes.{[],@each.sealed}', function () { // unsealed if there's at least one unsealed node return !!this.nodes.findBy('sealed', false); }), sealed: not('unsealed'), - leaderNode: computed('nodes', 'nodes.[]', function() { + leaderNode: computed('nodes', 'nodes.[]', function () { const nodes = this.nodes; if (nodes.get('length') === 1) { return nodes.get('firstObject'); @@ -59,15 +59,15 @@ export default Model.extend({ rm: service('replication-mode'), drMode: alias('dr.mode'), replicationMode: alias('rm.mode'), - replicationModeForDisplay: computed('replicationMode', function() { + replicationModeForDisplay: computed('replicationMode', function () { return this.replicationMode === 'dr' ? 'Disaster Recovery' : 'Performance'; }), - replicationIsInitializing: computed('dr.mode', 'performance.mode', function() { + replicationIsInitializing: computed('dr.mode', 'performance.mode', function () { // a mode of null only happens when a cluster is being initialized // otherwise the mode will be 'disabled', 'primary', 'secondary' return !this.dr.mode || !this.performance.mode; }), - replicationAttrs: computed('dr.mode', 'performance.mode', 'replicationMode', function() { + replicationAttrs: computed('dr.mode', 'performance.mode', 'replicationMode', function () { const replicationMode = this.replicationMode; return replicationMode ? get(this, replicationMode) : null; }), diff --git a/ui/app/models/control-group-config.js b/ui/app/models/control-group-config.js index c598f1688..a2dcf507f 100644 --- a/ui/app/models/control-group-config.js +++ b/ui/app/models/control-group-config.js @@ -6,7 +6,7 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; export default Model.extend({ - fields: computed(function() { + fields: computed(function () { return expandAttributeMeta(this, ['maxTtl']); }), diff --git a/ui/app/models/database/connection.js b/ui/app/models/database/connection.js index 83f66d029..d1fc76290 100644 --- a/ui/app/models/database/connection.js +++ b/ui/app/models/database/connection.js @@ -11,14 +11,14 @@ import { AVAILABLE_PLUGIN_TYPES } from '../../utils/database-helpers'; * @param {*} key item by which to group the fields. If item has no group it will be under "default" * @returns array of objects where the key is default or the name of the option group, and the value is an array of attr names */ -const fieldsToGroups = function(arr, key = 'subgroup') { +const fieldsToGroups = function (arr, key = 'subgroup') { const fieldGroups = []; - const byGroup = arr.reduce(function(rv, x) { + const byGroup = arr.reduce(function (rv, x) { (rv[x[key]] = rv[x[key]] || []).push(x); return rv; }, {}); - Object.keys(byGroup).forEach(key => { - const attrsArray = byGroup[key].map(obj => obj.attr); + Object.keys(byGroup).forEach((key) => { + const attrsArray = byGroup[key].map((obj) => obj.attr); const group = key === 'undefined' ? 'default' : key; fieldGroups.push({ [group]: attrsArray }); }); @@ -144,47 +144,47 @@ export default Model.extend({ defaultShown: 'Default', }), - isAvailablePlugin: computed('plugin_name', function() { - return !!AVAILABLE_PLUGIN_TYPES.find(a => a.value === this.plugin_name); + isAvailablePlugin: computed('plugin_name', function () { + return !!AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name); }), - showAttrs: computed('plugin_name', function() { - const fields = AVAILABLE_PLUGIN_TYPES.find(a => a.value === this.plugin_name) - .fields.filter(f => f.show !== false) - .map(f => f.attr); + showAttrs: computed('plugin_name', function () { + const fields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name) + .fields.filter((f) => f.show !== false) + .map((f) => f.attr); fields.push('allowed_roles'); return expandAttributeMeta(this, fields); }), - fieldAttrs: computed('plugin_name', function() { + fieldAttrs: computed('plugin_name', function () { // for both create and edit fields let fields = ['plugin_name', 'name', 'connection_url', 'verify_connection', 'password_policy']; if (this.plugin_name) { - fields = AVAILABLE_PLUGIN_TYPES.find(a => a.value === this.plugin_name) - .fields.filter(f => !f.group) - .map(field => field.attr); + fields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name) + .fields.filter((f) => !f.group) + .map((field) => field.attr); } return expandAttributeMeta(this, fields); }), - pluginFieldGroups: computed('plugin_name', function() { + pluginFieldGroups: computed('plugin_name', function () { if (!this.plugin_name) { return null; } - let pluginFields = AVAILABLE_PLUGIN_TYPES.find(a => a.value === this.plugin_name).fields.filter( - f => f.group === 'pluginConfig' + let pluginFields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name).fields.filter( + (f) => f.group === 'pluginConfig' ); let groups = fieldsToGroups(pluginFields, 'subgroup'); return fieldToAttrs(this, groups); }), - statementFields: computed('plugin_name', function() { + statementFields: computed('plugin_name', function () { if (!this.plugin_name) { return expandAttributeMeta(this, ['root_rotation_statements']); } - let fields = AVAILABLE_PLUGIN_TYPES.find(a => a.value === this.plugin_name) - .fields.filter(f => f.group === 'statements') - .map(field => field.attr); + let fields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name) + .fields.filter((f) => f.group === 'statements') + .map((field) => field.attr); return expandAttributeMeta(this, fields); }), diff --git a/ui/app/models/database/role.js b/ui/app/models/database/role.js index 2f9e11a2a..345427028 100644 --- a/ui/app/models/database/role.js +++ b/ui/app/models/database/role.js @@ -95,7 +95,7 @@ export default Model.extend({ return expandAttributeMeta(this, fields); }, - roleSettingAttrs: computed(function() { + roleSettingAttrs: computed(function () { // logic for which get displayed is on DatabaseRoleSettingForm let allRoleSettingFields = [ 'ttl', diff --git a/ui/app/models/identity/_base.js b/ui/app/models/identity/_base.js index 5ca18495e..2016b99d9 100644 --- a/ui/app/models/identity/_base.js +++ b/ui/app/models/identity/_base.js @@ -4,15 +4,15 @@ import { computed } from '@ember/object'; import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; export default Model.extend({ - formFields: computed(function() { + formFields: computed(function () { return assert('formFields should be overridden', false); }), - fields: computed('formFields', 'formFields.[]', function() { + fields: computed('formFields', 'formFields.[]', function () { return expandAttributeMeta(this, this.formFields); }), - identityType: computed('constructor.modelName', function() { + identityType: computed('constructor.modelName', function () { let modelType = this.constructor.modelName.split('/')[1]; return modelType; }), diff --git a/ui/app/models/identity/entity-alias.js b/ui/app/models/identity/entity-alias.js index efb8bc5d1..db2d5d966 100644 --- a/ui/app/models/identity/entity-alias.js +++ b/ui/app/models/identity/entity-alias.js @@ -6,7 +6,7 @@ import identityCapabilities from 'vault/macros/identity-capabilities'; export default IdentityModel.extend({ parentType: 'entity', - formFields: computed(function() { + formFields: computed(function () { return ['name', 'mountAccessor']; }), entity: belongsTo('identity/entity', { readOnly: true, async: false }), diff --git a/ui/app/models/identity/entity-merge.js b/ui/app/models/identity/entity-merge.js index 0a0e986af..cc6967669 100644 --- a/ui/app/models/identity/entity-merge.js +++ b/ui/app/models/identity/entity-merge.js @@ -3,7 +3,7 @@ import { computed } from '@ember/object'; import IdentityModel from './_base'; export default IdentityModel.extend({ - formFields: computed(function() { + formFields: computed(function () { return ['toEntityId', 'fromEntityIds', 'force']; }), toEntityId: attr('string', { diff --git a/ui/app/models/identity/entity.js b/ui/app/models/identity/entity.js index c3b325603..7cc686ff6 100644 --- a/ui/app/models/identity/entity.js +++ b/ui/app/models/identity/entity.js @@ -6,7 +6,7 @@ import apiPath from 'vault/utils/api-path'; import attachCapabilities from 'vault/lib/attach-capabilities'; let Model = IdentityModel.extend({ - formFields: computed(function() { + formFields: computed(function () { return ['name', 'disabled', 'policies', 'metadata']; }), name: attr('string'), diff --git a/ui/app/models/identity/group-alias.js b/ui/app/models/identity/group-alias.js index f73a97716..fa8c6c3a0 100644 --- a/ui/app/models/identity/group-alias.js +++ b/ui/app/models/identity/group-alias.js @@ -6,7 +6,7 @@ import identityCapabilities from 'vault/macros/identity-capabilities'; export default IdentityModel.extend({ parentType: 'group', - formFields: computed(function() { + formFields: computed(function () { return ['name', 'mountAccessor']; }), group: belongsTo('identity/group', { readOnly: true, async: false }), diff --git a/ui/app/models/identity/group.js b/ui/app/models/identity/group.js index 31a0b6932..9a35f04e7 100644 --- a/ui/app/models/identity/group.js +++ b/ui/app/models/identity/group.js @@ -6,7 +6,7 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; import identityCapabilities from 'vault/macros/identity-capabilities'; export default IdentityModel.extend({ - formFields: computed('type', function() { + formFields: computed('type', function () { let fields = ['name', 'type', 'policies', 'metadata']; if (this.type === 'internal') { return fields.concat(['memberGroupIds', 'memberEntityIds']); @@ -62,7 +62,7 @@ export default IdentityModel.extend({ 'memberEntityIds.[]', 'memberGroupIds', 'memberGroupIds.[]', - function() { + function () { let { memberEntityIds, memberGroupIds } = this; let numEntities = (memberEntityIds && memberEntityIds.length) || 0; let numGroups = (memberGroupIds && memberGroupIds.length) || 0; @@ -76,7 +76,7 @@ export default IdentityModel.extend({ canEdit: alias('updatePath.canUpdate'), aliasPath: lazyCapabilities(apiPath`identity/group-alias`), - canAddAlias: computed('aliasPath.canCreate', 'type', 'alias', function() { + canAddAlias: computed('aliasPath.canCreate', 'type', 'alias', function () { let type = this.type; let alias = this.alias; // internal groups can't have aliases, and external groups can only have one diff --git a/ui/app/models/kmip/config.js b/ui/app/models/kmip/config.js index 0ccb77153..67b1cd3b5 100644 --- a/ui/app/models/kmip/config.js +++ b/ui/app/models/kmip/config.js @@ -10,7 +10,7 @@ export default Model.extend({ return `/v1/${path}/config?help=1`; }, - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [{ default: ['listenAddrs', 'connectionTimeout'] }]; groups = combineFieldGroups(groups, this.newFields, []); diff --git a/ui/app/models/kmip/credential.js b/ui/app/models/kmip/credential.js index e5923aa37..58b11212b 100644 --- a/ui/app/models/kmip/credential.js +++ b/ui/app/models/kmip/credential.js @@ -19,7 +19,7 @@ const ModelExport = Model.extend({ defaultValue: 'pem', label: 'Certificate format', }), - fieldGroups: computed(function() { + fieldGroups: computed(function () { const groups = [ { default: ['format'], diff --git a/ui/app/models/kmip/role.js b/ui/app/models/kmip/role.js index c1317c5dd..9141a4c4d 100644 --- a/ui/app/models/kmip/role.js +++ b/ui/app/models/kmip/role.js @@ -5,19 +5,19 @@ import apiPath from 'vault/utils/api-path'; import attachCapabilities from 'vault/lib/attach-capabilities'; export const COMPUTEDS = { - operationFields: computed('newFields', function() { - return this.newFields.filter(key => key.startsWith('operation')); + operationFields: computed('newFields', function () { + return this.newFields.filter((key) => key.startsWith('operation')); }), - operationFieldsWithoutSpecial: computed('operationFields', function() { + operationFieldsWithoutSpecial: computed('operationFields', function () { return this.operationFields.slice().removeObjects(['operationAll', 'operationNone']); }), - tlsFields: computed(function() { + tlsFields: computed(function () { return ['tlsClientKeyBits', 'tlsClientKeyType', 'tlsClientTtl']; }), - nonOperationFields: computed('newFields', 'operationFields', 'tlsFields', function() { + nonOperationFields: computed('newFields', 'operationFields', 'tlsFields', function () { let excludeFields = ['role'].concat(this.operationFields, this.tlsFields); return this.newFields.slice().removeObjects(excludeFields); }), @@ -31,7 +31,7 @@ const ModelExport = Model.extend(COMPUTEDS, { getHelpUrl(path) { return `/v1/${path}/scope/example/role/example?help=1`; }, - fieldGroups: computed('fields', 'nonOperationFields.length', 'tlsFields', function() { + fieldGroups: computed('fields', 'nonOperationFields.length', 'tlsFields', function () { const groups = [{ TLS: this.tlsFields }]; if (this.nonOperationFields.length) { groups.unshift({ default: this.nonOperationFields }); @@ -40,7 +40,7 @@ const ModelExport = Model.extend(COMPUTEDS, { return ret; }), - operationFormFields: computed('operationFieldsWithoutSpecial', function() { + operationFormFields: computed('operationFieldsWithoutSpecial', function () { let objects = [ 'operationCreate', 'operationActivate', @@ -66,10 +66,10 @@ const ModelExport = Model.extend(COMPUTEDS, { } return fieldToAttrs(this, groups); }), - tlsFormFields: computed('tlsFields', function() { + tlsFormFields: computed('tlsFields', function () { return expandAttributeMeta(this, this.tlsFields); }), - fields: computed('nonOperationFields', function() { + fields: computed('nonOperationFields', function () { return expandAttributeMeta(this, this.nonOperationFields); }), }); diff --git a/ui/app/models/kmip/scope.js b/ui/app/models/kmip/scope.js index cccf0f5f9..b673b850b 100644 --- a/ui/app/models/kmip/scope.js +++ b/ui/app/models/kmip/scope.js @@ -8,7 +8,7 @@ import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; let ModelExport = Model.extend({ name: attr('string'), backend: attr({ readOnly: true }), - attrs: computed(function() { + attrs: computed(function () { return expandAttributeMeta(this, ['name']); }), }); diff --git a/ui/app/models/namespace.js b/ui/app/models/namespace.js index 894c9879b..3dfc915c6 100644 --- a/ui/app/models/namespace.js +++ b/ui/app/models/namespace.js @@ -7,13 +7,13 @@ export default Model.extend({ validationAttr: 'pathIsValid', invalidMessage: 'You have entered and invalid path please only include letters, numbers, -, ., and _.', }), - pathIsValid: computed('path', function() { + pathIsValid: computed('path', function () { return this.path && this.path.match(/^[\w\d-.]+$/g); }), description: attr('string', { editType: 'textarea', }), - fields: computed(function() { + fields: computed(function () { return expandAttributeMeta(this, ['path']); }), }); diff --git a/ui/app/models/path-filter-config.js b/ui/app/models/path-filter-config.js index 569fa162c..e306fac76 100644 --- a/ui/app/models/path-filter-config.js +++ b/ui/app/models/path-filter-config.js @@ -3,7 +3,7 @@ import Model, { attr } from '@ember-data/model'; export default Model.extend({ mode: attr('string'), paths: attr('array', { - defaultValue: function() { + defaultValue: function () { return []; }, }), diff --git a/ui/app/models/pki-ca-certificate-sign.js b/ui/app/models/pki-ca-certificate-sign.js index 7bcc44b37..2f9ac1722 100644 --- a/ui/app/models/pki-ca-certificate-sign.js +++ b/ui/app/models/pki-ca-certificate-sign.js @@ -42,7 +42,7 @@ export default Certificate.extend({ editType: 'stringArray', }), - fieldGroups: computed('useCsrValues', function() { + fieldGroups: computed('useCsrValues', function () { const options = [ { Options: [ diff --git a/ui/app/models/pki-ca-certificate.js b/ui/app/models/pki-ca-certificate.js index c81a10f89..153978a68 100644 --- a/ui/app/models/pki-ca-certificate.js +++ b/ui/app/models/pki-ca-certificate.js @@ -5,7 +5,7 @@ import Certificate from './pki-certificate'; import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; export default Certificate.extend({ - DISPLAY_FIELDS: computed(function() { + DISPLAY_FIELDS: computed(function () { return [ 'csr', 'certificate', @@ -100,7 +100,7 @@ export default Certificate.extend({ label: 'Province/State', }), - fieldDefinition: computed('caType', 'uploadPemBundle', function() { + fieldDefinition: computed('caType', 'uploadPemBundle', function () { const type = this.caType; const isUpload = this.uploadPemBundle; let groups = [{ default: ['caType', 'uploadPemBundle'] }]; diff --git a/ui/app/models/pki-certificate-sign.js b/ui/app/models/pki-certificate-sign.js index 9e64e4dde..556fe6e94 100644 --- a/ui/app/models/pki-certificate-sign.js +++ b/ui/app/models/pki-certificate-sign.js @@ -15,7 +15,7 @@ export default Certificate.extend({ editType: 'textarea', }), - fieldGroups: computed('newFields', 'signVerbatim', function() { + fieldGroups: computed('newFields', 'signVerbatim', function () { const options = { Options: ['altNames', 'ipSans', 'ttl', 'excludeCnFromSans', 'otherSans'] }; let groups = [ { diff --git a/ui/app/models/pki-certificate.js b/ui/app/models/pki-certificate.js index 6b657f17a..92cd6d4f1 100644 --- a/ui/app/models/pki-certificate.js +++ b/ui/app/models/pki-certificate.js @@ -10,7 +10,7 @@ export default Model.extend({ idForNav: attr('string', { readOnly: true, }), - DISPLAY_FIELDS: computed(function() { + DISPLAY_FIELDS: computed(function () { return [ 'certificate', 'commonName', @@ -83,7 +83,7 @@ export default Model.extend({ return fieldToAttrs(this, fieldGroups); }, - fieldDefinition: computed(function() { + fieldDefinition: computed(function () { const groups = [ { default: ['commonName', 'format'] }, { Options: ['altNames', 'ipSans', 'ttl', 'excludeCnFromSans', 'otherSans'] }, @@ -91,11 +91,11 @@ export default Model.extend({ return groups; }), - fieldGroups: computed('fieldDefinition', function() { + fieldGroups: computed('fieldDefinition', function () { return this.fieldsToAttrs(this.fieldDefinition); }), - attrs: computed('DISPLAY_FIELDS', 'certificate', 'csr', function() { + attrs: computed('DISPLAY_FIELDS', 'certificate', 'csr', function () { let keys = this.certificate || this.csr ? this.DISPLAY_FIELDS.slice(0) : []; return expandAttributeMeta(this, keys); }), @@ -108,7 +108,7 @@ export default Model.extend({ 'privateKeyType', 'revocationTime', 'serialNumber', - function() { + function () { const props = { certificate: this.certificate, issuingCa: this.issuingCa, diff --git a/ui/app/models/pki-config.js b/ui/app/models/pki-config.js index 574c01076..9d8a88cef 100644 --- a/ui/app/models/pki-config.js +++ b/ui/app/models/pki-config.js @@ -12,7 +12,7 @@ export default Model.extend({ }, //urls - urlsAttrs: computed(function() { + urlsAttrs: computed(function () { let keys = ['issuingCertificates', 'crlDistributionPoints', 'ocspServers']; return this.attrList(keys); }), @@ -29,7 +29,7 @@ export default Model.extend({ }), //tidy - tidyAttrs: computed(function() { + tidyAttrs: computed(function () { let keys = ['tidyCertStore', 'tidyRevocationList', 'safetyBuffer']; return this.attrList(keys); }), @@ -46,7 +46,7 @@ export default Model.extend({ editType: 'ttl', }), - crlAttrs: computed(function() { + crlAttrs: computed(function () { let keys = ['expiry']; return this.attrList(keys); }), diff --git a/ui/app/models/policy.js b/ui/app/models/policy.js index 93e07ba0a..1cb15a30f 100644 --- a/ui/app/models/policy.js +++ b/ui/app/models/policy.js @@ -6,7 +6,7 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; export default Model.extend({ name: attr('string'), policy: attr('string'), - policyType: computed('constructor.modelName', function() { + policyType: computed('constructor.modelName', function () { return this.constructor.modelName.split('/')[1]; }), @@ -14,7 +14,7 @@ export default Model.extend({ canDelete: alias('updatePath.canDelete'), canEdit: alias('updatePath.canUpdate'), canRead: alias('updatePath.canRead'), - format: computed('policy', function() { + format: computed('policy', function () { let policy = this.policy; let isJSON; try { diff --git a/ui/app/models/policy/egp.js b/ui/app/models/policy/egp.js index d21afb931..255bd66a7 100644 --- a/ui/app/models/policy/egp.js +++ b/ui/app/models/policy/egp.js @@ -8,7 +8,7 @@ export default PolicyModel.extend({ paths: attr({ editType: 'stringArray', }), - additionalAttrs: computed(function() { + additionalAttrs: computed(function () { return expandAttributeMeta(this, ['enforcementLevel', 'paths']); }), }); diff --git a/ui/app/models/policy/rgp.js b/ui/app/models/policy/rgp.js index e4f3bc62a..9fb930323 100644 --- a/ui/app/models/policy/rgp.js +++ b/ui/app/models/policy/rgp.js @@ -10,7 +10,7 @@ export default PolicyModel.extend({ defaultValue: 'hard-mandatory', }), - additionalAttrs: computed(function() { + additionalAttrs: computed(function () { return expandAttributeMeta(this, ['enforcementLevel']); }), }); diff --git a/ui/app/models/raft-join.js b/ui/app/models/raft-join.js index 22e49a2e1..4fae1b94c 100644 --- a/ui/app/models/raft-join.js +++ b/ui/app/models/raft-join.js @@ -31,7 +31,7 @@ export default Model.extend({ label: 'Leader Client Key', editType: 'file', }), - fields: computed(function() { + fields: computed(function () { return expandAttributeMeta(this, [ 'leaderApiAddr', 'leaderCaCert', diff --git a/ui/app/models/replication-attributes.js b/ui/app/models/replication-attributes.js index 8e8e9de5c..dd58f7996 100644 --- a/ui/app/models/replication-attributes.js +++ b/ui/app/models/replication-attributes.js @@ -5,7 +5,7 @@ import Fragment from 'ember-data-model-fragments/fragment'; export default Fragment.extend({ clusterId: attr('string'), - clusterIdDisplay: computed('clusterId', 'mode', function() { + clusterIdDisplay: computed('clusterId', 'mode', function () { const clusterId = this.clusterId; return clusterId ? clusterId.split('-')[0] : null; }), @@ -23,13 +23,13 @@ export default Fragment.extend({ // secondary attrs isSecondary: match('mode', /secondary/), connection_state: attr('string'), - modeForUrl: computed('isPrimary', 'isSecondary', 'mode', function() { + modeForUrl: computed('isPrimary', 'isSecondary', 'mode', function () { const mode = this.mode; return mode === 'bootstrapping' ? 'bootstrapping' : (this.isSecondary && 'secondary') || (this.isPrimary && 'primary'); }), - modeForHeader: computed('mode', function() { + modeForHeader: computed('mode', function () { const mode = this.mode; if (!mode) { // mode will be false or undefined if it calls the status endpoint while still setting up the cluster @@ -60,7 +60,7 @@ export default Fragment.extend({ }; }, - syncProgressPercent: computed('syncProgress', function() { + syncProgressPercent: computed('syncProgress', function () { const syncProgress = this.syncProgress; if (!syncProgress) { return null; @@ -70,7 +70,7 @@ export default Fragment.extend({ return Math.floor(100 * (progress / total)); }), - modeDisplay: computed('mode', function() { + modeDisplay: computed('mode', function () { const displays = { disabled: 'Disabled', unknown: 'Unknown', diff --git a/ui/app/models/role-aws.js b/ui/app/models/role-aws.js index 6e5c425d7..af631ceb5 100644 --- a/ui/app/models/role-aws.js +++ b/ui/app/models/role-aws.js @@ -52,7 +52,7 @@ export default Model.extend({ helpText: 'A policy is an object in AWS that, when associated with an identity or resource, defines their permissions.', }), - fields: computed('credentialType', function() { + fields: computed('credentialType', function () { let credentialType = this.credentialType; let keysForType = { iam_user: ['name', 'credentialType', 'policyArns', 'policyDocument'], diff --git a/ui/app/models/role-jwt.js b/ui/app/models/role-jwt.js index 6e0a6cfe4..9f26fa3fa 100644 --- a/ui/app/models/role-jwt.js +++ b/ui/app/models/role-jwt.js @@ -18,13 +18,13 @@ export { DOMAIN_STRINGS, PROVIDER_WITH_LOGO }; export default Model.extend({ authUrl: attr('string'), - providerName: computed('authUrl', function() { + providerName: computed('authUrl', function () { let { hostname } = parseURL(this.authUrl); - let firstMatch = Object.keys(DOMAIN_STRINGS).find(name => hostname.includes(name)); + let firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name)); return DOMAIN_STRINGS[firstMatch] || null; }), - providerButtonComponent: computed('providerName', function() { + providerButtonComponent: computed('providerName', function () { let { providerName } = this; return PROVIDER_WITH_LOGO.includes(providerName) ? `auth-button-${providerName.toLowerCase()}` : null; }), diff --git a/ui/app/models/role-pki.js b/ui/app/models/role-pki.js index 219e37a39..ccf5fd775 100644 --- a/ui/app/models/role-pki.js +++ b/ui/app/models/role-pki.js @@ -15,7 +15,7 @@ export default Model.extend({ readOnly: true, }), useOpenAPI: true, - getHelpUrl: function(backend) { + getHelpUrl: function (backend) { return `/v1/${backend}/roles/example?help=1`; }, updatePath: lazyCapabilities(apiPath`${'backend'}/roles/${'id'}`, 'backend', 'id'), @@ -32,7 +32,7 @@ export default Model.extend({ signVerbatimPath: lazyCapabilities(apiPath`${'backend'}/sign-verbatim/${'id'}`, 'backend', 'id'), canSignVerbatim: alias('signVerbatimPath.canUpdate'), - fieldGroups: computed('newFields', function() { + fieldGroups: computed('newFields', function () { let groups = [ { default: ['name', 'keyType'] }, { diff --git a/ui/app/models/role-ssh.js b/ui/app/models/role-ssh.js index e33927a83..1f88fd504 100644 --- a/ui/app/models/role-ssh.js +++ b/ui/app/models/role-ssh.js @@ -40,7 +40,7 @@ const CA_FIELDS = [ export default Model.extend({ useOpenAPI: true, - getHelpUrl: function(backend) { + getHelpUrl: function (backend) { return `/v1/${backend}/roles/example?help=1`; }, zeroAddress: attr('boolean', { @@ -117,13 +117,13 @@ export default Model.extend({ helpText: 'When supplied, this value specifies a custom format for the key id of a signed certificate', }), - showFields: computed('keyType', function() { + showFields: computed('keyType', function () { const keyType = this.keyType; let keys = keyType === 'ca' ? CA_FIELDS.slice(0) : OTP_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), - fieldGroups: computed('keyType', function() { + fieldGroups: computed('keyType', function () { let numRequired = this.keyType === 'otp' ? 3 : 4; let fields = this.keyType === 'otp' ? [...OTP_FIELDS] : [...CA_FIELDS]; let defaultFields = fields.splice(0, numRequired); diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js index fc674bb6a..323c0c839 100644 --- a/ui/app/models/secret-engine.js +++ b/ui/app/models/secret-engine.js @@ -68,7 +68,7 @@ export default Model.extend(Validations, { helperTextEnabled: 'Delete all new versions of this secret after', }), - modelTypeForKV: computed('engineType', 'options.version', function() { + modelTypeForKV: computed('engineType', 'options.version', function () { let type = this.engineType; let version = this.options?.version; let modelType = 'secret'; @@ -80,7 +80,7 @@ export default Model.extend(Validations, { isV2KV: computed.equal('modelTypeForKV', 'secret-v2'), - formFields: computed('engineType', 'options.version', function() { + formFields: computed('engineType', 'options.version', function () { let type = this.engineType; let version = this.options?.version; let fields = [ @@ -102,7 +102,7 @@ export default Model.extend(Validations, { return fields; }), - formFieldGroups: computed('engineType', function() { + formFieldGroups: computed('engineType', function () { let type = this.engineType; let defaultGroup; // KV has specific config options it adds on the enable engine. https://www.vaultproject.io/api/secret/kv/kv-v2#configure-the-kv-engine @@ -142,25 +142,25 @@ export default Model.extend(Validations, { return [defaultGroup, optionsGroup]; }), - attrs: computed('formFields', function() { + attrs: computed('formFields', function () { return expandAttributeMeta(this, this.formFields); }), - fieldGroups: computed('formFieldGroups', function() { + fieldGroups: computed('formFieldGroups', function () { return fieldToAttrs(this, this.formFieldGroups); }), // namespaces introduced types with a `ns_` prefix for built-in engines // so we need to strip that to normalize the type - engineType: computed('type', function() { + engineType: computed('type', function () { return (this.type || '').replace(/^ns_/, ''); }), - shouldIncludeInList: computed('engineType', function() { + shouldIncludeInList: computed('engineType', function () { return !LIST_EXCLUDED_BACKENDS.includes(this.engineType); }), - localDisplay: computed('local', function() { + localDisplay: computed('local', function () { return this.local ? 'local' : 'replicated'; }), diff --git a/ui/app/models/secret-v2.js b/ui/app/models/secret-v2.js index c8f5e97ca..f4db1443c 100644 --- a/ui/app/models/secret-v2.js +++ b/ui/app/models/secret-v2.js @@ -54,7 +54,7 @@ export default Model.extend(KeyMixin, Validations, { helperTextDisabled: 'A secret’s version must be manually deleted.', helperTextEnabled: 'Delete all new versions of this secret after', }), - fields: computed(function() { + fields: computed(function () { return expandAttributeMeta(this, ['customMetadata', 'maxVersions', 'casRequired', 'deleteVersionAfter']); }), secretDataPath: lazyCapabilities(apiPath`${'engineId'}/data/${'id'}`, 'engineId', 'id'), diff --git a/ui/app/models/secret.js b/ui/app/models/secret.js index fb37f1452..86c528b26 100644 --- a/ui/app/models/secret.js +++ b/ui/app/models/secret.js @@ -12,20 +12,20 @@ export default Model.extend(KeyMixin, { renewable: attr('boolean'), secretData: attr('object'), - secretKeyAndValue: computed('secretData', function() { + secretKeyAndValue: computed('secretData', function () { const data = this.secretData; - return Object.keys(data).map(key => { + return Object.keys(data).map((key) => { return { key, value: data[key] }; }); }), - dataAsJSONString: computed('secretData', function() { + dataAsJSONString: computed('secretData', function () { return JSON.stringify(this.secretData, null, 2); }), - isAdvancedFormat: computed('secretData', function() { + isAdvancedFormat: computed('secretData', function () { const data = this.secretData; - return data && Object.keys(data).some(key => typeof data[key] !== 'string'); + return data && Object.keys(data).some((key) => typeof data[key] !== 'string'); }), helpText: attr('string'), diff --git a/ui/app/models/ssh-otp-credential.js b/ui/app/models/ssh-otp-credential.js index 9af3716b0..6740e9a4c 100644 --- a/ui/app/models/ssh-otp-credential.js +++ b/ui/app/models/ssh-otp-credential.js @@ -16,7 +16,7 @@ export default Model.extend({ key: attr('string'), keyType: attr('string'), port: attr('number'), - attrs: computed('key', function() { + attrs: computed('key', function () { let keys = this.key ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/ssh-sign.js b/ui/app/models/ssh-sign.js index dc38ad3f8..8cd177bbf 100644 --- a/ui/app/models/ssh-sign.js +++ b/ui/app/models/ssh-sign.js @@ -45,7 +45,7 @@ export default Model.extend({ serialNumber: attr('string'), signedKey: attr('string'), - attrs: computed('signedKey', function() { + attrs: computed('signedKey', function () { let keys = this.signedKey ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transform.js b/ui/app/models/transform.js index 2e77cbbd8..059a49d66 100644 --- a/ui/app/models/transform.js +++ b/ui/app/models/transform.js @@ -80,13 +80,13 @@ const ModelExport = Model.extend({ subText: 'Search for an existing role, type a new role to create it, or use a wildcard (*).', wildcardLabel: 'role', }), - transformAttrs: computed('type', function() { + transformAttrs: computed('type', function () { if (this.type === 'masking') { return ['name', 'type', 'masking_character', 'template', 'allowed_roles']; } return ['name', 'type', 'tweak_source', 'template', 'allowed_roles']; }), - transformFieldAttrs: computed('transformAttrs', function() { + transformFieldAttrs: computed('transformAttrs', function () { return expandAttributeMeta(this, this.transformAttrs); }), diff --git a/ui/app/models/transform/alphabet.js b/ui/app/models/transform/alphabet.js index b3cf51022..1cff5bbae 100644 --- a/ui/app/models/transform/alphabet.js +++ b/ui/app/models/transform/alphabet.js @@ -6,7 +6,7 @@ import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; const M = Model.extend({ idPrefix: 'alphabet/', - idForNav: computed('id', 'idPrefix', function() { + idForNav: computed('id', 'idPrefix', function () { let modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -22,7 +22,7 @@ const M = Model.extend({ 'Provide the set of valid UTF-8 characters contained within both the input and transformed value. Read more.', }), - attrs: computed(function() { + attrs: computed(function () { let keys = ['name', 'alphabet']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transform/role.js b/ui/app/models/transform/role.js index c650b6685..61ff802f3 100644 --- a/ui/app/models/transform/role.js +++ b/ui/app/models/transform/role.js @@ -8,7 +8,7 @@ const ModelExport = Model.extend({ // used for getting appropriate options for backend idPrefix: 'role/', // the id prefixed with `role/` so we can use it as the *secret param for the secret show route - idForNav: computed('id', 'idPrefix', function() { + idForNav: computed('id', 'idPrefix', function () { let modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -30,7 +30,7 @@ const ModelExport = Model.extend({ subText: 'Select which transformations this role will have access to. It must already exist.', }), - attrs: computed('transformations', function() { + attrs: computed('transformations', function () { let keys = ['name', 'transformations']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transform/template.js b/ui/app/models/transform/template.js index 103589e87..9d1af764e 100644 --- a/ui/app/models/transform/template.js +++ b/ui/app/models/transform/template.js @@ -6,7 +6,7 @@ import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; const M = Model.extend({ idPrefix: 'template/', - idForNav: computed('id', 'idPrefix', function() { + idForNav: computed('id', 'idPrefix', function () { let modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -32,7 +32,7 @@ const M = Model.extend({ selectLimit: 1, }), - attrs: computed(function() { + attrs: computed(function () { let keys = ['name', 'pattern', 'alphabet']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transit-key.js b/ui/app/models/transit-key.js index 09c6f47de..a89bf1925 100644 --- a/ui/app/models/transit-key.js +++ b/ui/app/models/transit-key.js @@ -89,24 +89,24 @@ export default Model.extend({ set(this, 'derived', val); }, - supportedActions: computed('type', function() { + supportedActions: computed('type', function () { return Object.keys(ACTION_VALUES) - .filter(name => { + .filter((name) => { const { isSupported } = ACTION_VALUES[name]; return typeof isSupported === 'boolean' || get(this, isSupported); }) - .map(name => { + .map((name) => { const { description, glyph } = ACTION_VALUES[name]; return { name, description, glyph }; }); }), - canDelete: computed('deletionAllowed', 'lastLoadTS', function() { + canDelete: computed('deletionAllowed', 'lastLoadTS', function () { const deleteAttrChanged = Boolean(this.changedAttributes().deletionAllowed); return this.deletionAllowed && deleteAttrChanged === false; }), - keyVersions: computed('validKeyVersions', function() { + keyVersions: computed('validKeyVersions', function () { let maxVersion = Math.max(...this.validKeyVersions); let versions = []; while (maxVersion > 0) { @@ -121,18 +121,18 @@ export default Model.extend({ 'keyVersions', 'latestVersion', 'minDecryptionVersion', - function() { + function () { const { keyVersions, minDecryptionVersion } = this; return keyVersions - .filter(version => { + .filter((version) => { return version >= minDecryptionVersion; }) .reverse(); } ), - keysForEncryption: computed('minEncryptionVersion', 'latestVersion', function() { + keysForEncryption: computed('minEncryptionVersion', 'latestVersion', function () { let { minEncryptionVersion, latestVersion } = this; let minVersion = clamp(minEncryptionVersion - 1, 0, latestVersion); let versions = []; @@ -143,11 +143,11 @@ export default Model.extend({ return versions; }), - validKeyVersions: computed('keys', function() { + validKeyVersions: computed('keys', function () { return Object.keys(this.keys); }), - exportKeyTypes: computed('exportable', 'supportsEncryption', 'supportsSigning', 'type', function() { + exportKeyTypes: computed('exportable', 'supportsEncryption', 'supportsSigning', 'type', function () { let types = ['hmac']; if (this.supportsSigning) { types.unshift('signing'); diff --git a/ui/app/router.js b/ui/app/router.js index c3f4c04c4..be9bfe857 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -6,9 +6,9 @@ export default class Router extends EmberRouter { rootURL = config.rootURL; } -Router.map(function() { - this.route('vault', { path: '/' }, function() { - this.route('cluster', { path: '/:cluster_name' }, function() { +Router.map(function () { + this.route('vault', { path: '/' }, function () { + this.route('cluster', { path: '/:cluster_name' }, function () { this.route('oidc-provider-ns', { path: '/*namespace/identity/oidc/provider/:provider_name/authorize' }); this.route('oidc-provider', { path: '/identity/oidc/provider/:provider_name/authorize' }); this.route('oidc-callback', { path: '/auth/*auth_path/oidc/callback' }); @@ -17,38 +17,38 @@ Router.map(function() { this.route('logout'); this.mount('open-api-explorer', { path: '/api-explorer' }); this.route('license'); - this.route('clients', function() { + this.route('clients', function () { this.route('index', { path: '/' }); this.route('edit'); }); this.route('storage', { path: '/storage/raft' }); this.route('storage-restore', { path: '/storage/raft/restore' }); - this.route('settings', function() { + this.route('settings', function () { this.route('index', { path: '/' }); this.route('seal'); - this.route('auth', function() { + this.route('auth', function () { this.route('index', { path: '/' }); this.route('enable'); - this.route('configure', { path: '/configure/:method' }, function() { + this.route('configure', { path: '/configure/:method' }, function () { this.route('index', { path: '/' }); this.route('section', { path: '/:section_name' }); }); }); this.route('mount-secret-backend'); - this.route('configure-secret-backend', { path: '/secrets/configure/:backend' }, function() { + this.route('configure-secret-backend', { path: '/secrets/configure/:backend' }, function () { this.route('index', { path: '/' }); this.route('section', { path: '/:section_name' }); }); }); this.route('unseal'); - this.route('tools', function() { + this.route('tools', function () { this.route('tool', { path: '/:selected_action' }); }); - this.route('access', function() { + this.route('access', function () { this.route('methods', { path: '/' }); - this.route('method', { path: '/:path' }, function() { + this.route('method', { path: '/:path' }, function () { this.route('index', { path: '/' }); - this.route('item', { path: '/item/:item_type' }, function() { + this.route('item', { path: '/item/:item_type' }, function () { this.route('list', { path: '/' }); this.route('create'); this.route('edit', { path: '/edit/:item_id' }); @@ -56,7 +56,7 @@ Router.map(function() { }); this.route('section', { path: '/:section_name' }); }); - this.route('leases', function() { + this.route('leases', function () { // lookup this.route('index', { path: '/' }); // lookup prefix @@ -67,13 +67,13 @@ Router.map(function() { this.route('show', { path: '/show/*lease_id' }); }); // the outer identity route handles group and entity items - this.route('identity', { path: '/identity/:item_type' }, function() { + this.route('identity', { path: '/identity/:item_type' }, function () { this.route('index', { path: '/' }); this.route('create'); this.route('merge'); this.route('edit', { path: '/edit/:item_id' }); this.route('show', { path: '/:item_id/:section' }); - this.route('aliases', function() { + this.route('aliases', function () { this.route('index', { path: '/' }); this.route('add', { path: '/add/:item_id' }); this.route('edit', { path: '/edit/:item_alias_id' }); @@ -83,14 +83,14 @@ Router.map(function() { this.route('control-groups'); this.route('control-groups-configure', { path: '/control-groups/configure' }); this.route('control-group-accessor', { path: '/control-groups/:accessor' }); - this.route('namespaces', function() { + this.route('namespaces', function () { this.route('index', { path: '/' }); this.route('create'); }); }); - this.route('secrets', function() { + this.route('secrets', function () { this.route('backends', { path: '/' }); - this.route('backend', { path: '/:backend' }, function() { + this.route('backend', { path: '/:backend' }, function () { this.mount('kmip'); this.route('index', { path: '/' }); this.route('configuration'); @@ -126,15 +126,15 @@ Router.map(function() { this.route('overview'); }); }); - this.route('policies', { path: '/policies/:type' }, function() { + this.route('policies', { path: '/policies/:type' }, function () { this.route('index', { path: '/' }); this.route('create'); }); - this.route('policy', { path: '/policy/:type' }, function() { + this.route('policy', { path: '/policy/:type' }, function () { this.route('show', { path: '/:policy_name' }); this.route('edit', { path: '/:policy_name/edit' }); }); - this.route('replication-dr-promote', function() { + this.route('replication-dr-promote', function () { this.route('details'); }); if (config.addRootMounts) { diff --git a/ui/app/routes/loading.js b/ui/app/routes/loading.js index 0e80d2a45..7457ead32 100644 --- a/ui/app/routes/loading.js +++ b/ui/app/routes/loading.js @@ -5,7 +5,7 @@ export default Route.extend({ router: service(), init() { this._super(...arguments); - this.router.on('routeWillChange', transition => { + this.router.on('routeWillChange', (transition) => { this.set('myTargetRouteName', transition.to.name); }); }, diff --git a/ui/app/routes/vault.js b/ui/app/routes/vault.js index 56b377066..1748db61c 100644 --- a/ui/app/routes/vault.js +++ b/ui/app/routes/vault.js @@ -23,7 +23,7 @@ export default Route.extend({ }, }; this.store.push(fixture); - return new Promise(resolve => { + return new Promise((resolve) => { later(() => { resolve(this.store.peekAll('cluster')); }, SPLASH_DELAY); diff --git a/ui/app/routes/vault/cluster.js b/ui/app/routes/vault/cluster.js index c9b1c150f..8b7dddcf1 100644 --- a/ui/app/routes/vault/cluster.js +++ b/ui/app/routes/vault/cluster.js @@ -18,7 +18,7 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { auth: service(), featureFlagService: service('featureFlag'), currentCluster: service(), - modelTypes: computed(function() { + modelTypes: computed(function () { return ['node', 'secret', 'secret-engine']; }), @@ -69,7 +69,7 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { return this.store.findRecord('cluster', id); }, - poll: task(function*() { + poll: task(function* () { while (true) { // when testing, the polling loop causes promises to never settle so acceptance tests hang // to get around that, we just disable the poll in tests @@ -121,7 +121,7 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { let controller = this.controllerFor('vault.cluster'); controller.set('currentlyLoading', true); - transition.finally(function() { + transition.finally(function () { controller.set('currentlyLoading', false); }); }, diff --git a/ui/app/routes/vault/cluster/access.js b/ui/app/routes/vault/cluster/access.js index 46c91a794..e4b6db7a4 100644 --- a/ui/app/routes/vault/cluster/access.js +++ b/ui/app/routes/vault/cluster/access.js @@ -4,7 +4,7 @@ import ClusterRoute from 'vault/mixins/cluster-route'; import ModelBoundaryRoute from 'vault/mixins/model-boundary-route'; export default Route.extend(ModelBoundaryRoute, ClusterRoute, { - modelTypes: computed(function() { + modelTypes: computed(function () { return ['capabilities', 'control-group', 'identity/group', 'identity/group-alias', 'identity/alias']; }), model() { diff --git a/ui/app/routes/vault/cluster/access/control-groups-configure.js b/ui/app/routes/vault/cluster/access/control-groups-configure.js index cd32f1690..d8b16670e 100644 --- a/ui/app/routes/vault/cluster/access/control-groups-configure.js +++ b/ui/app/routes/vault/cluster/access/control-groups-configure.js @@ -14,7 +14,7 @@ export default Route.extend(UnloadModel, { model() { let type = 'control-group-config'; return this.version.hasFeature('Control Groups') - ? this.store.findRecord(type, 'config').catch(e => { + ? this.store.findRecord(type, 'config').catch((e) => { // if you haven't saved a config, the API 404s, so create one here to edit and return it if (e.httpStatus === 404) { return this.store.createRecord(type, { diff --git a/ui/app/routes/vault/cluster/access/identity/aliases/index.js b/ui/app/routes/vault/cluster/access/identity/aliases/index.js index b661ef175..fc9a9bca3 100644 --- a/ui/app/routes/vault/cluster/access/identity/aliases/index.js +++ b/ui/app/routes/vault/cluster/access/identity/aliases/index.js @@ -11,7 +11,7 @@ export default Route.extend(ListRoute, { page: params.page, pageFilter: params.pageFilter, }) - .catch(err => { + .catch((err) => { if (err.httpStatus === 404) { return []; } else { diff --git a/ui/app/routes/vault/cluster/access/identity/index.js b/ui/app/routes/vault/cluster/access/identity/index.js index cdd6faabd..163b3c03e 100644 --- a/ui/app/routes/vault/cluster/access/identity/index.js +++ b/ui/app/routes/vault/cluster/access/identity/index.js @@ -11,7 +11,7 @@ export default Route.extend(ListRoute, { page: params.page, pageFilter: params.pageFilter, }) - .catch(err => { + .catch((err) => { if (err.httpStatus === 404) { return []; } else { diff --git a/ui/app/routes/vault/cluster/access/leases/list.js b/ui/app/routes/vault/cluster/access/leases/list.js index 9d8785693..c1ad888f1 100644 --- a/ui/app/routes/vault/cluster/access/leases/list.js +++ b/ui/app/routes/vault/cluster/access/leases/list.js @@ -25,11 +25,11 @@ export default Route.extend({ page: params.page, pageFilter: params.pageFilter, }) - .then(model => { + .then((model) => { this.set('has404', false); return model; }) - .catch(err => { + .catch((err) => { if (err.httpStatus === 404 && prefix === '') { return []; } else { diff --git a/ui/app/routes/vault/cluster/access/method.js b/ui/app/routes/vault/cluster/access/method.js index 0ebc0e9a4..3da9bc42a 100644 --- a/ui/app/routes/vault/cluster/access/method.js +++ b/ui/app/routes/vault/cluster/access/method.js @@ -7,14 +7,14 @@ export default Route.extend({ pathHelp: service('path-help'), model(params) { const { path } = params; - return this.store.findAll('auth-method').then(modelArray => { + return this.store.findAll('auth-method').then((modelArray) => { const model = modelArray.findBy('id', path); if (!model) { const error = new AdapterError(); set(error, 'httpStatus', 404); throw error; } - return this.pathHelp.getPaths(model.apiPath, path).then(paths => { + return this.pathHelp.getPaths(model.apiPath, path).then((paths) => { model.set('paths', paths); return model; }); diff --git a/ui/app/routes/vault/cluster/access/method/index.js b/ui/app/routes/vault/cluster/access/method/index.js index b97b96de3..356fdef7b 100644 --- a/ui/app/routes/vault/cluster/access/method/index.js +++ b/ui/app/routes/vault/cluster/access/method/index.js @@ -3,7 +3,7 @@ import { tabsForAuthSection } from 'vault/helpers/tabs-for-auth-section'; export default Route.extend({ beforeModel() { let { methodType, paths } = this.modelFor('vault.cluster.access.method'); - paths = paths ? paths.paths.filter(path => path.navigation === true) : null; + paths = paths ? paths.paths.filter((path) => path.navigation === true) : null; const activeTab = tabsForAuthSection([methodType, 'authConfig', paths])[0].routeParams; return this.transitionTo(...activeTab); }, diff --git a/ui/app/routes/vault/cluster/access/method/item.js b/ui/app/routes/vault/cluster/access/method/item.js index e3532fbd6..ee8b56456 100644 --- a/ui/app/routes/vault/cluster/access/method/item.js +++ b/ui/app/routes/vault/cluster/access/method/item.js @@ -24,11 +24,11 @@ export default Route.extend({ this._super(...arguments); const { apiPath, authMethodPath, itemType } = this.getMethodAndModelInfo(); controller.set('itemType', itemType); - this.pathHelp.getPaths(apiPath, authMethodPath, itemType).then(paths => { - let navigationPaths = paths.paths.filter(path => path.navigation); + this.pathHelp.getPaths(apiPath, authMethodPath, itemType).then((paths) => { + let navigationPaths = paths.paths.filter((path) => path.navigation); controller.set( 'paths', - navigationPaths.filter(path => path.itemType.includes(itemType)).map(path => path.path) + navigationPaths.filter((path) => path.itemType.includes(itemType)).map((path) => path.path) ); }); }, diff --git a/ui/app/routes/vault/cluster/access/method/item/list.js b/ui/app/routes/vault/cluster/access/method/item/list.js index 2b7eb447d..0eda1f9f8 100644 --- a/ui/app/routes/vault/cluster/access/method/item/list.js +++ b/ui/app/routes/vault/cluster/access/method/item/list.js @@ -28,7 +28,7 @@ export default Route.extend(ListRoute, { type: itemType, id: authMethodPath, }) - .catch(err => { + .catch((err) => { if (err.httpStatus === 404) { return []; } else { @@ -54,10 +54,10 @@ export default Route.extend(ListRoute, { const { apiPath, authMethodPath, itemType, methodModel } = this.getMethodAndModelInfo(); controller.set('itemType', itemType); controller.set('methodModel', methodModel); - this.pathHelp.getPaths(apiPath, authMethodPath, itemType).then(paths => { + this.pathHelp.getPaths(apiPath, authMethodPath, itemType).then((paths) => { controller.set( 'paths', - paths.paths.filter(path => path.navigation && path.itemType.includes(itemType)) + paths.paths.filter((path) => path.navigation && path.itemType.includes(itemType)) ); }); }, diff --git a/ui/app/routes/vault/cluster/access/method/section.js b/ui/app/routes/vault/cluster/access/method/section.js index bab327bc4..c4953ab7f 100644 --- a/ui/app/routes/vault/cluster/access/method/section.js +++ b/ui/app/routes/vault/cluster/access/method/section.js @@ -23,6 +23,9 @@ export default Route.extend({ this._super(...arguments); controller.set('section', section); let method = this.modelFor('vault.cluster.access.method'); - controller.set('paths', method.paths.paths.filter(path => path.navigation)); + controller.set( + 'paths', + method.paths.paths.filter((path) => path.navigation) + ); }, }); diff --git a/ui/app/routes/vault/cluster/access/namespaces/index.js b/ui/app/routes/vault/cluster/access/namespaces/index.js index f598997fa..4822effa5 100644 --- a/ui/app/routes/vault/cluster/access/namespaces/index.js +++ b/ui/app/routes/vault/cluster/access/namespaces/index.js @@ -23,10 +23,10 @@ export default Route.extend(UnloadModel, { responsePath: 'data.keys', page: Number(params?.page) || 1, }) - .then(model => { + .then((model) => { return model; }) - .catch(err => { + .catch((err) => { if (err.httpStatus === 404) { return []; } else { diff --git a/ui/app/routes/vault/cluster/clients/index.js b/ui/app/routes/vault/cluster/clients/index.js index f83088138..37f18463c 100644 --- a/ui/app/routes/vault/cluster/clients/index.js +++ b/ui/app/routes/vault/cluster/clients/index.js @@ -44,7 +44,7 @@ export default Route.extend(ClusterRoute, { }, model(params) { - let config = this.store.queryRecord('clients/config', {}).catch(e => { + let config = this.store.queryRecord('clients/config', {}).catch((e) => { console.debug(e); // swallowing error so activity can show if no config permissions return {}; @@ -65,7 +65,7 @@ export default Route.extend(ClusterRoute, { // eslint-disable-next-line ember/no-controller-access-in-routes let controller = this.controllerFor('vault.cluster.clients.index'); controller.set('currentlyLoading', true); - transition.promise.finally(function() { + transition.promise.finally(function () { controller.set('currentlyLoading', false); }); }, diff --git a/ui/app/routes/vault/cluster/logout.js b/ui/app/routes/vault/cluster/logout.js index c46a34e3c..85da83a99 100644 --- a/ui/app/routes/vault/cluster/logout.js +++ b/ui/app/routes/vault/cluster/logout.js @@ -12,7 +12,7 @@ export default Route.extend(ModelBoundaryRoute, { permissions: service(), namespaceService: service('namespace'), - modelTypes: computed(function() { + modelTypes: computed(function () { return ['secret', 'secret-engine']; }), diff --git a/ui/app/routes/vault/cluster/oidc-provider.js b/ui/app/routes/vault/cluster/oidc-provider.js index 190b59592..cac511996 100644 --- a/ui/app/routes/vault/cluster/oidc-provider.js +++ b/ui/app/routes/vault/cluster/oidc-provider.js @@ -74,7 +74,7 @@ export default class VaultClusterOidcProviderRoute extends Route { _buildUrl(urlString, params) { try { let url = new URL(urlString); - Object.keys(params).forEach(key => { + Object.keys(params).forEach((key) => { if (params[key]) { url.searchParams.append(key, params[key]); } diff --git a/ui/app/routes/vault/cluster/policies/index.js b/ui/app/routes/vault/cluster/policies/index.js index 5f46e865f..3d83435e2 100644 --- a/ui/app/routes/vault/cluster/policies/index.js +++ b/ui/app/routes/vault/cluster/policies/index.js @@ -28,7 +28,7 @@ export default Route.extend(ClusterRoute, ListRoute, { pageFilter: params.pageFilter, responsePath: 'data.keys', }) - .catch(err => { + .catch((err) => { // acls will never be empty, but sentinel policies can be if (err.httpStatus === 404 && this.policyType() !== 'acl') { return []; diff --git a/ui/app/routes/vault/cluster/secrets/backend.js b/ui/app/routes/vault/cluster/secrets/backend.js index 1dafeda49..28754e3c4 100644 --- a/ui/app/routes/vault/cluster/secrets/backend.js +++ b/ui/app/routes/vault/cluster/secrets/backend.js @@ -11,7 +11,7 @@ export default Route.extend({ .query('secret-engine', { path: backend, }) - .then(model => { + .then((model) => { if (model) { return model.get('firstObject'); } diff --git a/ui/app/routes/vault/cluster/secrets/backend/configuration.js b/ui/app/routes/vault/cluster/secrets/backend/configuration.js index 2d7bcf32b..50c547d32 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/configuration.js +++ b/ui/app/routes/vault/cluster/secrets/backend/configuration.js @@ -12,7 +12,7 @@ export default Route.extend({ if (backend.isV2KV) { let canRead = await this.store .findRecord('capabilities', `${backend.id}/config`) - .then(response => response.canRead); + .then((response) => response.canRead); // only set these config params if they can read the config endpoint. if (canRead) { // design wants specific default to show that can't be set in the model diff --git a/ui/app/routes/vault/cluster/secrets/backend/create-root.js b/ui/app/routes/vault/cluster/secrets/backend/create-root.js index 75c7a5140..6dac9d9cd 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/create-root.js +++ b/ui/app/routes/vault/cluster/secrets/backend/create-root.js @@ -20,7 +20,7 @@ let secretModel = (store, backend, key) => { return secret; }; -const transformModel = queryParams => { +const transformModel = (queryParams) => { let modelType = 'transform'; if (!queryParams || !queryParams.itemType) return modelType; diff --git a/ui/app/routes/vault/cluster/secrets/backend/credentials.js b/ui/app/routes/vault/cluster/secrets/backend/credentials.js index ae38e7199..f5c068071 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/credentials.js +++ b/ui/app/routes/vault/cluster/secrets/backend/credentials.js @@ -24,7 +24,7 @@ export default Route.extend({ }, getDatabaseCredential(backend, secret, roleType = '') { - return this.store.queryRecord('database/credential', { backend, secret, roleType }).catch(error => { + return this.store.queryRecord('database/credential', { backend, secret, roleType }).catch((error) => { if (error instanceof ControlGroupError) { throw error; } diff --git a/ui/app/routes/vault/cluster/secrets/backend/list.js b/ui/app/routes/vault/cluster/secrets/backend/list.js index 4c657142d..aa90b1173 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/list.js +++ b/ui/app/routes/vault/cluster/secrets/backend/list.js @@ -104,11 +104,11 @@ export default Route.extend({ page: params.page || 1, pageFilter: params.pageFilter, }) - .then(model => { + .then((model) => { this.set('has404', false); return model; }) - .catch(err => { + .catch((err) => { // if we're at the root we don't want to throw if (backendModel && err.httpStatus === 404 && secret === '') { return []; @@ -134,10 +134,10 @@ export default Route.extend({ // possible that there is no certificate for them in order to know, // we fetch them specifically on the list page, and then unload the // records if there is no `certificate` attribute on the resultant model - ['ca', 'crl', 'ca_chain'].map(id => this.store.queryRecord('pki-certificate', { id, backend })) + ['ca', 'crl', 'ca_chain'].map((id) => this.store.queryRecord('pki-certificate', { id, backend })) ).then( - results => { - results.rejectBy('certificate').forEach(record => record.unloadRecord()); + (results) => { + results.rejectBy('certificate').forEach((record) => record.unloadRecord()); return model; }, () => { diff --git a/ui/app/routes/vault/cluster/secrets/backend/metadata.js b/ui/app/routes/vault/cluster/secrets/backend/metadata.js index e9f862322..ea95f834b 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/metadata.js +++ b/ui/app/routes/vault/cluster/secrets/backend/metadata.js @@ -18,7 +18,7 @@ export default class MetadataShow extends Route { backend: this.backend, id: secret, }) - .catch(error => { + .catch((error) => { // there was an error likely in read metadata. // still load the page and handle what you show by filtering for this property if (error.httpStatus === 403) { diff --git a/ui/app/routes/vault/cluster/secrets/backend/overview.js b/ui/app/routes/vault/cluster/secrets/backend/overview.js index fb46f85d7..3952708d1 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/overview.js +++ b/ui/app/routes/vault/cluster/secrets/backend/overview.js @@ -64,7 +64,7 @@ export default Route.extend({ !model.connectionCapabilities.canCreate && !model.connectionCapabilities.canUpdate; - let emptyStateMessage = function() { + let emptyStateMessage = function () { if (noConnectionCapabilities) { return 'You cannot yet generate credentials. Ask your administrator if you think you should have access.'; } else { diff --git a/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js b/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js index 03e544acd..fb697b944 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js +++ b/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js @@ -283,10 +283,7 @@ export default Route.extend(UnloadModelRoute, { capabilities: model.capabilities, baseKey: { id: secret }, // mode will be 'show', 'edit', 'create' - mode: this.routeName - .split('.') - .pop() - .replace('-root', ''), + mode: this.routeName.split('.').pop().replace('-root', ''), backend, preferAdvancedEdit, backendType, @@ -322,7 +319,7 @@ export default Route.extend(UnloadModelRoute, { // when you don't have read access on metadata we add currentVersion to the model // this makes it look like you have unsaved changes and prompts a browser warning // here we are specifically ignoring it. - if (mode === 'edit' && (changedKeys.length && changedKeys[0] === 'currentVersion')) { + if (mode === 'edit' && changedKeys.length && changedKeys[0] === 'currentVersion') { version && version.rollbackAttributes(); return true; } @@ -330,7 +327,7 @@ export default Route.extend(UnloadModelRoute, { // it's going to dirty the model state, so we need to look for it // and explicity ignore it here if ( - (mode !== 'show' && (changedKeys.length && changedKeys[0] !== 'backend')) || + (mode !== 'show' && changedKeys.length && changedKeys[0] !== 'backend') || (mode !== 'show' && version && Object.keys(version.changedAttributes()).length) ) { if ( diff --git a/ui/app/routes/vault/cluster/secrets/backend/sign.js b/ui/app/routes/vault/cluster/secrets/backend/sign.js index c187a089d..ee2f1212a 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/sign.js +++ b/ui/app/routes/vault/cluster/secrets/backend/sign.js @@ -26,7 +26,7 @@ export default Route.extend(UnloadModel, { if (backendModel.get('type') !== 'ssh') { return this.transitionTo('vault.cluster.secrets.backend.list-root', backend); } - return this.store.queryRecord('capabilities', this.pathQuery(role, backend)).then(capabilities => { + return this.store.queryRecord('capabilities', this.pathQuery(role, backend)).then((capabilities) => { if (!capabilities.get('canUpdate')) { return this.transitionTo('vault.cluster.secrets.backend.list-root', backend); } diff --git a/ui/app/routes/vault/cluster/settings/auth/configure/section.js b/ui/app/routes/vault/cluster/settings/auth/configure/section.js index 26d47d7ff..f4495cd06 100644 --- a/ui/app/routes/vault/cluster/settings/auth/configure/section.js +++ b/ui/app/routes/vault/cluster/settings/auth/configure/section.js @@ -63,14 +63,14 @@ export default Route.extend(UnloadModelRoute, { } return this.store .findRecord(modelType, backend.id) - .then(config => { + .then((config) => { config.set('backend', backend); return RSVP.hash({ model: config, section, }); }) - .catch(e => { + .catch((e) => { let config; // if you haven't saved a config, the API 404s, so create one here to edit and return it if (e.httpStatus === 404) { diff --git a/ui/app/routes/vault/cluster/settings/configure-secret-backend.js b/ui/app/routes/vault/cluster/settings/configure-secret-backend.js index 22b85cc2a..a1c3c27f3 100644 --- a/ui/app/routes/vault/cluster/settings/configure-secret-backend.js +++ b/ui/app/routes/vault/cluster/settings/configure-secret-backend.js @@ -7,7 +7,7 @@ const CONFIGURABLE_BACKEND_TYPES = ['aws', 'ssh', 'pki']; export default Route.extend({ model() { const { backend } = this.paramsFor(this.routeName); - return this.store.query('secret-engine', { path: backend }).then(modelList => { + return this.store.query('secret-engine', { path: backend }).then((modelList) => { let model = modelList && modelList.get('firstObject'); if (!model || !CONFIGURABLE_BACKEND_TYPES.includes(model.get('type'))) { const error = new AdapterError(); @@ -40,7 +40,10 @@ export default Route.extend({ backend: model.id, type, }) - .then(() => model, () => model); + .then( + () => model, + () => model + ); } return model; }, diff --git a/ui/app/routes/vault/cluster/settings/configure-secret-backend/section.js b/ui/app/routes/vault/cluster/settings/configure-secret-backend/section.js index 007cea5f3..b4aa5da1a 100644 --- a/ui/app/routes/vault/cluster/settings/configure-secret-backend/section.js +++ b/ui/app/routes/vault/cluster/settings/configure-secret-backend/section.js @@ -15,7 +15,7 @@ export default Route.extend({ backend: backendModel.id, section: sectionName, }) - .then(model => { + .then((model) => { model.set('backendType', backendModel.get('type')); model.set('section', sectionName); return model; diff --git a/ui/app/routes/vault/cluster/settings/index.js b/ui/app/routes/vault/cluster/settings/index.js index cd1f30425..5b6928fe6 100644 --- a/ui/app/routes/vault/cluster/settings/index.js +++ b/ui/app/routes/vault/cluster/settings/index.js @@ -1,7 +1,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ - beforeModel: function(transition) { + beforeModel: function (transition) { if (transition.targetName === this.routeName) { transition.abort(); return this.replaceWith('vault.cluster.settings.mount-secret-backend'); diff --git a/ui/app/serializers/application.js b/ui/app/serializers/application.js index 96f0bc2de..ae257b961 100644 --- a/ui/app/serializers/application.js +++ b/ui/app/serializers/application.js @@ -4,13 +4,13 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default JSONSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, normalizeItems(payload) { if (payload.data && payload.data.keys && Array.isArray(payload.data.keys)) { - let models = payload.data.keys.map(key => { + let models = payload.data.keys.map((key) => { if (typeof key !== 'string') { return key; } diff --git a/ui/app/serializers/auth-method.js b/ui/app/serializers/auth-method.js index 3fd8aaf06..695c3f43a 100644 --- a/ui/app/serializers/auth-method.js +++ b/ui/app/serializers/auth-method.js @@ -14,7 +14,7 @@ export default ApplicationSerializer.extend({ const isCreate = requestType === 'createRecord'; const backends = isCreate ? payload.data - : Object.keys(payload.data).map(path => this.normalizeBackend(path, payload.data[path])); + : Object.keys(payload.data).map((path) => this.normalizeBackend(path, payload.data[path])); return this._super(store, primaryModelClass, backends, id, requestType); }, diff --git a/ui/app/serializers/cluster.js b/ui/app/serializers/cluster.js index 83d5a3553..d27c94883 100644 --- a/ui/app/serializers/cluster.js +++ b/ui/app/serializers/cluster.js @@ -3,7 +3,7 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend(EmbeddedRecordsMixin, { - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, diff --git a/ui/app/serializers/config.js b/ui/app/serializers/config.js index e2fb2cc85..383d274b9 100644 --- a/ui/app/serializers/config.js +++ b/ui/app/serializers/config.js @@ -3,7 +3,7 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, diff --git a/ui/app/serializers/database/connection.js b/ui/app/serializers/database/connection.js index 34d750b4b..3a6b9ecaa 100644 --- a/ui/app/serializers/database/connection.js +++ b/ui/app/serializers/database/connection.js @@ -16,7 +16,7 @@ export default RESTSerializer.extend({ normalizeSecrets(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { - const connections = payload.data.keys.map(secret => ({ name: secret, backend: payload.backend })); + const connections = payload.data.keys.map((secret) => ({ name: secret, backend: payload.backend })); return connections; } // Query single record response: @@ -52,14 +52,14 @@ export default RESTSerializer.extend({ if (!data.plugin_name) { return data; } - let pluginType = AVAILABLE_PLUGIN_TYPES.find(plugin => plugin.value === data.plugin_name); + let pluginType = AVAILABLE_PLUGIN_TYPES.find((plugin) => plugin.value === data.plugin_name); if (!pluginType) { return data; } - let pluginAttributes = pluginType.fields.map(fields => fields.attr).concat('backend'); + let pluginAttributes = pluginType.fields.map((fields) => fields.attr).concat('backend'); // filter data to only allow plugin specific attrs - let allowedAttributes = Object.keys(data).filter(dataAttrs => pluginAttributes.includes(dataAttrs)); + let allowedAttributes = Object.keys(data).filter((dataAttrs) => pluginAttributes.includes(dataAttrs)); for (const key in data) { if (!allowedAttributes.includes(key)) { delete data[key]; diff --git a/ui/app/serializers/database/role.js b/ui/app/serializers/database/role.js index d4f480a3b..5b94fc2a7 100644 --- a/ui/app/serializers/database/role.js +++ b/ui/app/serializers/database/role.js @@ -5,7 +5,7 @@ export default RESTSerializer.extend({ normalizeSecrets(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { - const roles = payload.data.keys.map(secret => { + const roles = payload.data.keys.map((secret) => { let type = 'dynamic'; let path = 'roles'; if (payload.data.staticRoles.includes(secret)) { diff --git a/ui/app/serializers/identity/_base.js b/ui/app/serializers/identity/_base.js index 2a6546c9c..c28231d69 100644 --- a/ui/app/serializers/identity/_base.js +++ b/ui/app/serializers/identity/_base.js @@ -4,7 +4,7 @@ import ApplicationSerializer from '../application'; export default ApplicationSerializer.extend({ normalizeItems(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { - return payload.data.keys.map(key => { + return payload.data.keys.map((key) => { let model = payload.data.key_info[key]; model.id = key; return model; diff --git a/ui/app/serializers/lease.js b/ui/app/serializers/lease.js index c0dc3bef4..c6c268b25 100644 --- a/ui/app/serializers/lease.js +++ b/ui/app/serializers/lease.js @@ -2,13 +2,13 @@ import RESTSerializer from '@ember-data/serializer/rest'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, normalizeAll(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { - const records = payload.data.keys.map(record => { + const records = payload.data.keys.map((record) => { const fullPath = payload.prefix ? payload.prefix + record : record; return { id: fullPath }; }); diff --git a/ui/app/serializers/namespace.js b/ui/app/serializers/namespace.js index 01ab5c1cc..ced413aee 100644 --- a/ui/app/serializers/namespace.js +++ b/ui/app/serializers/namespace.js @@ -3,7 +3,7 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ normalizeList(payload) { const data = payload.data.keys - ? payload.data.keys.map(key => ({ + ? payload.data.keys.map((key) => ({ path: key, // remove the trailing slash from the id id: key.replace(/\/$/, ''), diff --git a/ui/app/serializers/node.js b/ui/app/serializers/node.js index a5d104825..35be4ee90 100644 --- a/ui/app/serializers/node.js +++ b/ui/app/serializers/node.js @@ -3,7 +3,7 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend(EmbeddedRecordsMixin, { - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, @@ -28,7 +28,7 @@ export default RESTSerializer.extend(EmbeddedRecordsMixin, { normalizeResponse(store, primaryModelClass, payload, id, requestType) { const nodes = payload.nodes - ? Object.keys(payload.nodes).map(name => this.nodeFromObject(name, payload)) + ? Object.keys(payload.nodes).map((name) => this.nodeFromObject(name, payload)) : [assign(payload, { id: '1' })]; const transformedPayload = { nodes: nodes }; diff --git a/ui/app/serializers/path-filter-config.js b/ui/app/serializers/path-filter-config.js index 0bd867388..edf2d5778 100644 --- a/ui/app/serializers/path-filter-config.js +++ b/ui/app/serializers/path-filter-config.js @@ -2,7 +2,7 @@ import RESTSerializer from '@ember-data/serializer/rest'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, diff --git a/ui/app/serializers/pki-certificate.js b/ui/app/serializers/pki-certificate.js index 427f40a67..2ab0d307b 100644 --- a/ui/app/serializers/pki-certificate.js +++ b/ui/app/serializers/pki-certificate.js @@ -5,7 +5,7 @@ import { decamelize } from '@ember/string'; import { parsePkiCert } from '../helpers/parse-pki-cert'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, @@ -22,7 +22,7 @@ export default RESTSerializer.extend({ normalizeItems(payload) { if (payload.data && payload.data.keys && Array.isArray(payload.data.keys)) { - let ret = payload.data.keys.map(key => { + let ret = payload.data.keys.map((key) => { let model = { id_for_nav: `cert/${key}`, id: key, diff --git a/ui/app/serializers/pki-config.js b/ui/app/serializers/pki-config.js index e2fb2cc85..383d274b9 100644 --- a/ui/app/serializers/pki-config.js +++ b/ui/app/serializers/pki-config.js @@ -3,7 +3,7 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, diff --git a/ui/app/serializers/policy.js b/ui/app/serializers/policy.js index 9646bbb94..10c5685d6 100644 --- a/ui/app/serializers/policy.js +++ b/ui/app/serializers/policy.js @@ -4,7 +4,7 @@ export default ApplicationSerializer.extend({ primaryKey: 'name', normalizePolicies(payload) { - const data = payload.data.keys ? payload.data.keys.map(name => ({ name })) : payload.data; + const data = payload.data.keys ? payload.data.keys.map((name) => ({ name })) : payload.data; return data; }, diff --git a/ui/app/serializers/replication-attributes.js b/ui/app/serializers/replication-attributes.js index 511b89289..8a72a7587 100644 --- a/ui/app/serializers/replication-attributes.js +++ b/ui/app/serializers/replication-attributes.js @@ -2,7 +2,7 @@ import RESTSerializer from '@ember-data/serializer/rest'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, }); diff --git a/ui/app/serializers/role-aws.js b/ui/app/serializers/role-aws.js index 6a394c8c0..e479a61f8 100644 --- a/ui/app/serializers/role-aws.js +++ b/ui/app/serializers/role-aws.js @@ -2,7 +2,7 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, }; diff --git a/ui/app/serializers/role.js b/ui/app/serializers/role.js index 38c1d5f52..27d9d3653 100644 --- a/ui/app/serializers/role.js +++ b/ui/app/serializers/role.js @@ -5,13 +5,13 @@ export default ApplicationSerializer.extend({ let ret; if (payload.zero_address_roles) { - payload.zero_address_roles.forEach(role => { + payload.zero_address_roles.forEach((role) => { // mutate key_info object to add zero_address info payload.data.key_info[role].zero_address = true; }); } if (!payload.data.key_info) { - return payload.data.keys.map(key => { + return payload.data.keys.map((key) => { let model = { id: key, }; @@ -22,7 +22,7 @@ export default ApplicationSerializer.extend({ }); } - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, key_type: payload.data.key_info[key].key_type, diff --git a/ui/app/serializers/secret-engine.js b/ui/app/serializers/secret-engine.js index d47401324..e6100eb7c 100644 --- a/ui/app/serializers/secret-engine.js +++ b/ui/app/serializers/secret-engine.js @@ -37,11 +37,11 @@ export default ApplicationSerializer.extend({ // this is terrible, I'm sorry // TODO extract AWS and SSH config saving from the secret-engine model to simplify this if (payload.data.secret) { - backends = Object.keys(payload.data.secret).map(id => + backends = Object.keys(payload.data.secret).map((id) => this.normalizeBackend(id, payload.data.secret[id]) ); } else if (!payload.data.path) { - backends = Object.keys(payload.data).map(id => this.normalizeBackend(id, payload[id])); + backends = Object.keys(payload.data).map((id) => this.normalizeBackend(id, payload[id])); } else { backends = [this.normalizeBackend(payload.data.path, payload.data)]; } diff --git a/ui/app/serializers/secret-v2.js b/ui/app/serializers/secret-v2.js index 2639cbeb9..9af7b8905 100644 --- a/ui/app/serializers/secret-v2.js +++ b/ui/app/serializers/secret-v2.js @@ -10,7 +10,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { if (payload.data.keys && Array.isArray(payload.data.keys)) { // if we have data.keys, it's a list of ids, so we map over that // and create objects with id's - return payload.data.keys.map(secret => { + return payload.data.keys.map((secret) => { // secrets don't have an id in the response, so we need to concat the full // path of the secret here - the id in the payload is added // in the adapter after making the request @@ -30,7 +30,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { } // transform versions to an array with composite IDs if (payload.data.versions) { - payload.data.versions = Object.keys(payload.data.versions).map(version => { + payload.data.versions = Object.keys(payload.data.versions).map((version) => { let body = payload.data.versions[version]; body.version = version; body.path = payload.id; diff --git a/ui/app/serializers/secret.js b/ui/app/serializers/secret.js index b352f7aea..2a3a19dc8 100644 --- a/ui/app/serializers/secret.js +++ b/ui/app/serializers/secret.js @@ -12,7 +12,7 @@ export default ApplicationSerializer.extend({ ) { // if we have data.keys, it's a list of ids, so we map over that // and create objects with id's - return payload.data.keys.map(secret => { + return payload.data.keys.map((secret) => { // secrets don't have an id in the response, so we need to concat the full // path of the secret here - the id in the payload is added // in the adapter after making the request diff --git a/ui/app/serializers/ssh.js b/ui/app/serializers/ssh.js index 4e7c29209..eb69b6fd1 100644 --- a/ui/app/serializers/ssh.js +++ b/ui/app/serializers/ssh.js @@ -4,7 +4,7 @@ import { assign } from '@ember/polyfills'; import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, diff --git a/ui/app/serializers/transform.js b/ui/app/serializers/transform.js index 95017c57f..e86c3a3eb 100644 --- a/ui/app/serializers/transform.js +++ b/ui/app/serializers/transform.js @@ -19,7 +19,7 @@ export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, }; diff --git a/ui/app/serializers/transform/alphabet.js b/ui/app/serializers/transform/alphabet.js index 70052248a..957917b6c 100644 --- a/ui/app/serializers/transform/alphabet.js +++ b/ui/app/serializers/transform/alphabet.js @@ -8,7 +8,7 @@ export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, }; diff --git a/ui/app/serializers/transform/role.js b/ui/app/serializers/transform/role.js index 5e35ae6a2..29fcb4b04 100644 --- a/ui/app/serializers/transform/role.js +++ b/ui/app/serializers/transform/role.js @@ -3,7 +3,7 @@ import ApplicationSerializer from '../application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, }; diff --git a/ui/app/serializers/transform/template.js b/ui/app/serializers/transform/template.js index 18bb7bf28..7a4cf7e21 100644 --- a/ui/app/serializers/transform/template.js +++ b/ui/app/serializers/transform/template.js @@ -20,7 +20,7 @@ export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; - ret = payload.data.keys.map(key => { + ret = payload.data.keys.map((key) => { let model = { id: key, }; diff --git a/ui/app/serializers/transit-key.js b/ui/app/serializers/transit-key.js index 9861a77b8..d044e69a7 100644 --- a/ui/app/serializers/transit-key.js +++ b/ui/app/serializers/transit-key.js @@ -5,13 +5,13 @@ import { decamelize } from '@ember/string'; export default RESTSerializer.extend({ primaryKey: 'name', - keyForAttribute: function(attr) { + keyForAttribute: function (attr) { return decamelize(attr); }, normalizeSecrets(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { - const secrets = payload.data.keys.map(secret => ({ name: secret, backend: payload.backend })); + const secrets = payload.data.keys.map((secret) => ({ name: secret, backend: payload.backend })); return secrets; } assign(payload, payload.data); diff --git a/ui/app/services/auth.js b/ui/app/services/auth.js index 005f0dbd5..b2a1a99ff 100644 --- a/ui/app/services/auth.js +++ b/ui/app/services/auth.js @@ -33,7 +33,7 @@ export default Service.extend({ return getOwner(this).lookup('adapter:cluster'); }, - tokens: computed(function() { + tokens: computed(function () { return this.getTokensFromStorage() || []; }), @@ -92,7 +92,7 @@ export default Service.extend({ return fetch(url, { method: opts.method || 'GET', headers: opts.headers || {}, - }).then(response => { + }).then((response) => { if (response.status === 204) { return resolve(); } else if (response.status >= 200 && response.status < 300) { @@ -144,7 +144,7 @@ export default Service.extend({ let currentBackend = BACKENDS.findBy('type', backend); let displayName; if (isArray(currentBackend.displayNamePath)) { - displayName = currentBackend.displayNamePath.map(name => get(resp, name)).join('/'); + displayName = currentBackend.displayNamePath.map((name) => get(resp, name)).join('/'); } else { displayName = get(resp, currentBackend.displayNamePath); } @@ -217,7 +217,7 @@ export default Service.extend({ return this.storage(token).removeItem(token); }, - tokenExpirationDate: computed('currentTokenName', 'expirationCalcTS', function() { + tokenExpirationDate: computed('currentTokenName', 'expirationCalcTS', function () { const tokenName = this.currentTokenName; if (!tokenName) { return; @@ -232,7 +232,7 @@ export default Service.extend({ return expiration ? this.now() >= expiration : null; }, - renewAfterEpoch: computed('currentTokenName', 'expirationCalcTS', function() { + renewAfterEpoch: computed('currentTokenName', 'expirationCalcTS', function () { const tokenName = this.currentTokenName; let { expirationCalcTS } = this; const data = this.getTokenData(tokenName); @@ -252,18 +252,18 @@ export default Service.extend({ } this.isRenewing = true; return this.renewCurrentToken().then( - resp => { + (resp) => { this.isRenewing = false; return this.persistAuthData(tokenName, resp.data || resp.auth); }, - e => { + (e) => { this.isRenewing = false; throw e; } ); }, - checkShouldRenew: task(function*() { + checkShouldRenew: task(function* () { while (true) { if (Ember.testing) { return; @@ -303,7 +303,7 @@ export default Service.extend({ getTokensFromStorage(filterFn) { return this.storage() .keys() - .reject(key => { + .reject((key) => { return key.indexOf(TOKEN_PREFIX) !== 0 || (filterFn && filterFn(key)); }); }, @@ -313,7 +313,7 @@ export default Service.extend({ return; } - this.getTokensFromStorage().forEach(key => { + this.getTokensFromStorage().forEach((key) => { const data = this.getTokenData(key); if (data && data.policies && data.policies.includes('root')) { this.removeTokenData(key); @@ -349,19 +349,19 @@ export default Service.extend({ }, // returns the key for the token to use - currentTokenName: computed('activeCluster', 'tokens', 'tokens.[]', function() { + currentTokenName: computed('activeCluster', 'tokens', 'tokens.[]', function () { const regex = new RegExp(this.activeCluster); - return this.tokens.find(key => regex.test(key)); + return this.tokens.find((key) => regex.test(key)); }), - currentToken: computed('currentTokenName', function() { + currentToken: computed('currentTokenName', function () { const name = this.currentTokenName; const data = name && this.getTokenData(name); // data.token is undefined so that's why it returns current token undefined return name && data ? data.token : null; }), - authData: computed('currentTokenName', function() { + authData: computed('currentTokenName', function () { const token = this.currentTokenName; if (!token) { return; diff --git a/ui/app/services/console.js b/ui/app/services/console.js index c6f237b74..5880074d6 100644 --- a/ui/app/services/console.js +++ b/ui/app/services/console.js @@ -31,7 +31,7 @@ export default Service.extend({ return getOwner(this).lookup('adapter:console'); }, commandHistory: filterBy('log', 'type', 'command'), - log: computed(function() { + log: computed(function () { return []; }), commandIndex: null, diff --git a/ui/app/services/control-group.js b/ui/app/services/control-group.js index 8d3cec2b2..46a7e00c0 100644 --- a/ui/app/services/control-group.js +++ b/ui/app/services/control-group.js @@ -32,8 +32,8 @@ export default Service.extend({ keyFromAccessor(accessor) { let keys = this.storage().keys() || []; let returnKey = keys - .filter(k => k.startsWith(CONTROL_GROUP_PREFIX)) - .find(key => key.replace(CONTROL_GROUP_PREFIX, '').startsWith(accessor)); + .filter((k) => k.startsWith(CONTROL_GROUP_PREFIX)) + .find((key) => key.replace(CONTROL_GROUP_PREFIX, '').startsWith(accessor)); return returnKey ? returnKey : null; }, @@ -50,7 +50,7 @@ export default Service.extend({ deleteTokens() { let keys = this.storage().keys() || []; - keys.filter(k => k.startsWith(CONTROL_GROUP_PREFIX)).forEach(key => this.storage().removeItem(key)); + keys.filter((k) => k.startsWith(CONTROL_GROUP_PREFIX)).forEach((key) => this.storage().removeItem(key)); }, wrapInfoForAccessor(accessor) { @@ -99,7 +99,7 @@ export default Service.extend({ paramsFromTransition(transitionTo, params, queryParams) { let returnedParams = params.slice(); let qps = queryParams; - transitionTo.paramNames.map(name => { + transitionTo.paramNames.map((name) => { let param = transitionTo.params[name]; if (param.length) { // push on to the front of the array since were're started at the end diff --git a/ui/app/services/csp-event.js b/ui/app/services/csp-event.js index 62a0284c3..d2c0ba188 100644 --- a/ui/app/services/csp-event.js +++ b/ui/app/services/csp-event.js @@ -5,11 +5,11 @@ import Service from '@ember/service'; import { task, waitForEvent } from 'ember-concurrency'; export default Service.extend({ - events: computed(function() { + events: computed(function () { return []; }), - connectionViolations: computed('events.@each.violatedDirective', function() { - return this.events.filter(e => e.violatedDirective.startsWith('connect-src')); + connectionViolations: computed('events.@each.violatedDirective', function () { + return this.events.filter((e) => e.violatedDirective.startsWith('connect-src')); }), attach() { @@ -20,7 +20,7 @@ export default Service.extend({ this.monitor.cancelAll(); }, - monitor: task(function*() { + monitor: task(function* () { this.events.clear(); while (true) { diff --git a/ui/app/services/namespace.js b/ui/app/services/namespace.js index 3b8d41189..7a27d779c 100644 --- a/ui/app/services/namespace.js +++ b/ui/app/services/namespace.js @@ -23,7 +23,7 @@ export default Service.extend({ this.set('path', path); }, - findNamespacesForUser: task(function*() { + findNamespacesForUser: task(function* () { // uses the adapter and the raw response here since // models get wiped when switching namespaces and we // want to keep track of these separately @@ -40,7 +40,7 @@ export default Service.extend({ let keys = ns.data.keys || []; this.set( 'accessibleNamespaces', - keys.map(n => { + keys.map((n) => { let fullNS = n; // if the user's root isn't '', then we need to construct // the paths so they connect to the user root to the list diff --git a/ui/app/services/path-help.js b/ui/app/services/path-help.js index 422bb28b0..b81334e09 100644 --- a/ui/app/services/path-help.js +++ b/ui/app/services/path-help.js @@ -64,7 +64,7 @@ export default Service.extend({ // use paths to dynamically create our openapi help url // if we have a brand new model return this.getPaths(apiPath, backend, itemType) - .then(pathInfo => { + .then((pathInfo) => { const adapterFactory = owner.factoryFor(`adapter:${modelType}`); // if we have an adapter already use that, otherwise create one if (!adapterFactory) { @@ -75,7 +75,7 @@ export default Service.extend({ let path, paths; // if we have an item we want the create info for that itemType paths = itemType ? this.filterPathsByItemType(pathInfo, itemType) : pathInfo.paths; - const createPath = paths.find(path => path.operations.includes('post') && path.action !== 'Delete'); + const createPath = paths.find((path) => path.operations.includes('post') && path.action !== 'Delete'); path = createPath.path; path = path.includes('{') ? path.slice(0, path.indexOf('{') - 1) + '/example' : path; if (!path) { @@ -89,7 +89,7 @@ export default Service.extend({ newModel = newModel.extend({ paths: pathInfo }); return this.registerNewModelWithProps(helpUrl, backend, newModel, modelName); }) - .catch(err => { + .catch((err) => { // TODO: we should handle the error better here console.error(err); }); @@ -109,7 +109,7 @@ export default Service.extend({ itemType = displayAttrs.itemType; let items = itemType.split(':'); itemName = items[items.length - 1]; - items = items.map(item => dasherize(singularize(item.toLowerCase()))); + items = items.map((item) => dasherize(singularize(item.toLowerCase()))); itemType = items.join('~*'); } @@ -148,7 +148,7 @@ export default Service.extend({ if (!itemType) { return pathInfo.paths; } - return pathInfo.paths.filter(path => { + return pathInfo.paths.filter((path) => { return itemType === path.itemType; }); }, @@ -159,7 +159,7 @@ export default Service.extend({ ? `Fetching relevant paths for ${backend} ${itemType} ${itemID} from ${apiPath}` : `Fetching relevant paths for ${backend} ${itemType} from ${apiPath}`; debug(debugString); - return this.ajax(`/v1/${apiPath}?help=1`, backend).then(help => { + return this.ajax(`/v1/${apiPath}?help=1`, backend).then((help) => { const pathInfo = help.openapi.paths; let paths = Object.entries(pathInfo); @@ -180,7 +180,7 @@ export default Service.extend({ // add name of thing you want debug(`Fetching schema properties for ${backend} from ${helpUrl}`); - return this.ajax(helpUrl, backend).then(help => { + return this.ajax(helpUrl, backend).then((help) => { // paths is an array but it will have a single entry // for the scope we're in const path = Object.keys(help.openapi.paths)[0]; // do this or look at name @@ -219,13 +219,13 @@ export default Service.extend({ // we need list and create paths to set the correct urls for actions let paths = this.filterPathsByItemType(pathInfo, itemType); let { apiPath } = pathInfo; - const getPath = paths.find(path => path.operations.includes('get')); + const getPath = paths.find((path) => path.operations.includes('get')); // the action might be "Generate" or something like that so we'll grab the first post endpoint if there // isn't one with "Create" // TODO: look into a more sophisticated way to determine the create endpoint - const createPath = paths.find(path => path.action === 'Create' || path.operations.includes('post')); - const deletePath = paths.find(path => path.operations.includes('delete')); + const createPath = paths.find((path) => path.action === 'Create' || path.operations.includes('post')); + const deletePath = paths.find((path) => path.operations.includes('delete')); return generatedItemAdapter.extend({ urlForItem(id, isList, dynamicApiPath) { @@ -274,7 +274,7 @@ export default Service.extend({ }, registerNewModelWithProps(helpUrl, backend, newModel, modelName) { - return this.getProps(helpUrl, backend).then(props => { + return this.getProps(helpUrl, backend).then((props) => { const { attrs, newFields } = combineAttributes(newModel.attributes, props); let owner = getOwner(this); newModel = newModel.extend(attrs, { newFields }); @@ -307,7 +307,7 @@ export default Service.extend({ default: [], }; let fieldGroups = []; - newModel.attributes.forEach(attr => { + newModel.attributes.forEach((attr) => { // if the attr comes in with a fieldGroup from OpenAPI, // add it to that group if (attr.options.fieldGroup) { diff --git a/ui/app/services/permissions.js b/ui/app/services/permissions.js index aa67e2128..eab830c40 100644 --- a/ui/app/services/permissions.js +++ b/ui/app/services/permissions.js @@ -59,7 +59,7 @@ export default Service.extend({ auth: service(), namespace: service(), - getPaths: task(function*() { + getPaths: task(function* () { if (this.paths) { return; } @@ -93,11 +93,11 @@ export default Service.extend({ return this.hasPermission(API_PATHS[navItem][routeParams], capability); } - return Object.values(API_PATHS[navItem]).some(path => this.hasPermission(path)); + return Object.values(API_PATHS[navItem]).some((path) => this.hasPermission(path)); }, navPathParams(navItem) { - const path = Object.values(API_PATHS[navItem]).find(path => this.hasPermission(path)); + const path = Object.values(API_PATHS[navItem]).find((path) => this.hasPermission(path)); if (['policies', 'tools'].includes(navItem)) { return path.split('/').lastObject; } @@ -122,14 +122,15 @@ export default Service.extend({ } return capabilities.every( - capability => this.hasMatchingExactPath(path, capability) || this.hasMatchingGlobPath(path, capability) + (capability) => + this.hasMatchingExactPath(path, capability) || this.hasMatchingGlobPath(path, capability) ); }, hasMatchingExactPath(pathName, capability) { const exactPaths = this.exactPaths; if (exactPaths) { - const prefix = Object.keys(exactPaths).find(path => path.startsWith(pathName)); + const prefix = Object.keys(exactPaths).find((path) => path.startsWith(pathName)); const hasMatchingPath = prefix && !this.isDenied(exactPaths[prefix]); if (prefix && capability) { @@ -144,7 +145,7 @@ export default Service.extend({ hasMatchingGlobPath(pathName, capability) { const globPaths = this.globPaths; if (globPaths) { - const matchingPath = Object.keys(globPaths).find(k => { + const matchingPath = Object.keys(globPaths).find((k) => { return pathName.includes(k) || pathName.includes(k.replace(/\/$/, '')); }); const hasMatchingPath = diff --git a/ui/app/services/store.js b/ui/app/services/store.js index acd5995b9..452679d9e 100644 --- a/ui/app/services/store.js +++ b/ui/app/services/store.js @@ -29,7 +29,7 @@ export function keyForCache(query) { export default Store.extend({ // this is a map of map that stores the caches - lazyCaches: computed(function() { + lazyCaches: computed(function () { return new Map(); }), @@ -81,7 +81,7 @@ export default Store.extend({ } return adapter .query(this, { modelName }, query) - .then(response => { + .then((response) => { const serializer = this.serializerFor(modelName); const datasetHelper = serializer.extractLazyPaginatedData; const dataset = datasetHelper @@ -91,7 +91,7 @@ export default Store.extend({ this.storeDataset(modelName, query, response, dataset); return this.fetchPage(modelName, query); }) - .catch(function(e) { + .catch(function (e) { throw e; }); }, @@ -99,7 +99,7 @@ export default Store.extend({ filterData(filter, dataset) { let newData = dataset || []; if (filter) { - newData = dataset.filter(function(item) { + newData = dataset.filter(function (item) { const id = item.id || item; return id.toLowerCase().includes(filter.toLowerCase()); }); @@ -141,10 +141,10 @@ export default Store.extend({ // pushes records into the store and returns the result fetchPage(modelName, query) { const response = this.constructResponse(modelName, query); - this.peekAll(modelName).forEach(record => { + this.peekAll(modelName).forEach((record) => { record.unloadRecord(); }); - return new Promise(resolve => { + return new Promise((resolve) => { schedule('destroy', () => { this.push( this.serializerFor(modelName).normalizeResponse( diff --git a/ui/app/services/version.js b/ui/app/services/version.js index 01dc5051a..3d5f03e37 100644 --- a/ui/app/services/version.js +++ b/ui/app/services/version.js @@ -10,8 +10,8 @@ const hasFeatureMethod = (context, featureKey) => { } return features.includes(featureKey); }; -const hasFeature = featureKey => { - return computed('features', 'features.[]', function() { +const hasFeature = (featureKey) => { + return computed('features', 'features.[]', function () { return hasFeatureMethod(this, featureKey); }); }; @@ -47,7 +47,7 @@ export default Service.extend({ this.set('_features', resp.features); }, - getVersion: task(function*() { + getVersion: task(function* () { if (this.version) { return; } @@ -56,7 +56,7 @@ export default Service.extend({ return; }), - getFeatures: task(function*() { + getFeatures: task(function* () { if (this.features?.length || this.isOSS) { return; } @@ -69,10 +69,10 @@ export default Service.extend({ } }).keepLatest(), - fetchVersion: function() { + fetchVersion: function () { return this.getVersion.perform(); }, - fetchFeatures: function() { + fetchFeatures: function () { return this.getFeatures.perform(); }, }); diff --git a/ui/app/services/wizard.js b/ui/app/services/wizard.js index 6d16a63a6..d1f272aa5 100644 --- a/ui/app/services/wizard.js +++ b/ui/app/services/wizard.js @@ -2,6 +2,7 @@ import { next } from '@ember/runloop'; import { typeOf } from '@ember/utils'; import Service, { inject as service } from '@ember/service'; import { Machine } from 'xstate'; +import { capitalize } from '@ember/string'; import getStorage from 'vault/lib/token-storage'; import { STORAGE_KEYS, DEFAULTS, MACHINES } from 'vault/helpers/wizard-constants'; @@ -38,7 +39,11 @@ export default Service.extend(DEFAULTS, { this.set('componentState', this.getExtState(COMPONENT_STATE)); } let stateNodes = TutorialMachine.getStateNodes(this.currentState); - this.executeActions(stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), null, 'tutorial'); + this.executeActions( + stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), + null, + 'tutorial' + ); if (this.storageHasKey(FEATURE_LIST)) { this.set('featureList', this.getExtState(FEATURE_LIST)); @@ -57,7 +62,7 @@ export default Service.extend(DEFAULTS, { clearFeatureData() { let storage = this.storage(); // empty storage - [FEATURE_LIST, FEATURE_STATE, FEATURE_STATE_HISTORY, COMPLETED_FEATURES].forEach(key => + [FEATURE_LIST, FEATURE_STATE, FEATURE_STATE_HISTORY, COMPLETED_FEATURES].forEach((key) => storage.removeItem(key) ); @@ -71,7 +76,7 @@ export default Service.extend(DEFAULTS, { this.clearFeatureData(); let storage = this.storage(); // empty storage - [TUTORIAL_STATE, COMPONENT_STATE, RESUME_URL, RESUME_ROUTE].forEach(key => storage.removeItem(key)); + [TUTORIAL_STATE, COMPONENT_STATE, RESUME_URL, RESUME_ROUTE].forEach((key) => storage.removeItem(key)); // reset wizard state this.setProperties(DEFAULTS); // restart machines from blank state @@ -283,7 +288,7 @@ export default Service.extend(DEFAULTS, { return; } this.startFeature(); - let nextFeature = this.featureList.length > 1 ? this.featureList.objectAt(1).capitalize() : 'Finish'; + let nextFeature = this.featureList.length > 1 ? capitalize(this.featureList.objectAt(1)) : 'Finish'; this.set('nextFeature', nextFeature); let next; if (this.currentMachine === 'secrets' && this.featureState === 'display') { @@ -293,7 +298,11 @@ export default Service.extend(DEFAULTS, { } this.saveState('nextStep', next.value); let stateNodes = FeatureMachine.getStateNodes(this.featureState); - this.executeActions(stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), null, 'feature'); + this.executeActions( + stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), + null, + 'feature' + ); }, startFeature() { @@ -323,12 +332,7 @@ export default Service.extend(DEFAULTS, { completed.push(done); this.saveExtState(COMPLETED_FEATURES, completed); } else { - this.saveExtState( - COMPLETED_FEATURES, - this.getExtState(COMPLETED_FEATURES) - .toArray() - .addObject(done) - ); + this.saveExtState(COMPLETED_FEATURES, this.getExtState(COMPLETED_FEATURES).toArray().addObject(done)); } this.saveExtState(FEATURE_LIST, features.length ? features : null); diff --git a/ui/app/templates/application.hbs b/ui/app/templates/application.hbs index b560c7189..5ca395c18 100644 --- a/ui/app/templates/application.hbs +++ b/ui/app/templates/application.hbs @@ -1,3 +1,3 @@
{{outlet}} -
+
\ No newline at end of file diff --git a/ui/app/templates/components/alert-popup.hbs b/ui/app/templates/components/alert-popup.hbs index 389c1eeaa..143e5a00c 100644 --- a/ui/app/templates/components/alert-popup.hbs +++ b/ui/app/templates/components/alert-popup.hbs @@ -1,21 +1,20 @@ -
+
-
-
- {{type.text}} + {{this.type.text}}
- {{#if message}} -

{{message}}

+ {{#if this.message}} +

+ {{this.message}} +

{{/if}}
-
+
\ No newline at end of file diff --git a/ui/app/templates/components/alphabet-edit.hbs b/ui/app/templates/components/alphabet-edit.hbs index 918962e44..67d4937f7 100644 --- a/ui/app/templates/components/alphabet-edit.hbs +++ b/ui/app/templates/components/alphabet-edit.hbs @@ -1,46 +1,42 @@

- {{#if (eq mode "create") }} + {{#if (eq this.mode "create")}} Create Alphabet - {{else if (eq mode "edit")}} + {{else if (eq this.mode "edit")}} Edit Alphabet {{else}} - Alphabet {{model.id}} + Alphabet + {{this.model.id}} {{/if}}

-{{#if (eq mode "show")}} +{{#if (eq this.mode "show")}} - {{#if capabilities.canDelete}} - -
+
{{/if}} - {{#if capabilities.canUpdate }} + {{#if this.capabilities.canUpdate}} Edit alphabet @@ -49,73 +45,85 @@ {{/if}} -{{#if (or (eq mode 'edit') (eq mode 'create'))}} -
-
- - - {{#each model.attrs as |attr|}} - {{#if (and (eq attr.name 'name') (eq mode 'edit')) }} - - {{#if attr.options.subText}} -

{{attr.options.subText}}

+{{#if (or (eq this.mode "edit") (eq this.mode "create"))}} + +
+ + + {{#each this.model.attrs as |attr|}} + {{#if (and (eq attr.name "name") (eq this.mode "edit"))}} + + {{#if attr.options.subText}} +

{{attr.options.subText}}

+ {{/if}} + + {{else}} + {{/if}} - - {{else}} - - {{/if}} - {{/each}} -
-
-
- - - Cancel - + {{/each}}
-
- +
+
+ + + Cancel + +
+
+ {{else}} - {{#if model.displayErrors}} + {{#if this.model.displayErrors}}
- +
{{/if}}
- {{#each model.attrs as |attr|}} + {{#each this.model.attrs as |attr|}} {{#if (eq attr.type "object")}} - + {{else if (eq attr.type "array")}} - + {{else}} - + {{/if}} {{/each}}
-{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/auth-button-auth0.hbs b/ui/app/templates/components/auth-button-auth0.hbs index 6d5591c4b..232dda080 100644 --- a/ui/app/templates/components/auth-button-auth0.hbs +++ b/ui/app/templates/components/auth-button-auth0.hbs @@ -1,8 +1,19 @@ -
+
- + {{! template-lint-disable no-forbidden-elements }} + + + + + + + + {{! template-lint-enable no-forbidden-elements }}
Sign in with Auth0
-
+
\ No newline at end of file diff --git a/ui/app/templates/components/auth-button-gitlab.hbs b/ui/app/templates/components/auth-button-gitlab.hbs index 6bcbcfbb2..699269324 100644 --- a/ui/app/templates/components/auth-button-gitlab.hbs +++ b/ui/app/templates/components/auth-button-gitlab.hbs @@ -1,6 +1,48 @@ -
- +
+ {{! template-lint-disable no-forbidden-elements }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{! template-lint-enable no-forbidden-elements }}
Sign in with GitLab
-
+
\ No newline at end of file diff --git a/ui/app/templates/components/auth-button-google.hbs b/ui/app/templates/components/auth-button-google.hbs index 50a11af45..06c7a54d8 100644 --- a/ui/app/templates/components/auth-button-google.hbs +++ b/ui/app/templates/components/auth-button-google.hbs @@ -1,44 +1,70 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + -
-Sign in with Google -
-
+
+ Sign in with Google +
+
\ No newline at end of file diff --git a/ui/app/templates/components/auth-config-form/config.hbs b/ui/app/templates/components/auth-config-form/config.hbs index 370626bf3..cc91e4664 100644 --- a/ui/app/templates/components/auth-config-form/config.hbs +++ b/ui/app/templates/components/auth-config-form/config.hbs @@ -1,21 +1,21 @@ -
+
- - {{#if model.attrs}} - {{#each model.attrs as |attr|}} - {{form-field data-test-field attr=attr model=model}} + + {{#if this.model.attrs}} + {{#each this.model.attrs as |attr|}} + {{/each}} - {{else if model.fieldGroups}} - + {{else if this.model.fieldGroups}} + {{/if}}
diff --git a/ui/app/templates/components/auth-config-form/options.hbs b/ui/app/templates/components/auth-config-form/options.hbs index 3b8b227c9..fbd018c43 100644 --- a/ui/app/templates/components/auth-config-form/options.hbs +++ b/ui/app/templates/components/auth-config-form/options.hbs @@ -1,19 +1,19 @@ - +
- + - {{#each model.tuneAttrs as |attr|}} - + {{#each this.model.tuneAttrs as |attr|}} + {{/each}}
- + \ No newline at end of file diff --git a/ui/app/templates/components/auth-form-options.hbs b/ui/app/templates/components/auth-form-options.hbs index 8dbd0bdf2..3ff0a93b1 100644 --- a/ui/app/templates/components/auth-form-options.hbs +++ b/ui/app/templates/components/auth-form-options.hbs @@ -1,9 +1,6 @@ {{#unless this.selectedAuthIsPath}}
- + {{#if this.isOpen}}
{{/if}}
-{{/unless}} +{{/unless}} \ No newline at end of file diff --git a/ui/app/templates/components/auth-form.hbs b/ui/app/templates/components/auth-form.hbs index c782b341c..654a6b43f 100644 --- a/ui/app/templates/components/auth-form.hbs +++ b/ui/app/templates/components/auth-form.hbs @@ -1,19 +1,36 @@
- {{#if hasMethodsWithPath}} + {{#if this.hasMethodsWithPath}}
-
+
\ No newline at end of file diff --git a/ui/app/templates/components/auth-info.hbs b/ui/app/templates/components/auth-info.hbs index 5b24756eb..2e2384bf7 100644 --- a/ui/app/templates/components/auth-info.hbs +++ b/ui/app/templates/components/auth-info.hbs @@ -1,65 +1,82 @@ - -
- + \ No newline at end of file diff --git a/ui/app/templates/components/auth-jwt.hbs b/ui/app/templates/components/auth-jwt.hbs index 3264c4a32..7bad92761 100644 --- a/ui/app/templates/components/auth-jwt.hbs +++ b/ui/app/templates/components/auth-jwt.hbs @@ -1,7 +1,4 @@ -
+
@@ -19,9 +16,9 @@ />
@@ -29,22 +26,37 @@
- +
{{/unless}}
{{yield}}
- -
+ \ No newline at end of file diff --git a/ui/app/templates/components/auth-method/configuration.hbs b/ui/app/templates/components/auth-method/configuration.hbs index a56d2a760..8287bb2e7 100644 --- a/ui/app/templates/components/auth-method/configuration.hbs +++ b/ui/app/templates/components/auth-method/configuration.hbs @@ -1,9 +1,17 @@
{{#each @model.attrs as |attr|}} {{#if (eq attr.type "object")}} - + {{else}} - + {{/if}} {{/each}} -
+ \ No newline at end of file diff --git a/ui/app/templates/components/b64-toggle.hbs b/ui/app/templates/components/b64-toggle.hbs index c52f4f4ff..dd31e66fc 100644 --- a/ui/app/templates/components/b64-toggle.hbs +++ b/ui/app/templates/components/b64-toggle.hbs @@ -1,5 +1,5 @@ -{{#if isBase64}} +{{#if this.isBase64}} Decode from base64 {{else}} Encode to base64 -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/block-error.hbs b/ui/app/templates/components/block-error.hbs index c09a206db..92ba49f73 100644 --- a/ui/app/templates/components/block-error.hbs +++ b/ui/app/templates/components/block-error.hbs @@ -1,3 +1,3 @@
-{{yield}} + {{yield}}
\ No newline at end of file diff --git a/ui/app/templates/components/clients/config.hbs b/ui/app/templates/components/clients/config.hbs index 0551956de..90eefb7e6 100644 --- a/ui/app/templates/components/clients/config.hbs +++ b/ui/app/templates/components/clients/config.hbs @@ -6,12 +6,27 @@ {{#if (and (eq attr.type "string") (eq attr.options.editType "boolean"))}} {{#if attr.options.helpText}} -

{{attr.options.helpText}} {{#if attr.options.docLink}}See our documentation for help.{{/if}}

+

+ {{attr.options.helpText}} + {{#if attr.options.docLink}} + + See our documentation + + for help. + {{/if}} +

{{/if}}
- -
- {{else if (eq attr.type "number")}} -
- - {{#if attr.options.subText}} -

{{attr.options.subText}} {{#if attr.options.docLink}}See our documentation for help.{{/if}}

- {{/if}} -
- -
+ {{else if (eq attr.type "number")}} +
+ + {{#if attr.options.subText}} +

+ {{attr.options.subText}} + {{#if attr.options.docLink}} + + See our documentation + + for help. + {{/if}} +

+ {{/if}} +
+
+
{{/if}} {{/each}}
@@ -47,16 +71,13 @@
- + Cancel
@@ -71,10 +92,16 @@ > @@ -82,28 +109,23 @@ - {{else}} -
+
{{#each this.infoRows as |item|}} - + {{/each}}
-{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/clients/history.hbs b/ui/app/templates/components/clients/history.hbs index 35cc4973e..fdf57bfb1 100644 --- a/ui/app/templates/components/clients/history.hbs +++ b/ui/app/templates/components/clients/history.hbs @@ -1,5 +1,5 @@ -{{#if (and (eq @tab 'history') (eq @model.config.queriesAvailable false))}} - {{#if (eq @model.config.enabled 'On')}} +{{#if (and (eq @tab "history") (eq @model.config.queriesAvailable false))}} + {{#if (eq @model.config.enabled "On")}} {{#if @model.config.configPath.canUpdate}}

- + Go to configuration

@@ -20,15 +20,15 @@ {{/if}} {{else}}
- {{#if (eq @tab 'current')}} + {{#if (eq @tab "current")}}

Current month

- The below data is for the current month starting from the first day. For historical data, see the monthly - history tab. + The below data is for the current month starting from the first day. For historical data, see the monthly history + tab.

- {{#if (eq @model.config.enabled 'Off')}} + {{#if (eq @model.config.enabled "Off")}} {{/if}} {{else}} - {{#if (eq @model.config.enabled 'Off')}} + {{#if (eq @model.config.enabled "Off")}} - Tracking is currently disabled and data is not being collected. Historical data can be searched, but you will - need to + Tracking is currently disabled and data is not being collected. Historical data can be searched, but you will need + to edit the configuration @@ -55,8 +55,8 @@ Monthly history

- This data is presented by full month. If there is data missing, it's possible that tracking was turned off at - the time. Vault will only show data for contiguous blocks of time during which tracking was on. + This data is presented by full month. If there is data missing, it's possible that tracking was turned off at the + time. Vault will only show data for contiguous blocks of time during which tracking was on.

{{/if}} {{#if @isLoading}} - - {{else}} - {{#unless this.hasClientData}} - {{#if (eq @tab 'current')}} - {{#if (eq @model.config.enabled 'On')}} - - {{/if}} - {{else}} - - {{/if}} - {{else}} -
-
-
-
-

- Total usage -

-

- These totals are within this namespace and all its children. -

-
- - Learn more - + + {{else if this.hasClientData}} +
+
+
+
+

+ Total usage +

+

+ These totals are within this namespace and all its children. +

-
-
-
- -
-
- -
-
- + + Learn more + +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ {{#if this.showGraphs}} +
+
+ + + +
+
+
+
+ {{#if (and this.barChartSelection this.selectedNamespace)}} + +
    +
  • +
    + {{or this.selectedNamespace.namespace_path "root"}} +
    +
    + +
    +
  • +
+ {{else}} + + {{/if}} + {{#if this.selectedNamespace}} +
+
+ +
+
+
+
+ +
+
+ +
+
+ {{else}} + + {{/if}}
- {{#if this.showGraphs}} -
-
- - - -
-
-
-
- {{#if (and this.barChartSelection this.selectedNamespace)}} - -
    -
  • -
    - {{or this.selectedNamespace.namespace_path 'root'}} -
    -
    - -
    -
  • -
- {{else}} - - {{/if}} - {{#if this.selectedNamespace}} -
-
- -
-
-
-
- -
-
- -
-
- {{else}} - - {{/if}} -
-
-
-
- {{/if}} - {{/unless}} + {{/if}} + {{else if (eq @tab "current")}} + {{#if (eq @model.config.enabled "On")}} + + {{/if}} + {{else}} + {{/if}}
-{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/cluster-info.hbs b/ui/app/templates/components/cluster-info.hbs index 17e3ff1ca..3d9458647 100644 --- a/ui/app/templates/components/cluster-info.hbs +++ b/ui/app/templates/components/cluster-info.hbs @@ -2,132 +2,166 @@
{{#unless this.version.isOSS}} {{#if (and this.activeCluster.unsealed this.auth.currentToken)}} - {{#unless @cluster.dr.isSecondary}} - {{#if (has-permission 'status' routeParams='replication')}} + {{#if @cluster.dr.isSecondary}} + {{#if (has-permission "status" routeParams="replication")}} +
+ {{/if}} + {{else}} + {{#if (has-permission "status" routeParams="replication")}} + -
+
{{/if}} - {{else}} - {{#if (has-permission 'status' routeParams='replication')}} - -
- {{/if}} - {{/unless}} + {{/if}} {{/if}} {{/unless}} - + {{/if}} + {{#if (and @cluster.usingRaft (has-permission "status" routeParams="raft"))}} +
  • + {{! template-lint-disable no-unknown-arguments-for-builtin-components }} + +
    + Raft Storage + +
    +
    + {{! template-lint-enable }} +
  • + {{/if}} + + {{/if}} + {{#if (and (has-permission "clients" routeParams="activity") (not @cluster.dr.isSecondary) this.auth.currentToken)}} + + {{/if}} +
    -
    +
    \ No newline at end of file diff --git a/ui/app/templates/components/config-pki-ca.hbs b/ui/app/templates/components/config-pki-ca.hbs index 9fe0b04b8..a5499152f 100644 --- a/ui/app/templates/components/config-pki-ca.hbs +++ b/ui/app/templates/components/config-pki-ca.hbs @@ -1,45 +1,53 @@ -{{#if replaceCA}} - +{{#if this.replaceCA}} +

    - {{#if needsConfig}} + {{#if this.needsConfig}} Configure CA Certificate {{else}} Replace CA Certificate {{/if}}

    - {{#if (or model.certificate model.csr)}} - {{#if (not (eq model.canParse true))}} + {{#if (or this.model.certificate this.model.csr)}} + {{#if (not (eq this.model.canParse true))}} {{/if}} - {{#each model.attrs as |attr|}} + {{#each this.model.attrs as |attr|}} {{#if attr.options.masked}} - - + + - {{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} - + {{else if (and (get this.model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} + {{else}} - + {{/if}} {{/each}}
    - - Copy {{if model.certificate "Certificate" "CSR"}} + + Copy + {{if this.model.certificate "Certificate" "CSR"}}
    @@ -51,21 +59,23 @@ {{else}}
    - {{#if model.uploadPemBundle}} + {{#if this.model.uploadPemBundle}} {{/if}} - +
    -
    @@ -76,7 +86,7 @@
    - {{#if model.canDeleteRoot}} + {{#if this.model.canDeleteRoot}} {{/if}} -{{else if signIntermediate}} - {{#if (or model.certificate)}} +{{else if this.signIntermediate}} + {{#if (or this.model.certificate)}} - {{#each model.attrs as |attr|}} + {{#each this.model.attrs as |attr|}} {{#if attr.options.masked}} - - + + - {{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} - + {{else if (and (get this.model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} + {{else}} - + {{/if}} {{/each}}
    - + Copy Certificate
    @@ -134,15 +150,17 @@ {{else}}

    Sign intermediate

    - +
    - +
    -
    @@ -154,25 +172,36 @@
    {{/if}} -{{else if setSignedIntermediate}} +{{else if this.setSignedIntermediate}}

    Set signed intermediate

    - -

    - Submit a signed CA certificate corresponding to a generated private key. -

    + +

    + Submit a signed CA certificate corresponding to a generated private key. +

    - {{textarea data-test-signed-intermediate class="textarea" id="certificate" name="certificate" value=model.certificate}} + + data-test-pgp-file-textarea={{true}} + >{{this.key.value}}

    - {{#if textareaHelpText}} - {{textareaHelpText}} + {{#if this.textareaHelpText}} + {{this.textareaHelpText}} {{else}} Enter a base64-encoded key {{/if}} @@ -45,33 +46,35 @@

    - {{#if fileHelpText}} - {{fileHelpText}} + {{#if this.fileHelpText}} + {{this.fileHelpText}} {{else}} Select a PGP key from your computer {{/if}}

    {{/if}} -
    +
    \ No newline at end of file diff --git a/ui/app/templates/components/pgp-list.hbs b/ui/app/templates/components/pgp-list.hbs index 1873331d9..738118490 100644 --- a/ui/app/templates/components/pgp-list.hbs +++ b/ui/app/templates/components/pgp-list.hbs @@ -1,7 +1,7 @@ -{{#each listData as |key index|}} +{{#each this.listData as |key index|}} {{else}}

    Enter a number of Key Shares to enter PGP keys.

    -{{/each}} +{{/each}} \ No newline at end of file diff --git a/ui/app/templates/components/pki-cert-popup.hbs b/ui/app/templates/components/pki-cert-popup.hbs index b01766488..1d6f64744 100644 --- a/ui/app/templates/components/pki-cert-popup.hbs +++ b/ui/app/templates/components/pki-cert-popup.hbs @@ -2,19 +2,19 @@ - + \ No newline at end of file diff --git a/ui/app/templates/components/pki-cert-show.hbs b/ui/app/templates/components/pki-cert-show.hbs index 00080cef4..f68cebc24 100644 --- a/ui/app/templates/components/pki-cert-show.hbs +++ b/ui/app/templates/components/pki-cert-show.hbs @@ -1,6 +1,12 @@ - +

    @@ -8,7 +14,7 @@

    -{{#if (not (eq model.canParse true))}} +{{#if (not (eq this.model.canParse true))}} {{/if}}
    - - {{#each model.attrs as |attr|}} + + {{#each this.model.attrs as |attr|}} {{#if (eq attr.type "object")}} - + {{else}} {{#if attr.options.masked}} - - + + - {{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} - - {{else if (and (get model attr.name) (eq attr.name "revocationTime"))}} - + {{else if (and (get this.model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}} + + {{else if (and (get this.model attr.name) (eq attr.name "revocationTime"))}} + {{else}} - + {{/if}} {{/if}} {{/each}} @@ -53,7 +65,12 @@
    - + Copy credentials
    @@ -63,7 +80,7 @@
    - {{#if (and (not model.revocationTime) model.canRevoke)}} + {{#if (and (not this.model.revocationTime) this.model.canRevoke)}} {{/if}} -
    +
    \ No newline at end of file diff --git a/ui/app/templates/components/pricing-metrics-dates.hbs b/ui/app/templates/components/pricing-metrics-dates.hbs index 826405fbd..26f8b9282 100644 --- a/ui/app/templates/components/pricing-metrics-dates.hbs +++ b/ui/app/templates/components/pricing-metrics-dates.hbs @@ -5,11 +5,11 @@
    @@ -19,26 +19,28 @@
    - +
    -{{#if error}} - {{error}} +{{#if this.error}} + {{this.error}} {{/if}}
    - {{#if (and resultStart resultEnd)}} + {{#if (and this.resultStart this.resultEnd)}}

    - {{date-format resultStart "MMM dd, yyyy" dateOnly=true}} through {{date-format resultEnd "MMM dd, yyyy" dateOnly=true}} + {{date-format this.resultStart "MMM dd, yyyy" dateOnly=true}} + through + {{date-format this.resultEnd "MMM dd, yyyy" dateOnly=true}}

    {{/if}} -
    +
    \ No newline at end of file diff --git a/ui/app/templates/components/radial-progress.hbs b/ui/app/templates/components/radial-progress.hbs index 775a9ac65..0bcd24b96 100644 --- a/ui/app/templates/components/radial-progress.hbs +++ b/ui/app/templates/components/radial-progress.hbs @@ -1,20 +1,20 @@ + stroke-width={{this.strokeWidth}} +> + stroke-width={{this.strokeWidth}} + stroke-dasharray={{this.c}} + stroke-dashoffset={{this.dashArrayOffset}} +> \ No newline at end of file diff --git a/ui/app/templates/components/raft-join.hbs b/ui/app/templates/components/raft-join.hbs index 283a89b50..51a39f7eb 100644 --- a/ui/app/templates/components/raft-join.hbs +++ b/ui/app/templates/components/raft-join.hbs @@ -1,12 +1,8 @@ - +
    - Warning Vault is sealed + Warning + Vault is sealed
    @@ -26,7 +22,7 @@ />
    {{else}} -
    +

    This server is configured to use Raft Storage. @@ -37,23 +33,23 @@ - -

    diff --git a/ui/app/templates/components/raft-storage-overview.hbs b/ui/app/templates/components/raft-storage-overview.hbs index 20a605278..a93f554fb 100644 --- a/ui/app/templates/components/raft-storage-overview.hbs +++ b/ui/app/templates/components/raft-storage-overview.hbs @@ -5,85 +5,79 @@ - - - + + + - - Snapshots - - - - - - - - + {{/if}} + +
  • + + Restore + +
  • + + + + + + - - - - - - - - - - - {{#each @model as |server|}} - - + + {{/each}} + +
    AddressVoter
    - {{server.address}} - {{#if server.leader}} + + + + + + + + + + + {{#each @model as |server|}} + + - + - + - - {{/each}} - -
    AddressVoter
    + {{server.address}} + {{#if server.leader}} Leader - {{/if}} - + {{/if}} + - {{#if server.voter}} - - {{else}} - - {{/if}} - - - + {{#if server.voter}} + + {{else}} + + {{/if}} + + + - - -
    + + +
    \ No newline at end of file diff --git a/ui/app/templates/components/raft-storage-restore.hbs b/ui/app/templates/components/raft-storage-restore.hbs index 66139766a..efbe9ebaa 100644 --- a/ui/app/templates/components/raft-storage-restore.hbs +++ b/ui/app/templates/components/raft-storage-restore.hbs @@ -23,16 +23,16 @@ {{#if this.isUploading}}
    -
    - +
    {{else}}
    @@ -40,24 +40,21 @@ @type="warning" @title="This might take a while" @message="Raft snapshots can be very large files. Uploading the snapshot may take some time." - /> - + /> +

    - Bypass checks to ensure the AutoUnseal or Shamir keys are consistent with the snapshot data. + Bypass checks to ensure the AutoUnseal or Shamir keys are consistent with the snapshot data.

    @@ -67,4 +64,4 @@ @cancelLinkParams={{array "vault.cluster.storage"}} /> {{/if}} -
    + \ No newline at end of file diff --git a/ui/app/templates/components/role-aws-edit.hbs b/ui/app/templates/components/role-aws-edit.hbs index e6799c893..9c42c2a0c 100644 --- a/ui/app/templates/components/role-aws-edit.hbs +++ b/ui/app/templates/components/role-aws-edit.hbs @@ -1,47 +1,44 @@ - +

    - {{#if (eq mode "create")}} + {{#if (eq this.mode "create")}} Create an AWS Role - {{else if (eq mode 'edit')}} - Edit AWS Role {{model.id}} + {{else if (eq this.mode "edit")}} + Edit AWS Role + {{this.model.id}} {{else}} - AWS Role {{model.id}} + AWS Role + {{this.model.id}} {{/if}}

    -{{#if (eq mode "show")}} +{{#if (eq this.mode "show")}} - {{#if model.canDelete}} - + {{#if this.model.canDelete}} + Delete role -
    +
    {{/if}} - {{#if model.canGenerate}} - + {{#if this.model.canGenerate}} + Generate credentials {{/if}} - {{#if model.canEdit}} - + {{#if this.model.canEdit}} + Edit role {{/if}} @@ -49,37 +46,32 @@ {{/if}} -{{#if (or (eq mode 'edit') (eq mode 'create'))}} +{{#if (or (eq this.mode "edit") (eq this.mode "create"))}}
    - - - {{#if (gt model.credentialTypes.length 1)}} + + + {{#if (gt this.model.credentialTypes.length 1)}} {{/if}} - {{#each (if (eq mode 'edit') (drop 1 (or model.fields (array))) model.fields) as |attr|}} - {{form-field data-test-field attr=attr model=model}} + {{#each (if (eq this.mode "edit") (drop 1 (or this.model.fields (array))) this.model.fields) as |attr|}} + {{/each}}
    - - + Cancel
    @@ -87,21 +79,27 @@ {{else}}
    - {{#if (gt model.credentialTypes.length 1)}} + {{#if (gt this.model.credentialTypes.length 1)}} {{/if}} - {{#each model.fields as |attr|}} + {{#each this.model.fields as |attr|}} {{#if (eq attr.name "policyDocument")}} - -
    {{stringify (jsonify model.policyDocument)}}
    + +
    {{stringify (jsonify this.model.policyDocument)}}
    {{else}} - + {{/if}} {{/each}}
    -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/role-pki-edit.hbs b/ui/app/templates/components/role-pki-edit.hbs index cdff46be5..e8a05f3d7 100644 --- a/ui/app/templates/components/role-pki-edit.hbs +++ b/ui/app/templates/components/role-pki-edit.hbs @@ -1,91 +1,81 @@ - +

    - {{#if (eq mode "create") }} + {{#if (eq this.mode "create")}} Create a PKI Role - {{else if (eq mode 'edit')}} + {{else if (eq this.mode "edit")}} Edit PKI Role {{else}} - PKI Role {{model.id}} + PKI Role + {{this.model.id}} {{/if}}

    -{{#if (eq mode "show") }} +{{#if (eq this.mode "show")}} - {{#if model.canDelete}} - + {{#if this.model.canDelete}} + Delete role -
    +
    {{/if}} - {{#if model.canGenerate}} + {{#if this.model.canGenerate}} Generate Certificate {{/if}} - {{#if model.canSign}} + {{#if this.model.canSign}} Sign Certificate {{/if}} - {{#if model.canEdit}} - + {{#if this.model.canEdit}} + Edit role {{/if}} {{/if}} -{{#if (or (eq mode 'edit') (eq mode 'create'))}} +{{#if (or (eq this.mode "edit") (eq this.mode "create"))}}
    - - - + + +
    - - + Cancel
    @@ -93,11 +83,15 @@ {{else}}
    - {{#each model.fieldGroups as |fieldGroup|}} + {{#each this.model.fieldGroups as |fieldGroup|}} {{#each-in fieldGroup as |group fields|}} {{#if (or (eq group "default") (eq group "Options"))}} {{#each fields as |attr|}} - + {{/each}} {{else}}
    @@ -105,11 +99,15 @@ {{group}} {{#each fields as |attr|}} - + {{/each}}
    {{/if}} {{/each-in}} {{/each}}
    -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/role-ssh-edit.hbs b/ui/app/templates/components/role-ssh-edit.hbs index 2fb8c702a..2fa17fd59 100644 --- a/ui/app/templates/components/role-ssh-edit.hbs +++ b/ui/app/templates/components/role-ssh-edit.hbs @@ -1,58 +1,52 @@ - +

    - {{#if (eq mode "create") }} + {{#if (eq this.mode "create")}} Create an SSH role - {{else if (eq mode 'edit')}} + {{else if (eq this.mode "edit")}} Edit SSH role {{else}} - SSH role {{model.id}} + SSH role + {{this.model.id}} {{/if}}

    -{{#if (eq mode "show")}} +{{#if (eq this.mode "show")}} - {{#if model.canDelete}} - + {{#if this.model.canDelete}} + Delete role -
    +
    {{/if}} - {{#if (eq model.keyType "otp")}} + {{#if (eq this.model.keyType "otp")}} - Generate Credential - + Generate Credential + {{else}} - + Sign Keys {{/if}} - {{#if (or model.canUpdate model.canDelete)}} - + {{#if (or this.model.canUpdate this.model.canDelete)}} + Edit role {{/if}} @@ -60,31 +54,23 @@ {{/if}} -{{#if (or (eq mode 'edit') (eq mode 'create'))}} +{{#if (or (eq this.mode "edit") (eq this.mode "create"))}}
    - - - + + +
    - - + Cancel
    @@ -92,12 +78,18 @@ {{else}}
    - {{#each model.showFields as |attr|}} + {{#each this.model.showFields as |attr|}} {{#if (eq attr.type "object")}} - + {{else}} - + {{/if}} {{/each}}
    -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-create-or-update.hbs b/ui/app/templates/components/secret-create-or-update.hbs index bfccd5fb7..4d27a2410 100644 --- a/ui/app/templates/components/secret-create-or-update.hbs +++ b/ui/app/templates/components/secret-create-or-update.hbs @@ -1,31 +1,32 @@ {{#if (eq @mode "create")}} -
    +

    -

    - {{#if (get this.validationMessages 'path')}} - {{/if}} {{#if @modelForData.isFolder}}

    - The secret path may not end in / + The secret path may not end in + /

    {{/if}} {{#if this.pathWhiteSpaceWarning}} @@ -33,11 +34,11 @@
    - {{/if}} + {{/if}}
    {{#if @showAdvancedMode}}
    @@ -45,77 +46,79 @@ @title={{if @isV2 "Version Data" "Secret Data"}} @value={{this.codemirrorString}} @valueUpdated={{action "codemirrorUpdated"}} - @onFocusOut={{action "formatJSON"}}> - + @onFocusOut={{action "formatJSON"}} + />
    {{else}}
    - {{#each @secretData as |secret index|}} -
    -
    - +
    + +
    +
    + +
    +
    + {{#if (eq @secretData.length (inc index))}} + + {{else}} + + {{/if}} +
    +
    + {{#if this.validationMessages.key}} + -
    -
    - -
    -
    - {{#if (eq @secretData.length (inc index))}} - - {{else}} - - {{/if}} -
    -
    - {{#if this.validationMessages.key}} - - {{/if}} - {{/each}} + {{/if}} + {{/each}}
    {{/if}} - {{!-- must have UPDATE permissions to add secret metadata. Create only will not work --}} - {{#if (and @isV2 @canUpdateSecretMetadata)}} - + {{! must have UPDATE permissions to add secret metadata. Create only will not work }} + {{#if (and @isV2 @canUpdateSecretMetadata)}} + {{#if this.showMetadata}} {{/if}} - {{/if}} + {{/if}}
    @@ -145,7 +148,7 @@ {{/if}} {{#if (eq @mode "edit")}} -{{!-- no metadata option because metadata is version agnostic --}} + {{! no metadata option because metadata is version agnostic }}
    @@ -172,8 +175,8 @@ @title={{if @isV2 "Version Data" "Secret Data"}} @value={{this.codemirrorString}} @valueUpdated={{action "codemirrorUpdated"}} - @onFocusOut={{action "formatJSON"}}> - + @onFocusOut={{action "formatJSON"}} + />
    {{else}}
    @@ -184,52 +187,54 @@ Secret data {{/if}} - {{#each @secretData as |secret index|}} -
    -
    - + {{#each @secretData as |secret index|}} +
    +
    + +
    +
    + +
    +
    + {{#if (eq @secretData.length (inc index))}} + + {{else}} + + {{/if}} +
    -
    - -
    -
    - {{#if (eq @secretData.length (inc index))}} - - {{else}} - - {{/if}} -
    -
    - {{/each}} + {{/each}}
    {{/if}} -
    +
    @@ -243,11 +248,16 @@
    - + Cancel
    -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-delete-menu.hbs b/ui/app/templates/components/secret-delete-menu.hbs index fb6c6dbad..e92bdcdaf 100644 --- a/ui/app/templates/components/secret-delete-menu.hbs +++ b/ui/app/templates/components/secret-delete-menu.hbs @@ -1,28 +1,10 @@ -{{#unless @isV2}} - {{#if this.canDeleteSecretData}} - - Delete - -
    - {{/if}} -{{else}} +{{#if @isV2}} {{#if (and this.canUndeleteVersion @modelForData.deleted)}} - {{/if}} - {{#if (and (not @modelForData.deleted) (not @modelForData.destroyed)) }} + {{#if (and (not @modelForData.deleted) (not @modelForData.destroyed))}} {{#if (or this.canDestroyVersion this.canDestroyAllVersions)}} -
    +
    {{else}} {{#if (or (and this.isLatestVersion this.canDeleteSecretData) this.canSoftDeleteSecretData)}}
    {{/if}} @@ -89,7 +79,11 @@ />
    -

    Version {{@modelForData.version}} is permanently destroyed and cannot be read or recovered later.

    +

    + Version + {{@modelForData.version}} + is permanently destroyed and cannot be read or recovered later. +

    {{/if}} @@ -105,7 +99,9 @@ @radioId="destroy-all-versions" />
    - +

    All secret versions and metadata are permanently destroyed and cannot be read or recovered later.

    @@ -121,13 +117,20 @@ > Delete - -{{/unless}} +{{else if this.canDeleteSecretData}} + + Delete + +
    +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-edit-metadata.hbs b/ui/app/templates/components/secret-edit-metadata.hbs index 24392d4ae..b04c7cbcd 100644 --- a/ui/app/templates/components/secret-edit-metadata.hbs +++ b/ui/app/templates/components/secret-edit-metadata.hbs @@ -1,13 +1,17 @@
    -
    +

    - The options below are all version-agnostic; they apply to all versions of this secret. {{if (eq @mode 'create') 'After the secret is created, this can be edited in the Metadata tab.' ''}} + The options below are all version-agnostic; they apply to all versions of this secret. + {{if (eq @mode "create") "After the secret is created, this can be edited in the Metadata tab." ""}}

    {{#each @model.fields as |attr|}} {{#if (eq attr.name "customMetadata")}} - - + {{/if}} - {{#unless (eq attr.name "customMetadata")}} + {{#if (not-eq attr.name "customMetadata")}} - {{/unless}} + {{/if}} {{/each}}
    - {{#unless (eq @mode "create")}} + {{#if (not-eq @mode "create")}}
    -
    - + Cancel
    - {{/unless}} - + {{/if}} + \ No newline at end of file diff --git a/ui/app/templates/components/secret-edit-toolbar.hbs b/ui/app/templates/components/secret-edit-toolbar.hbs index e173977b0..a7df6733c 100644 --- a/ui/app/templates/components/secret-edit-toolbar.hbs +++ b/ui/app/templates/components/secret-edit-toolbar.hbs @@ -1,21 +1,22 @@ +{{! template-lint-configure simple-unless "warn" }} - {{#unless (and (eq @mode 'show') @isWriteWithoutRead)}} + {{#unless (and (eq @mode "show") @isWriteWithoutRead)}} + > JSON {{/unless}} - {{#if (eq @mode 'show')}} - {{/if}} - {{#if (and (eq @mode 'show') @canUpdateSecretData)}} - {{#let (concat 'vault.cluster.secrets.backend.' (if (eq @mode 'show') 'edit' 'show')) as |targetRoute|}} - {{#unless (and @isV2 (or @isWriteWithoutRead @modelForData.destroyed @modelForData.deleted))}} - + - - Copy - - - - + + + {{/unless}} {{/if}} {{#if (and (eq @mode "show") @isV2 (not @model.failedServerRead))}} - + {{/if}} - {{#if (and (eq @mode 'show') @canUpdateSecretData)}} - {{#let (concat 'vault.cluster.secrets.backend.' (if (eq @mode 'show') 'edit' 'show')) as |targetRoute|}} + {{#if (and (eq @mode "show") @canUpdateSecretData)}} + {{#let (concat "vault.cluster.secrets.backend." (if (eq @mode "show") "edit" "show")) as |targetRoute|}} {{#if @isV2}} {{else}} - + Edit secret {{/if}} diff --git a/ui/app/templates/components/secret-edit.hbs b/ui/app/templates/components/secret-edit.hbs index 3d42a361c..a5bdcd746 100644 --- a/ui/app/templates/components/secret-edit.hbs +++ b/ui/app/templates/components/secret-edit.hbs @@ -1,85 +1,100 @@ - +

    - {{#if (eq mode "create") }} + {{#if (eq this.mode "create")}} Create secret - {{else if (and isV2 (eq mode 'edit'))}} + {{else if (and this.isV2 (eq this.mode "edit"))}} Create new version - {{else if (eq mode 'edit')}} + {{else if (eq this.mode "edit")}} Edit secret {{else}} - {{key.id}} + {{this.key.id}} {{/if}}

    -{{!-- tabs for show only --}} -{{#if (eq mode "show")}} +{{! tabs for show only }} +{{#if (eq this.mode "show")}}
    {{/if}} -{{#if (or (eq mode "create") (eq mode "edit"))}} +{{#if (or (eq this.mode "create") (eq this.mode "edit"))}} -{{else if (eq mode "show")}} +{{else if (eq this.mode "show")}} {{else}} - -{{/if}} + +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-form-show.hbs b/ui/app/templates/components/secret-form-show.hbs index 0d992f988..238711121 100644 --- a/ui/app/templates/components/secret-form-show.hbs +++ b/ui/app/templates/components/secret-form-show.hbs @@ -21,21 +21,19 @@ - + /> {{else}} {{#if @showAdvancedMode}}
    {{else}} @@ -49,14 +47,15 @@
    - - Version created {{date-format @modelForData.createdTime 'MMM dd, yyyy hh:mm a'}} - - + + Version created + {{date-format @modelForData.createdTime "MMM dd, yyyy hh:mm a"}} + +
    {{@modelForData.createdTime}}
    -
    +
    @@ -65,17 +64,17 @@ {{#each @modelForData.secretKeyAndValue as |secret|}} {{#if secret.value}} - + {{else}} {{/if}} {{/each}} {{else}} - {{!-- In the case of no key or value will still render --}} + {{! In the case of no key or value will still render }} {{/if}} {{/if}} -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-link.hbs b/ui/app/templates/components/secret-link.hbs index de4276fd3..b5ec99307 100644 --- a/ui/app/templates/components/secret-link.hbs +++ b/ui/app/templates/components/secret-link.hbs @@ -1,16 +1,18 @@ -{{#link-to params=linkParams - class=class - data-test-secret-create=data-test-secret-create - data-test-credentials-link=data-test-credentials-link - data-test-backend-credentials=data-test-backend-credentials - data-test-edit-link=data-test-edit-link - data-test-sign-link=data-test-sign-link - data-test-transit-link=data-test-transit-link - data-test-transit-key-actions-link=data-test-transit-key-actions-link - data-test-transit-action-link=data-test-transit-action-link - data-test-version-history=data-test-version-history - data-test-version=data-test-version - invokeAction=(action onLinkClick) +{{! template-lint-configure no-curly-component-invocation "warn" }} +{{#link-to + params=this.linkParams + class=this.class + data-test-secret-create=this.data-test-secret-create + data-test-credentials-link=this.data-test-credentials-link + data-test-backend-credentials=this.data-test-backend-credentials + data-test-edit-link=this.data-test-edit-link + data-test-sign-link=this.data-test-sign-link + data-test-transit-link=this.data-test-transit-link + data-test-transit-key-actions-link=this.data-test-transit-key-actions-link + data-test-transit-action-link=this.data-test-transit-action-link + data-test-version-history=this.data-test-version-history + data-test-version=this.data-test-version + invokeAction=(action this.onLinkClick) }} {{yield}} -{{/link-to}} +{{/link-to}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list-header-tab.hbs b/ui/app/templates/components/secret-list-header-tab.hbs index 84c5dd221..55455d5a1 100644 --- a/ui/app/templates/components/secret-list-header-tab.hbs +++ b/ui/app/templates/components/secret-list-header-tab.hbs @@ -1,7 +1,14 @@ {{#unless this.dontShowTab}} - + {{! template-lint-configure no-unknown-arguments-for-builtin-components "warn" }} + {{@label}} -{{/unless}} +{{/unless}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list-header.hbs b/ui/app/templates/components/secret-list-header.hbs index 6a8b12948..5a6f06e86 100644 --- a/ui/app/templates/components/secret-list-header.hbs +++ b/ui/app/templates/components/secret-list-header.hbs @@ -1,7 +1,7 @@ {{#with (options-for-backend @model.engineType) as |options|}} - +
  • / @@ -18,7 +18,8 @@ {{@model.id}} {{#if this.isKV}} - Version {{or @model.options.version "1"}} + Version + {{or @model.options.version "1"}} {{/if}} @@ -29,7 +30,13 @@
  • -{{/linked-block}} +{{/linked-block}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/database-list-item.hbs b/ui/app/templates/components/secret-list/database-list-item.hbs index 9808f5702..3367a4daf 100644 --- a/ui/app/templates/components/secret-list/database-list-item.hbs +++ b/ui/app/templates/components/secret-list/database-list-item.hbs @@ -1,6 +1,5 @@
    - +
    - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} {{this.keyTypeValue}}
    @@ -30,10 +26,7 @@
    - + \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/item.hbs b/ui/app/templates/components/secret-list/item.hbs index 6e5661063..af13b1d01 100644 --- a/ui/app/templates/components/secret-list/item.hbs +++ b/ui/app/templates/components/secret-list/item.hbs @@ -1,9 +1,5 @@ {{#linked-block - (concat - "vault.cluster.secrets.backend." - (if @item.isFolder "list" "show") - (unless @item.id "-root") - ) + (concat "vault.cluster.secrets.backend." (if @item.isFolder "list" "show") (unless @item.id "-root")) @item.id class="list-item-row" data-test-secret-link=@item.id @@ -13,86 +9,73 @@
    - {{#if (eq @backendModel.type "transit")}} - - {{else}} - - {{/if}} - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} + @class="has-text-black has-text-weight-semibold" + > + {{#if (eq @backendModel.type "transit")}} + + {{else}} + + {{/if}} + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}}
    -
    -{{/linked-block}} +{{/linked-block}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/pki-cert-item.hbs b/ui/app/templates/components/secret-list/pki-cert-item.hbs index 799a11680..68b233d1f 100644 --- a/ui/app/templates/components/secret-list/pki-cert-item.hbs +++ b/ui/app/templates/components/secret-list/pki-cert-item.hbs @@ -1,9 +1,5 @@ {{#linked-block - (concat - "vault.cluster.secrets.backend." - "show" - (unless @item.id "-root") - ) + (concat "vault.cluster.secrets.backend." "show" (unless @item.id "-root")) @item.idForNav class="list-item-row" data-test-secret-link=@item.id @@ -12,18 +8,19 @@ }}
    - - -
    - {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} -
    + + +
    + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} +
    -{{/linked-block}} +{{/linked-block}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/pki-role-item.hbs b/ui/app/templates/components/secret-list/pki-role-item.hbs index fef744578..63cd77363 100644 --- a/ui/app/templates/components/secret-list/pki-role-item.hbs +++ b/ui/app/templates/components/secret-list/pki-role-item.hbs @@ -1,9 +1,5 @@ {{#linked-block - (concat - "vault.cluster.secrets.backend." - "credentials" - (unless @item.id "-root") - ) + (concat "vault.cluster.secrets.backend." "credentials" (unless @item.id "-root")) @item.backend @item.id queryParams=(hash action="issue") @@ -14,14 +10,16 @@ }}
    - - -
    - {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} -
    + + +
    + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} +
    @@ -40,14 +38,24 @@
    -{{/linked-block}} +{{/linked-block}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/ssh-role-item.hbs b/ui/app/templates/components/secret-list/ssh-role-item.hbs index db34a7699..0f12be372 100644 --- a/ui/app/templates/components/secret-list/ssh-role-item.hbs +++ b/ui/app/templates/components/secret-list/ssh-role-item.hbs @@ -1,9 +1,5 @@ {{#linked-block - (concat - "vault.cluster.secrets.backend." - (if (eq @item.keyType "ca") "sign" "credentials") - (unless @item.id "-root") - ) + (concat "vault.cluster.secrets.backend." (if (eq @item.keyType "ca") "sign" "credentials") (unless @item.id "-root")) @item.id class="list-item-row" data-test-secret-link=@item.id @@ -11,14 +7,19 @@ }}
    - - + +
    - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} -
    + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} +
    {{@item.keyType}} {{#if @item.zeroAddress}} Zero-Address @@ -27,12 +28,12 @@
    - {{#if (eq @backendType 'ssh')}} + {{#if (eq @backendType "ssh")}}
    -{{/linked-block}} +{{/linked-block}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/transform-list-item.hbs b/ui/app/templates/components/secret-list/transform-list-item.hbs index 5fc3d4c2c..4c98f3d07 100644 --- a/ui/app/templates/components/secret-list/transform-list-item.hbs +++ b/ui/app/templates/components/secret-list/transform-list-item.hbs @@ -8,48 +8,42 @@ queryParams=(secret-query-params @backendType) }}
    -
    - - - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} - +
    + + + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} + +
    +
    + {{#if (or @item.updatePath.canRead @item.updatePath.canUpdate)}} + + + + {{/if}} +
    -
    - {{#if (or @item.updatePath.canRead @item.updatePath.canUpdate)}} - - - - {{/if}} -
    -
    {{/linked-block}} {{else}}
    @@ -57,18 +51,16 @@
    {{#if this.isBuiltin}} - - + + {{@item.id}} - - + +
    - This is a built-in HashiCorp {{@itemType}}. It can't be viewed or edited. + This is a built-in HashiCorp + {{@itemType}}. It can't be viewed or edited.
    -
    +
    {{else}} {{@item.id}} @@ -76,5 +68,4 @@
    -{{/if}} - +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/secret-list/transform-transformation-item.hbs b/ui/app/templates/components/secret-list/transform-transformation-item.hbs index 288164d07..9f36f6c81 100644 --- a/ui/app/templates/components/secret-list/transform-transformation-item.hbs +++ b/ui/app/templates/components/secret-list/transform-transformation-item.hbs @@ -1,4 +1,4 @@ -{{!-- CBS TODO do not let click if !canRead --}} +{{! CBS TODO do not let click if !canRead }} {{#if (eq @options.item "transformation")}} {{#linked-block "vault.cluster.secrets.backend.show" @@ -9,63 +9,57 @@ queryParams=(secret-query-params @backendModel.type) }}
    -
    - - - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} - +
    + + + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}} + +
    +
    + {{#if (or @item.updatePath.canRead @item.updatePath.canUpdate)}} + + + + {{/if}} +
    -
    - {{#if (or @item.updatePath.canRead @item.updatePath.canUpdate)}} - - - - {{/if}} -
    -
    {{/linked-block}} {{else}}
    - {{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}} + {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}}
    diff --git a/ui/app/templates/components/secret-version-menu.hbs b/ui/app/templates/components/secret-version-menu.hbs index 5c560ce79..1f64086d1 100644 --- a/ui/app/templates/components/secret-version-menu.hbs +++ b/ui/app/templates/components/secret-version-menu.hbs @@ -1,63 +1,66 @@ - - - Version {{@version.version}} - - - - + + \ No newline at end of file diff --git a/ui/app/templates/components/section-tabs.hbs b/ui/app/templates/components/section-tabs.hbs index 9b578a31d..20b48ef26 100644 --- a/ui/app/templates/components/section-tabs.hbs +++ b/ui/app/templates/components/section-tabs.hbs @@ -1,18 +1,16 @@ -{{#with (tabs-for-auth-section model tabType paths) as |tabs|}} +{{#with (tabs-for-auth-section this.model this.tabType this.paths) as |tabs|}} {{#if tabs.length}}
    diff --git a/ui/app/templates/components/selectable-card.hbs b/ui/app/templates/components/selectable-card.hbs index 9080e691c..6f9272342 100644 --- a/ui/app/templates/components/selectable-card.hbs +++ b/ui/app/templates/components/selectable-card.hbs @@ -1,39 +1,39 @@ -{{!-- conditional to check if SelectableCard is apart of a CSS Grid, if yes return grid item class --}} -{{#if gridContainer}} +{{! conditional to check if SelectableCard is apart of a CSS Grid, if yes return grid item class }} +{{#if this.gridContainer}}
    -

    {{format-number total}}

    -

    {{formattedCardTitle}}

    -

    {{subText}}

    +

    {{format-number this.total}}

    +

    {{this.formattedCardTitle}}

    +

    {{this.subText}}

    {{yield}}
    {{else}} -
    - {{#unless actionCard}} -
    -

    {{format-number total}}

    -

    {{formattedCardTitle}}

    -

    {{subText}}

    -
    - {{else}} -
    -

    {{formattedCardTitle}}

    - + {{#if this.actionCard}} +
    +

    {{this.formattedCardTitle}}

    + - {{actionText}} - {{#if actionText}} + {{this.actionText}} + {{#if this.actionText}} {{/if}}
    -

    {{subText}}

    -

    {{format-number total}}

    - {{/unless}} +

    {{this.subText}}

    +

    {{format-number this.total}}

    + {{else}} +
    +

    {{format-number this.total}}

    +

    {{this.formattedCardTitle}}

    +

    {{this.subText}}

    +
    + {{/if}} {{yield}}
    -{{/if}} +{{/if}} \ No newline at end of file diff --git a/ui/app/templates/components/shamir-progress.hbs b/ui/app/templates/components/shamir-progress.hbs index eb905fda8..91b731cb8 100644 --- a/ui/app/templates/components/shamir-progress.hbs +++ b/ui/app/templates/components/shamir-progress.hbs @@ -1,10 +1,11 @@
    - {{progress}}/{{threshold}} keys provided + {{this.progress}}/{{this.threshold}} + keys provided
    - +
    -
    +
    \ No newline at end of file diff --git a/ui/app/templates/components/splash-page.hbs b/ui/app/templates/components/splash-page.hbs index 8c3dd1cd0..d6970a742 100644 --- a/ui/app/templates/components/splash-page.hbs +++ b/ui/app/templates/components/splash-page.hbs @@ -5,9 +5,9 @@ - + @@ -15,16 +15,16 @@
    - {{yield (hash header=(component 'splash-page/splash-header'))}} + {{yield (hash header=(component "splash-page/splash-header"))}}
    - {{yield (hash sub-header=(component 'splash-page/splash-header'))}} + {{yield (hash sub-header=(component "splash-page/splash-header"))}}
    - {{yield (hash footer=(component 'splash-page/splash-content')) }} + {{yield (hash footer=(component "splash-page/splash-content"))}}
    - + \ No newline at end of file diff --git a/ui/app/templates/components/splash-page/splash-content.hbs b/ui/app/templates/components/splash-page/splash-content.hbs deleted file mode 100644 index 889d9eead..000000000 --- a/ui/app/templates/components/splash-page/splash-content.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield}} diff --git a/ui/app/templates/components/splash-page/splash-footer.hbs b/ui/app/templates/components/splash-page/splash-footer.hbs deleted file mode 100644 index 889d9eead..000000000 --- a/ui/app/templates/components/splash-page/splash-footer.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield}} diff --git a/ui/app/templates/components/splash-page/splash-header.hbs b/ui/app/templates/components/splash-page/splash-header.hbs deleted file mode 100644 index 889d9eead..000000000 --- a/ui/app/templates/components/splash-page/splash-header.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield}} diff --git a/ui/app/templates/components/status-menu.hbs b/ui/app/templates/components/status-menu.hbs index b2d3a1408..89bd17fae 100644 --- a/ui/app/templates/components/status-menu.hbs +++ b/ui/app/templates/components/status-menu.hbs @@ -1,18 +1,24 @@ - - - + + +
    - {{label}} + {{this.label}}
    - -
    - - {{#if (eq type "user")}} - {{#if (and cluster.name auth.currentToken)}} - + +
    + + {{#if (eq this.type "user")}} + {{#if (and this.cluster.name this.auth.currentToken)}} + {{/if}} {{else}} - + {{/if}} - -
    + + \ No newline at end of file diff --git a/ui/app/templates/components/text-file.hbs b/ui/app/templates/components/text-file.hbs index 94dce03cb..26a6f9e1f 100644 --- a/ui/app/templates/components/text-file.hbs +++ b/ui/app/templates/components/text-file.hbs @@ -1,7 +1,7 @@ {{#unless this.inputOnly}}
    -
    \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/linkable-item/content.hbs b/ui/lib/core/addon/templates/components/linkable-item/content.hbs index c89cdcc83..fa6612c57 100644 --- a/ui/lib/core/addon/templates/components/linkable-item/content.hbs +++ b/ui/lib/core/addon/templates/components/linkable-item/content.hbs @@ -2,18 +2,14 @@
    {{#if @glyph}} - - - - + + + +
    {{or @glyphText @title}}
    -
    +
    {{/if}} @@ -24,7 +20,7 @@ @model={{@link.model}} class="has-text-black has-text-weight-semibold" data-test-secret-path - > + > {{@title}} {{else}} @@ -41,8 +37,8 @@ {{#if @description}} {{@description}} - + {{/if}} {{yield}} -
    +
    \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/linkable-item/menu.hbs b/ui/lib/core/addon/templates/components/linkable-item/menu.hbs index 50e91b3f0..2361fb7da 100644 --- a/ui/lib/core/addon/templates/components/linkable-item/menu.hbs +++ b/ui/lib/core/addon/templates/components/linkable-item/menu.hbs @@ -1,3 +1,3 @@
    - {{yield}} + {{yield}}
    \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/linked-block.hbs b/ui/lib/core/addon/templates/components/linked-block.hbs deleted file mode 100644 index 889d9eead..000000000 --- a/ui/lib/core/addon/templates/components/linked-block.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield}} diff --git a/ui/lib/core/addon/templates/components/list-item.hbs b/ui/lib/core/addon/templates/components/list-item.hbs index db971d92f..b7e38b007 100644 --- a/ui/lib/core/addon/templates/components/list-item.hbs +++ b/ui/lib/core/addon/templates/components/list-item.hbs @@ -1,8 +1,8 @@ -{{#if componentName}} - {{component componentName item=item}} -{{else if linkParams}} -
    - {{#link-to params=linkParams class="has-text-weight-semibold has-text-black is-display-flex is-flex-1 is-no-underline"}} + {{! refactor to use @route and @model args and convert to angle brackets }} + {{! template-lint-configure no-curly-component-invocation "warn" }} + {{#link-to + params=this.linkParams + class="has-text-weight-semibold has-text-black is-display-flex is-flex-1 is-no-underline" + }} {{yield (hash content=(component "list-item/content"))}} {{/link-to}} -
    +
    - {{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu" item=item hasMenu=hasMenu))}} + {{yield + (hash callMethod=this.callMethod menu=(component "list-item/popup-menu" item=this.item hasMenu=this.hasMenu)) + }}
    @@ -29,10 +36,11 @@
    - {{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu" item=item hasMenu=hasMenu))}} + {{yield + (hash callMethod=this.callMethod menu=(component "list-item/popup-menu" item=this.item hasMenu=this.hasMenu)) + }}
    -{{/if}} - +{{/if}} \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/list-item/content.hbs b/ui/lib/core/addon/templates/components/list-item/content.hbs deleted file mode 100644 index 889d9eead..000000000 --- a/ui/lib/core/addon/templates/components/list-item/content.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield}} diff --git a/ui/lib/core/addon/templates/components/list-item/popup-menu.hbs b/ui/lib/core/addon/templates/components/list-item/popup-menu.hbs index ede6cd46c..bb40c48a1 100644 --- a/ui/lib/core/addon/templates/components/list-item/popup-menu.hbs +++ b/ui/lib/core/addon/templates/components/list-item/popup-menu.hbs @@ -1,4 +1,4 @@ -{{#if hasMenu}} +{{#if this.hasMenu}}