diff --git a/ui/.eslintrc.js b/ui/.eslintrc.js index 8b55732d46..85cd6e1057 100644 --- a/ui/.eslintrc.js +++ b/ui/.eslintrc.js @@ -24,6 +24,7 @@ module.exports = { }, rules: { 'no-console': 'error', + 'prefer-const': ['error', { destructuring: 'all' }], '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 diff --git a/ui/app/adapters/application.js b/ui/app/adapters/application.js index 4d3e4e9f47..fc12d067a1 100644 --- a/ui/app/adapters/application.js +++ b/ui/app/adapters/application.js @@ -32,15 +32,16 @@ export default RESTAdapter.extend({ }, addHeaders(url, options) { - let token = options.clientToken || this.auth.currentToken; - let headers = {}; + const token = options.clientToken || this.auth.currentToken; + const headers = {}; if (token && !options.unauthenticated) { headers['X-Vault-Token'] = token; } if (options.wrapTTL) { headers['X-Vault-Wrap-TTL'] = options.wrapTTL; } - let namespace = typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; + const namespace = + typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) { headers['X-Vault-Namespace'] = namespace; } @@ -61,8 +62,8 @@ export default RESTAdapter.extend({ let url = intendedUrl; let type = method; let options = passedOptions; - let controlGroup = this.controlGroup; - let controlGroupToken = controlGroup.tokenForUrl(url); + const controlGroup = this.controlGroup; + const controlGroupToken = controlGroup.tokenForUrl(url); // if we have a Control Group token that matches the intendedUrl, // then we want to unwrap it and return the unwrapped response as // if it were the initial request @@ -77,7 +78,7 @@ export default RESTAdapter.extend({ }, }; } - let opts = this._preRequest(url, options); + const opts = this._preRequest(url, options); return this._super(url, type, opts).then((...args) => { if (controlGroupToken) { @@ -85,7 +86,7 @@ export default RESTAdapter.extend({ } const [resp] = args; if (resp && resp.warnings) { - let flash = this.flashMessages; + const flash = this.flashMessages; resp.warnings.forEach((message) => { flash.info(message); }); @@ -96,7 +97,7 @@ export default RESTAdapter.extend({ // for use on endpoints that don't return JSON responses rawRequest(url, type, options = {}) { - let opts = this._preRequest(url, options); + const opts = this._preRequest(url, options); return fetch(url, { method: type || 'GET', headers: opts.headers || {}, diff --git a/ui/app/adapters/auth-method.js b/ui/app/adapters/auth-method.js index dc7a5e1229..2d722f5777 100644 --- a/ui/app/adapters/auth-method.js +++ b/ui/app/adapters/auth-method.js @@ -16,9 +16,9 @@ export default ApplicationAdapter.extend({ }, findAll(store, type, sinceToken, snapshotRecordArray) { - let isUnauthenticated = snapshotRecordArray?.adapterOptions?.unauthenticated; + const isUnauthenticated = snapshotRecordArray?.adapterOptions?.unauthenticated; if (isUnauthenticated) { - let url = `/${this.urlPrefix()}/internal/ui/mounts`; + const url = `/${this.urlPrefix()}/internal/ui/mounts`; return this.ajax(url, 'GET', { unauthenticated: true, }) diff --git a/ui/app/adapters/aws-credential.js b/ui/app/adapters/aws-credential.js index ff8309973b..463411a1ee 100644 --- a/ui/app/adapters/aws-credential.js +++ b/ui/app/adapters/aws-credential.js @@ -2,12 +2,12 @@ import ApplicationAdapter from './application'; export default ApplicationAdapter.extend({ createRecord(store, type, snapshot) { - let ttl = snapshot.attr('ttl'); - let roleArn = snapshot.attr('roleArn'); - let roleType = snapshot.attr('credentialType'); + const ttl = snapshot.attr('ttl'); + const roleArn = snapshot.attr('roleArn'); + const roleType = snapshot.attr('credentialType'); let method = 'POST'; let options; - let data = {}; + const data = {}; if (roleType === 'iam_user') { method = 'GET'; } else { @@ -19,8 +19,8 @@ export default ApplicationAdapter.extend({ } options = data.ttl || data.role_arn ? { data } : {}; } - let role = snapshot.attr('role'); - let url = `/v1/${role.backend}/creds/${role.name}`; + const role = snapshot.attr('role'); + const url = `/v1/${role.backend}/creds/${role.name}`; return this.ajax(url, method, options).then((response) => { response.id = snapshot.id; diff --git a/ui/app/adapters/clients/activity.js b/ui/app/adapters/clients/activity.js index b387b892e8..a8990b4632 100644 --- a/ui/app/adapters/clients/activity.js +++ b/ui/app/adapters/clients/activity.js @@ -8,14 +8,14 @@ export default Application.extend({ let { start_time, end_time } = query; // check if it's an array, if it is, it's coming from an action like selecting a new startTime or new EndTime if (Array.isArray(start_time)) { - let startYear = Number(start_time[0]); - let startMonth = Number(start_time[1]); + const startYear = Number(start_time[0]); + const startMonth = Number(start_time[1]); start_time = formatRFC3339(new Date(startYear, startMonth, 10)); } if (end_time) { if (Array.isArray(end_time)) { - let endYear = Number(end_time[0]); - let endMonth = Number(end_time[1]); + const endYear = Number(end_time[0]); + const endMonth = Number(end_time[1]); end_time = formatRFC3339(new Date(endYear, endMonth, 20)); } @@ -30,12 +30,12 @@ export default Application.extend({ // end_time: (2) ['2022', 0] // start_time: (2) ['2021', 2] queryRecord(store, type, query) { - let url = `${this.buildURL()}/internal/counters/activity`; + const url = `${this.buildURL()}/internal/counters/activity`; // check if start and/or end times are in RFC3395 format, if not convert with timezone UTC/zulu. - let queryParams = this.formatTimeParams(query); + const queryParams = this.formatTimeParams(query); if (queryParams) { return this.ajax(url, 'GET', { data: queryParams }).then((resp) => { - let response = resp || {}; + const response = resp || {}; response.id = response.request_id || 'no-data'; return response; }); diff --git a/ui/app/adapters/clients/monthly.js b/ui/app/adapters/clients/monthly.js index a960e91aae..a1f3c5e1ce 100644 --- a/ui/app/adapters/clients/monthly.js +++ b/ui/app/adapters/clients/monthly.js @@ -2,10 +2,10 @@ import ApplicationAdapter from '../application'; export default class MonthlyAdapter extends ApplicationAdapter { queryRecord() { - let url = `${this.buildURL()}/internal/counters/activity/monthly`; + const url = `${this.buildURL()}/internal/counters/activity/monthly`; // Query has startTime defined. The API will return the endTime if none is provided. return this.ajax(url, 'GET').then((resp) => { - let response = resp || {}; + const response = resp || {}; response.id = response.request_id || 'no-data'; return response; }); diff --git a/ui/app/adapters/cluster.js b/ui/app/adapters/cluster.js index 3c53106d71..9045520838 100644 --- a/ui/app/adapters/cluster.js +++ b/ui/app/adapters/cluster.js @@ -38,7 +38,7 @@ export default ApplicationAdapter.extend({ }, findRecord(store, type, id, snapshot) { - let fetches = { + const fetches = { health: this.health(), sealStatus: this.sealStatus().catch((e) => e), }; @@ -110,7 +110,7 @@ export default ApplicationAdapter.extend({ const { role, jwt, token, password, username, path, nonce } = data; const url = this.urlForAuth(backend, username, path); const verb = backend === 'token' ? 'GET' : 'POST'; - let options = { + const options = { unauthenticated: true, }; if (backend === 'token') { diff --git a/ui/app/adapters/control-group.js b/ui/app/adapters/control-group.js index 9b88ab50d7..07cae1d735 100644 --- a/ui/app/adapters/control-group.js +++ b/ui/app/adapters/control-group.js @@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({ }, findRecord(store, type, id) { - let baseUrl = this.buildURL(type.modelName); + const baseUrl = this.buildURL(type.modelName); return this.ajax(`${baseUrl}/request`, 'POST', { data: { accessor: id, @@ -18,7 +18,7 @@ export default ApplicationAdapter.extend({ }, urlForUpdateRecord(id, modelName) { - let base = this.buildURL(modelName); + const base = this.buildURL(modelName); return `${base}/authorize`; }, }); diff --git a/ui/app/adapters/database/connection.js b/ui/app/adapters/database/connection.js index 477458dc54..1946cf6cfc 100644 --- a/ui/app/adapters/database/connection.js +++ b/ui/app/adapters/database/connection.js @@ -16,7 +16,7 @@ export default ApplicationAdapter.extend({ return url; }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/database/role.js b/ui/app/adapters/database/role.js index cb7a81cbd6..a95efb802e 100644 --- a/ui/app/adapters/database/role.js +++ b/ui/app/adapters/database/role.js @@ -53,7 +53,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } @@ -83,9 +83,9 @@ export default ApplicationAdapter.extend({ } // Names are distinct across both types of role, // so only one request should ever come back with value - let type = staticResp.value ? 'static' : 'dynamic'; - let successful = staticResp.value || dynamicResp.value; - let resp = { + const type = staticResp.value ? 'static' : 'dynamic'; + const successful = staticResp.value || dynamicResp.value; + const resp = { data: {}, backend, id, @@ -105,7 +105,7 @@ export default ApplicationAdapter.extend({ const dynamicReq = this.dynamicRoles(backend); return allSettled([staticReq, dynamicReq]).then(([staticResp, dynamicResp]) => { - let resp = { + const resp = { backend, data: { keys: [] }, }; @@ -139,7 +139,7 @@ export default ApplicationAdapter.extend({ async _updateAllowedRoles(store, { role, backend, db, type = 'add' }) { const connection = await store.queryRecord('database/connection', { backend, id: db }); - let roles = [...connection.allowed_roles]; + const roles = [...connection.allowed_roles]; const allowedRoles = type === 'add' ? addToArray([roles, role]) : removeFromArray([roles, role]); connection.allowed_roles = allowedRoles; return connection.save(); diff --git a/ui/app/adapters/generated-item-list.js b/ui/app/adapters/generated-item-list.js index 2fc79ab817..472d582c91 100644 --- a/ui/app/adapters/generated-item-list.js +++ b/ui/app/adapters/generated-item-list.js @@ -11,14 +11,14 @@ export default ApplicationAdapter.extend({ getDynamicApiPath: task(function* (id) { // TODO: remove yield at some point. - let result = yield this.store.peekRecord('auth-method', id); + const result = yield this.store.peekRecord('auth-method', id); this.dynamicApiPath = result.apiPath; return; }), fetchByQuery: task(function* (store, query, isList) { const { id } = query; - let data = {}; + const data = {}; if (isList) { data.list = true; yield this.getDynamicApiPath.perform(id); diff --git a/ui/app/adapters/identity/entity-merge.js b/ui/app/adapters/identity/entity-merge.js index f087244c5f..9705bc7b3e 100644 --- a/ui/app/adapters/identity/entity-merge.js +++ b/ui/app/adapters/identity/entity-merge.js @@ -3,7 +3,7 @@ import IdentityAdapter from './base'; export default IdentityAdapter.extend({ buildURL() { // first arg is modelName which we're hardcoding in the call to _super. - let [, ...args] = arguments; + const [, ...args] = arguments; return this._super('identity/entity/merge', ...args); }, diff --git a/ui/app/adapters/identity/entity.js b/ui/app/adapters/identity/entity.js index 3449b48b4e..1686a69dda 100644 --- a/ui/app/adapters/identity/entity.js +++ b/ui/app/adapters/identity/entity.js @@ -2,11 +2,11 @@ import IdentityAdapter from './base'; export default IdentityAdapter.extend({ lookup(store, data) { - let url = `/${this.urlPrefix()}/identity/lookup/entity`; + const url = `/${this.urlPrefix()}/identity/lookup/entity`; return this.ajax(url, 'POST', { data }).then((response) => { // unsuccessful lookup is a 204 if (!response) return; - let modelName = 'identity/entity'; + const modelName = 'identity/entity'; store.push( store .serializerFor(modelName) diff --git a/ui/app/adapters/identity/group.js b/ui/app/adapters/identity/group.js index 6f4ffbc826..791079419a 100644 --- a/ui/app/adapters/identity/group.js +++ b/ui/app/adapters/identity/group.js @@ -2,11 +2,11 @@ import IdentityAdapter from './base'; export default IdentityAdapter.extend({ lookup(store, data) { - let url = `/${this.urlPrefix()}/identity/lookup/group`; + const url = `/${this.urlPrefix()}/identity/lookup/group`; return this.ajax(url, 'POST', { data }).then((response) => { // unsuccessful lookup is a 204 if (!response) return; - let modelName = 'identity/group'; + const modelName = 'identity/group'; store.push( store .serializerFor(modelName) diff --git a/ui/app/adapters/keymgmt/key.js b/ui/app/adapters/keymgmt/key.js index 0eebdd816e..17f0283d2a 100644 --- a/ui/app/adapters/keymgmt/key.js +++ b/ui/app/adapters/keymgmt/key.js @@ -47,13 +47,13 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter { _updateKey(backend, name, serialized) { // Only these two attributes are allowed to be updated - let data = pickKeys(serialized, ['deletion_allowed', 'min_enabled_version']); + const data = pickKeys(serialized, ['deletion_allowed', 'min_enabled_version']); return this.ajax(this.url(backend, name), 'PUT', { data }); } _createKey(backend, name, serialized) { // Only type is allowed on create - let data = pickKeys(serialized, ['type']); + const data = pickKeys(serialized, ['type']); return this.ajax(this.url(backend, name), 'POST', { data }); } @@ -159,7 +159,7 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter { } async rotateKey(backend, id) { - let keyModel = this.store.peekRecord('keymgmt/key', id); + const keyModel = this.store.peekRecord('keymgmt/key', id); const result = await this.ajax(this.url(backend, id, 'ROTATE'), 'PUT'); await keyModel.reload(); return result; diff --git a/ui/app/adapters/kmip/base.js b/ui/app/adapters/kmip/base.js index d6dcbe202b..d413219aa7 100644 --- a/ui/app/adapters/kmip/base.js +++ b/ui/app/adapters/kmip/base.js @@ -8,8 +8,8 @@ export default ApplicationAdapter.extend({ }, _url(modelType, meta = {}, id) { - let { backend, scope, role } = meta; - let type = this.pathForType(modelType); + const { backend, scope, role } = meta; + const type = this.pathForType(modelType); let base; switch (type) { case 'scope': @@ -33,7 +33,7 @@ export default ApplicationAdapter.extend({ }, urlForQuery(query, modelType) { - let base = this._url(modelType, query); + const base = this._url(modelType, query); return base + '?list=true'; }, @@ -47,7 +47,7 @@ export default ApplicationAdapter.extend({ }, queryRecord(store, type, query) { - let id = query.id; + const id = query.id; delete query.id; return this.ajax(this._url(type.modelName, query, id), 'GET').then((resp) => { resp.id = id; diff --git a/ui/app/adapters/kmip/ca.js b/ui/app/adapters/kmip/ca.js index bc07c11c0d..ee8c7473e1 100644 --- a/ui/app/adapters/kmip/ca.js +++ b/ui/app/adapters/kmip/ca.js @@ -2,7 +2,7 @@ import BaseAdapter from './base'; export default BaseAdapter.extend({ urlForFindRecord(id, modelName, snapshot) { - let name = this.pathForType(modelName); + const name = this.pathForType(modelName); return this.buildURL(id, name, snapshot); }, }); diff --git a/ui/app/adapters/kmip/config.js b/ui/app/adapters/kmip/config.js index 32f27803f8..8f4452e515 100644 --- a/ui/app/adapters/kmip/config.js +++ b/ui/app/adapters/kmip/config.js @@ -2,7 +2,7 @@ import BaseAdapter from './base'; export default BaseAdapter.extend({ _url(id, modelName, snapshot) { - let name = this.pathForType(modelName); + const name = this.pathForType(modelName); // id here will be the mount path, // modelName will be config so we want to transpose the first two call args return this.buildURL(id, name, snapshot); diff --git a/ui/app/adapters/kmip/role.js b/ui/app/adapters/kmip/role.js index 31667bf3f2..4f19aad46c 100644 --- a/ui/app/adapters/kmip/role.js +++ b/ui/app/adapters/kmip/role.js @@ -4,8 +4,8 @@ import { getProperties } from '@ember/object'; export default BaseAdapter.extend({ createRecord(store, type, snapshot) { - let name = snapshot.id || snapshot.attr('name'); - let url = this._url( + const name = snapshot.id || snapshot.attr('name'); + const url = this._url( type.modelName, { backend: snapshot.record.backend, @@ -24,8 +24,8 @@ export default BaseAdapter.extend({ }, deleteRecord(store, type, snapshot) { - let name = snapshot.id || snapshot.attr('name'); - let url = this._url( + const name = snapshot.id || snapshot.attr('name'); + const url = this._url( type.modelName, { backend: snapshot.record.backend, @@ -39,10 +39,10 @@ export default BaseAdapter.extend({ serialize(snapshot) { // the endpoint here won't allow sending `operation_all` and `operation_none` at the same time or with // other operation_ values, so we manually check for them and send an abbreviated object - let json = snapshot.serialize(); - let keys = snapshot.record.nonOperationFields.map(decamelize); - let nonOperationFields = getProperties(json, keys); - for (let field in nonOperationFields) { + const json = snapshot.serialize(); + const keys = snapshot.record.nonOperationFields.map(decamelize); + const nonOperationFields = getProperties(json, keys); + for (const field in nonOperationFields) { if (nonOperationFields[field] == null) { delete nonOperationFields[field]; } diff --git a/ui/app/adapters/kmip/scope.js b/ui/app/adapters/kmip/scope.js index 2bd8f3c190..96a6dcb9bd 100644 --- a/ui/app/adapters/kmip/scope.js +++ b/ui/app/adapters/kmip/scope.js @@ -2,7 +2,7 @@ import BaseAdapter from './base'; export default BaseAdapter.extend({ createRecord(store, type, snapshot) { - let name = snapshot.attr('name'); + const name = snapshot.attr('name'); return this.ajax(this._url(type.modelName, { backend: snapshot.record.backend }, name), 'POST').then( () => { return { diff --git a/ui/app/adapters/lease.js b/ui/app/adapters/lease.js index 163e71a905..5311671fc1 100644 --- a/ui/app/adapters/lease.js +++ b/ui/app/adapters/lease.js @@ -15,7 +15,7 @@ export default ApplicationAdapter.extend({ }, renew(lease_id, increment) { - let url = this.buildURL() + '/leases/renew'; + const url = this.buildURL() + '/leases/renew'; return this.ajax(url, 'PUT', { data: { lease_id, diff --git a/ui/app/adapters/mfa-method.js b/ui/app/adapters/mfa-method.js index fb5fc310de..87651dcb77 100644 --- a/ui/app/adapters/mfa-method.js +++ b/ui/app/adapters/mfa-method.js @@ -46,7 +46,7 @@ export default class MfaMethodAdapter extends ApplicationAdapter { buildURL(modelName, id, snapshot, requestType) { if (requestType === 'POST') { - let url = `${super.buildURL(modelName)}/${snapshot.attr('type')}`; + const url = `${super.buildURL(modelName)}/${snapshot.attr('type')}`; return id ? `${url}/${id}` : url; } return super.buildURL(...arguments); diff --git a/ui/app/adapters/mfa-setup.js b/ui/app/adapters/mfa-setup.js index c22561ef28..806249a88a 100644 --- a/ui/app/adapters/mfa-setup.js +++ b/ui/app/adapters/mfa-setup.js @@ -2,12 +2,12 @@ import ApplicationAdapter from './application'; export default class MfaSetupAdapter extends ApplicationAdapter { adminGenerate(data) { - let url = `/v1/identity/mfa/method/totp/admin-generate`; + const url = `/v1/identity/mfa/method/totp/admin-generate`; return this.ajax(url, 'POST', { data }); } adminDestroy(data) { - let url = `/v1/identity/mfa/method/totp/admin-destroy`; + const url = `/v1/identity/mfa/method/totp/admin-destroy`; return this.ajax(url, 'POST', { data }); } } diff --git a/ui/app/adapters/named-path.js b/ui/app/adapters/named-path.js index 383fa75b5b..63c93e5b83 100644 --- a/ui/app/adapters/named-path.js +++ b/ui/app/adapters/named-path.js @@ -18,8 +18,8 @@ export default class NamedPathAdapter extends ApplicationAdapter { // create does not return response similar to PUT request createRecord() { - let [store, { modelName }, snapshot] = arguments; - let name = snapshot.attr('name'); + const [store, { modelName }, snapshot] = arguments; + const name = snapshot.attr('name'); // throw error if user attempts to create a record with same name, otherwise POST request silently overrides (updates) the existing model if (store.hasRecordForId(modelName, name)) { throw new Error(`A record already exists with the name: ${name}`); @@ -51,7 +51,7 @@ export default class NamedPathAdapter extends ApplicationAdapter { // * 'paramKey' is a string of the param name (model attr) we're filtering for, e.g. 'client_id' // * 'filterFor' is an array of values to filter for (value type must match the attr type), e.g. array of ID strings // * 'allowed_client_id' is a valid query param to the /provider endpoint - let queryParams = { list: true, ...(allowed_client_id && { allowed_client_id }) }; + const queryParams = { list: true, ...(allowed_client_id && { allowed_client_id }) }; const response = await this.ajax(url, 'GET', { data: queryParams }); // filter LIST response only if key_info exists and query includes both 'paramKey' & 'filterFor' diff --git a/ui/app/adapters/namespace.js b/ui/app/adapters/namespace.js index 2c9d8a97e4..ff8eff59bf 100644 --- a/ui/app/adapters/namespace.js +++ b/ui/app/adapters/namespace.js @@ -12,12 +12,12 @@ export default ApplicationAdapter.extend({ }, urlForCreateRecord(modelName, snapshot) { - let id = snapshot.attr('path'); + const id = snapshot.attr('path'); return this.buildURL(modelName, id); }, createRecord(store, type, snapshot) { - let id = snapshot.attr('path'); + const id = snapshot.attr('path'); return this._super(...arguments).then(() => { return { id }; }); diff --git a/ui/app/adapters/pki/cert.js b/ui/app/adapters/pki/cert.js index 321c406809..ca80b9f7fb 100644 --- a/ui/app/adapters/pki/cert.js +++ b/ui/app/adapters/pki/cert.js @@ -14,7 +14,7 @@ export default Adapter.extend({ return url; }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/pki/pki-config.js b/ui/app/adapters/pki/pki-config.js index c94d30d1c7..203b1b0afb 100644 --- a/ui/app/adapters/pki/pki-config.js +++ b/ui/app/adapters/pki/pki-config.js @@ -23,7 +23,7 @@ export default ApplicationAdapter.extend({ return; } const data = snapshot.adapterOptions.fields.reduce((data, field) => { - let attr = snapshot.attr(field); + const attr = snapshot.attr(field); if (attr) { serializer.serializeAttribute(snapshot, data, field, attr); } else { @@ -32,7 +32,7 @@ export default ApplicationAdapter.extend({ return data; }, {}); return this.ajax(url, 'POST', { data }).then((resp) => { - let response = resp || {}; + const response = resp || {}; response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`; return response; }); diff --git a/ui/app/adapters/pki/pki-issuer-engine.js b/ui/app/adapters/pki/pki-issuer-engine.js index af3bd0f037..a6aa65cb27 100644 --- a/ui/app/adapters/pki/pki-issuer-engine.js +++ b/ui/app/adapters/pki/pki-issuer-engine.js @@ -5,7 +5,7 @@ export default class PkiIssuerEngineAdapter extends ApplicationAdapter { namespace = 'v1'; optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/pki/pki-key-engine.js b/ui/app/adapters/pki/pki-key-engine.js index 98982ca202..456dfaa776 100644 --- a/ui/app/adapters/pki/pki-key-engine.js +++ b/ui/app/adapters/pki/pki-key-engine.js @@ -5,7 +5,7 @@ export default class PkiKeyEngineAdapter extends ApplicationAdapter { namespace = 'v1'; optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/pki/pki-role-engine.js b/ui/app/adapters/pki/pki-role-engine.js index 691c1de805..5c39f4ed4d 100644 --- a/ui/app/adapters/pki/pki-role-engine.js +++ b/ui/app/adapters/pki/pki-role-engine.js @@ -14,7 +14,7 @@ export default class PkiRoleEngineAdapter extends ApplicationAdapter { } _optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/pki/pki-role.js b/ui/app/adapters/pki/pki-role.js index 44f0163c03..80e2c06fed 100644 --- a/ui/app/adapters/pki/pki-role.js +++ b/ui/app/adapters/pki/pki-role.js @@ -9,7 +9,7 @@ export default ApplicationAdapter.extend({ const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot, requestType); const { id } = snapshot; - let url = this.urlForRole(snapshot.record.get('backend'), id); + const url = this.urlForRole(snapshot.record.get('backend'), id); return this.ajax(url, 'POST', { data }); }, @@ -40,7 +40,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/policy.js b/ui/app/adapters/policy.js index 99509c6edc..baac358259 100644 --- a/ui/app/adapters/policy.js +++ b/ui/app/adapters/policy.js @@ -4,7 +4,7 @@ import ApplicationAdapter from './application'; export default ApplicationAdapter.extend({ namespace: 'v1/sys', pathForType(type) { - let path = type.replace('policy', 'policies'); + const path = type.replace('policy', 'policies'); return path; }, diff --git a/ui/app/adapters/replication-mode.js b/ui/app/adapters/replication-mode.js index ed2134d525..7d721abeb3 100644 --- a/ui/app/adapters/replication-mode.js +++ b/ui/app/adapters/replication-mode.js @@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({ }, fetchStatus(mode) { - let url = this.getStatusUrl(mode); + const url = this.getStatusUrl(mode); 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 ad40d848b4..44a5fc774a 100644 --- a/ui/app/adapters/role-aws.js +++ b/ui/app/adapters/role-aws.js @@ -9,7 +9,7 @@ export default ApplicationAdapter.extend({ const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot, requestType); const { id } = snapshot; - let url = this.urlForRole(snapshot.record.get('backend'), id); + const url = this.urlForRole(snapshot.record.get('backend'), id); return this.ajax(url, 'POST', { data }); }, @@ -40,7 +40,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/adapters/role-jwt.js b/ui/app/adapters/role-jwt.js index d510c525e5..5474901771 100644 --- a/ui/app/adapters/role-jwt.js +++ b/ui/app/adapters/role-jwt.js @@ -9,8 +9,8 @@ export default ApplicationAdapter.extend({ let [path, role] = JSON.parse(id); path = encodePath(path); - let namespace = snapshot?.adapterOptions.namespace; - let url = `/v1/auth/${path}/oidc/auth_url`; + const namespace = snapshot?.adapterOptions.namespace; + const url = `/v1/auth/${path}/oidc/auth_url`; let redirect_uri = `${window.location.origin}${this.router.urlFor('vault.cluster.oidc-callback', { auth_path: path, })}`; diff --git a/ui/app/adapters/role-ssh.js b/ui/app/adapters/role-ssh.js index f3029114e6..3d62279ddb 100644 --- a/ui/app/adapters/role-ssh.js +++ b/ui/app/adapters/role-ssh.js @@ -10,7 +10,7 @@ export default ApplicationAdapter.extend({ const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot, requestType); const { id } = snapshot; - let url = this.urlForRole(snapshot.record.get('backend'), id); + const url = this.urlForRole(snapshot.record.get('backend'), id); return this.ajax(url, 'POST', { data }); }, @@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } @@ -61,7 +61,7 @@ export default ApplicationAdapter.extend({ if (!results[0].value) { throw results[0].reason; } - let resp = { + const resp = { id, name: id, backend, diff --git a/ui/app/adapters/secret-engine.js b/ui/app/adapters/secret-engine.js index 3f10ac3a1a..dd0c14738d 100644 --- a/ui/app/adapters/secret-engine.js +++ b/ui/app/adapters/secret-engine.js @@ -54,7 +54,7 @@ export default ApplicationAdapter.extend({ data.config.id = path; // config relationship needs an id so use path for now if (data.type === 'kv' && data.options.version === 2) { // data has both data for sys mount and the config, we need to separate them - let splitObjects = splitObject(data, ['max_versions', 'delete_version_after', 'cas_required']); + const splitObjects = splitObject(data, ['max_versions', 'delete_version_after', 'cas_required']); let configData; [configData, data] = splitObjects; @@ -116,13 +116,13 @@ export default ApplicationAdapter.extend({ }, saveAWSRoot(store, type, snapshot) { - let { data } = snapshot.adapterOptions; + const { data } = snapshot.adapterOptions; const path = encodePath(snapshot.id); return this.ajax(`/v1/${path}/config/root`, 'POST', { data }); }, saveAWSLease(store, type, snapshot) { - let { data } = snapshot.adapterOptions; + const { data } = snapshot.adapterOptions; const path = encodePath(snapshot.id); return this.ajax(`/v1/${path}/config/lease`, 'POST', { data }); }, diff --git a/ui/app/adapters/secret.js b/ui/app/adapters/secret.js index be9ac495f3..6a21fdb83c 100644 --- a/ui/app/adapters/secret.js +++ b/ui/app/adapters/secret.js @@ -43,7 +43,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id, action, wrapTTL) { - let data = {}; + const data = {}; if (action === 'query') { data.list = true; } diff --git a/ui/app/adapters/server.js b/ui/app/adapters/server.js index b7c7cda60b..658932a23c 100644 --- a/ui/app/adapters/server.js +++ b/ui/app/adapters/server.js @@ -12,8 +12,8 @@ export default ApplicationAdapter.extend({ return '/v1/sys/storage/raft/remove-peer'; }, deleteRecord(store, type, snapshot) { - let server_id = snapshot.attr('nodeId'); - let url = '/v1/sys/storage/raft/remove-peer'; + const server_id = snapshot.attr('nodeId'); + const url = '/v1/sys/storage/raft/remove-peer'; return this.ajax(url, 'POST', { data: { server_id } }); }, }); diff --git a/ui/app/adapters/transform.js b/ui/app/adapters/transform.js index 351b5551c1..5c82cdf72f 100644 --- a/ui/app/adapters/transform.js +++ b/ui/app/adapters/transform.js @@ -10,7 +10,7 @@ export default ApplicationAdapter.extend({ const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot); const { id } = snapshot; - let url = this.urlForTransformations(snapshot.record.get('backend'), id); + const url = this.urlForTransformations(snapshot.record.get('backend'), id); return this.ajax(url, 'POST', { data }); }, @@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } @@ -57,7 +57,7 @@ export default ApplicationAdapter.extend({ if (!results[0].value) { throw results[0].reason; } - let resp = { + const resp = { id, name: id, backend, diff --git a/ui/app/adapters/transform/base.js b/ui/app/adapters/transform/base.js index 7673085a44..dfdaeb486f 100644 --- a/ui/app/adapters/transform/base.js +++ b/ui/app/adapters/transform/base.js @@ -12,7 +12,7 @@ export default ApplicationAdapter.extend({ const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot); const { id } = snapshot; - let url = this.url(snapshot.record.get('backend'), type.modelName, id); + const url = this.url(snapshot.record.get('backend'), type.modelName, id); return this.ajax(url, 'POST', { data }); }, @@ -31,8 +31,8 @@ export default ApplicationAdapter.extend({ }, url(backend, modelType, id) { - let type = this.pathForType(modelType); - let url = `/${this.namespace}/${encodePath(backend)}/${encodePath(type)}`; + const type = this.pathForType(modelType); + const url = `/${this.namespace}/${encodePath(backend)}/${encodePath(type)}`; if (id) { return `${url}/${encodePath(id)}`; } diff --git a/ui/app/adapters/transit-key.js b/ui/app/adapters/transit-key.js index c88babb0c6..9c174235fe 100644 --- a/ui/app/adapters/transit-key.js +++ b/ui/app/adapters/transit-key.js @@ -8,14 +8,14 @@ export default ApplicationAdapter.extend({ createOrUpdate(store, type, snapshot, requestType) { const serializer = store.serializerFor(type.modelName); const data = serializer.serialize(snapshot, requestType); - let name = snapshot.attr('name'); + const name = snapshot.attr('name'); let url = this.urlForSecret(snapshot.record.get('backend'), name); if (requestType === 'update') { url = url + '/config'; } return this.ajax(url, 'POST', { data }).then((resp) => { - let response = resp || {}; + const response = resp || {}; response.id = name; return response; }); @@ -59,7 +59,7 @@ export default ApplicationAdapter.extend({ }, urlForAction(action, backend, id, param) { - let urlBase = `${this.buildURL()}/${encodePath(backend)}/${action}`; + const urlBase = `${this.buildURL()}/${encodePath(backend)}/${action}`; // these aren't key-specific if (action === 'hash' || action === 'random') { return urlBase; @@ -69,7 +69,7 @@ export default ApplicationAdapter.extend({ return `${urlBase}/${param}/${encodePath(id)}`; } if (action === 'export' && param) { - let [type, version] = param; + const [type, version] = param; const exportBase = `${urlBase}/${type}-key/${encodePath(id)}`; return version ? `${exportBase}/${version}` : exportBase; } @@ -77,7 +77,7 @@ export default ApplicationAdapter.extend({ }, optionsForQuery(id) { - let data = {}; + const data = {}; if (!id) { data['list'] = true; } diff --git a/ui/app/components/auth-config-form/options.js b/ui/app/components/auth-config-form/options.js index a0ccfb1ea6..191c9c1365 100644 --- a/ui/app/components/auth-config-form/options.js +++ b/ui/app/components/auth-config-form/options.js @@ -24,7 +24,7 @@ export default AuthConfigComponent.extend({ saveModel: task( waitFor(function* () { - let data = this.model.config.serialize(); + const 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' diff --git a/ui/app/components/auth-form.js b/ui/app/components/auth-form.js index c5ebc4c7b3..48df029f79 100644 --- a/ui/app/components/auth-form.js +++ b/ui/app/components/auth-form.js @@ -59,7 +59,7 @@ export default Component.extend(DEFAULTS, { didReceiveAttrs() { this._super(...arguments); - let { + const { wrappedToken: token, oldWrappedToken: oldToken, oldNamespace: oldNS, @@ -94,13 +94,13 @@ export default Component.extend(DEFAULTS, { didRender() { this._super(...arguments); // on very narrow viewports the active tab may be overflowed, so we scroll it into view here - let activeEle = this.element.querySelector('li.is-active'); + const activeEle = this.element.querySelector('li.is-active'); if (activeEle) { activeEle.scrollIntoView(); } next(() => { - let firstMethod = this.firstMethod(); + const firstMethod = this.firstMethod(); // set `with` to the first method if ( !this.wrappedToken && @@ -113,7 +113,7 @@ export default Component.extend(DEFAULTS, { }, firstMethod() { - let firstMethod = this.methodsToShow.firstObject; + const firstMethod = this.methodsToShow.firstObject; if (!firstMethod) return; // prefer backends with a path over those with a type return firstMethod.path || firstMethod.type; @@ -154,7 +154,7 @@ export default Component.extend(DEFAULTS, { } let type = this.selectedAuthBackend.type || 'token'; type = type.toLowerCase(); - let templateName = dasherize(type); + const templateName = dasherize(type); return templateName; }), @@ -163,8 +163,8 @@ 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 () { - let hasMethodsWithPath = this.hasMethodsWithPath; - let methodsToShow = this.methodsToShow; + const hasMethodsWithPath = this.hasMethodsWithPath; + const methodsToShow = this.methodsToShow; return hasMethodsWithPath ? methodsToShow.concat(BACKENDS) : methodsToShow; }), @@ -172,8 +172,8 @@ export default Component.extend(DEFAULTS, { return this.methodsToShow.isAny('path'); }), methodsToShow: computed('methods', function () { - let methods = this.methods || []; - let shownMethods = methods.filter((m) => + const methods = this.methods || []; + const shownMethods = methods.filter((m) => BACKENDS.find((b) => b.type.toLowerCase() === m.type.toLowerCase()) ); return shownMethods.length ? shownMethods : BACKENDS; @@ -183,9 +183,9 @@ export default Component.extend(DEFAULTS, { waitFor(function* (token) { // will be using the Token Auth Method, so set it here this.set('selectedAuth', 'token'); - let adapter = this.store.adapterFor('tools'); + const adapter = this.store.adapterFor('tools'); try { - let response = yield adapter.toolAction('unwrap', null, { clientToken: token }); + const response = yield adapter.toolAction('unwrap', null, { clientToken: token }); this.set('token', response.auth.client_token); this.send('doSubmit'); } catch (e) { @@ -196,9 +196,9 @@ export default Component.extend(DEFAULTS, { fetchMethods: task( waitFor(function* () { - let store = this.store; + const store = this.store; try { - let methods = yield store.findAll('auth-method', { + const methods = yield store.findAll('auth-method', { adapterOptions: { unauthenticated: true, }, diff --git a/ui/app/components/auth-jwt.js b/ui/app/components/auth-jwt.js index 9e6e5ae135..bc09dbc6b4 100644 --- a/ui/app/components/auth-jwt.js +++ b/ui/app/components/auth-jwt.js @@ -58,8 +58,8 @@ export default Component.extend({ // debounce yield timeout(Ember.testing ? 0 : WAIT_TIME); } - let path = this.selectedAuthPath || this.selectedAuthType; - let id = JSON.stringify([path, roleName]); + const path = this.selectedAuthPath || this.selectedAuthType; + const id = JSON.stringify([path, roleName]); let role = null; try { role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } }); @@ -137,7 +137,7 @@ export default Component.extend({ // in the state param in the format `,ns=`. So if // `namespace` is empty, check for namespace in state as well. if (namespace === '' || this.featureFlagService.managedNamespaceRoot) { - let i = state.indexOf(',ns='); + const i = state.indexOf(',ns='); if (i >= 0) { // ",ns=" is 4 characters namespace = state.substring(i + 4); @@ -152,7 +152,7 @@ export default Component.extend({ if (!path || !state || !code) { return this.handleOIDCError(ERROR_MISSING_PARAMS); } - let adapter = this.store.adapterFor('auth-method'); + const adapter = this.store.adapterFor('auth-method'); this.onNamespace(namespace); let resp; // do the OIDC exchange, set the token on the parent component @@ -190,13 +190,13 @@ export default Component.extend({ throw error; } } - let win = this.getWindow(); + const win = this.getWindow(); const POPUP_WIDTH = 500; const POPUP_HEIGHT = 600; - let left = win.screen.width / 2 - POPUP_WIDTH / 2; - let top = win.screen.height / 2 - POPUP_HEIGHT / 2; - let oidcWindow = win.open( + const left = win.screen.width / 2 - POPUP_WIDTH / 2; + const top = win.screen.height / 2 - POPUP_HEIGHT / 2; + const oidcWindow = win.open( this.role.authUrl, 'vaultOIDCWindow', `width=${POPUP_WIDTH},height=${POPUP_HEIGHT},resizable,scrollbars=yes,top=${top},left=${left}` diff --git a/ui/app/components/b64-toggle.js b/ui/app/components/b64-toggle.js index 0f631ba671..89bb35bd3b 100644 --- a/ui/app/components/b64-toggle.js +++ b/ui/app/components/b64-toggle.js @@ -116,12 +116,12 @@ export default Component.extend({ }, click() { - let val = this.value; + const val = this.value; const isUTF8 = this.currentEncoding === UTF8; if (!val) { return; } - let newVal = isUTF8 ? encodeString(val) : decodeString(val); + const newVal = isUTF8 ? encodeString(val) : decodeString(val); const encoding = isUTF8 ? B64 : UTF8; set(this, 'value', newVal); set(this, '_value', newVal); diff --git a/ui/app/components/calendar-widget.js b/ui/app/components/calendar-widget.js index b39e223373..c8725fbd10 100644 --- a/ui/app/components/calendar-widget.js +++ b/ui/app/components/calendar-widget.js @@ -41,7 +41,7 @@ class CalendarWidget extends Component { return this.displayYear === this.currentYear; } get disablePastYear() { - let startYear = parseInt(this.args.startTimeDisplay.split(' ')[1]); + const startYear = parseInt(this.args.startTimeDisplay.split(' ')[1]); return this.displayYear === startYear; // if on startYear then don't let them click back to the year prior } get widgetMonths() { @@ -98,7 +98,7 @@ class CalendarWidget extends Component { @action addTooltip() { if (this.disablePastYear) { - let previousYear = Number(this.displayYear) - 1; + const previousYear = Number(this.displayYear) - 1; this.tooltipText = `${previousYear} is unavailable because it is before your billing start month. Change your billing start month to a date in ${previousYear} to see data for this year.`; // set tooltip text this.tooltipTarget = '#previous-year'; } diff --git a/ui/app/components/clients/attribution.js b/ui/app/components/clients/attribution.js index 0ed4d8935d..34e48a0a2e 100644 --- a/ui/app/components/clients/attribution.js +++ b/ui/app/components/clients/attribution.js @@ -75,7 +75,7 @@ export default class Attribution extends Component { } get chartText() { - let dateText = this.isDateRange ? 'date range' : 'month'; + const dateText = this.isDateRange ? 'date range' : 'month'; switch (this.isSingleNamespace) { case true: return { @@ -108,14 +108,14 @@ export default class Attribution extends Component { destructureCountsToArray(object) { // destructure the namespace object {label: 'some-namespace', entity_clients: 171, non_entity_clients: 20, clients: 191} // to get integers for CSV file - let { clients, entity_clients, non_entity_clients } = object; + const { clients, entity_clients, non_entity_clients } = object; return [clients, entity_clients, non_entity_clients]; } constructCsvRow(namespaceColumn, mountColumn = null, totalColumns, newColumns = null) { // if namespaceColumn is a string, then we're at mount level attribution, otherwise it is an object // if constructing a namespace row, mountColumn=null so the column is blank, otherwise it is an object - let otherColumns = newColumns ? [...totalColumns, ...newColumns] : [...totalColumns]; + const otherColumns = newColumns ? [...totalColumns, ...newColumns] : [...totalColumns]; return [ `${typeof namespaceColumn === 'string' ? namespaceColumn : namespaceColumn.label}`, `${mountColumn ? mountColumn.label : ''}`, @@ -126,30 +126,30 @@ export default class Attribution extends Component { generateCsvData() { const totalAttribution = this.args.totalClientAttribution; const newAttribution = this.barChartNewClients ? this.args.newClientAttribution : null; - let csvData = [], - csvHeader = [ - 'Namespace path', - 'Authentication method', - 'Total clients', - 'Entity clients', - 'Non-entity clients', - ]; + const csvData = []; + const csvHeader = [ + 'Namespace path', + 'Authentication method', + 'Total clients', + 'Entity clients', + 'Non-entity clients', + ]; if (newAttribution) { - csvHeader = [...csvHeader, 'Total new clients, New entity clients, New non-entity clients']; + csvHeader.push('Total new clients, New entity clients, New non-entity clients'); } totalAttribution.forEach((totalClientsObject) => { - let namespace = this.isSingleNamespace ? this.args.selectedNamespace : totalClientsObject; - let mount = this.isSingleNamespace ? totalClientsObject : null; + const namespace = this.isSingleNamespace ? this.args.selectedNamespace : totalClientsObject; + const mount = this.isSingleNamespace ? totalClientsObject : null; // find new client data for namespace/mount object we're iterating over - let newClientsObject = newAttribution + const newClientsObject = newAttribution ? newAttribution.find((d) => d.label === totalClientsObject.label) : null; - let totalClients = this.destructureCountsToArray(totalClientsObject); - let newClients = newClientsObject ? this.destructureCountsToArray(newClientsObject) : null; + const totalClients = this.destructureCountsToArray(totalClientsObject); + const newClients = newClientsObject ? this.destructureCountsToArray(newClientsObject) : null; csvData.push(this.constructCsvRow(namespace, mount, totalClients, newClients)); // constructCsvRow returns an array that corresponds to a row in the csv file: @@ -158,11 +158,11 @@ export default class Attribution extends Component { // only iterate through mounts if NOT viewing a single namespace if (!this.isSingleNamespace && namespace.mounts) { namespace.mounts.forEach((mount) => { - let newMountData = newAttribution + const newMountData = newAttribution ? newClientsObject?.mounts.find((m) => m.label === mount.label) : null; - let mountTotalClients = this.destructureCountsToArray(mount); - let mountNewClients = newMountData ? this.destructureCountsToArray(newMountData) : null; + const mountTotalClients = this.destructureCountsToArray(mount); + const mountNewClients = newMountData ? this.destructureCountsToArray(newMountData) : null; csvData.push(this.constructCsvRow(namespace, mount, mountTotalClients, mountNewClients)); }); } @@ -174,8 +174,8 @@ export default class Attribution extends Component { } get getCsvFileName() { - let endRange = this.isDateRange ? `-${this.args.endTimeDisplay}` : ''; - let csvDateRange = this.args.startTimeDisplay + endRange; + const endRange = this.isDateRange ? `-${this.args.endTimeDisplay}` : ''; + const csvDateRange = this.args.startTimeDisplay + endRange; return this.isSingleNamespace ? `clients_by_auth_method_${csvDateRange}` : `clients_by_namespace_${csvDateRange}`; @@ -184,7 +184,7 @@ export default class Attribution extends Component { // ACTIONS @action exportChartData(filename) { - let contents = this.generateCsvData(); + const contents = this.generateCsvData(); this.downloadCsv.download(filename, contents); this.showCSVDownloadModal = false; } diff --git a/ui/app/components/clients/config.js b/ui/app/components/clients/config.js index b84494b413..265038e7ce 100644 --- a/ui/app/components/clients/config.js +++ b/ui/app/components/clients/config.js @@ -58,7 +58,7 @@ export default class ConfigComponent extends Component { @action updateBooleanValue(attr, value) { - let valueToSet = value === true ? attr.options.trueValue : attr.options.falseValue; + const valueToSet = value === true ? attr.options.trueValue : attr.options.falseValue; this.args.model[attr.name] = valueToSet; } diff --git a/ui/app/components/clients/current.js b/ui/app/components/clients/current.js index 776b0bd74b..e21681005c 100644 --- a/ui/app/components/clients/current.js +++ b/ui/app/components/clients/current.js @@ -23,10 +23,10 @@ export default class Current extends Component { } // get upgrade data for initial upgrade to 1.9 and/or 1.10 - let relevantUpgrades = []; + const relevantUpgrades = []; const importantUpgrades = ['1.9', '1.10']; importantUpgrades.forEach((version) => { - let findUpgrade = versionHistory.find((versionData) => versionData.id.match(version)); + const findUpgrade = versionHistory.find((versionData) => versionData.id.match(version)); if (findUpgrade) relevantUpgrades.push(findUpgrade); }); // array of upgrade data objects for noteworthy upgrades @@ -71,7 +71,7 @@ export default class Current extends Component { } const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { // TODO how do timezones affect this? - let upgradeDate = new Date(upgrade.timestampInstalled); + const upgradeDate = new Date(upgrade.timestampInstalled); return isAfter(upgradeDate, startOfMonth(new Date())); }); // return all upgrades that happened within date range of queried activity @@ -83,10 +83,10 @@ export default class Current extends Component { return null; } if (this.upgradeDuringCurrentMonth.length === 2) { - let versions = this.upgradeDuringCurrentMonth.map((upgrade) => upgrade.id).join(' and '); + const versions = this.upgradeDuringCurrentMonth.map((upgrade) => upgrade.id).join(' and '); return `Vault was upgraded to ${versions} during this month.`; } else { - let version = this.upgradeDuringCurrentMonth[0]; + const version = this.upgradeDuringCurrentMonth[0]; return `Vault was upgraded to ${version.id} on this month.`; } } @@ -96,7 +96,7 @@ export default class Current extends Component { return null; } if (this.upgradeDuringCurrentMonth.length === 1) { - let version = this.upgradeDuringCurrentMonth[0].id; + const version = this.upgradeDuringCurrentMonth[0].id; if (version.match('1.9')) { return ' How we count clients changed in 1.9, so keep that in mind when looking at the data below.'; } diff --git a/ui/app/components/clients/history.js b/ui/app/components/clients/history.js index 3466a6761d..0e40b93c1e 100644 --- a/ui/app/components/clients/history.js +++ b/ui/app/components/clients/history.js @@ -98,10 +98,10 @@ export default class History extends Component { } // get upgrade data for initial upgrade to 1.9 and/or 1.10 - let relevantUpgrades = []; + const relevantUpgrades = []; const importantUpgrades = ['1.9', '1.10']; importantUpgrades.forEach((version) => { - let findUpgrade = versionHistory.find((versionData) => versionData.id.match(version)); + const findUpgrade = versionHistory.find((versionData) => versionData.id.match(version)); if (findUpgrade) relevantUpgrades.push(findUpgrade); }); @@ -117,7 +117,7 @@ export default class History extends Component { const activityEnd = new Date(this.getActivityResponse.endTime); const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { // TODO how do timezones affect this? - let upgradeDate = new Date(upgrade.timestampInstalled); + const upgradeDate = new Date(upgrade.timestampInstalled); return isAfter(upgradeDate, activityStart) && isBefore(upgradeDate, activityEnd); }); // return all upgrades that happened within date range of queried activity @@ -129,13 +129,13 @@ export default class History extends Component { return null; } if (this.upgradeDuringActivity.length === 2) { - let firstUpgrade = this.upgradeDuringActivity[0]; - let secondUpgrade = this.upgradeDuringActivity[1]; - let firstDate = dateFormat([firstUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); - let secondDate = dateFormat([secondUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); + const firstUpgrade = this.upgradeDuringActivity[0]; + const secondUpgrade = this.upgradeDuringActivity[1]; + const firstDate = dateFormat([firstUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); + const secondDate = dateFormat([secondUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); return `Vault was upgraded to ${firstUpgrade.id} (${firstDate}) and ${secondUpgrade.id} (${secondDate}) during this time range.`; } else { - let upgrade = this.upgradeDuringActivity[0]; + const upgrade = this.upgradeDuringActivity[0]; return `Vault was upgraded to ${upgrade.id} on ${dateFormat( [upgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true } @@ -148,7 +148,7 @@ export default class History extends Component { return null; } if (this.upgradeDuringActivity.length === 1) { - let version = this.upgradeDuringActivity[0].id; + const version = this.upgradeDuringActivity[0].id; if (version.match('1.9')) { return ' How we count clients changed in 1.9, so keep that in mind when looking at the data below.'; } @@ -164,8 +164,8 @@ export default class History extends Component { if (!this.startTimeFromResponse) { return null; } - let month = this.startTimeFromResponse[1]; - let year = this.startTimeFromResponse[0]; + const month = this.startTimeFromResponse[1]; + const year = this.startTimeFromResponse[0]; return `${this.arrayOfMonths[month]} ${year}`; } @@ -173,8 +173,8 @@ export default class History extends Component { if (!this.endTimeFromResponse) { return null; } - let month = this.endTimeFromResponse[1]; - let year = this.endTimeFromResponse[0]; + const month = this.endTimeFromResponse[1]; + const year = this.endTimeFromResponse[0]; return `${this.arrayOfMonths[month]} ${year}`; } @@ -289,7 +289,7 @@ export default class History extends Component { } // clicked "Edit" Billing start month in History which opens a modal. if (dateType === 'startTime') { - let monthIndex = this.arrayOfMonths.indexOf(month); + const monthIndex = this.arrayOfMonths.indexOf(month); this.startTimeRequested = [year.toString(), monthIndex]; // ['2021', 0] (e.g. January 2021) this.endTimeRequested = null; } @@ -302,7 +302,7 @@ export default class History extends Component { try { this.isLoadingQuery = true; - let response = await this.store.queryRecord('clients/activity', { + const response = await this.store.queryRecord('clients/activity', { start_time: this.startTimeRequested, end_time: this.endTimeRequested, }); diff --git a/ui/app/components/clients/horizontal-bar-chart.js b/ui/app/components/clients/horizontal-bar-chart.js index f64ea332d6..da7e9c43f5 100644 --- a/ui/app/components/clients/horizontal-bar-chart.js +++ b/ui/app/components/clients/horizontal-bar-chart.js @@ -66,24 +66,24 @@ export default class HorizontalBarChart extends Component { // chart legend tells stackFunction how to stack/organize data // creates an array of data for each key name // each array contains coordinates for each data bar - let stackFunction = stack().keys(this.chartLegend.map((l) => l.key)); - let dataset = chartData; - let stackedData = stackFunction(dataset); - let labelKey = this.labelKey; - let xKey = this.xKey; - let xScale = scaleLinear() + const stackFunction = stack().keys(this.chartLegend.map((l) => l.key)); + const dataset = chartData; + const stackedData = stackFunction(dataset); + const labelKey = this.labelKey; + const xKey = this.xKey; + const xScale = scaleLinear() .domain([0, max(dataset.map((d) => d[xKey]))]) .range([0, 75]); // 25% reserved for margins - let yScale = scaleBand() + const yScale = scaleBand() .domain(dataset.map((d) => d[labelKey])) .range([0, dataset.length * LINE_HEIGHT]) .paddingInner(0.765); // percent of the total width to reserve for padding between bars - let chartSvg = select(element); + const chartSvg = select(element); chartSvg.attr('width', '100%').attr('viewBox', `0 0 564 ${(dataset.length + 1) * LINE_HEIGHT}`); - let dataBarGroup = chartSvg + const dataBarGroup = chartSvg .selectAll('g') .remove() .exit() @@ -95,9 +95,9 @@ export default class HorizontalBarChart extends Component { .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`) .style('fill', (d, i) => LIGHT_AND_DARK_BLUE[i]); - let yAxis = axisLeft(yScale).tickSize(0); + const yAxis = axisLeft(yScale).tickSize(0); - let yLabelsGroup = chartSvg + const yLabelsGroup = chartSvg .append('g') .attr('data-test-group', 'y-labels') .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`); @@ -105,7 +105,7 @@ export default class HorizontalBarChart extends Component { chartSvg.select('.domain').remove(); - let truncate = (selection) => + const truncate = (selection) => selection.text((string) => string.length < CHAR_LIMIT ? string : string.slice(0, CHAR_LIMIT - 3) + '...' ); @@ -129,9 +129,9 @@ export default class HorizontalBarChart extends Component { .attr('rx', 3) .attr('ry', 3); - let actionBarGroup = chartSvg.append('g').attr('data-test-group', 'action-bars'); + const actionBarGroup = chartSvg.append('g').attr('data-test-group', 'action-bars'); - let actionBars = actionBarGroup + const actionBars = actionBarGroup .selectAll('.action-bar') .remove() .exit() @@ -148,9 +148,9 @@ export default class HorizontalBarChart extends Component { .style('opacity', '0') .style('mix-blend-mode', 'multiply'); - let labelActionBarGroup = chartSvg.append('g').attr('data-test-group', 'label-action-bars'); + const labelActionBarGroup = chartSvg.append('g').attr('data-test-group', 'label-action-bars'); - let labelActionBar = labelActionBarGroup + const labelActionBar = labelActionBarGroup .selectAll('.label-action-bar') .remove() .exit() @@ -166,16 +166,16 @@ export default class HorizontalBarChart extends Component { .style('opacity', '0') .style('mix-blend-mode', 'multiply'); - let dataBars = chartSvg.selectAll('rect.data-bar'); - let actionBarSelection = chartSvg.selectAll('rect.action-bar'); + const dataBars = chartSvg.selectAll('rect.data-bar'); + const actionBarSelection = chartSvg.selectAll('rect.action-bar'); - let compareAttributes = (elementA, elementB, attr) => + const compareAttributes = (elementA, elementB, attr) => select(elementA).attr(`${attr}`) === select(elementB).attr(`${attr}`); // MOUSE EVENTS FOR DATA BARS actionBars .on('mouseover', (data) => { - let hoveredElement = actionBars.filter((bar) => bar[labelKey] === data[labelKey]).node(); + const hoveredElement = actionBars.filter((bar) => bar[labelKey] === data[labelKey]).node(); this.tooltipTarget = hoveredElement; this.isLabel = false; this.tooltipText = this.total @@ -206,7 +206,7 @@ export default class HorizontalBarChart extends Component { labelActionBar .on('mouseover', (data) => { if (data[labelKey].length >= CHAR_LIMIT) { - let hoveredElement = labelActionBar.filter((bar) => bar[labelKey] === data[labelKey]).node(); + const hoveredElement = labelActionBar.filter((bar) => bar[labelKey] === data[labelKey]).node(); this.tooltipTarget = hoveredElement; this.isLabel = true; this.tooltipText = data[labelKey]; @@ -239,7 +239,7 @@ export default class HorizontalBarChart extends Component { }); // client count total values to the right - let totalValueGroup = chartSvg + const totalValueGroup = chartSvg .append('g') .attr('data-test-group', 'total-values') .attr('transform', `translate(${TRANSLATE.left}, ${TRANSLATE.down})`); diff --git a/ui/app/components/clients/line-chart.js b/ui/app/components/clients/line-chart.js index d346c33bdd..378548830e 100644 --- a/ui/app/components/clients/line-chart.js +++ b/ui/app/components/clients/line-chart.js @@ -182,14 +182,14 @@ export default class LineChart extends Component { this.tooltipTotal = formatNumber([data[this.yKey]]) + ' total clients'; this.tooltipNew = (formatNumber([data?.new_clients[this.yKey]]) || '0') + ' new clients'; this.tooltipUpgradeText = ''; - let upgradeInfo = findUpgradeData(data); + const upgradeInfo = findUpgradeData(data); if (upgradeInfo) { - let { id, previousVersion } = upgradeInfo; + const { id, previousVersion } = upgradeInfo; this.tooltipUpgradeText = `Vault was upgraded ${previousVersion ? 'from ' + previousVersion : ''} to ${id}`; } - let node = hoverCircles.filter((plot) => plot[this.xKey] === data[this.xKey]).node(); + const node = hoverCircles.filter((plot) => plot[this.xKey] === data[this.xKey]).node(); this.tooltipTarget = node; }); } diff --git a/ui/app/components/clients/vertical-bar-chart.js b/ui/app/components/clients/vertical-bar-chart.js index 6d10748674..2d84567d2e 100644 --- a/ui/app/components/clients/vertical-bar-chart.js +++ b/ui/app/components/clients/vertical-bar-chart.js @@ -147,12 +147,12 @@ export default class VerticalBarChart extends Component { // MOUSE EVENT FOR TOOLTIP tooltipRect.on('mouseover', (data) => { - let hoveredMonth = data[this.xKey]; + const hoveredMonth = data[this.xKey]; this.tooltipTotal = `${formatNumber([data[this.yKey]])} ${data.new_clients ? 'total' : 'new'} clients`; this.entityClients = `${formatNumber([data.entity_clients])} entity clients`; this.nonEntityClients = `${formatNumber([data.non_entity_clients])} non-entity clients`; // filter for the tether point that matches the hoveredMonth - let hoveredElement = tooltipTether.filter((data) => data.month === hoveredMonth).node(); + const hoveredElement = tooltipTether.filter((data) => data.month === hoveredMonth).node(); this.tooltipTarget = hoveredElement; // grab the node from the list of rects }); } diff --git a/ui/app/components/console/log-object.js b/ui/app/components/console/log-object.js index 20ee00a3de..f380c4f512 100644 --- a/ui/app/components/console/log-object.js +++ b/ui/app/components/console/log-object.js @@ -16,7 +16,7 @@ export function stringifyObjectValues(data) { export default Component.extend({ content: null, columns: computed('content', function () { - let data = this.content; + const data = this.content; stringifyObjectValues(data); return columnify(data, { diff --git a/ui/app/components/console/ui-panel.js b/ui/app/components/console/ui-panel.js index 572dec8065..bbe2c07aa4 100644 --- a/ui/app/components/console/ui-panel.js +++ b/ui/app/components/console/ui-panel.js @@ -42,7 +42,7 @@ export default Component.extend({ executeCommand: task(function* (command, shouldThrow = false) { this.set('inputValue', ''); - let service = this.console; + const service = this.console; let serviceArgs; if ( @@ -69,19 +69,19 @@ export default Component.extend({ return; } - let [method, flagArray, path, dataArray] = serviceArgs; + const [method, flagArray, path, dataArray] = serviceArgs; if (dataArray || flagArray) { var { data, flags } = extractDataAndFlags(method, dataArray, flagArray); } - let inputError = logErrorFromInput(path, method, flags, dataArray); + const inputError = logErrorFromInput(path, method, flags, dataArray); if (inputError) { this.logAndOutput(command, inputError); return; } try { - let resp = yield service[method].call(service, path, data, flags.wrapTTL); + const resp = yield service[method].call(service, path, data, flags.wrapTTL); this.logAndOutput(command, logFromResponse(resp, path, method, flags)); } catch (error) { if (error instanceof ControlGroupError) { @@ -92,8 +92,8 @@ export default Component.extend({ }), refreshRoute: task(function* () { - let owner = getOwner(this); - let currentRoute = owner.lookup(`router:main`).get('currentRouteName'); + const owner = getOwner(this); + const currentRoute = owner.lookup(`router:main`).get('currentRouteName'); try { this.store.clearAllDatasets(); @@ -105,7 +105,7 @@ export default Component.extend({ }), routeToExplore: task(function* (command) { - let filter = command.replace('api', '').trim(); + const 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.'; if (filter) { diff --git a/ui/app/components/control-group-success.js b/ui/app/components/control-group-success.js index 6c64cab571..23c0cc1f78 100644 --- a/ui/app/components/control-group-success.js +++ b/ui/app/components/control-group-success.js @@ -16,10 +16,10 @@ export default Component.extend({ unwrapData: null, unwrap: task(function* (token) { - let adapter = this.store.adapterFor('tools'); + const adapter = this.store.adapterFor('tools'); this.set('error', null); try { - let response = yield adapter.toolAction('unwrap', null, { clientToken: token }); + const response = yield adapter.toolAction('unwrap', null, { clientToken: token }); this.set('unwrapData', response.auth || response.data); this.controlGroup.deleteControlGroupToken(this.model.id); } catch (e) { @@ -29,7 +29,7 @@ export default Component.extend({ markAndNavigate: task(function* () { this.controlGroup.markTokenForUnwrap(this.model.id); - let { url } = this.controlGroupResponse.uiParams; + const { url } = this.controlGroupResponse.uiParams; yield this.router.transitionTo(url); }).drop(), }); diff --git a/ui/app/components/control-group.js b/ui/app/components/control-group.js index 50f10e1808..83461b324e 100644 --- a/ui/app/components/control-group.js +++ b/ui/app/components/control-group.js @@ -14,8 +14,8 @@ export default Component.extend({ didReceiveAttrs() { this._super(...arguments); - let accessor = this.model.id; - let data = this.controlGroup.wrapInfoForAccessor(accessor); + const accessor = this.model.id; + const data = this.controlGroup.wrapInfoForAccessor(accessor); this.set('controlGroupResponse', data); }, @@ -27,13 +27,13 @@ export default Component.extend({ }), currentUserHasAuthorized: computed('currentUserEntityId', 'model.authorizations.@each.id', function () { - let authorizations = this.model.authorizations || []; + const authorizations = this.model.authorizations || []; return Boolean(authorizations.findBy('id', this.currentUserEntityId)); }), isSuccess: or('currentUserHasAuthorized', 'model.approved'), requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function () { - let entity = this.model.requestEntity; + const entity = this.model.requestEntity; if (this.currentUserIsRequesting) { return 'You'; @@ -55,8 +55,8 @@ export default Component.extend({ }), bannerText: computed('model.approved', 'currentUserIsRequesting', 'currentUserHasAuthorized', function () { - let isApproved = this.model.approved; - let { currentUserHasAuthorized, currentUserIsRequesting } = this; + const isApproved = this.model.approved; + const { currentUserHasAuthorized, currentUserIsRequesting } = this; if (currentUserHasAuthorized) { return 'You have given authorization'; } diff --git a/ui/app/components/database-connection.js b/ui/app/components/database-connection.js index c34507c749..c71c7ac776 100644 --- a/ui/app/components/database-connection.js +++ b/ui/app/components/database-connection.js @@ -35,7 +35,7 @@ export default class DatabaseConnectionEdit extends Component { } rotateCredentials(backend, name) { - let adapter = this.store.adapterFor('database/connection'); + const adapter = this.store.adapterFor('database/connection'); return adapter.rotateRootCredentials(backend, name); } @@ -61,8 +61,8 @@ export default class DatabaseConnectionEdit extends Component { @action async handleCreateConnection(evt) { evt.preventDefault(); - let secret = this.args.model; - let secretId = secret.name; + const secret = this.args.model; + const secretId = secret.name; secret.set('id', secretId); secret .save() @@ -100,8 +100,8 @@ export default class DatabaseConnectionEdit extends Component { @action handleUpdateConnection(evt) { evt.preventDefault(); - let secret = this.args.model; - let secretId = secret.name; + const secret = this.args.model; + const secretId = secret.name; secret .save() .then(() => { @@ -126,7 +126,7 @@ export default class DatabaseConnectionEdit extends Component { @action reset() { const { name, backend } = this.args.model; - let adapter = this.store.adapterFor('database/connection'); + const adapter = this.store.adapterFor('database/connection'); adapter .resetConnection(backend, name) .then(() => { diff --git a/ui/app/components/database-role-edit.js b/ui/app/components/database-role-edit.js index 0bb925668e..64ea98eace 100644 --- a/ui/app/components/database-role-edit.js +++ b/ui/app/components/database-role-edit.js @@ -28,7 +28,7 @@ export default class DatabaseRoleEdit extends Component { @tracked loading = false; get warningMessages() { - let warnings = {}; + const warnings = {}; if (this.args.model.canUpdateDb === false) { warnings.database = `You don’t have permissions to update this database connection, so this role cannot be created.`; } @@ -84,11 +84,11 @@ export default class DatabaseRoleEdit extends Component { this.loading = true; const mode = this.args.mode; - let roleSecret = this.args.model; - let secretId = roleSecret.name; + const roleSecret = this.args.model; + const secretId = roleSecret.name; if (mode === 'create') { roleSecret.set('id', secretId); - let path = roleSecret.type === 'static' ? 'static-roles' : 'roles'; + const path = roleSecret.type === 'static' ? 'static-roles' : 'roles'; roleSecret.set('path', path); } roleSecret @@ -111,7 +111,7 @@ export default class DatabaseRoleEdit extends Component { @action rotateRoleCred(id) { const backend = this.args.model?.backend; - let adapter = this.store.adapterFor('database/credential'); + const adapter = this.store.adapterFor('database/credential'); adapter .rotateRoleCredentials(backend, id) .then(() => { diff --git a/ui/app/components/database-role-setting-form.js b/ui/app/components/database-role-setting-form.js index 9107c38b20..5da5356653 100644 --- a/ui/app/components/database-role-setting-form.js +++ b/ui/app/components/database-role-setting-form.js @@ -19,7 +19,7 @@ import { getStatementFields, getRoleFields } from '../utils/database-helpers'; export default class DatabaseRoleSettingForm extends Component { get settingFields() { if (!this.args.roleType) return null; - let dbValidFields = getRoleFields(this.args.roleType); + const dbValidFields = getRoleFields(this.args.roleType); return this.args.attrs.filter((a) => { return dbValidFields.includes(a.name); }); @@ -29,7 +29,7 @@ export default class DatabaseRoleSettingForm extends Component { const type = this.args.roleType; const plugin = this.args.dbType; if (!type) return null; - let dbValidFields = getStatementFields(type, plugin); + const dbValidFields = getStatementFields(type, plugin); 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 25b8ad1f44..eafdcad417 100644 --- a/ui/app/components/diff-version-selector.js +++ b/ui/app/components/diff-version-selector.js @@ -33,14 +33,14 @@ export default class DiffVersionSelector extends Component { } get leftSideDataInit() { - let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.args.model.currentVersion}"]`; + const string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.args.model.currentVersion}"]`; return this.adapter .querySecretDataByVersion(string) .then((response) => response.data) .catch(() => null); } get rightSideDataInit() { - let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`; + const string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`; return this.adapter .querySecretDataByVersion(string) .then((response) => response.data) @@ -52,10 +52,10 @@ export default class DiffVersionSelector extends Component { } async createVisualDiff() { - let diffpatcher = jsondiffpatch.create({}); - let leftSideVersionData = this.leftSideVersionDataSelected || (await this.leftSideDataInit); - let rightSideVersionData = this.rightSideVersionDataSelected || (await this.rightSideDataInit); - let delta = diffpatcher.diff(rightSideVersionData, leftSideVersionData); + const diffpatcher = jsondiffpatch.create({}); + const leftSideVersionData = this.leftSideVersionDataSelected || (await this.leftSideDataInit); + const rightSideVersionData = this.rightSideVersionDataSelected || (await this.rightSideDataInit); + const delta = diffpatcher.diff(rightSideVersionData, leftSideVersionData); if (delta === undefined) { this.statesMatch = true; // params: value, replacer (all properties included), space (white space and indentation, line break, etc.) @@ -68,8 +68,8 @@ export default class DiffVersionSelector extends Component { @action async selectVersion(selectedVersion, actions, side) { - let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${selectedVersion}"]`; - let secretData = await this.adapter.querySecretDataByVersion(string); + const string = `["${this.args.model.engineId}", "${this.args.model.id}", "${selectedVersion}"]`; + const secretData = await this.adapter.querySecretDataByVersion(string); if (side === 'left') { this.leftSideVersionDataSelected = secretData.data; this.leftSideVersionSelected = selectedVersion; diff --git a/ui/app/components/file-to-array-buffer.js b/ui/app/components/file-to-array-buffer.js index fb738e4cda..e9056f357a 100644 --- a/ui/app/components/file-to-array-buffer.js +++ b/ui/app/components/file-to-array-buffer.js @@ -39,7 +39,7 @@ export default Component.extend({ actions: { pickedFile(e) { - let { files } = e.target; + const { files } = e.target; if (!files.length) { return; } @@ -51,8 +51,8 @@ export default Component.extend({ this.send('onChange'); }, onChange(fileAsBytes, fileMeta) { - let { name, size, lastModifiedDate } = fileMeta || {}; - let fileSize = size ? filesize(size) : null; + const { name, size, lastModifiedDate } = fileMeta || {}; + const fileSize = size ? filesize(size) : null; this.set('file', fileAsBytes); this.set('fileName', name); this.set('fileSize', fileSize); diff --git a/ui/app/components/generate-credentials.js b/ui/app/components/generate-credentials.js index 0b197f8e85..74526b2094 100644 --- a/ui/app/components/generate-credentials.js +++ b/ui/app/components/generate-credentials.js @@ -96,7 +96,7 @@ export default Component.extend({ actions: { create() { - let model = this.model; + const model = this.model; this.set('loading', true); this.model .save() diff --git a/ui/app/components/generated-item-list.js b/ui/app/components/generated-item-list.js index 8e1f8e6a7c..f8db8d8889 100644 --- a/ui/app/components/generated-item-list.js +++ b/ui/app/components/generated-item-list.js @@ -31,7 +31,7 @@ export default class GeneratedItemList extends Component { @action refreshItemList() { - let route = getOwner(this).lookup(`route:${this.router.currentRouteName}`); + const route = getOwner(this).lookup(`route:${this.router.currentRouteName}`); this.store.clearAllDatasets(); route.refresh(); } diff --git a/ui/app/components/generated-item.js b/ui/app/components/generated-item.js index f46e3fdbd0..ef939a6ac7 100644 --- a/ui/app/components/generated-item.js +++ b/ui/app/components/generated-item.js @@ -64,7 +64,7 @@ export default Component.extend({ this.model.fieldGroups.forEach((element) => { if (element.default) { element.default.forEach((attr) => { - let fieldValue = attr.options && attr.options.fieldValue; + const fieldValue = attr.options && attr.options.fieldValue; if (fieldValue) { this.model[attr.name] = this.model[fieldValue]; } diff --git a/ui/app/components/identity/_popup-base.js b/ui/app/components/identity/_popup-base.js index eeda69e0d7..d8f6211325 100644 --- a/ui/app/components/identity/_popup-base.js +++ b/ui/app/components/identity/_popup-base.js @@ -25,8 +25,8 @@ export default Component.extend({ actions: { performTransaction() { - let args = [...arguments]; - let messageArgs = this.messageArgs(...args); + const args = [...arguments]; + const messageArgs = this.messageArgs(...args); return this.transaction(...args) .then(() => { this.onSuccess(); diff --git a/ui/app/components/identity/edit-form.js b/ui/app/components/identity/edit-form.js index ae8b6c148e..b71898b3cb 100644 --- a/ui/app/components/identity/edit-form.js +++ b/ui/app/components/identity/edit-form.js @@ -22,8 +22,8 @@ export default Component.extend({ onSave: () => {}, cancelLink: computed('mode', 'model.identityType', function () { - let { model, mode } = this; - let routes = { + const { model, mode } = this; + const routes = { 'create-entity': 'vault.cluster.access.identity', 'edit-entity': 'vault.cluster.access.identity.show', 'merge-entity-merge': 'vault.cluster.access.identity', @@ -34,14 +34,14 @@ export default Component.extend({ 'create-group-alias': 'vault.cluster.access.identity.aliases', 'edit-group-alias': 'vault.cluster.access.identity.aliases.show', }; - let key = model ? `${mode}-${model.identityType}` : 'merge-entity-alias'; + const key = model ? `${mode}-${model.identityType}` : 'merge-entity-alias'; return routes[key]; }), getMessage(model, isDelete = false) { - let mode = this.mode; - let typeDisplay = humanize([model.identityType]); - let action = isDelete ? 'deleted' : 'saved'; + const mode = this.mode; + const typeDisplay = humanize([model.identityType]); + const action = isDelete ? 'deleted' : 'saved'; if (mode === 'merge') { return 'Successfully merged entities'; } @@ -53,8 +53,8 @@ export default Component.extend({ save: task( waitFor(function* () { - let model = this.model; - let message = this.getMessage(model); + const model = this.model; + const message = this.getMessage(model); try { yield model.save(); @@ -69,7 +69,7 @@ export default Component.extend({ willDestroy() { this._super(...arguments); - let model = this.model; + const model = this.model; if (!model) return; if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) { model.rollbackAttributes(); @@ -78,8 +78,8 @@ export default Component.extend({ actions: { deleteItem(model) { - let message = this.getMessage(model, true); - let flash = this.flashMessages; + const message = this.getMessage(model, true); + const flash = this.flashMessages; model.destroyRecord().then(() => { flash.success(message); return this.onSave({ saveType: 'delete', model }); diff --git a/ui/app/components/identity/lookup-input.js b/ui/app/components/identity/lookup-input.js index b974b9a8f7..8573593717 100644 --- a/ui/app/components/identity/lookup-input.js +++ b/ui/app/components/identity/lookup-input.js @@ -27,14 +27,14 @@ export default Component.extend({ }, adapter() { - let type = this.type; - let store = this.store; + const type = this.type; + const store = this.store; return store.adapterFor(`identity/${type}`); }, data() { - let { param, paramValue, aliasMountAccessor } = this; - let data = {}; + const { param, paramValue, aliasMountAccessor } = this; + const data = {}; data[underscore([param])] = paramValue; if (param === 'alias name') { @@ -44,10 +44,10 @@ export default Component.extend({ }, lookup: task(function* () { - let flash = this.flashMessages; - let type = this.type; - let store = this.store; - let { param, paramValue } = this; + const flash = this.flashMessages; + const type = this.type; + const store = this.store; + const { param, paramValue } = this; let response; try { response = yield this.adapter().lookup(store, this.data()); diff --git a/ui/app/components/identity/popup-alias.js b/ui/app/components/identity/popup-alias.js index 20852421c4..b0830fe67c 100644 --- a/ui/app/components/identity/popup-alias.js +++ b/ui/app/components/identity/popup-alias.js @@ -2,8 +2,8 @@ import Base from './_popup-base'; export default Base.extend({ messageArgs(model) { - let type = model.get('identityType'); - let id = model.id; + const type = model.get('identityType'); + const id = model.id; return [type, id]; }, @@ -12,7 +12,7 @@ export default Base.extend({ }, errorMessage(e, type, id) { - let error = e.errors ? e.errors.join(' ') : e.message; + const error = e.errors ? e.errors.join(' ') : e.message; return `There was a problem deleting ${type}: ${id} - ${error}`; }, diff --git a/ui/app/components/identity/popup-members.js b/ui/app/components/identity/popup-members.js index de724f9871..a6feb3a265 100644 --- a/ui/app/components/identity/popup-members.js +++ b/ui/app/components/identity/popup-members.js @@ -22,12 +22,12 @@ export default Base.extend({ }, errorMessage(e, model, groupArray, memberId) { - let error = e.errors ? e.errors.join(' ') : e.message; + const error = e.errors ? e.errors.join(' ') : e.message; return `There was a problem removing '${memberId}' from the group - ${error}`; }, transaction(model, groupArray, memberId) { - let members = model.get(groupArray); + const members = model.get(groupArray); model.set(groupArray, members.without(memberId)); return model.save(); }, diff --git a/ui/app/components/identity/popup-metadata.js b/ui/app/components/identity/popup-metadata.js index 6afc27e646..8a4fc31db9 100644 --- a/ui/app/components/identity/popup-metadata.js +++ b/ui/app/components/identity/popup-metadata.js @@ -16,12 +16,12 @@ export default Base.extend({ return `Successfully removed '${key}' from metadata`; }, errorMessage(e, model, key) { - let error = e.errors ? e.errors.join(' ') : e.message; + const error = e.errors ? e.errors.join(' ') : e.message; return `There was a problem removing '${key}' from the metadata - ${error}`; }, transaction(model, key) { - let metadata = model.metadata; + const metadata = model.metadata; delete metadata[key]; model.set('metadata', { ...metadata }); return model.save(); diff --git a/ui/app/components/identity/popup-policy.js b/ui/app/components/identity/popup-policy.js index 7e3385e7a0..0536e3638d 100644 --- a/ui/app/components/identity/popup-policy.js +++ b/ui/app/components/identity/popup-policy.js @@ -17,12 +17,12 @@ export default Base.extend({ }, errorMessage(e, model, policyName) { - let error = e.errors ? e.errors.join(' ') : e.message; + const error = e.errors ? e.errors.join(' ') : e.message; return `There was a problem removing '${policyName}' policy - ${error}`; }, transaction(model, policyName) { - let policies = model.get('policies'); + const policies = model.get('policies'); model.set('policies', policies.without(policyName)); return model.save(); }, diff --git a/ui/app/components/license-info.js b/ui/app/components/license-info.js index 2b82403b83..1062fe1ead 100644 --- a/ui/app/components/license-info.js +++ b/ui/app/components/license-info.js @@ -24,9 +24,9 @@ import { allFeatures } from 'vault/helpers/all-features'; export default class LicenseInfoComponent extends Component { get featuresInfo() { return allFeatures().map((feature) => { - let active = this.args.features.includes(feature); + const active = this.args.features.includes(feature); if (active && feature === 'Performance Standby') { - let count = this.args.performanceStandbyCount; + const count = this.args.performanceStandbyCount; return { name: feature, active: count ? active : false, diff --git a/ui/app/components/mfa/mfa-login-enforcement-form.js b/ui/app/components/mfa/mfa-login-enforcement-form.js index 250019be60..44a8c33cb9 100644 --- a/ui/app/components/mfa/mfa-login-enforcement-form.js +++ b/ui/app/components/mfa/mfa-login-enforcement-form.js @@ -56,7 +56,7 @@ export default class MfaLoginEnforcementForm extends Component { } async flattenTargets() { - for (let { label, key } of this.targetTypes) { + for (const { label, key } of this.targetTypes) { const targetArray = await this.args.model[key]; const targets = targetArray.map((value) => ({ label, key, value })); this.targets.addObjects(targets); diff --git a/ui/app/components/mfa/mfa-setup-step-one.js b/ui/app/components/mfa/mfa-setup-step-one.js index 52b533b8c9..f94807c8f1 100644 --- a/ui/app/components/mfa/mfa-setup-step-one.js +++ b/ui/app/components/mfa/mfa-setup-step-one.js @@ -29,7 +29,7 @@ export default class MfaSetupStepOne extends Component { @action async verifyUUID(evt) { evt.preventDefault(); - let response = await this.postAdminGenerate(); + const response = await this.postAdminGenerate(); if (response === 'stop_progress') { this.args.isUUIDVerified(false); @@ -43,7 +43,7 @@ export default class MfaSetupStepOne extends Component { async postAdminGenerate() { this.error = ''; this.warning = ''; - let adapter = this.store.adapterFor('mfa-setup'); + const adapter = this.store.adapterFor('mfa-setup'); let response; try { @@ -53,7 +53,7 @@ export default class MfaSetupStepOne extends Component { }); this.args.saveUUIDandQrCode(this.UUID, response.data?.url); // if there was a warning it won't fail but needs to be handled here and the flow needs to be interrupted - let warnings = response.warnings || []; + const warnings = response.warnings || []; if (warnings.length > 0) { this.UUID = ''; // clear UUID const alreadyGenerated = warnings.find((w) => diff --git a/ui/app/components/mfa/mfa-setup-step-two.js b/ui/app/components/mfa/mfa-setup-step-two.js index d81765160c..97ddd8b56b 100644 --- a/ui/app/components/mfa/mfa-setup-step-two.js +++ b/ui/app/components/mfa/mfa-setup-step-two.js @@ -25,7 +25,7 @@ export default class MfaSetupStepTwo extends Component { @action async restartSetup() { this.error = null; - let adapter = this.store.adapterFor('mfa-setup'); + const adapter = this.store.adapterFor('mfa-setup'); try { await adapter.adminDestroy({ entity_id: this.args.entityId, diff --git a/ui/app/components/mount-accessor-select.js b/ui/app/components/mount-accessor-select.js index d5263e6920..c86c5075b8 100644 --- a/ui/app/components/mount-accessor-select.js +++ b/ui/app/components/mount-accessor-select.js @@ -38,7 +38,7 @@ export default class MountAccessorSelect extends Component { } @task *authMethods() { - let methods = yield this.store.findAll('auth-method'); + const methods = yield this.store.findAll('auth-method'); if (!this.args.value && !this.args.noDefault) { const getValue = methods.get('firstObject.accessor'); this.args.onChange(getValue); diff --git a/ui/app/components/mount-backend-form.js b/ui/app/components/mount-backend-form.js index b3b3a6bff3..89bf91ecf3 100644 --- a/ui/app/components/mount-backend-form.js +++ b/ui/app/components/mount-backend-form.js @@ -72,12 +72,12 @@ export default class MountBackendForm extends Component { } checkPathChange(type) { - let mount = this.mountModel; - let currentPath = mount.path; - let list = this.mountTypes; + const mount = this.mountModel; + const currentPath = mount.path; + const list = this.mountTypes; // if the current path matches a type (meaning the user hasn't altered it), // change it here to match the new type - let isUnchanged = list.findBy('type', currentPath); + const isUnchanged = list.findBy('type', currentPath); if (!currentPath || isUnchanged) { mount.path = type; } @@ -120,8 +120,8 @@ export default class MountBackendForm extends Component { } } - let changedAttrKeys = Object.keys(mountModel.changedAttributes()); - let updatesConfig = + const changedAttrKeys = Object.keys(mountModel.changedAttributes()); + const updatesConfig = changedAttrKeys.includes('casRequired') || changedAttrKeys.includes('deleteVersionAfter') || changedAttrKeys.includes('maxVersions'); @@ -137,7 +137,7 @@ export default class MountBackendForm extends Component { return; } if (err.errors) { - let errors = err.errors.map((e) => { + const errors = err.errors.map((e) => { if (typeof e === 'object') return e.title || e.message || JSON.stringify(e); return e; }); diff --git a/ui/app/components/namespace-link.js b/ui/app/components/namespace-link.js index fc62cd8b0e..2e8d65a019 100644 --- a/ui/app/components/namespace-link.js +++ b/ui/app/components/namespace-link.js @@ -13,15 +13,15 @@ export default Component.extend({ showLastSegment: false, normalizedNamespace: computed('targetNamespace', function () { - let ns = this.targetNamespace; + const ns = this.targetNamespace; return (ns || '').replace(/\.+/g, '/').replace(/☃/g, '.'); }), namespaceDisplay: computed('normalizedNamespace', 'showLastSegment', function () { - let ns = this.normalizedNamespace; + const ns = this.normalizedNamespace; if (!ns) return 'root'; - let showLastSegment = this.showLastSegment; - let parts = ns?.split('/'); + const showLastSegment = this.showLastSegment; + const parts = ns?.split('/'); return showLastSegment ? parts[parts.length - 1] : ns; }), @@ -30,7 +30,7 @@ export default Component.extend({ }), get namespaceLink() { - let origin = + const origin = window.location.protocol + '//' + window.location.hostname + diff --git a/ui/app/components/namespace-picker.js b/ui/app/components/namespace-picker.js index 23705e1f4b..b671a07854 100644 --- a/ui/app/components/namespace-picker.js +++ b/ui/app/components/namespace-picker.js @@ -27,8 +27,8 @@ export default Component.extend({ didReceiveAttrs() { this._super(...arguments); - let ns = this.namespace; - let oldNS = this.oldNamespace; + const ns = this.namespace; + const oldNS = this.oldNamespace; if (!oldNS || ns !== oldNS) { this.setForAnimation.perform(); this.fetchListCapability.perform(); @@ -38,7 +38,7 @@ export default Component.extend({ fetchListCapability: task(function* () { try { - let capability = yield this.store.findRecord('capabilities', 'sys/namespaces/'); + const capability = yield this.store.findRecord('capabilities', 'sys/namespaces/'); this.set('listCapability', capability); this.set('canList', true); } catch (e) { @@ -48,15 +48,15 @@ export default Component.extend({ } }), setForAnimation: task(function* () { - let leaves = this.menuLeaves; - let lastLeaves = this.lastMenuLeaves; + const leaves = this.menuLeaves; + const lastLeaves = this.lastMenuLeaves; if (!lastLeaves) { this.set('lastMenuLeaves', leaves); yield timeout(0); return; } - let isAdding = leaves.length > lastLeaves.length; - let changedLeaf = (isAdding ? leaves : lastLeaves).get('lastObject'); + const isAdding = leaves.length > lastLeaves.length; + const changedLeaf = (isAdding ? leaves : lastLeaves).get('lastObject'); this.set('isAdding', isAdding); this.set('changedLeaf', changedLeaf); @@ -82,7 +82,7 @@ export default Component.extend({ inRootNamespace: alias('namespaceService.inRootNamespace'), namespaceTree: computed('accessibleNamespaces', function () { - let nsList = this.accessibleNamespaces; + const nsList = this.accessibleNamespaces; if (!nsList) { return []; @@ -91,7 +91,7 @@ export default Component.extend({ }), maybeAddRoot(leaves) { - let userRoot = this.auth.authData.userRootNamespace; + const userRoot = this.auth.authData.userRootNamespace; if (userRoot === '') { leaves.unshift(''); } @@ -137,8 +137,8 @@ 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 () { - let tree = this.namespaceTree; - let leaves = Object.keys(tree); + const tree = this.namespaceTree; + const leaves = Object.keys(tree); return leaves; }), @@ -149,9 +149,9 @@ export default Component.extend({ }), namespaceDisplay: computed('namespacePath', 'accessibleNamespaces', 'accessibleNamespaces.[]', function () { - let namespace = this.namespacePath; + const namespace = this.namespacePath; if (!namespace) return ''; - let parts = namespace?.split('/'); + const parts = namespace?.split('/'); return parts[parts.length - 1]; }), diff --git a/ui/app/components/nav-header.js b/ui/app/components/nav-header.js index 7f67b8f258..0d59d4a4bb 100644 --- a/ui/app/components/nav-header.js +++ b/ui/app/components/nav-header.js @@ -12,7 +12,7 @@ export default Component.extend({ navDrawerOpen: false, consoleFullscreen: false, hideLinks: computed('router.currentRouteName', function () { - let currentRoute = this.router.currentRouteName; + const 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 a4c8742765..30794ce5c4 100644 --- a/ui/app/components/oidc-consent-block.js +++ b/ui/app/components/oidc-consent-block.js @@ -26,7 +26,7 @@ export default class OidcConsentBlockComponent extends Component { buildUrl(urlString, params) { try { - let url = new URL(urlString); + const url = new URL(urlString); Object.keys(params).forEach((key) => { if (params[key] && validParameters.includes(key)) { url.searchParams.append(key, params[key]); @@ -42,8 +42,8 @@ export default class OidcConsentBlockComponent extends Component { @action handleSubmit(evt) { evt.preventDefault(); - let { redirect, ...params } = this.args; - let redirectUrl = this.buildUrl(redirect, params); + const { redirect, ...params } = this.args; + const redirectUrl = this.buildUrl(redirect, params); if (Ember.testing) { this.args.testRedirect(redirectUrl.toString()); } else { diff --git a/ui/app/components/oidc/provider-form.js b/ui/app/components/oidc/provider-form.js index 2b0f4224f5..a2fd2ad21f 100644 --- a/ui/app/components/oidc/provider-form.js +++ b/ui/app/components/oidc/provider-form.js @@ -34,7 +34,7 @@ export default class OidcProviderForm extends Component { // function passed to search select renderInfoTooltip(selection, dropdownOptions) { // if a client has been deleted it will not exist in dropdownOptions (response from search select's query) - let clientExists = !!dropdownOptions.findBy('clientId', selection); + const clientExists = !!dropdownOptions.findBy('clientId', selection); return !clientExists ? 'The application associated with this client_id no longer exists' : false; } diff --git a/ui/app/components/pgp-list.js b/ui/app/components/pgp-list.js index 4f71004308..005f387ae0 100644 --- a/ui/app/components/pgp-list.js +++ b/ui/app/components/pgp-list.js @@ -11,7 +11,7 @@ export default Component.extend({ if (num) { num = parseInt(num, 10); } - let list = this.newList(num); + const list = this.newList(num); this.set('listData', list); }, @@ -45,7 +45,7 @@ export default Component.extend({ actions: { setKey(index, key) { - let { listData } = this; + const { listData } = this; listData.splice(index, 1, key); this.onDataUpdate(listData.compact().map((k) => k.value)); }, diff --git a/ui/app/components/radial-progress.js b/ui/app/components/radial-progress.js index ba2693d3cd..74a6615c2a 100644 --- a/ui/app/components/radial-progress.js +++ b/ui/app/components/radial-progress.js @@ -11,7 +11,7 @@ export default Component.extend({ strokeWidth: 1, viewBox: computed('size', function () { - let s = this.size; + const s = this.size; return `0 0 ${s} ${s}`; }), centerValue: computed('size', function () { diff --git a/ui/app/components/raft-storage-overview.js b/ui/app/components/raft-storage-overview.js index b77028e679..16e8dec105 100644 --- a/ui/app/components/raft-storage-overview.js +++ b/ui/app/components/raft-storage-overview.js @@ -47,11 +47,11 @@ export default Component.extend({ actions: { async removePeer(model) { - let { nodeId } = model; + const { nodeId } = model; try { await model.destroyRecord(); } catch (e) { - let errString = e.errors ? e.errors.join(' ') : e.message || e; + const errString = e.errors ? e.errors.join(' ') : e.message || e; this.flashMessages.danger(`There was an issue removing the peer ${nodeId}: ${errString}`); return; } @@ -72,7 +72,7 @@ export default Component.extend({ // then forcing a download by clicking a link that has a download attribute // // this is not the default because - let adapter = getOwner(this).lookup('adapter:application'); + const adapter = getOwner(this).lookup('adapter:application'); this.flashMessages.success('The snapshot download has begun.'); let resp, blob; @@ -80,18 +80,18 @@ export default Component.extend({ resp = await adapter.rawRequest('/v1/sys/storage/raft/snapshot', 'GET'); blob = await resp.blob(); } catch (e) { - let errString = e.errors ? e.errors.join(' ') : e.message || e; + const errString = e.errors ? e.errors.join(' ') : e.message || e; this.flashMessages.danger(`There was an error trying to download the snapshot: ${errString}`); } - let filename = 'snapshot.gz'; - let file = new Blob([blob], { type: 'application/x-gzip' }); + const filename = 'snapshot.gz'; + const file = new Blob([blob], { type: 'application/x-gzip' }); file.name = filename; if ('msSaveOrOpenBlob' in navigator) { navigator.msSaveOrOpenBlob(file, filename); return; } - let a = document.createElement('a'); - let objectURL = window.URL.createObjectURL(file); + const a = document.createElement('a'); + const objectURL = window.URL.createObjectURL(file); a.href = objectURL; a.download = filename; document.body.appendChild(a); diff --git a/ui/app/components/raft-storage-restore.js b/ui/app/components/raft-storage-restore.js index 226217cc5a..4dd31dedac 100644 --- a/ui/app/components/raft-storage-restore.js +++ b/ui/app/components/raft-storage-restore.js @@ -14,14 +14,14 @@ export default Component.extend({ abortController: null, restore: task(function* () { this.set('errors', null); - let adapter = getOwner(this).lookup('adapter:application'); + const adapter = getOwner(this).lookup('adapter:application'); try { let url = '/v1/sys/storage/raft/snapshot'; if (this.forceRestore) { url = `${url}-force`; } - let file = new Blob([this.file], { type: 'application/gzip' }); - let controller = new AbortController(); + const file = new Blob([this.file], { type: 'application/gzip' }); + const controller = new AbortController(); this.set('abortController', controller); yield adapter.rawRequest(url, 'POST', { body: file, signal: controller.signal }); this.flashMessages.success('The snapshot was successfully uploaded!'); @@ -33,7 +33,7 @@ export default Component.extend({ if (e.json) { resp = yield e.json(); } - let err = resp ? resp.errors : [e]; + const err = resp ? resp.errors : [e]; this.set('errors', err); } }), diff --git a/ui/app/components/role-edit.js b/ui/app/components/role-edit.js index 3c222836d1..861e3d7d12 100644 --- a/ui/app/components/role-edit.js +++ b/ui/app/components/role-edit.js @@ -43,7 +43,7 @@ export default Component.extend(FocusOnInsertMixin, { waitForKeyUp: task(function* () { while (true) { - let event = yield waitForEvent(document.body, 'keyup'); + const event = yield waitForEvent(document.body, 'keyup'); this.onEscape(event); } }) diff --git a/ui/app/components/role-ssh-edit.js b/ui/app/components/role-ssh-edit.js index 05da151c99..ccfc789fa9 100644 --- a/ui/app/components/role-ssh-edit.js +++ b/ui/app/components/role-ssh-edit.js @@ -9,7 +9,7 @@ export default RoleEdit.extend({ actions: { updateTtl(path, val) { const model = this.model; - let valueToSet = val.enabled === true ? `${val.seconds}s` : undefined; + const valueToSet = val.enabled === true ? `${val.seconds}s` : undefined; model.set(path, valueToSet); }, }, diff --git a/ui/app/components/secret-create-or-update.js b/ui/app/components/secret-create-or-update.js index 52b86a8795..634fb4b05f 100644 --- a/ui/app/components/secret-create-or-update.js +++ b/ui/app/components/secret-create-or-update.js @@ -92,7 +92,7 @@ export default class SecretCreateOrUpdate extends Component { ? set(this.validationMessages, name, `A secret with this ${name} already exists.`) : set(this.validationMessages, name, ''); } - let values = Object.values(this.validationMessages); + const values = Object.values(this.validationMessages); this.validationErrorCount = values.filter(Boolean).length; } onEscape(e) { @@ -107,22 +107,22 @@ export default class SecretCreateOrUpdate extends Component { } } pathHasWhiteSpace(value) { - let validation = new RegExp('\\s', 'g'); // search for whitespace + const validation = new RegExp('\\s', 'g'); // search for whitespace this.pathWhiteSpaceWarning = validation.test(value); } // successCallback is called in the context of the component persistKey(successCallback) { - let secret = this.args.model; - let secretData = this.args.modelForData; - let isV2 = this.args.isV2; + const secret = this.args.model; + const secretData = this.args.modelForData; + const isV2 = this.args.isV2; let key = secretData.get('path') || secret.id; if (key.startsWith('/')) { key = key.replace(/^\/+/g, ''); secretData.set(secretData.pathAttr, key); } - let changed = secret.changedAttributes(); - let changedKeys = Object.keys(changed); + const changed = secret.changedAttributes(); + const changedKeys = Object.keys(changed); return secretData .save() @@ -157,7 +157,7 @@ export default class SecretCreateOrUpdate extends Component { }) .catch((error) => { if (error instanceof ControlGroupError) { - let errorMessage = this.controlGroup.logFromError(error); + const errorMessage = this.controlGroup.logFromError(error); this.error = errorMessage.content; } throw error; @@ -174,7 +174,7 @@ export default class SecretCreateOrUpdate extends Component { } get isCreateNewVersionFromOldVersion() { - let model = this.args.model; + const model = this.args.model; if (!model) { return false; } @@ -191,7 +191,7 @@ export default class SecretCreateOrUpdate extends Component { @(task(function* (name, value) { this.checkValidation(name, value); while (true) { - let event = yield waitForEvent(document.body, 'keyup'); + const event = yield waitForEvent(document.body, 'keyup'); this.onEscape(event); } }) @@ -263,7 +263,7 @@ export default class SecretCreateOrUpdate extends Component { if (!(e.keyCode === keys.ENTER && e.metaKey)) { return; } - let $form = this.element.querySelector('form'); + const $form = this.element.querySelector('form'); if ($form.length) { $form.submit(); } diff --git a/ui/app/components/secret-delete-menu.js b/ui/app/components/secret-delete-menu.js index ab8bd57540..a23db76ccb 100644 --- a/ui/app/components/secret-delete-menu.js +++ b/ui/app/components/secret-delete-menu.js @@ -8,7 +8,8 @@ import { alias } from '@ember/object/computed'; import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; const getErrorMessage = (errors) => { - let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.'; + const errorMessage = + errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.'; return errorMessage; }; export default class SecretDeleteMenu extends Component { @@ -22,7 +23,7 @@ export default class SecretDeleteMenu extends Component { 'capabilities', (context) => { if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; - let [backend, id] = JSON.parse(context.args.modelForData.id); + const [backend, id] = JSON.parse(context.args.modelForData.id); return { id: `${backend}/undelete/${id}`, }; @@ -36,7 +37,7 @@ export default class SecretDeleteMenu extends Component { 'capabilities', (context) => { if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; - let [backend, id] = JSON.parse(context.args.modelForData.id); + const [backend, id] = JSON.parse(context.args.modelForData.id); return { id: `${backend}/destroy/${id}`, }; @@ -50,8 +51,8 @@ export default class SecretDeleteMenu extends Component { 'capabilities', (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; + const backend = context.args.model.engine.id; + const id = context.args.model.id; return { id: `${backend}/metadata/${id}`, }; @@ -69,9 +70,9 @@ export default class SecretDeleteMenu extends Component { if (!context.args.model || context.args.mode === 'create') { return; } - let backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; - let id = context.args.model.id; - let path = context.args.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; + const backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; + const id = context.args.model.id; + const path = context.args.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; return { id: path, }; @@ -90,9 +91,9 @@ export default class SecretDeleteMenu extends Component { if (!context.args.model || context.args.mode === 'create') { return; } - let backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; - let id = context.args.model.id; - let path = context.args.isV2 ? `${backend}/delete/${id}` : `${backend}/${id}`; + const backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; + const id = context.args.model.id; + const path = context.args.isV2 ? `${backend}/delete/${id}` : `${backend}/${id}`; return { id: path, }; @@ -107,10 +108,10 @@ export default class SecretDeleteMenu extends Component { get isLatestVersion() { // must have metadata access. - let { model } = this.args; + const { model } = this.args; if (!model) return false; - let latestVersion = model.currentVersion; - let selectedVersion = model.selectedVersion.version; + const latestVersion = model.currentVersion; + const selectedVersion = model.selectedVersion.version; if (latestVersion !== selectedVersion) { return false; } diff --git a/ui/app/components/secret-edit-metadata.js b/ui/app/components/secret-edit-metadata.js index 996c822471..8b34326e71 100644 --- a/ui/app/components/secret-edit-metadata.js +++ b/ui/app/components/secret-edit-metadata.js @@ -28,7 +28,7 @@ export default class SecretEditMetadata extends Component { @tracked modelValidations; async save() { - let model = this.args.model; + const model = this.args.model; try { await model.save(); } catch (e) { @@ -49,7 +49,7 @@ export default class SecretEditMetadata extends Component { if (name === 'customMetadata') { // atypical case where property is not set on model on change - validate independently /* eslint-disable no-useless-escape */ - let regex = /^[^\\]+$/g; // looking for a backward slash + const regex = /^[^\\]+$/g; // looking for a backward slash if (!value.match(regex)) { state[name] = { errors: ['Custom values cannot contain a backward slash.'], @@ -63,7 +63,7 @@ export default class SecretEditMetadata extends Component { } } let count = 0; - for (let key in state) { + for (const key in state) { if (!state[key].isValid) { count++; } diff --git a/ui/app/components/secret-edit.js b/ui/app/components/secret-edit.js index 52c06e560b..2a9ab3a0ef 100644 --- a/ui/app/components/secret-edit.js +++ b/ui/app/components/secret-edit.js @@ -55,9 +55,9 @@ export default class SecretEdit extends Component { if (!context.args.model || context.args.mode === 'create') { return; } - let backend = context.isV2 ? context.args.model.engine.id : context.args.model.backend; - let id = context.args.model.id; - let path = context.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; + const backend = context.isV2 ? context.args.model.engine.id : context.args.model.backend; + const id = context.args.model.id; + const path = context.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; return { id: path, }; @@ -98,7 +98,7 @@ export default class SecretEdit extends Component { @or('requestInFlight', 'model.isFolder', 'model.flagsIsInvalid') buttonDisabled; get modelForData() { - let { model } = this.args; + const { model } = this.args; if (!model) return null; return this.isV2 ? model.belongsTo('selectedVersion').value() : model; } diff --git a/ui/app/components/secret-list/database-list-item.js b/ui/app/components/secret-list/database-list-item.js index 32b0572482..acb05947b3 100644 --- a/ui/app/components/secret-list/database-list-item.js +++ b/ui/app/components/secret-list/database-list-item.js @@ -35,7 +35,7 @@ export default class DatabaseListItem extends Component { @action resetConnection(id) { const { backend } = this.args.item; - let adapter = this.store.adapterFor('database/connection'); + const adapter = this.store.adapterFor('database/connection'); adapter .resetConnection(backend, id) .then(() => { @@ -48,7 +48,7 @@ export default class DatabaseListItem extends Component { @action rotateRootCred(id) { const { backend } = this.args.item; - let adapter = this.store.adapterFor('database/connection'); + const adapter = this.store.adapterFor('database/connection'); adapter .rotateRootCredentials(backend, id) .then(() => { @@ -61,7 +61,7 @@ export default class DatabaseListItem extends Component { @action rotateRoleCred(id) { const { backend } = this.args.item; - let adapter = this.store.adapterFor('database/credential'); + const adapter = this.store.adapterFor('database/credential'); adapter .rotateRoleCredentials(backend, id) .then(() => { diff --git a/ui/app/components/text-file.js b/ui/app/components/text-file.js index e94b692994..5402f26619 100644 --- a/ui/app/components/text-file.js +++ b/ui/app/components/text-file.js @@ -68,7 +68,7 @@ export default class TextFile extends Component { @action updateData(e) { e.preventDefault(); - let file = this.args.file; + const file = this.args.file; set(file, 'value', e.target.value); this.args.onChange(this.index, file); } diff --git a/ui/app/components/token-expire-warning.js b/ui/app/components/token-expire-warning.js index 406b6670b8..11989790c8 100644 --- a/ui/app/components/token-expire-warning.js +++ b/ui/app/components/token-expire-warning.js @@ -5,7 +5,7 @@ export default class TokenExpireWarning extends Component { @service router; get showWarning() { - let currentRoute = this.router.currentRouteName; + const currentRoute = this.router.currentRouteName; if ('vault.cluster.oidc-provider' === currentRoute) { return false; } diff --git a/ui/app/components/tool-actions-form.js b/ui/app/components/tool-actions-form.js index 0bfd6171f0..e2329d4452 100644 --- a/ui/app/components/tool-actions-form.js +++ b/ui/app/components/tool-actions-form.js @@ -78,9 +78,9 @@ export default Component.extend(DEFAULTS, { handleSuccess(resp, action) { let props = {}; - let secret = (resp && resp.data) || resp.auth; + const secret = (resp && resp.data) || resp.auth; if (secret && action === 'unwrap') { - let details = { + const details = { 'Request ID': resp.request_id, 'Lease ID': resp.lease_id || 'None', Renewable: resp.renewable ? 'Yes' : 'No', diff --git a/ui/app/components/transform-role-edit.js b/ui/app/components/transform-role-edit.js index 23d5caf505..cdc1f5d440 100644 --- a/ui/app/components/transform-role-edit.js +++ b/ui/app/components/transform-role-edit.js @@ -40,10 +40,10 @@ export default TransformBase.extend({ }); Promise.all(promises).then((res) => { - let hasError = res.find((r) => !!r.errorStatus); + const 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'); + const errorAdding = res.find((r) => r.errorStatus === 403 && r.action === 'ADD'); + const 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.'; diff --git a/ui/app/components/transform-show-transformation.js b/ui/app/components/transform-show-transformation.js index a00970c994..4aedf8a4e5 100644 --- a/ui/app/components/transform-show-transformation.js +++ b/ui/app/components/transform-show-transformation.js @@ -7,12 +7,12 @@ export default TransformBase.extend({ return; } - let { type, allowed_roles, tweak_source, name } = this.model; - let wildCardRole = allowed_roles.find((role) => role.includes('*')); + const { type, allowed_roles, tweak_source, name } = this.model; + const wildCardRole = allowed_roles.find((role) => role.includes('*')); // values to be returned let role = ''; - let value = 'value='; + const value = 'value='; let tweak = ''; // determine the role diff --git a/ui/app/components/transformation-edit.js b/ui/app/components/transformation-edit.js index ec65ea3e88..430208ebc9 100644 --- a/ui/app/components/transformation-edit.js +++ b/ui/app/components/transformation-edit.js @@ -67,7 +67,7 @@ export default TransformBase.extend({ const promises = updateRoles.map((r) => this.updateOrCreateRole(r, transformationId, backend)); Promise.all(promises).then((results) => { - let hasError = results.find((role) => !!role.errorStatus); + const hasError = results.find((role) => !!role.errorStatus); if (hasError) { let message = diff --git a/ui/app/components/transit-edit.js b/ui/app/components/transit-edit.js index 33620345a4..7b21e32cb3 100644 --- a/ui/app/components/transit-edit.js +++ b/ui/app/components/transit-edit.js @@ -30,7 +30,7 @@ export default Component.extend(FocusOnInsertMixin, { waitForKeyUp: task(function* () { while (true) { - let event = yield waitForEvent(document.body, 'keyup'); + const 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 42f5a9d999..ddfddfb3b4 100644 --- a/ui/app/components/transit-key-actions.js +++ b/ui/app/components/transit-key-actions.js @@ -93,7 +93,7 @@ export default Component.extend(TRANSIT_PARAMS, { }, keyIsRSA: computed('key.type', function () { - let type = this.key.type; + const type = this.key.type; return type === 'rsa-2048' || type === 'rsa-3072' || type === 'rsa-4096'; }), @@ -120,9 +120,9 @@ export default Component.extend(TRANSIT_PARAMS, { }, resetParams(oldAction, action) { - let params = copy(TRANSIT_PARAMS); + const params = copy(TRANSIT_PARAMS); let paramsToKeep; - let clearWithoutCheck = + const clearWithoutCheck = !oldAction || // don't save values from datakey oldAction === 'datakey' || @@ -181,8 +181,8 @@ export default Component.extend(TRANSIT_PARAMS, { }, compactData(data) { - let type = this.key.type; - let isRSA = type === 'rsa-2048' || type === 'rsa-3072' || type === 'rsa-4096'; + const type = this.key.type; + const isRSA = type === 'rsa-2048' || type === 'rsa-3072' || type === 'rsa-4096'; return Object.keys(data).reduce((result, key) => { if (key === 'signature_algorithm' && !isRSA) { return result; @@ -232,7 +232,7 @@ export default Component.extend(TRANSIT_PARAMS, { formData.input = encodeString(formData.input); } } - let payload = formData ? this.compactData(formData) : null; + const payload = formData ? this.compactData(formData) : null; this.setProperties({ errors: null, result: null, diff --git a/ui/app/components/ui-wizard.js b/ui/app/components/ui-wizard.js index 0793a2a6be..7a7341f05f 100644 --- a/ui/app/components/ui-wizard.js +++ b/ui/app/components/ui-wizard.js @@ -23,8 +23,8 @@ export default Component.extend({ }, advanceWizard() { - let inInit = matchesState('init', this.wizard.currentState); - let event = inInit ? this.wizard.initEvent || 'CONTINUE' : 'CONTINUE'; + const inInit = matchesState('init', this.wizard.currentState); + const event = inInit ? this.wizard.initEvent || 'CONTINUE' : 'CONTINUE'; this.wizard.transitionTutorialMachine(this.currentState, event); }, diff --git a/ui/app/components/wizard-content.js b/ui/app/components/wizard-content.js index 98ec13b33b..92fae5c912 100644 --- a/ui/app/components/wizard-content.js +++ b/ui/app/components/wizard-content.js @@ -64,8 +64,8 @@ export default Component.extend({ ), currentTutorialProgress: computed('tutorialState', function () { if (this.tutorialState.includes('init.active')) { - let currentStepName = this.tutorialState.split('.')[2]; - let currentStepNumber = INIT_STEPS.indexOf(currentStepName) + 1; + const currentStepName = this.tutorialState.split('.')[2]; + const currentStepNumber = INIT_STEPS.indexOf(currentStepName) + 1; return { percentage: (currentStepNumber / INIT_STEPS.length) * 100, text: `Step ${currentStepNumber} of ${INIT_STEPS.length}`, @@ -81,7 +81,7 @@ export default Component.extend({ 'currentTutorialProgress.percentage', 'wizard.featureList', function () { - let bar = []; + const bar = []; if (this.currentTutorialProgress) { bar.push({ style: htmlSafe(`width:${this.currentTutorialProgress.percentage}%;`), diff --git a/ui/app/components/wizard/features-selection.js b/ui/app/components/wizard/features-selection.js index 4f7a528faa..b44f5831b4 100644 --- a/ui/app/components/wizard/features-selection.js +++ b/ui/app/components/wizard/features-selection.js @@ -16,13 +16,13 @@ export default Component.extend({ }, maybeHideFeatures() { - let features = this.allFeatures; + const features = this.allFeatures; features.forEach((feat) => { feat.disabled = this.doesNotHavePermission(feat.requiredPermissions); }); if (this.showReplication === false) { - let feature = this.allFeatures.findBy('key', 'replication'); + const feature = this.allFeatures.findBy('key', 'replication'); feature.show = false; } }, @@ -41,7 +41,7 @@ export default Component.extend({ estimatedTime: computed('selectedFeatures', function () { let time = 0; - for (let feature of Object.keys(FEATURE_MACHINE_TIME)) { + for (const feature of Object.keys(FEATURE_MACHINE_TIME)) { if (this.selectedFeatures.includes(feature)) { time += FEATURE_MACHINE_TIME[feature]; } @@ -137,7 +137,7 @@ export default Component.extend({ actions: { saveFeatures() { - let wizard = this.wizard; + const wizard = this.wizard; wizard.saveFeatures(this.selectedFeatures); wizard.transitionTutorialMachine('active.select', 'CONTINUE'); }, diff --git a/ui/app/components/wizard/mounts-wizard.js b/ui/app/components/wizard/mounts-wizard.js index 8e76528aa5..3113d86db0 100644 --- a/ui/app/components/wizard/mounts-wizard.js +++ b/ui/app/components/wizard/mounts-wizard.js @@ -24,7 +24,7 @@ export default Component.extend({ needsEncryption: equal('mountSubtype', 'transit'), stepComponent: alias('wizard.stepComponent'), detailsComponent: computed('currentMachine', 'mountSubtype', function () { - let suffix = this.currentMachine === 'secrets' ? 'engine' : 'method'; + const suffix = this.currentMachine === 'secrets' ? 'engine' : 'method'; return this.mountSubtype ? `wizard/${this.mountSubtype}-${suffix}` : null; }), isSupported: computed('currentMachine', 'mountSubtype', function () { diff --git a/ui/app/controllers/application.js b/ui/app/controllers/application.js index 22643644c6..45f22ce9d1 100644 --- a/ui/app/controllers/application.js +++ b/ui/app/controllers/application.js @@ -8,7 +8,7 @@ export default Controller.extend({ auth: service(), store: service(), activeCluster: computed('auth.activeCluster', function () { - let id = this.auth.activeCluster; + const id = this.auth.activeCluster; return id ? this.store.peekRecord('cluster', id) : null; }), activeClusterName: computed('activeCluster', function () { diff --git a/ui/app/controllers/vault.js b/ui/app/controllers/vault.js index 827eace50f..fc2b868a93 100644 --- a/ui/app/controllers/vault.js +++ b/ui/app/controllers/vault.js @@ -16,7 +16,7 @@ export default Controller.extend({ auth: service(), store: service(), activeCluster: computed('auth.activeCluster', function () { - let id = this.auth.activeCluster; + const id = this.auth.activeCluster; return id ? this.store.peekRecord('cluster', id) : null; }), activeClusterName: computed('activeCluster', function () { diff --git a/ui/app/controllers/vault/cluster/access/identity/create.js b/ui/app/controllers/vault/cluster/access/identity/create.js index 704c262949..bf12cb67b2 100644 --- a/ui/app/controllers/vault/cluster/access/identity/create.js +++ b/ui/app/controllers/vault/cluster/access/identity/create.js @@ -5,15 +5,15 @@ export default Controller.extend({ showRoute: 'vault.cluster.access.identity.show', showTab: 'details', navAfterSave: task(function* ({ saveType, model }) { - let isDelete = saveType === 'delete'; - let type = model.get('identityType'); - let listRoutes = { + const isDelete = saveType === 'delete'; + const type = model.get('identityType'); + const listRoutes = { 'entity-alias': 'vault.cluster.access.identity.aliases.index', 'group-alias': 'vault.cluster.access.identity.aliases.index', group: 'vault.cluster.access.identity.index', entity: 'vault.cluster.access.identity.index', }; - let routeName = listRoutes[type]; + const routeName = listRoutes[type]; if (!isDelete) { yield this.transitionToRoute(this.showRoute, model.id, this.showTab); return; diff --git a/ui/app/controllers/vault/cluster/access/identity/index.js b/ui/app/controllers/vault/cluster/access/identity/index.js index bd00ce7c60..f9d9f7877e 100644 --- a/ui/app/controllers/vault/cluster/access/identity/index.js +++ b/ui/app/controllers/vault/cluster/access/identity/index.js @@ -7,8 +7,8 @@ export default Controller.extend(ListController, { actions: { delete(model) { - let type = model.get('identityType'); - let id = model.id; + const type = model.get('identityType'); + const id = model.id; return model .destroyRecord() .then(() => { @@ -23,9 +23,9 @@ export default Controller.extend(ListController, { }, toggleDisabled(model) { - let action = model.get('disabled') ? ['enabled', 'enabling'] : ['disabled', 'disabling']; - let type = model.get('identityType'); - let id = model.id; + const action = model.get('disabled') ? ['enabled', 'enabling'] : ['disabled', 'disabling']; + const type = model.get('identityType'); + const id = model.id; model.toggleProperty('disabled'); model diff --git a/ui/app/controllers/vault/cluster/access/leases/list.js b/ui/app/controllers/vault/cluster/access/leases/list.js index 5fa6c5cbb7..f2a598b43b 100644 --- a/ui/app/controllers/vault/cluster/access/leases/list.js +++ b/ui/app/controllers/vault/cluster/access/leases/list.js @@ -25,8 +25,8 @@ export default Controller.extend(ListController, { }), emptyTitle: computed('baseKey.id', 'filter', 'filterIsFolder', function () { - let id = this.baseKey.id; - let filter = this.filter; + const id = this.baseKey.id; + const filter = this.filter; if (id === '') { return 'There are currently no leases.'; } diff --git a/ui/app/controllers/vault/cluster/auth.js b/ui/app/controllers/vault/cluster/auth.js index 76f9bb9f78..9d37d1d6f7 100644 --- a/ui/app/controllers/vault/cluster/auth.js +++ b/ui/app/controllers/vault/cluster/auth.js @@ -20,8 +20,8 @@ export default Controller.extend({ oidcProvider: '', get managedNamespaceChild() { - let fullParam = this.namespaceQueryParam; - let split = fullParam.split('/'); + const fullParam = this.namespaceQueryParam; + const split = fullParam.split('/'); if (split.length > 1) { split.shift(); return `/${split.join('/')}`; diff --git a/ui/app/controllers/vault/cluster/init.js b/ui/app/controllers/vault/cluster/init.js index 6f5d488bbe..9c4439bfa6 100644 --- a/ui/app/controllers/vault/cluster/init.js +++ b/ui/app/controllers/vault/cluster/init.js @@ -41,9 +41,9 @@ export default Controller.extend(DEFAULTS, { actions: { initCluster(data) { - let isCloudSeal = !!this.model.sealType && this.model.sealType !== 'shamir'; + const isCloudSeal = !!this.model.sealType && this.model.sealType !== 'shamir'; if (data.secret_shares) { - let shares = parseInt(data.secret_shares, 10); + const shares = parseInt(data.secret_shares, 10); data.secret_shares = shares; if (isCloudSeal) { data.stored_shares = 1; @@ -51,7 +51,7 @@ export default Controller.extend(DEFAULTS, { } } if (data.secret_threshold) { - let threshold = parseInt(data.secret_threshold, 10); + const threshold = parseInt(data.secret_threshold, 10); data.secret_threshold = threshold; if (isCloudSeal) { data.recovery_threshold = threshold; diff --git a/ui/app/controllers/vault/cluster/policies/create.js b/ui/app/controllers/vault/cluster/policies/create.js index 405f653270..69e22f68fc 100644 --- a/ui/app/controllers/vault/cluster/policies/create.js +++ b/ui/app/controllers/vault/cluster/policies/create.js @@ -7,11 +7,11 @@ export default Controller.extend(PolicyEditController, { file: null, actions: { setPolicyFromFile(index, fileInfo) { - let { value, fileName } = fileInfo; - let model = this.model; + const { value, fileName } = fileInfo; + const model = this.model; model.set('policy', value); if (!model.get('name')) { - let trimmedFileName = trimRight(fileName, ['.json', '.txt', '.hcl', '.policy']); + const trimmedFileName = trimRight(fileName, ['.json', '.txt', '.hcl', '.policy']); model.set('name', trimmedFileName); } this.set('showFileUpload', false); diff --git a/ui/app/controllers/vault/cluster/policies/index.js b/ui/app/controllers/vault/cluster/policies/index.js index c079e39bc2..b75e2703a9 100644 --- a/ui/app/controllers/vault/cluster/policies/index.js +++ b/ui/app/controllers/vault/cluster/policies/index.js @@ -49,9 +49,9 @@ export default Controller.extend({ this.set('filterFocused', bool); }, deletePolicy(model) { - let policyType = model.get('policyType'); - let name = model.id; - let flash = this.flashMessages; + const policyType = model.get('policyType'); + const name = model.id; + const flash = this.flashMessages; model .destroyRecord() .then(() => { @@ -63,7 +63,7 @@ export default Controller.extend({ } }) .catch((e) => { - let errors = e.errors ? e.errors.join('') : e.message; + const 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/sign.js b/ui/app/controllers/vault/cluster/secrets/backend/sign.js index 514d232a72..5c5aeae28e 100644 --- a/ui/app/controllers/vault/cluster/secrets/backend/sign.js +++ b/ui/app/controllers/vault/cluster/secrets/backend/sign.js @@ -25,7 +25,7 @@ export default Controller.extend({ updateTtl(path, val) { const model = this.model; - let valueToSet = val.enabled === true ? `${val.seconds}s` : undefined; + const valueToSet = val.enabled === true ? `${val.seconds}s` : undefined; set(model, path, valueToSet); }, diff --git a/ui/app/controllers/vault/cluster/settings/auth/enable.js b/ui/app/controllers/vault/cluster/settings/auth/enable.js index 4d236128db..d0e02c9507 100644 --- a/ui/app/controllers/vault/cluster/settings/auth/enable.js +++ b/ui/app/controllers/vault/cluster/settings/auth/enable.js @@ -6,7 +6,7 @@ export default Controller.extend({ actions: { onMountSuccess: function (type, path) { this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', type); - let transition = this.transitionToRoute('vault.cluster.settings.auth.configure', path); + const transition = this.transitionToRoute('vault.cluster.settings.auth.configure', path); return transition.followRedirects(); }, }, diff --git a/ui/app/decorators/model-validations.js b/ui/app/decorators/model-validations.js index 1db84446d1..91fc0ff8ed 100644 --- a/ui/app/decorators/model-validations.js +++ b/ui/app/decorators/model-validations.js @@ -126,7 +126,7 @@ export function withModelValidations(validations) { generateErrorCountMessage(errorCount) { if (errorCount < 1) return null; // returns count specific message: 'There is an error/are N errors with this form.' - let isPlural = errorCount > 1 ? `are ${errorCount} errors` : false; + const isPlural = errorCount > 1 ? `are ${errorCount} errors` : false; return `There ${isPlural ? isPlural : 'is an error'} with this form.`; } }; diff --git a/ui/app/helpers/date-from-now.js b/ui/app/helpers/date-from-now.js index 2f446fb645..98c1e9bf40 100644 --- a/ui/app/helpers/date-from-now.js +++ b/ui/app/helpers/date-from-now.js @@ -4,7 +4,7 @@ import { formatDistanceToNow } from 'date-fns'; export function dateFromNow([date], options = {}) { // check first if string. If it is, it could be ISO format or UTC, either way create a new date object // otherwise it's a number or object and just return - let newDate = typeof date === 'string' ? new Date(date) : date; + const newDate = typeof date === 'string' ? new Date(date) : date; return formatDistanceToNow(newDate, { ...options }); } diff --git a/ui/app/helpers/filter-wildcard.js b/ui/app/helpers/filter-wildcard.js index bb3f4ab15f..d9421d57cf 100644 --- a/ui/app/helpers/filter-wildcard.js +++ b/ui/app/helpers/filter-wildcard.js @@ -7,7 +7,7 @@ export function filterWildcard([string, array]) { if (!string.id && string) { string = { id: string }; } - let stringId = string.id; + const stringId = string.id; const filterBy = (stringId) => array.filter((item) => new RegExp('^' + stringId.replace(/\*/g, '.*') + '$').test(item)); return filterBy(stringId).length; diff --git a/ui/app/helpers/format-duration.js b/ui/app/helpers/format-duration.js index e7a58d609c..6a20792f61 100644 --- a/ui/app/helpers/format-duration.js +++ b/ui/app/helpers/format-duration.js @@ -12,7 +12,7 @@ export function duration([time], { nullable = false }) { } // time must be in seconds - let duration = Number.parseInt(time, 10); + const duration = Number.parseInt(time, 10); if (isNaN(duration)) { return time; } diff --git a/ui/app/helpers/has-permission.js b/ui/app/helpers/has-permission.js index e528dfaaf1..b4a64c97cd 100644 --- a/ui/app/helpers/has-permission.js +++ b/ui/app/helpers/has-permission.js @@ -15,8 +15,8 @@ export default Helper.extend({ ), compute([route], params) { - let { routeParams } = params; - let permissions = this.permissions; + const { routeParams } = params; + const permissions = this.permissions; return permissions.hasNavPermission(route, routeParams); }, diff --git a/ui/app/helpers/parse-pki-cert.js b/ui/app/helpers/parse-pki-cert.js index 79f91118eb..759ae54a1f 100644 --- a/ui/app/helpers/parse-pki-cert.js +++ b/ui/app/helpers/parse-pki-cert.js @@ -11,9 +11,9 @@ export function parsePkiCert([model]) { } let cert; try { - let cert_base64 = model.certificate.replace(/(-----(BEGIN|END) CERTIFICATE-----|\n)/g, ''); - let cert_der = fromBase64(cert_base64); - let cert_asn1 = asn1js.fromBER(stringToArrayBuffer(cert_der)); + const cert_base64 = model.certificate.replace(/(-----(BEGIN|END) CERTIFICATE-----|\n)/g, ''); + const cert_der = fromBase64(cert_base64); + const cert_asn1 = asn1js.fromBER(stringToArrayBuffer(cert_der)); cert = new Certificate({ schema: cert_asn1.result }); } catch (error) { console.debug('DEBUG: Parsing Certificate', error); // eslint-disable-line diff --git a/ui/app/helpers/route-params-for.js b/ui/app/helpers/route-params-for.js index 652e047272..14afe697bc 100644 --- a/ui/app/helpers/route-params-for.js +++ b/ui/app/helpers/route-params-for.js @@ -4,7 +4,7 @@ import { inject as service } from '@ember/service'; export default Helper.extend({ permissions: service(), compute([navItem]) { - let permissions = this.permissions; + const permissions = this.permissions; return permissions.navPathParams(navItem); }, }); diff --git a/ui/app/helpers/split-object.js b/ui/app/helpers/split-object.js index 6a7cbfaa8f..eb73accd48 100644 --- a/ui/app/helpers/split-object.js +++ b/ui/app/helpers/split-object.js @@ -15,10 +15,10 @@ import { helper as buildHelper } from '@ember/component/helper'; export function splitObject(originalObject, array) { - let object1 = {}; - let object2 = {}; + const object1 = {}; + const object2 = {}; // convert object to key's array - let keys = Object.keys(originalObject); + const keys = Object.keys(originalObject); keys.forEach((key) => { if (array.includes(key)) { object1[key] = originalObject[key]; diff --git a/ui/app/instance-initializers/track-csp-event.js b/ui/app/instance-initializers/track-csp-event.js index bc07a25e6f..a1ac104ec0 100644 --- a/ui/app/instance-initializers/track-csp-event.js +++ b/ui/app/instance-initializers/track-csp-event.js @@ -1,5 +1,5 @@ export function initialize(appInstance) { - let service = appInstance.lookup('service:csp-event'); + const service = appInstance.lookup('service:csp-event'); service.attach(); } diff --git a/ui/app/lib/attach-capabilities.js b/ui/app/lib/attach-capabilities.js index aabd5574d7..5dccbdc59e 100644 --- a/ui/app/lib/attach-capabilities.js +++ b/ui/app/lib/attach-capabilities.js @@ -27,8 +27,8 @@ import { isArray } from '@ember/array'; * */ export default function attachCapabilities(modelClass, capabilities) { - let capabilityKeys = Object.keys(capabilities); - let newRelationships = capabilityKeys.reduce((ret, key) => { + const capabilityKeys = Object.keys(capabilities); + const newRelationships = capabilityKeys.reduce((ret, key) => { ret[key] = belongsTo('capabilities'); return ret; }, {}); @@ -46,19 +46,19 @@ export default function attachCapabilities(modelClass, capabilities) { data = jsonAPIDoc; } if (isArray(data)) { - let newData = data.map(this.relatedCapabilities); + const newData = data.map(this.relatedCapabilities); return { data: newData, included, }; } - let context = { + const context = { id: data.id, ...data.attributes, }; - for (let newCapability of capabilityKeys) { - let templateFn = capabilities[newCapability]; - let type = typeOf(templateFn); + for (const newCapability of capabilityKeys) { + const templateFn = capabilities[newCapability]; + const type = typeOf(templateFn); assert(`expected value of ${newCapability} to be a function but found ${type}.`, type === 'function'); data.relationships[newCapability] = { data: { diff --git a/ui/app/lib/console-helpers.js b/ui/app/lib/console-helpers.js index d54ed77ebc..baa8a71ba9 100644 --- a/ui/app/lib/console-helpers.js +++ b/ui/app/lib/console-helpers.js @@ -11,7 +11,7 @@ export function extractDataAndFlags(method, data, flags) { // will be "key=value" or "-flag=value" or "foo=bar=baz" // split on the first = // default to value of empty string - let [item, value = ''] = val.split(/=(.+)?/); + const [item, value = ''] = val.split(/=(.+)?/); if (item.startsWith('-')) { let flagName = item.replace(/^-/, ''); if (flagName === 'wrap-ttl') { @@ -38,8 +38,8 @@ export function extractDataAndFlags(method, data, flags) { } export function executeUICommand(command, logAndOutput, commandFns) { - let cmd = command.startsWith('api') ? 'api' : command; - let isUICommand = uiCommands.includes(cmd); + const cmd = command.startsWith('api') ? 'api' : command; + const isUICommand = uiCommands.includes(cmd); if (isUICommand) { logAndOutput(command); } @@ -50,22 +50,22 @@ export function executeUICommand(command, logAndOutput, commandFns) { } export function parseCommand(command, shouldThrow) { - let args = argTokenizer(parse(command)); + const args = argTokenizer(parse(command)); if (args[0] === 'vault') { args.shift(); } - let [method, ...rest] = args; + const [method, ...rest] = args; let path; - let flags = []; - let data = []; + const flags = []; + const data = []; rest.forEach((arg) => { if (arg.startsWith('-')) { flags.push(arg); } else { if (path) { - let strippedArg = arg + const strippedArg = arg // we'll have arg=something or arg="lol I need spaces", so need to split on the first = .split(/=(.+)/) // if there were quotes, there's an empty string as the last member in the array that we don't want, @@ -90,7 +90,7 @@ export function parseCommand(command, shouldThrow) { } export function logFromResponse(response, path, method, flags) { - let { format, field } = flags; + const { format, field } = flags; let secret = response && (response.auth || response.data || response.wrap_info); if (!secret) { if (method === 'write') { @@ -103,7 +103,7 @@ export function logFromResponse(response, path, method, flags) { } if (field) { - let fieldValue = secret[field]; + const fieldValue = secret[field]; let response; if (fieldValue) { if (format && format === 'json') { @@ -140,8 +140,8 @@ export function logFromResponse(response, path, method, flags) { export function logFromError(error, vaultPath, method) { let content; - let { httpStatus, path } = error; - let verbClause = { + const { httpStatus, path } = error; + const verbClause = { read: 'reading from', write: 'writing to', list: 'listing', @@ -159,7 +159,7 @@ export function logFromError(error, vaultPath, method) { export function shiftCommandIndex(keyCode, history, index) { let newInputValue; - let commandHistoryLength = history.length; + const commandHistoryLength = history.length; if (!commandHistoryLength) { return []; diff --git a/ui/app/lib/control-group-error.js b/ui/app/lib/control-group-error.js index 52094f1ae9..655c7de012 100644 --- a/ui/app/lib/control-group-error.js +++ b/ui/app/lib/control-group-error.js @@ -2,7 +2,7 @@ import AdapterError from '@ember-data/adapter/error'; export default class ControlGroupError extends AdapterError { constructor(wrapInfo) { - let { accessor, creation_path, creation_time, token, ttl } = wrapInfo; + const { accessor, creation_path, creation_time, token, ttl } = wrapInfo; super(); this.message = 'Control Group encountered'; diff --git a/ui/app/lib/kv-object.js b/ui/app/lib/kv-object.js index 9e44eb2b55..80e71a745e 100644 --- a/ui/app/lib/kv-object.js +++ b/ui/app/lib/kv-object.js @@ -7,8 +7,8 @@ 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 obj = { + const contents = Object.keys(json || []).map((key) => { + const obj = { name: key, value: json[key], }; @@ -38,7 +38,7 @@ export default ArrayProxy.extend({ if (!includeBlanks && item.value === '' && item.name === '') { return obj; } - let val = typeof item.value === 'undefined' ? '' : item.value; + const val = typeof item.value === 'undefined' ? '' : item.value; obj[item.name || ''] = val; return obj; }, {}); diff --git a/ui/app/lib/memory-storage.js b/ui/app/lib/memory-storage.js index b702afd31d..9d76039dbf 100644 --- a/ui/app/lib/memory-storage.js +++ b/ui/app/lib/memory-storage.js @@ -1,4 +1,4 @@ -let cache = {}; +const cache = {}; export default { getItem(key) { diff --git a/ui/app/lib/path-to-tree.js b/ui/app/lib/path-to-tree.js index aac81b1fdb..884d6e51a6 100644 --- a/ui/app/lib/path-to-tree.js +++ b/ui/app/lib/path-to-tree.js @@ -22,16 +22,16 @@ const DOT_REPLACEMENT = '☃'; // } 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)); + const list = paths.slice(0).sort((a, b) => b.length - a.length || b.localeCompare(a)); // then reduce to an array // and we remove all of the items that have a string // that starts with the same prefix from the list // 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)); + const 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) === '/'; + const isFullMatch = nsWithPrefix && nsWithPrefix.charAt(ns.length) === '/'; if (!isFullMatch) { accumulator.push(ns); } diff --git a/ui/app/macros/lazy-capabilities.js b/ui/app/macros/lazy-capabilities.js index 5a4bf376dc..85ab1f98e3 100644 --- a/ui/app/macros/lazy-capabilities.js +++ b/ui/app/macros/lazy-capabilities.js @@ -15,8 +15,8 @@ import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; export function apiPath(strings, ...keys) { return function (data) { - let dict = data || {}; - let result = [strings[0]]; + const dict = data || {}; + const result = [strings[0]]; keys.forEach((key, i) => { result.push(dict[key], strings[i + 1]); }); @@ -25,14 +25,14 @@ export function apiPath(strings, ...keys) { } export default function () { - let [templateFn, ...keys] = arguments; + const [templateFn, ...keys] = arguments; return maybeQueryRecord( 'capabilities', (context) => { // pull all context attrs - let contextObject = context.getProperties(...keys); + const contextObject = context.getProperties(...keys); // remove empty ones - let nonEmptyContexts = Object.keys(contextObject).reduce((ret, key) => { + const nonEmptyContexts = Object.keys(contextObject).reduce((ret, key) => { if (contextObject[key] != null) { ret[key] = contextObject[key]; } diff --git a/ui/app/mixins/policy-edit-controller.js b/ui/app/mixins/policy-edit-controller.js index 8f77988491..e56d6a318e 100644 --- a/ui/app/mixins/policy-edit-controller.js +++ b/ui/app/mixins/policy-edit-controller.js @@ -6,9 +6,9 @@ export default Mixin.create({ wizard: service(), actions: { deletePolicy(model) { - let policyType = model.get('policyType'); - let name = model.get('name'); - let flash = this.flashMessages; + const policyType = model.get('policyType'); + const name = model.get('name'); + const flash = this.flashMessages; model .destroyRecord() .then(() => { @@ -16,7 +16,7 @@ export default Mixin.create({ return this.transitionToRoute('vault.cluster.policies', policyType); }) .catch((e) => { - let errors = e.errors ? e.errors.join('') : e.message; + const errors = e.errors ? e.errors.join('') : e.message; flash.danger( `There was an error deleting the ${policyType.toUpperCase()} policy "${name}": ${errors}.` ); @@ -24,9 +24,9 @@ export default Mixin.create({ }, savePolicy(model) { - let flash = this.flashMessages; - let policyType = model.get('policyType'); - let name = model.get('name'); + const flash = this.flashMessages; + const policyType = model.get('policyType'); + const name = model.get('name'); model .save() .then((m) => { diff --git a/ui/app/mixins/unload-model-route.js b/ui/app/mixins/unload-model-route.js index ce5c370191..6657b371fa 100644 --- a/ui/app/mixins/unload-model-route.js +++ b/ui/app/mixins/unload-model-route.js @@ -6,9 +6,9 @@ import removeRecord from 'vault/utils/remove-record'; export default Mixin.create({ modelPath: 'model', unloadModel() { - let { modelPath } = this; + const { modelPath } = this; /* eslint-disable-next-line ember/no-controller-access-in-routes */ - let model = this.controller.get(modelPath); + const model = this.controller.get(modelPath); // error is thrown when you attempt to unload a record that is inFlight (isSaving) if (!model || !model.unloadRecord || model.isSaving) { return; diff --git a/ui/app/mixins/with-nav-to-nearest-ancestor.js b/ui/app/mixins/with-nav-to-nearest-ancestor.js index 9ecb518881..335137bc72 100644 --- a/ui/app/mixins/with-nav-to-nearest-ancestor.js +++ b/ui/app/mixins/with-nav-to-nearest-ancestor.js @@ -13,12 +13,12 @@ import { task } from 'ember-concurrency'; // the ancestors array and transitions to the root export default Mixin.create({ navToNearestAncestor: task(function* (key) { - let ancestors = utils.ancestorKeysForKey(key); + const ancestors = utils.ancestorKeysForKey(key); let errored = false; let nearest = ancestors.pop(); while (nearest) { try { - let transition = this.transitionToRoute('vault.cluster.secrets.backend.list', nearest); + const transition = this.transitionToRoute('vault.cluster.secrets.backend.list', nearest); transition.data.isDeletion = true; yield transition.promise; } catch (e) { diff --git a/ui/app/models/auth-config/jwt.js b/ui/app/models/auth-config/jwt.js index 6926c6b108..7018e7e7e8 100644 --- a/ui/app/models/auth-config/jwt.js +++ b/ui/app/models/auth-config/jwt.js @@ -37,7 +37,7 @@ export default AuthConfig.extend({ helpText: 'The value against which to match the iss claim in a JWT', }), fieldGroups: computed('constructor.modelName', 'newFields', function () { - let type = this.constructor.modelName.split('/')[1].toUpperCase(); + const type = this.constructor.modelName.split('/')[1].toUpperCase(); let groups = [ { default: ['oidcDiscoveryUrl', 'defaultRole'], diff --git a/ui/app/models/auth-method.js b/ui/app/models/auth-method.js index f46015e3ec..87b02be4c6 100644 --- a/ui/app/models/auth-method.js +++ b/ui/app/models/auth-method.js @@ -51,7 +51,7 @@ const ModelExport = AuthMethodModel.extend({ }), tuneAttrs: computed('path', function () { - let { methodType } = this; + const { methodType } = this; let tuneAttrs; // token_type should not be tuneable for the token auth method if (methodType === 'token') { diff --git a/ui/app/models/aws-credential.js b/ui/app/models/aws-credential.js index 6a9ff270f6..45471335a4 100644 --- a/ui/app/models/aws-credential.js +++ b/ui/app/models/aws-credential.js @@ -52,8 +52,8 @@ export default Model.extend({ securityToken: attr('string'), attrs: computed('credentialType', 'accessKey', 'securityToken', function () { - let type = this.credentialType; - let fieldsForType = { + const type = this.credentialType; + const fieldsForType = { iam_user: ['credentialType'], assumed_role: ['credentialType', 'ttl', 'roleArn'], federation_token: ['credentialType', 'ttl'], diff --git a/ui/app/models/clients/config.js b/ui/app/models/clients/config.js index 49c83a3597..e4f101ca2c 100644 --- a/ui/app/models/clients/config.js +++ b/ui/app/models/clients/config.js @@ -20,7 +20,7 @@ const M = Model.extend({ }), configAttrs: computed(function () { - let keys = ['enabled', 'retentionMonths']; + const keys = ['enabled', 'retentionMonths']; return expandAttributeMeta(this, keys); }), }); diff --git a/ui/app/models/database/connection.js b/ui/app/models/database/connection.js index 143882dca0..2e55afabdc 100644 --- a/ui/app/models/database/connection.js +++ b/ui/app/models/database/connection.js @@ -171,10 +171,10 @@ export default Model.extend({ if (!this.plugin_name) { return null; } - let pluginFields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name).fields.filter( + const pluginFields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name).fields.filter( (f) => f.group === 'pluginConfig' ); - let groups = fieldsToGroups(pluginFields, 'subgroup'); + const groups = fieldsToGroups(pluginFields, 'subgroup'); return fieldToAttrs(this, groups); }), @@ -182,7 +182,7 @@ export default Model.extend({ if (!this.plugin_name) { return expandAttributeMeta(this, ['root_rotation_statements']); } - let fields = AVAILABLE_PLUGIN_TYPES.find((a) => a.value === this.plugin_name) + const 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 6626dae26b..02cec979f6 100644 --- a/ui/app/models/database/role.js +++ b/ui/app/models/database/role.js @@ -84,7 +84,7 @@ export default Model.extend({ /* FIELD ATTRIBUTES */ get fieldAttrs() { // Main fields on edit/create form - let fields = ['name', 'database', 'type']; + const fields = ['name', 'database', 'type']; return expandAttributeMeta(this, fields); }, @@ -100,7 +100,7 @@ export default Model.extend({ roleSettingAttrs: computed(function () { // logic for which get displayed is on DatabaseRoleSettingForm - let allRoleSettingFields = [ + const allRoleSettingFields = [ 'default_ttl', 'max_ttl', 'username', diff --git a/ui/app/models/identity/_base.js b/ui/app/models/identity/_base.js index 2016b99d93..ec7d8bb7ef 100644 --- a/ui/app/models/identity/_base.js +++ b/ui/app/models/identity/_base.js @@ -13,7 +13,7 @@ export default Model.extend({ }), identityType: computed('constructor.modelName', function () { - let modelType = this.constructor.modelName.split('/')[1]; + const modelType = this.constructor.modelName.split('/')[1]; return modelType; }), }); diff --git a/ui/app/models/identity/entity.js b/ui/app/models/identity/entity.js index 57fd9a8823..0a73af7375 100644 --- a/ui/app/models/identity/entity.js +++ b/ui/app/models/identity/entity.js @@ -5,7 +5,7 @@ import IdentityModel from './_base'; import apiPath from 'vault/utils/api-path'; import attachCapabilities from 'vault/lib/attach-capabilities'; -let Model = IdentityModel.extend({ +const Model = IdentityModel.extend({ formFields: computed(function () { return ['name', 'disabled', 'policies', 'metadata']; }), diff --git a/ui/app/models/identity/group.js b/ui/app/models/identity/group.js index 2060bc47f4..9f51db1403 100644 --- a/ui/app/models/identity/group.js +++ b/ui/app/models/identity/group.js @@ -7,7 +7,7 @@ import identityCapabilities from 'vault/macros/identity-capabilities'; export default IdentityModel.extend({ formFields: computed('type', function () { - let fields = ['name', 'type', 'policies', 'metadata']; + const fields = ['name', 'type', 'policies', 'metadata']; if (this.type === 'internal') { return fields.concat(['memberGroupIds', 'memberEntityIds']); } @@ -67,9 +67,9 @@ export default IdentityModel.extend({ 'memberGroupIds', 'memberGroupIds.[]', function () { - let { memberEntityIds, memberGroupIds } = this; - let numEntities = (memberEntityIds && memberEntityIds.length) || 0; - let numGroups = (memberGroupIds && memberGroupIds.length) || 0; + const { memberEntityIds, memberGroupIds } = this; + const numEntities = (memberEntityIds && memberEntityIds.length) || 0; + const numGroups = (memberGroupIds && memberGroupIds.length) || 0; return numEntities + numGroups > 0; } ), @@ -81,8 +81,8 @@ export default IdentityModel.extend({ aliasPath: lazyCapabilities(apiPath`identity/group-alias`), canAddAlias: computed('aliasPath.canCreate', 'type', 'alias', function () { - let type = this.type; - let alias = this.alias; + const type = this.type; + const alias = this.alias; // internal groups can't have aliases, and external groups can only have one if (type === 'internal' || alias) { return false; diff --git a/ui/app/models/keymgmt/provider.js b/ui/app/models/keymgmt/provider.js index 43ebcad6eb..266d85768a 100644 --- a/ui/app/models/keymgmt/provider.js +++ b/ui/app/models/keymgmt/provider.js @@ -101,7 +101,7 @@ export default class KeymgmtProviderModel extends Model { const [creds, fields] = this.credentialProps.reduce( ([creds, fields], prop) => { creds[prop] = null; - let field = { name: `credentials.${prop}`, type: 'string', options: { label: prop } }; + const field = { name: `credentials.${prop}`, type: 'string', options: { label: prop } }; if (prop === 'service_account_file') { field.options.subText = 'The path to a Google service account key file, not the file itself.'; } diff --git a/ui/app/models/kmip/role.js b/ui/app/models/kmip/role.js index 1b1c10b358..5e5a0734d4 100644 --- a/ui/app/models/kmip/role.js +++ b/ui/app/models/kmip/role.js @@ -19,7 +19,7 @@ export const COMPUTEDS = { // For rendering on the create/edit pages defaultFields: computed('newFields', 'operationFields', 'tlsFields', function () { - let excludeFields = ['role'].concat(this.operationFields, this.tlsFields); + const excludeFields = ['role'].concat(this.operationFields, this.tlsFields); return this.newFields.slice().removeObjects(excludeFields); }), @@ -42,12 +42,12 @@ const ModelExport = Model.extend(COMPUTEDS, { if (this.defaultFields.length) { groups.unshift({ default: this.defaultFields }); } - let ret = fieldToAttrs(this, groups); + const ret = fieldToAttrs(this, groups); return ret; }), operationFormFields: computed('operationFieldsWithoutSpecial', function () { - let objects = [ + const objects = [ 'operationCreate', 'operationActivate', 'operationGet', @@ -57,9 +57,11 @@ const ModelExport = Model.extend(COMPUTEDS, { 'operationDestroy', ]; - let attributes = ['operationAddAttribute', 'operationGetAttributes']; - let server = ['operationDiscoverVersion']; - let others = this.operationFieldsWithoutSpecial.slice().removeObjects(objects.concat(attributes, server)); + const attributes = ['operationAddAttribute', 'operationGetAttributes']; + const server = ['operationDiscoverVersion']; + const others = this.operationFieldsWithoutSpecial + .slice() + .removeObjects(objects.concat(attributes, server)); const groups = [ { 'Managed Cryptographic Objects': objects }, { 'Object Attributes': attributes }, diff --git a/ui/app/models/kmip/scope.js b/ui/app/models/kmip/scope.js index b673b850ba..e853f9797b 100644 --- a/ui/app/models/kmip/scope.js +++ b/ui/app/models/kmip/scope.js @@ -5,7 +5,7 @@ import attachCapabilities from 'vault/lib/attach-capabilities'; import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; -let ModelExport = Model.extend({ +const ModelExport = Model.extend({ name: attr('string'), backend: attr({ readOnly: true }), attrs: computed(function () { diff --git a/ui/app/models/pki-ca-certificate.js b/ui/app/models/pki-ca-certificate.js index ec444c1383..c79f4ab297 100644 --- a/ui/app/models/pki-ca-certificate.js +++ b/ui/app/models/pki-ca-certificate.js @@ -101,7 +101,7 @@ export default Certificate.extend({ fieldDefinition: computed('caType', 'uploadPemBundle', function () { const type = this.caType; const isUpload = this.uploadPemBundle; - let groups = [{ default: ['caType', 'uploadPemBundle'] }]; + const groups = [{ default: ['caType', 'uploadPemBundle'] }]; if (isUpload) { groups[0].default.push('pemBundle'); } else { diff --git a/ui/app/models/pki/cert.js b/ui/app/models/pki/cert.js index 92cd6d4f18..66ec7c5dba 100644 --- a/ui/app/models/pki/cert.js +++ b/ui/app/models/pki/cert.js @@ -96,7 +96,7 @@ export default Model.extend({ }), attrs: computed('DISPLAY_FIELDS', 'certificate', 'csr', function () { - let keys = this.certificate || this.csr ? this.DISPLAY_FIELDS.slice(0) : []; + const keys = this.certificate || this.csr ? this.DISPLAY_FIELDS.slice(0) : []; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/pki/pki-config.js b/ui/app/models/pki/pki-config.js index 91770fca63..4a73798842 100644 --- a/ui/app/models/pki/pki-config.js +++ b/ui/app/models/pki/pki-config.js @@ -13,7 +13,7 @@ export default Model.extend({ //urls urlsAttrs: computed(function () { - let keys = ['issuingCertificates', 'crlDistributionPoints', 'ocspServers']; + const keys = ['issuingCertificates', 'crlDistributionPoints', 'ocspServers']; return this.attrList(keys); }), issuingCertificates: attr({ @@ -30,7 +30,7 @@ export default Model.extend({ //tidy tidyAttrs: computed(function () { - let keys = ['tidyCertStore', 'tidyRevocationList', 'safetyBuffer']; + const keys = ['tidyCertStore', 'tidyRevocationList', 'safetyBuffer']; return this.attrList(keys); }), tidyCertStore: attr('boolean', { @@ -47,7 +47,7 @@ export default Model.extend({ }), crlAttrs: computed(function () { - let keys = ['expiry', 'disable']; + const keys = ['expiry', 'disable']; return this.attrList(keys); }), //crl diff --git a/ui/app/models/pki/pki-role.js b/ui/app/models/pki/pki-role.js index ccf5fd775c..e3025b76f0 100644 --- a/ui/app/models/pki/pki-role.js +++ b/ui/app/models/pki/pki-role.js @@ -78,7 +78,7 @@ export default Model.extend({ Advanced: ['generateLease', 'noStore', 'basicConstraintsValidForNonCa', 'policyIdentifiers'], }, ]; - let excludedFields = ['extKeyUsage']; + const excludedFields = ['extKeyUsage']; if (this.newFields) { groups = combineFieldGroups(groups, this.newFields, excludedFields); } diff --git a/ui/app/models/policy.js b/ui/app/models/policy.js index 647e367eca..842155d173 100644 --- a/ui/app/models/policy.js +++ b/ui/app/models/policy.js @@ -14,10 +14,10 @@ export default Model.extend({ canEdit: alias('updatePath.canUpdate'), canRead: alias('updatePath.canRead'), format: computed('policy', function () { - let policy = this.policy; + const policy = this.policy; let isJSON; try { - let parsed = JSON.parse(policy); + const parsed = JSON.parse(policy); if (parsed) { isJSON = true; } diff --git a/ui/app/models/role-aws.js b/ui/app/models/role-aws.js index af631ceb5b..9ddef405f2 100644 --- a/ui/app/models/role-aws.js +++ b/ui/app/models/role-aws.js @@ -53,8 +53,8 @@ export default Model.extend({ 'A policy is an object in AWS that, when associated with an identity or resource, defines their permissions.', }), fields: computed('credentialType', function () { - let credentialType = this.credentialType; - let keysForType = { + const credentialType = this.credentialType; + const keysForType = { iam_user: ['name', 'credentialType', 'policyArns', 'policyDocument'], assumed_role: ['name', 'credentialType', 'roleArns', 'policyDocument'], federation_token: ['name', 'credentialType', 'policyDocument'], diff --git a/ui/app/models/role-jwt.js b/ui/app/models/role-jwt.js index 9f26fa3fa6..6de28f1212 100644 --- a/ui/app/models/role-jwt.js +++ b/ui/app/models/role-jwt.js @@ -19,13 +19,13 @@ export default Model.extend({ authUrl: attr('string'), providerName: computed('authUrl', function () { - let { hostname } = parseURL(this.authUrl); - let firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name)); + const { hostname } = parseURL(this.authUrl); + const firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name)); return DOMAIN_STRINGS[firstMatch] || null; }), providerButtonComponent: computed('providerName', function () { - let { providerName } = this; + const { providerName } = this; return PROVIDER_WITH_LOGO.includes(providerName) ? `auth-button-${providerName.toLowerCase()}` : null; }), }); diff --git a/ui/app/models/role-ssh.js b/ui/app/models/role-ssh.js index 07b4aeef79..abb13fb5b6 100644 --- a/ui/app/models/role-ssh.js +++ b/ui/app/models/role-ssh.js @@ -120,14 +120,14 @@ export default Model.extend({ showFields: computed('keyType', function () { const keyType = this.keyType; - let keys = keyType === 'ca' ? CA_FIELDS.slice(0) : OTP_FIELDS.slice(0); + const keys = keyType === 'ca' ? CA_FIELDS.slice(0) : OTP_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), 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); + const numRequired = this.keyType === 'otp' ? 3 : 4; + const fields = this.keyType === 'otp' ? [...OTP_FIELDS] : [...CA_FIELDS]; + const defaultFields = fields.splice(0, numRequired); const groups = [ { default: defaultFields }, { diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js index 0f32cb96c0..66bb3e5b2b 100644 --- a/ui/app/models/secret-engine.js +++ b/ui/app/models/secret-engine.js @@ -68,7 +68,7 @@ export default SecretEngineModel.extend({ }), modelTypeForKV: computed('engineType', 'version', function () { - let type = this.engineType; + const type = this.engineType; let modelType = 'secret'; if ((type === 'kv' || type === 'generic') && this.version === 2) { modelType = 'secret-v2'; @@ -79,8 +79,8 @@ export default SecretEngineModel.extend({ isV2KV: equal('modelTypeForKV', 'secret-v2'), formFields: computed('engineType', 'version', function () { - let type = this.engineType; - let fields = ['type', 'path', 'description', 'accessor', 'local', 'sealWrap']; + const type = this.engineType; + const fields = ['type', 'path', 'description', 'accessor', 'local', 'sealWrap']; // no ttl options for keymgmt const ttl = type !== 'keymgmt' ? 'defaultLeaseTtl,maxLeaseTtl,' : ''; fields.push(`config.{${ttl}auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`); @@ -95,7 +95,7 @@ export default SecretEngineModel.extend({ }), formFieldGroups: computed('engineType', function () { - let type = this.engineType; + const 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 if (type === 'kv') { @@ -103,7 +103,7 @@ export default SecretEngineModel.extend({ } else { defaultGroup = { default: ['path'] }; } - let optionsGroup = { + const optionsGroup = { 'Method Options': ['description', 'config.listingVisibility', 'local', 'sealWrap'], }; // no ttl options for keymgmt diff --git a/ui/app/models/ssh-otp-credential.js b/ui/app/models/ssh-otp-credential.js index 6740e9a4c1..8b5ed9fee9 100644 --- a/ui/app/models/ssh-otp-credential.js +++ b/ui/app/models/ssh-otp-credential.js @@ -17,7 +17,7 @@ export default Model.extend({ keyType: attr('string'), port: attr('number'), attrs: computed('key', function () { - let keys = this.key ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); + const keys = this.key ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), toCreds: reads('key'), diff --git a/ui/app/models/ssh-sign.js b/ui/app/models/ssh-sign.js index 8cd177bbf8..95377db371 100644 --- a/ui/app/models/ssh-sign.js +++ b/ui/app/models/ssh-sign.js @@ -46,7 +46,7 @@ export default Model.extend({ signedKey: attr('string'), attrs: computed('signedKey', function () { - let keys = this.signedKey ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); + const keys = this.signedKey ? DISPLAY_FIELDS.slice(0) : CREATE_FIELDS.slice(0); return expandAttributeMeta(this, keys); }), }); diff --git a/ui/app/models/transform/alphabet.js b/ui/app/models/transform/alphabet.js index 1cff5bbae2..f881c69dba 100644 --- a/ui/app/models/transform/alphabet.js +++ b/ui/app/models/transform/alphabet.js @@ -7,7 +7,7 @@ import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; const M = Model.extend({ idPrefix: 'alphabet/', idForNav: computed('id', 'idPrefix', function () { - let modelId = this.id || ''; + const modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -23,7 +23,7 @@ const M = Model.extend({ }), attrs: computed(function () { - let keys = ['name', 'alphabet']; + const keys = ['name', 'alphabet']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transform/role.js b/ui/app/models/transform/role.js index d6a2fe9861..b59f9b39e3 100644 --- a/ui/app/models/transform/role.js +++ b/ui/app/models/transform/role.js @@ -9,7 +9,7 @@ const ModelExport = Model.extend({ 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 () { - let modelId = this.id || ''; + const modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -31,7 +31,7 @@ const ModelExport = Model.extend({ }), attrs: computed('transformations', function () { - let keys = ['name', 'transformations']; + const keys = ['name', 'transformations']; return expandAttributeMeta(this, keys); }), diff --git a/ui/app/models/transform/template.js b/ui/app/models/transform/template.js index 37b33dd0bf..39a3c4e684 100644 --- a/ui/app/models/transform/template.js +++ b/ui/app/models/transform/template.js @@ -7,7 +7,7 @@ import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; const M = Model.extend({ idPrefix: 'template/', idForNav: computed('id', 'idPrefix', function () { - let modelId = this.id || ''; + const modelId = this.id || ''; return `${this.idPrefix}${modelId}`; }), @@ -37,7 +37,7 @@ const M = Model.extend({ backend: attr('string', { readOnly: true }), readAttrs: computed(function () { - let keys = ['name', 'pattern', 'encodeFormat', 'decodeFormats', 'alphabet']; + const keys = ['name', 'pattern', 'encodeFormat', 'decodeFormats', 'alphabet']; return expandAttributeMeta(this, keys); }), writeAttrs: computed(function () { diff --git a/ui/app/models/transit-key.js b/ui/app/models/transit-key.js index 4c849a4d77..e87b64e8c1 100644 --- a/ui/app/models/transit-key.js +++ b/ui/app/models/transit-key.js @@ -114,7 +114,7 @@ export default Model.extend({ keyVersions: computed('validKeyVersions', function () { let maxVersion = Math.max(...this.validKeyVersions); - let versions = []; + const versions = []; while (maxVersion > 0) { versions.unshift(maxVersion); maxVersion--; @@ -140,8 +140,8 @@ export default Model.extend({ keysForEncryption: computed('minEncryptionVersion', 'latestVersion', function () { let { minEncryptionVersion, latestVersion } = this; - let minVersion = clamp(minEncryptionVersion - 1, 0, latestVersion); - let versions = []; + const minVersion = clamp(minEncryptionVersion - 1, 0, latestVersion); + const versions = []; while (latestVersion > minVersion) { versions.push(latestVersion); latestVersion--; @@ -154,7 +154,7 @@ export default Model.extend({ }), exportKeyTypes: computed('exportable', 'supportsEncryption', 'supportsSigning', 'type', function () { - let types = ['hmac']; + const types = ['hmac']; if (this.supportsSigning) { types.unshift('signing'); } diff --git a/ui/app/routes/application.js b/ui/app/routes/application.js index 4ea6a2f1a0..1f8c8ec098 100644 --- a/ui/app/routes/application.js +++ b/ui/app/routes/application.js @@ -15,7 +15,7 @@ export default Route.extend({ window.scrollTo(0, 0); }, error(error, transition) { - let controlGroup = this.controlGroup; + const controlGroup = this.controlGroup; if (error instanceof ControlGroupError) { return controlGroup.handleError(error); } @@ -23,10 +23,10 @@ export default Route.extend({ controlGroup.unmarkTokenForUnwrap(); } - let router = this.routing; + const router = this.routing; //FIXME transition.intent likely needs to be replaced let errorURL = transition.intent.url; - let { name, contexts, queryParams } = transition.intent; + const { name, contexts, queryParams } = transition.intent; // If the transition is internal to Ember, we need to generate the URL // from the route parameters ourselves @@ -61,21 +61,21 @@ export default Route.extend({ return true; }, didTransition() { - let wizard = this.wizard; + const wizard = this.wizard; if (wizard.get('currentState') !== 'active.feature') { return true; } next(() => { - let applicationURL = this.routing.currentURL; - let activeRoute = this.routing.currentRouteName; + const applicationURL = this.routing.currentURL; + const activeRoute = this.routing.currentRouteName; if (this.wizard.setURLAfterTransition) { this.set('wizard.setURLAfterTransition', false); this.set('wizard.expectedURL', applicationURL); this.set('wizard.expectedRouteName', activeRoute); } - let expectedRouteName = this.wizard.expectedRouteName; + const expectedRouteName = this.wizard.expectedRouteName; if (this.routing.isActive(expectedRouteName) === false) { wizard.transitionTutorialMachine(wizard.get('currentState'), 'PAUSE'); } diff --git a/ui/app/routes/vault/cluster.js b/ui/app/routes/vault/cluster.js index 327bfc99fc..a81bb84881 100644 --- a/ui/app/routes/vault/cluster.js +++ b/ui/app/routes/vault/cluster.js @@ -63,7 +63,7 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { this.transitionTo({ queryParams: { namespace } }); } } else if (managedRoot !== null) { - let managed = getManagedNamespace(namespace, managedRoot); + const managed = getManagedNamespace(namespace, managedRoot); if (managed !== namespace) { this.transitionTo({ queryParams: { namespace: managed } }); } @@ -135,7 +135,7 @@ export default Route.extend(ModelBoundaryRoute, ClusterRoute, { return; } // eslint-disable-next-line ember/no-controller-access-in-routes - let controller = this.controllerFor('vault.cluster'); + const controller = this.controllerFor('vault.cluster'); controller.set('currentlyLoading', true); transition.finally(function () { 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 a7e375dd17..19fba46eb0 100644 --- a/ui/app/routes/vault/cluster/access/control-groups-configure.js +++ b/ui/app/routes/vault/cluster/access/control-groups-configure.js @@ -13,7 +13,7 @@ export default Route.extend(UnloadModel, { }, model() { - let type = 'control-group-config'; + const type = 'control-group-config'; return this.version.hasFeature('Control Groups') ? 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 diff --git a/ui/app/routes/vault/cluster/access/identity.js b/ui/app/routes/vault/cluster/access/identity.js index 03cc052b82..5c07e94359 100644 --- a/ui/app/routes/vault/cluster/access/identity.js +++ b/ui/app/routes/vault/cluster/access/identity.js @@ -9,7 +9,7 @@ const MODEL_FROM_PARAM = { export default Route.extend({ model(params) { - let model = MODEL_FROM_PARAM[params.item_type]; + const model = MODEL_FROM_PARAM[params.item_type]; if (!model) { const error = new AdapterError(); set(error, 'httpStatus', 404); diff --git a/ui/app/routes/vault/cluster/access/identity/aliases/add.js b/ui/app/routes/vault/cluster/access/identity/aliases/add.js index 3b71732a01..41f2577452 100644 --- a/ui/app/routes/vault/cluster/access/identity/aliases/add.js +++ b/ui/app/routes/vault/cluster/access/identity/aliases/add.js @@ -7,8 +7,8 @@ export default Route.extend(UnloadModelRoute, UnsavedModelRoute, { store: service(), model(params) { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}-alias`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}-alias`; return this.store.createRecord(modelType, { canonicalId: params.item_id, }); diff --git a/ui/app/routes/vault/cluster/access/identity/aliases/edit.js b/ui/app/routes/vault/cluster/access/identity/aliases/edit.js index 54de88c236..1c3187d39b 100644 --- a/ui/app/routes/vault/cluster/access/identity/aliases/edit.js +++ b/ui/app/routes/vault/cluster/access/identity/aliases/edit.js @@ -7,8 +7,8 @@ export default Route.extend(UnloadModelRoute, UnsavedModelRoute, { store: service(), model(params) { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}-alias`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}-alias`; return this.store.findRecord(modelType, params.item_alias_id); }, }); 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 7c2e3221c4..a20d144806 100644 --- a/ui/app/routes/vault/cluster/access/identity/aliases/index.js +++ b/ui/app/routes/vault/cluster/access/identity/aliases/index.js @@ -6,8 +6,8 @@ export default Route.extend(ListRoute, { store: service(), model(params) { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}-alias`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}-alias`; return this.store .lazyPaginatedQuery(modelType, { responsePath: 'data.keys', diff --git a/ui/app/routes/vault/cluster/access/identity/aliases/show.js b/ui/app/routes/vault/cluster/access/identity/aliases/show.js index 38d61065d9..ef7b5c35c5 100644 --- a/ui/app/routes/vault/cluster/access/identity/aliases/show.js +++ b/ui/app/routes/vault/cluster/access/identity/aliases/show.js @@ -9,10 +9,10 @@ export default Route.extend({ store: service(), model(params) { - let { section } = params; - let itemType = this.modelFor('vault.cluster.access.identity') + '-alias'; - let tabs = TABS[itemType]; - let modelType = `identity/${itemType}`; + const { section } = params; + const itemType = this.modelFor('vault.cluster.access.identity') + '-alias'; + const tabs = TABS[itemType]; + const modelType = `identity/${itemType}`; if (!tabs.includes(section)) { const error = new AdapterError(); set(error, 'httpStatus', 404); @@ -26,7 +26,7 @@ export default Route.extend({ }, setupController(controller, resolvedModel) { - let { model, section } = resolvedModel; + const { model, section } = resolvedModel; controller.setProperties({ model, section, diff --git a/ui/app/routes/vault/cluster/access/identity/create.js b/ui/app/routes/vault/cluster/access/identity/create.js index c3308ece85..c6d156cf0a 100644 --- a/ui/app/routes/vault/cluster/access/identity/create.js +++ b/ui/app/routes/vault/cluster/access/identity/create.js @@ -7,8 +7,8 @@ export default Route.extend(UnloadModelRoute, UnsavedModelRoute, { store: service(), model() { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}`; return this.store.createRecord(modelType); }, }); diff --git a/ui/app/routes/vault/cluster/access/identity/edit.js b/ui/app/routes/vault/cluster/access/identity/edit.js index 80ba55fc1e..cd2aec8f87 100644 --- a/ui/app/routes/vault/cluster/access/identity/edit.js +++ b/ui/app/routes/vault/cluster/access/identity/edit.js @@ -7,8 +7,8 @@ export default Route.extend(UnloadModelRoute, UnsavedModelRoute, { store: service(), model(params) { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}`; return this.store.findRecord(modelType, params.item_id); }, }); diff --git a/ui/app/routes/vault/cluster/access/identity/index.js b/ui/app/routes/vault/cluster/access/identity/index.js index 3d2d34ff4b..5414932046 100644 --- a/ui/app/routes/vault/cluster/access/identity/index.js +++ b/ui/app/routes/vault/cluster/access/identity/index.js @@ -6,8 +6,8 @@ export default Route.extend(ListRoute, { store: service(), model(params) { - let itemType = this.modelFor('vault.cluster.access.identity'); - let modelType = `identity/${itemType}`; + const itemType = this.modelFor('vault.cluster.access.identity'); + const modelType = `identity/${itemType}`; return this.store .lazyPaginatedQuery(modelType, { responsePath: 'data.keys', diff --git a/ui/app/routes/vault/cluster/access/identity/merge.js b/ui/app/routes/vault/cluster/access/identity/merge.js index 373c092c09..5dca80d1e7 100644 --- a/ui/app/routes/vault/cluster/access/identity/merge.js +++ b/ui/app/routes/vault/cluster/access/identity/merge.js @@ -6,14 +6,14 @@ export default Route.extend(UnloadModelRoute, { store: service(), beforeModel() { - let itemType = this.modelFor('vault.cluster.access.identity'); + const itemType = this.modelFor('vault.cluster.access.identity'); if (itemType !== 'entity') { return this.transitionTo('vault.cluster.access.identity'); } }, model() { - let modelType = `identity/entity-merge`; + const modelType = `identity/entity-merge`; return this.store.createRecord(modelType); }, }); diff --git a/ui/app/routes/vault/cluster/access/identity/show.js b/ui/app/routes/vault/cluster/access/identity/show.js index f9ed722256..9bd1db6320 100644 --- a/ui/app/routes/vault/cluster/access/identity/show.js +++ b/ui/app/routes/vault/cluster/access/identity/show.js @@ -10,10 +10,10 @@ export default Route.extend({ store: service(), model(params) { - let { section } = params; - let itemType = this.modelFor('vault.cluster.access.identity'); - let tabs = TABS[itemType]; - let modelType = `identity/${itemType}`; + const { section } = params; + const itemType = this.modelFor('vault.cluster.access.identity'); + const tabs = TABS[itemType]; + const modelType = `identity/${itemType}`; if (!tabs.includes(section)) { const error = new AdapterError(); set(error, 'httpStatus', 404); @@ -51,14 +51,14 @@ export default Route.extend({ }, afterModel(resolvedModel) { - let { section, model } = resolvedModel; + const { section, model } = resolvedModel; if (model.get('identityType') === 'group' && model.get('type') === 'internal' && section === 'aliases') { return this.transitionTo('vault.cluster.access.identity.show', model.id, 'details'); } }, setupController(controller, resolvedModel) { - let { model, section } = resolvedModel; + const { model, section } = resolvedModel; controller.setProperties({ model, section, diff --git a/ui/app/routes/vault/cluster/access/method/item.js b/ui/app/routes/vault/cluster/access/method/item.js index ee8b564562..9371a9a7e5 100644 --- a/ui/app/routes/vault/cluster/access/method/item.js +++ b/ui/app/routes/vault/cluster/access/method/item.js @@ -8,7 +8,7 @@ export default Route.extend({ beforeModel() { const { apiPath, type, authMethodPath, itemType } = this.getMethodAndModelInfo(); - let modelType = `generated-${singularize(itemType)}-${type}`; + const modelType = `generated-${singularize(itemType)}-${type}`; return this.pathHelp.getNewModel(modelType, authMethodPath, apiPath, itemType); }, @@ -25,7 +25,7 @@ export default Route.extend({ 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); + const navigationPaths = paths.paths.filter((path) => path.navigation); controller.set( 'paths', 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 f8ee79d41f..d2e4315e89 100644 --- a/ui/app/routes/vault/cluster/access/method/item/list.js +++ b/ui/app/routes/vault/cluster/access/method/item/list.js @@ -19,7 +19,7 @@ export default Route.extend(ListRoute, { model() { const { type, authMethodPath, itemType } = this.getMethodAndModelInfo(); const { page, pageFilter } = this.paramsFor(this.routeName); - let modelType = `generated-${singularize(itemType)}-${type}`; + const modelType = `generated-${singularize(itemType)}-${type}`; return this.store .lazyPaginatedQuery(modelType, { diff --git a/ui/app/routes/vault/cluster/access/method/section.js b/ui/app/routes/vault/cluster/access/method/section.js index c4953ab7f1..904f2f5190 100644 --- a/ui/app/routes/vault/cluster/access/method/section.js +++ b/ui/app/routes/vault/cluster/access/method/section.js @@ -13,7 +13,7 @@ export default Route.extend({ set(error, 'httpStatus', 404); throw error; } - let backend = this.modelFor('vault.cluster.access.method'); + const backend = this.modelFor('vault.cluster.access.method'); this.wizard.transitionFeatureMachine(this.wizard.featureState, 'DETAILS', backend.type); return backend; }, @@ -22,7 +22,7 @@ export default Route.extend({ const { section_name: section } = this.paramsFor(this.routeName); this._super(...arguments); controller.set('section', section); - let method = this.modelFor('vault.cluster.access.method'); + const method = this.modelFor('vault.cluster.access.method'); controller.set( 'paths', method.paths.paths.filter((path) => path.navigation) diff --git a/ui/app/routes/vault/cluster/access/mfa/methods/method.js b/ui/app/routes/vault/cluster/access/mfa/methods/method.js index a1390f9f19..8f7aa7ae16 100644 --- a/ui/app/routes/vault/cluster/access/mfa/methods/method.js +++ b/ui/app/routes/vault/cluster/access/mfa/methods/method.js @@ -11,8 +11,8 @@ export default class MfaMethodRoute extends Route { enforcements: this.store .query('mfa-login-enforcement', {}) .then((data) => { - let filteredEnforcements = data.filter((item) => { - let results = item.hasMany('mfa_methods').ids(); + const filteredEnforcements = data.filter((item) => { + const results = item.hasMany('mfa_methods').ids(); return results.includes(id); }); return filteredEnforcements; diff --git a/ui/app/routes/vault/cluster/clients.js b/ui/app/routes/vault/cluster/clients.js index eb23aef81c..2bb5297033 100644 --- a/ui/app/routes/vault/cluster/clients.js +++ b/ui/app/routes/vault/cluster/clients.js @@ -9,8 +9,8 @@ export default class ClientsRoute extends Route { @service store; async getVersionHistory() { try { - let arrayOfModels = []; - let response = await this.store.findAll('clients/version-history'); // returns a class with nested models + const arrayOfModels = []; + const response = await this.store.findAll('clients/version-history'); // returns a class with nested models response.forEach((model) => { arrayOfModels.push({ id: model.id, @@ -26,7 +26,7 @@ export default class ClientsRoute extends Route { } async model() { - let config = await this.store.queryRecord('clients/config', {}).catch((e) => { + const config = await this.store.queryRecord('clients/config', {}).catch((e) => { console.debug(e); // eslint-disable-line // swallowing error so activity can show if no config permissions return {}; @@ -41,7 +41,7 @@ export default class ClientsRoute extends Route { @action async loading(transition) { // eslint-disable-next-line ember/no-controller-access-in-routes - let controller = this.controllerFor(this.routeName); + const controller = this.controllerFor(this.routeName); controller.set('currentlyLoading', true); transition.promise.finally(function () { controller.set('currentlyLoading', false); diff --git a/ui/app/routes/vault/cluster/clients/current.js b/ui/app/routes/vault/cluster/clients/current.js index d44362fbc1..d631c0121b 100644 --- a/ui/app/routes/vault/cluster/clients/current.js +++ b/ui/app/routes/vault/cluster/clients/current.js @@ -6,7 +6,7 @@ export default class CurrentRoute extends Route { @service store; async model() { - let parentModel = this.modelFor('vault.cluster.clients'); + const parentModel = this.modelFor('vault.cluster.clients'); return RSVP.hash({ config: parentModel.config, diff --git a/ui/app/routes/vault/cluster/clients/history.js b/ui/app/routes/vault/cluster/clients/history.js index c50f02f931..f0e8a8f4fe 100644 --- a/ui/app/routes/vault/cluster/clients/history.js +++ b/ui/app/routes/vault/cluster/clients/history.js @@ -20,7 +20,7 @@ export default class HistoryRoute extends Route { async getLicenseStartTime() { try { - let license = await this.store.queryRecord('license', {}); + const license = await this.store.queryRecord('license', {}); // if license.startTime is 'undefined' return 'null' for consistency return license.startTime || getStorage().getItem(INPUTTED_START_DATE) || null; } catch (e) { @@ -31,9 +31,9 @@ export default class HistoryRoute extends Route { } async model() { - let parentModel = this.modelFor('vault.cluster.clients'); - let licenseStart = await this.getLicenseStartTime(); - let activity = await this.getActivity(licenseStart); + const parentModel = this.modelFor('vault.cluster.clients'); + const licenseStart = await this.getLicenseStartTime(); + const activity = await this.getActivity(licenseStart); return RSVP.hash({ config: parentModel.config, diff --git a/ui/app/routes/vault/cluster/oidc-callback.js b/ui/app/routes/vault/cluster/oidc-callback.js index 2e9e752974..c7fa09918c 100644 --- a/ui/app/routes/vault/cluster/oidc-callback.js +++ b/ui/app/routes/vault/cluster/oidc-callback.js @@ -14,7 +14,7 @@ export default Route.extend({ } path = window.decodeURIComponent(path); const source = 'oidc-callback'; // required by event listener in auth-jwt component - let queryParams = { source, path: path || '', code: code || '', state: state || '' }; + const queryParams = { source, path: path || '', code: code || '', state: state || '' }; if (namespace) { queryParams.namespace = namespace; } diff --git a/ui/app/routes/vault/cluster/oidc-provider.js b/ui/app/routes/vault/cluster/oidc-provider.js index ea33f3781b..8dcfe12578 100644 --- a/ui/app/routes/vault/cluster/oidc-provider.js +++ b/ui/app/routes/vault/cluster/oidc-provider.js @@ -16,7 +16,7 @@ export default class VaultClusterOidcProviderRoute extends Route { _redirect(url, params) { if (!url) return; - let redir = this._buildUrl(url, params); + const redir = this._buildUrl(url, params); if (Ember.testing) { return redir; } @@ -25,7 +25,7 @@ export default class VaultClusterOidcProviderRoute extends Route { beforeModel(transition) { const currentToken = this.auth.get('currentTokenName'); - let qp = transition.to.queryParams; + const qp = transition.to.queryParams; // remove redirect_to if carried over from auth qp.redirect_to = null; if (!currentToken && 'none' === qp.prompt?.toLowerCase()) { @@ -34,7 +34,7 @@ export default class VaultClusterOidcProviderRoute extends Route { error: 'login_required', }); } else if (!currentToken || 'login' === qp.prompt?.toLowerCase()) { - let logout = !!currentToken; + const logout = !!currentToken; if ('login' === qp.prompt?.toLowerCase()) { // need to remove before redirect to avoid infinite loop qp.prompt = null; @@ -48,7 +48,7 @@ export default class VaultClusterOidcProviderRoute extends Route { } _redirectToAuth({ provider_name, namespace = null, qp, logout = false }) { - let { cluster_name } = this.paramsFor('vault.cluster'); + const { cluster_name } = this.paramsFor('vault.cluster'); let url = namespace ? this.router.urlFor(NS_PROVIDER, cluster_name, namespace, provider_name, { queryParams: qp }) : this.router.urlFor(PROVIDER, cluster_name, provider_name, { queryParams: qp }); @@ -61,7 +61,7 @@ export default class VaultClusterOidcProviderRoute extends Route { this.auth.deleteCurrentToken(); } // o param can be anything, as long as it's present the auth page will change - let queryParams = { + const queryParams = { redirect_to: url, o: provider_name, }; @@ -73,7 +73,7 @@ export default class VaultClusterOidcProviderRoute extends Route { _buildUrl(urlString, params) { try { - let url = new URL(urlString); + const url = new URL(urlString); Object.keys(params).forEach((key) => { if (params[key]) { url.searchParams.append(key, params[key]); @@ -88,14 +88,14 @@ export default class VaultClusterOidcProviderRoute extends Route { _handleSuccess(response, baseUrl, state) { const { code } = response; - let redirectUrl = this._buildUrl(baseUrl, { code, state }); + const redirectUrl = this._buildUrl(baseUrl, { code, state }); if (Ember.testing) { return { redirectUrl }; } this.win.location.replace(redirectUrl); } _handleError(errorResp, baseUrl) { - let redirectUrl = this._buildUrl(baseUrl, { ...errorResp }); + const redirectUrl = this._buildUrl(baseUrl, { ...errorResp }); if (Ember.testing) { return { redirectUrl }; } @@ -108,8 +108,8 @@ export default class VaultClusterOidcProviderRoute extends Route { * @returns object with provider_name (string), qp (object of query params), decodedRedirect (string, FQDN) */ _getInfoFromParams(params) { - let { provider_name, namespace, ...qp } = params; - let decodedRedirect = decodeURI(qp.redirect_uri); + const { provider_name, namespace, ...qp } = params; + const decodedRedirect = decodeURI(qp.redirect_uri); return { provider_name, qp, @@ -119,9 +119,9 @@ export default class VaultClusterOidcProviderRoute extends Route { } async model(params) { - let modelInfo = this._getInfoFromParams(params); - let { qp, decodedRedirect, ...routeParams } = modelInfo; - let endpoint = this._buildUrl( + const modelInfo = this._getInfoFromParams(params); + const { qp, decodedRedirect, ...routeParams } = modelInfo; + const endpoint = this._buildUrl( `${this.win.origin}/v1/identity/oidc/provider/${routeParams.provider_name}/authorize`, qp ); @@ -141,8 +141,8 @@ export default class VaultClusterOidcProviderRoute extends Route { } return this._handleSuccess(response, decodedRedirect, qp.state); } catch (errorRes) { - let resp = await errorRes.json(); - let code = resp.error; + const resp = await errorRes.json(); + const code = resp.error; if (code === 'max_age_violation' || resp?.errors?.includes('permission denied')) { this._redirectToAuth({ ...routeParams, qp, logout: true }); } else if (code === 'invalid_redirect_uri') { diff --git a/ui/app/routes/vault/cluster/policies.js b/ui/app/routes/vault/cluster/policies.js index a33816e9b6..da72c00aa4 100644 --- a/ui/app/routes/vault/cluster/policies.js +++ b/ui/app/routes/vault/cluster/policies.js @@ -14,7 +14,7 @@ export default Route.extend(ClusterRoute, { }, model(params) { - let policyType = params.type; + const policyType = params.type; if (!ALLOWED_TYPES.includes(policyType)) { return this.transitionTo(this.routeName, ALLOWED_TYPES[0]); } diff --git a/ui/app/routes/vault/cluster/policies/create.js b/ui/app/routes/vault/cluster/policies/create.js index f5e95516f8..66f7813dc3 100644 --- a/ui/app/routes/vault/cluster/policies/create.js +++ b/ui/app/routes/vault/cluster/policies/create.js @@ -9,7 +9,7 @@ export default Route.extend(UnloadModelRoute, UnsavedModelRoute, { wizard: service(), model() { - let policyType = this.policyType(); + const policyType = this.policyType(); if ( policyType === 'acl' && this.wizard.currentMachine === 'policies' && diff --git a/ui/app/routes/vault/cluster/policies/index.js b/ui/app/routes/vault/cluster/policies/index.js index 9dd3f3a00e..ce4cb27e98 100644 --- a/ui/app/routes/vault/cluster/policies/index.js +++ b/ui/app/routes/vault/cluster/policies/index.js @@ -19,7 +19,7 @@ export default Route.extend(ClusterRoute, ListRoute, { }, model(params) { - let policyType = this.policyType(); + const policyType = this.policyType(); if (this.shouldReturnEmptyModel(policyType, this.version)) { return; } diff --git a/ui/app/routes/vault/cluster/policy.js b/ui/app/routes/vault/cluster/policy.js index 69ac6db702..3d017ac974 100644 --- a/ui/app/routes/vault/cluster/policy.js +++ b/ui/app/routes/vault/cluster/policy.js @@ -12,7 +12,7 @@ export default Route.extend(ClusterRoute, { }); }, model(params) { - let policyType = params.type; + const policyType = params.type; if (!ALLOWED_TYPES.includes(policyType)) { return this.transitionTo('vault.cluster.policies', ALLOWED_TYPES[0]); } diff --git a/ui/app/routes/vault/cluster/policy/show.js b/ui/app/routes/vault/cluster/policy/show.js index eb94d6bb44..e6d1e9ac2b 100644 --- a/ui/app/routes/vault/cluster/policy/show.js +++ b/ui/app/routes/vault/cluster/policy/show.js @@ -8,14 +8,14 @@ export default Route.extend(UnloadModelRoute, { beforeModel() { const params = this.paramsFor(this.routeName); - let policyType = this.policyType(); + const policyType = this.policyType(); if (policyType === 'acl' && params.policy_name === 'root') { return this.transitionTo('vault.cluster.policies', 'acl'); } }, model(params) { - let type = this.policyType(); + const type = this.policyType(); return hash({ policy: this.store.findRecord(`policy/${type}`, params.policy_name), capabilities: this.store.findRecord('capabilities', `sys/policies/${type}/${params.policy_name}`), diff --git a/ui/app/routes/vault/cluster/secrets/backend.js b/ui/app/routes/vault/cluster/secrets/backend.js index 079ac01d00..cfa02e8906 100644 --- a/ui/app/routes/vault/cluster/secrets/backend.js +++ b/ui/app/routes/vault/cluster/secrets/backend.js @@ -7,7 +7,7 @@ export default Route.extend({ oldModel: null, model(params) { - let { backend } = params; + const { backend } = params; this.secretMountPath.update(backend); return this.store .query('secret-engine', { @@ -21,7 +21,7 @@ export default Route.extend({ }, afterModel(model, transition) { - let path = model && model.get('path'); + const path = model && model.get('path'); if (transition.targetName === this.routeName) { return this.replaceWith('vault.cluster.secrets.backend.list-root', path); } diff --git a/ui/app/routes/vault/cluster/secrets/backend/configuration.js b/ui/app/routes/vault/cluster/secrets/backend/configuration.js index 50c547d32e..446be4b447 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/configuration.js +++ b/ui/app/routes/vault/cluster/secrets/backend/configuration.js @@ -5,12 +5,12 @@ export default Route.extend({ wizard: service(), store: service(), async model() { - let backend = this.modelFor('vault.cluster.secrets.backend'); + const backend = this.modelFor('vault.cluster.secrets.backend'); if (this.wizard.featureState === 'list') { this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', backend.get('type')); } if (backend.isV2KV) { - let canRead = await this.store + const canRead = await this.store .findRecord('capabilities', `${backend.id}/config`) .then((response) => response.canRead); // only set these config params if they can read the config endpoint. 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 ca82b4cf72..5041d60fce 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/create-root.js +++ b/ui/app/routes/vault/cluster/secrets/backend/create-root.js @@ -2,18 +2,18 @@ import { hash } from 'rsvp'; import { inject as service } from '@ember/service'; import EditBase from './secret-edit'; -let secretModel = (store, backend, key) => { - let backendModel = store.peekRecord('secret-engine', backend); - let modelType = backendModel.get('modelTypeForKV'); +const secretModel = (store, backend, key) => { + const backendModel = store.peekRecord('secret-engine', backend); + const modelType = backendModel.get('modelTypeForKV'); if (modelType !== 'secret-v2') { - let model = store.createRecord(modelType, { + const model = store.createRecord(modelType, { path: key, }); return model; } - let secret = store.createRecord(modelType); + const secret = store.createRecord(modelType); secret.set('engine', backendModel); - let version = store.createRecord('secret-v2-version', { + const version = store.createRecord('secret-v2-version', { path: key, }); secret.set('selectedVersion', version); @@ -21,7 +21,7 @@ let secretModel = (store, backend, key) => { }; const transformModel = (queryParams) => { - let modelType = 'transform'; + const modelType = 'transform'; if (!queryParams || !queryParams.itemType) return modelType; return `${modelType}/${queryParams.itemType}`; diff --git a/ui/app/routes/vault/cluster/secrets/backend/create.js b/ui/app/routes/vault/cluster/secrets/backend/create.js index 3b45ac002b..ca6b495db0 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/create.js +++ b/ui/app/routes/vault/cluster/secrets/backend/create.js @@ -2,8 +2,8 @@ import Route from '@ember/routing/route'; export default Route.extend({ beforeModel() { - let { secret, initialKey } = this.paramsFor(this.routeName); - let qp = initialKey || secret; + const { secret, initialKey } = this.paramsFor(this.routeName); + const qp = initialKey || secret; return this.transitionTo('vault.cluster.secrets.backend.create-root', { queryParams: { initialKey: qp }, }); diff --git a/ui/app/routes/vault/cluster/secrets/backend/credentials.js b/ui/app/routes/vault/cluster/secrets/backend/credentials.js index f5c0680710..0c6aa060cd 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/credentials.js +++ b/ui/app/routes/vault/cluster/secrets/backend/credentials.js @@ -19,7 +19,7 @@ export default Route.extend({ if (backend != 'ssh') { return; } - let modelType = 'ssh-otp-credential'; + const modelType = 'ssh-otp-credential'; return this.pathHelp.getNewModel(modelType, backend); }, @@ -30,7 +30,7 @@ export default Route.extend({ } // Unless it's a control group error, we want to pass back error info // so we can render it on the GenerateCredentialsDatabase component - let status = error?.httpStatus; + const status = error?.httpStatus; let title; let message = `We ran into a problem and could not continue: ${ error?.errors ? error.errors[0] : 'See Vault logs for details.' @@ -50,11 +50,11 @@ export default Route.extend({ }, async model(params) { - let role = params.secret; - let backendModel = this.backendModel(); - let backendPath = backendModel.get('id'); - let backendType = backendModel.get('type'); - let roleType = params.roleType; + const role = params.secret; + const backendModel = this.backendModel(); + const backendPath = backendModel.get('id'); + const backendType = backendModel.get('type'); + const roleType = params.roleType; let dbCred; if (backendType === 'database') { dbCred = await this.getDatabaseCredential(backendPath, role, roleType); diff --git a/ui/app/routes/vault/cluster/secrets/backend/diff.js b/ui/app/routes/vault/cluster/secrets/backend/diff.js index 6ffb2e95dc..b94c833ad5 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/diff.js +++ b/ui/app/routes/vault/cluster/secrets/backend/diff.js @@ -5,12 +5,12 @@ export default class diff extends Route { @service store; beforeModel() { - let { backend } = this.paramsFor('vault.cluster.secrets.backend'); + const { backend } = this.paramsFor('vault.cluster.secrets.backend'); this.backend = backend; } model(params) { - let { id } = params; + const { id } = params; return this.store.queryRecord('secret-v2', { backend: this.backend, id, diff --git a/ui/app/routes/vault/cluster/secrets/backend/list.js b/ui/app/routes/vault/cluster/secrets/backend/list.js index 92cb7cce56..952e11a996 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/list.js +++ b/ui/app/routes/vault/cluster/secrets/backend/list.js @@ -47,37 +47,37 @@ export default Route.extend({ }, secretParam() { - let { secret } = this.paramsFor(this.routeName); + const { secret } = this.paramsFor(this.routeName); return secret ? normalizePath(secret) : ''; }, enginePathParam() { - let { backend } = this.paramsFor('vault.cluster.secrets.backend'); + const { backend } = this.paramsFor('vault.cluster.secrets.backend'); return backend; }, beforeModel() { - let secret = this.secretParam(); - let backend = this.enginePathParam(); - let { tab } = this.paramsFor('vault.cluster.secrets.backend.list-root'); - let secretEngine = this.store.peekRecord('secret-engine', backend); - let type = secretEngine && secretEngine.get('engineType'); + const secret = this.secretParam(); + const backend = this.enginePathParam(); + const { tab } = this.paramsFor('vault.cluster.secrets.backend.list-root'); + const secretEngine = this.store.peekRecord('secret-engine', backend); + const type = secretEngine && secretEngine.get('engineType'); if (!type || !SUPPORTED_BACKENDS.includes(type)) { return this.transitionTo('vault.cluster.secrets'); } if (this.routeName === 'vault.cluster.secrets.backend.list' && !secret.endsWith('/')) { return this.replaceWith('vault.cluster.secrets.backend.list', secret + '/'); } - let modelType = this.getModelType(backend, tab); + const modelType = this.getModelType(backend, tab); return this.pathHelp.getNewModel(modelType, backend).then(() => { this.store.unloadAll('capabilities'); }); }, getModelType(backend, tab) { - let secretEngine = this.store.peekRecord('secret-engine', backend); - let type = secretEngine.get('engineType'); - let types = { + const secretEngine = this.store.peekRecord('secret-engine', backend); + const type = secretEngine.get('engineType'); + const types = { database: tab === 'role' ? 'database/role' : 'database/connection', transit: 'transit-key', ssh: 'role-ssh', @@ -154,13 +154,13 @@ export default Route.extend({ }, setupController(controller, resolvedModel) { - let secretParams = this.paramsFor(this.routeName); - let secret = resolvedModel.secret; - let model = resolvedModel.secrets; - let backend = this.enginePathParam(); - let backendModel = this.store.peekRecord('secret-engine', backend); - let has404 = this.has404; - let noMetadataPermissions = this.noMetadataPermissions; + const secretParams = this.paramsFor(this.routeName); + const secret = resolvedModel.secret; + const model = resolvedModel.secrets; + const backend = this.enginePathParam(); + const backendModel = this.store.peekRecord('secret-engine', backend); + const has404 = this.has404; + const noMetadataPermissions = this.noMetadataPermissions; // only clear store cache if this is a new model if (secret !== controller.get('baseKey.id')) { this.store.clearAllDatasets(); @@ -200,11 +200,11 @@ export default Route.extend({ actions: { error(error, transition) { - let secret = this.secretParam(); - let backend = this.enginePathParam(); - let is404 = error.httpStatus === 404; + const secret = this.secretParam(); + const backend = this.enginePathParam(); + const is404 = error.httpStatus === 404; /* eslint-disable-next-line ember/no-controller-access-in-routes */ - let hasModel = this.controllerFor(this.routeName).get('hasModel'); + const hasModel = this.controllerFor(this.routeName).get('hasModel'); // this will occur if we've deleted something, // and navigate to its parent and the parent doesn't exist - diff --git a/ui/app/routes/vault/cluster/secrets/backend/metadata.js b/ui/app/routes/vault/cluster/secrets/backend/metadata.js index ea95f834b2..ab3658c015 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/metadata.js +++ b/ui/app/routes/vault/cluster/secrets/backend/metadata.js @@ -11,7 +11,7 @@ export default class MetadataShow extends Route { } model(params) { - let { secret } = params; + const { secret } = params; this.id = secret; return this.store .queryRecord('secret-v2', { diff --git a/ui/app/routes/vault/cluster/secrets/backend/overview.js b/ui/app/routes/vault/cluster/secrets/backend/overview.js index 1adf7db76f..688dd30c1b 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/overview.js +++ b/ui/app/routes/vault/cluster/secrets/backend/overview.js @@ -7,7 +7,7 @@ export default Route.extend({ type: '', enginePathParam() { - let { backend } = this.paramsFor('vault.cluster.secrets.backend'); + const { backend } = this.paramsFor('vault.cluster.secrets.backend'); return backend; }, @@ -46,14 +46,14 @@ export default Route.extend({ }, model() { - let backend = this.enginePathParam(); - let queryOptions = { backend, id: '' }; + const backend = this.enginePathParam(); + const queryOptions = { backend, id: '' }; - let connection = this.fetchConnection(queryOptions); - let role = this.fetchAllRoles(queryOptions); - let roleCapabilities = this.fetchCapabilitiesRole(queryOptions); - let staticRoleCapabilities = this.fetchCapabilitiesStaticRole(queryOptions); - let connectionCapabilities = this.fetchCapabilitiesConnection(queryOptions); + const connection = this.fetchConnection(queryOptions); + const role = this.fetchAllRoles(queryOptions); + const roleCapabilities = this.fetchCapabilitiesRole(queryOptions); + const staticRoleCapabilities = this.fetchCapabilitiesStaticRole(queryOptions); + const connectionCapabilities = this.fetchCapabilitiesConnection(queryOptions); return hash({ backend, @@ -70,13 +70,13 @@ export default Route.extend({ setupController(controller, model) { this._super(...arguments); - let showEmptyState = model.connections === 404 && model.roles === 404; - let noConnectionCapabilities = + const showEmptyState = model.connections === 404 && model.roles === 404; + const noConnectionCapabilities = !model.connectionCapabilities.canList && !model.connectionCapabilities.canCreate && !model.connectionCapabilities.canUpdate; - let emptyStateMessage = function () { + const 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 c3d469107f..22d4886057 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js +++ b/ui/app/routes/vault/cluster/secrets/backend/secret-edit.js @@ -13,19 +13,19 @@ export default Route.extend(UnloadModelRoute, { wizard: service(), secretParam() { - let { secret } = this.paramsFor(this.routeName); + const { secret } = this.paramsFor(this.routeName); return secret ? normalizePath(secret) : ''; }, enginePathParam() { - let { backend } = this.paramsFor('vault.cluster.secrets.backend'); + const { backend } = this.paramsFor('vault.cluster.secrets.backend'); return backend; }, capabilities(secret, modelType) { const backend = this.enginePathParam(); - let backendModel = this.modelFor('vault.cluster.secrets.backend'); - let backendType = backendModel.engineType; + const backendModel = this.modelFor('vault.cluster.secrets.backend'); + const backendType = backendModel.engineType; let path; if (backendModel.isV2KV) { path = `${backend}/data/${secret}`; @@ -42,7 +42,7 @@ export default Route.extend(UnloadModelRoute, { }, buildTransformPath(backend, secret, modelType) { - let noun = modelType.split('/')[1]; + const noun = modelType.split('/')[1]; return `${backend}/${noun}/${secret}`; }, @@ -72,7 +72,7 @@ export default Route.extend(UnloadModelRoute, { templateName: 'vault/cluster/secrets/backend/secretEditLayout', beforeModel({ to: { queryParams } }) { - let secret = this.secretParam(); + const secret = this.secretParam(); return this.buildModel(secret, queryParams).then(() => { const parentKey = utils.parentKeyForKey(secret); const mode = this.routeName.split('.').pop(); @@ -88,7 +88,7 @@ export default Route.extend(UnloadModelRoute, { buildModel(secret, queryParams) { const backend = this.enginePathParam(); - let modelType = this.modelType(backend, secret, { queryParams }); + const modelType = this.modelType(backend, secret, { queryParams }); if (['secret', 'secret-v2'].includes(modelType)) { return resolve(); } @@ -96,9 +96,9 @@ export default Route.extend(UnloadModelRoute, { }, modelType(backend, secret, options = {}) { - let backendModel = this.modelFor('vault.cluster.secrets.backend', backend); - let type = backendModel.get('engineType'); - let types = { + const backendModel = this.modelFor('vault.cluster.secrets.backend', backend); + const type = backendModel.get('engineType'); + const types = { database: secret && secret.startsWith('role/') ? 'database/role' : 'database/connection', transit: 'transit-key', ssh: 'role-ssh', @@ -125,16 +125,16 @@ export default Route.extend(UnloadModelRoute, { }, async fetchV2Models(capabilities, secretModel, params) { - let backend = this.enginePathParam(); - let backendModel = this.modelFor('vault.cluster.secrets.backend', backend); - let targetVersion = this.getTargetVersion(secretModel.currentVersion, params.version); + const backend = this.enginePathParam(); + const backendModel = this.modelFor('vault.cluster.secrets.backend', backend); + const targetVersion = this.getTargetVersion(secretModel.currentVersion, params.version); // if we have the metadata, a list of versions are part of the payload - let version = secretModel.versions && secretModel.versions.findBy('version', targetVersion); + const version = secretModel.versions && secretModel.versions.findBy('version', targetVersion); // if it didn't fail the server read, and the version is not attached to the metadata, // this should 404 if (!version && secretModel.failedServerRead !== true) { - let error = new AdapterError(); + const error = new AdapterError(); set(error, 'httpStatus', 404); throw error; } @@ -149,12 +149,12 @@ export default Route.extend(UnloadModelRoute, { }, async fetchV2VersionModel(capabilities, secretModel, version, targetVersion) { - let secret = this.secretParam(); - let backend = this.enginePathParam(); + const secret = this.secretParam(); + const backend = this.enginePathParam(); // v2 versions have a composite ID, we generated one here if we need to manually set it // after a failed fetch later; - let versionId = targetVersion ? [backend, secret, targetVersion] : [backend, secret]; + const versionId = targetVersion ? [backend, secret, targetVersion] : [backend, secret]; let versionModel; try { @@ -213,7 +213,7 @@ export default Route.extend(UnloadModelRoute, { }, }, }); - let secretModel = this.store.peekRecord(modelType, secretId); + const secretModel = this.store.peekRecord(modelType, secretId); return secretModel; }, @@ -228,9 +228,9 @@ export default Route.extend(UnloadModelRoute, { async model(params, { to: { queryParams } }) { this.updateWizard(params); let secret = this.secretParam(); - let backend = this.enginePathParam(); - let modelType = this.modelType(backend, secret, { queryParams }); - let type = params.type || ''; + const backend = this.enginePathParam(); + const modelType = this.modelType(backend, secret, { queryParams }); + const type = params.type || ''; if (!secret) { secret = '\u0020'; } @@ -245,7 +245,7 @@ export default Route.extend(UnloadModelRoute, { } let secretModel; - let capabilities = this.capabilities(secret, modelType); + const capabilities = this.capabilities(secret, modelType); try { secretModel = await this.store.queryRecord(modelType, { id: secret, backend, type }); } catch (err) { @@ -272,8 +272,8 @@ export default Route.extend(UnloadModelRoute, { setupController(controller, model) { this._super(...arguments); - let secret = this.secretParam(); - let backend = this.enginePathParam(); + const secret = this.secretParam(); + const backend = this.enginePathParam(); const preferAdvancedEdit = /* eslint-disable-next-line ember/no-controller-access-in-routes */ this.controllerFor('vault.cluster.secrets.backend').get('preferAdvancedEdit') || false; @@ -299,8 +299,8 @@ export default Route.extend(UnloadModelRoute, { actions: { error(error) { - let secret = this.secretParam(); - let backend = this.enginePathParam(); + const secret = this.secretParam(); + const backend = this.enginePathParam(); set(error, 'keyId', backend + '/' + secret); set(error, 'backend', backend); return true; @@ -312,10 +312,10 @@ export default Route.extend(UnloadModelRoute, { willTransition(transition) { /* eslint-disable-next-line ember/no-controller-access-in-routes */ - let { mode, model } = this.controller; - let version = model.get('selectedVersion'); - let changed = model.changedAttributes(); - let changedKeys = Object.keys(changed); + const { mode, model } = this.controller; + const version = model.get('selectedVersion'); + const changed = model.changedAttributes(); + const changedKeys = Object.keys(changed); // 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 diff --git a/ui/app/routes/vault/cluster/secrets/backend/versions.js b/ui/app/routes/vault/cluster/secrets/backend/versions.js index 98b672162f..c0114f7c04 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/versions.js +++ b/ui/app/routes/vault/cluster/secrets/backend/versions.js @@ -9,7 +9,7 @@ export default Route.extend(UnloadModelRoute, { templateName: 'vault/cluster/secrets/backend/versions', beforeModel() { - let backendModel = this.modelFor('vault.cluster.secrets.backend'); + const backendModel = this.modelFor('vault.cluster.secrets.backend'); const { secret } = this.paramsFor(this.routeName); const parentKey = utils.parentKeyForKey(secret); if (backendModel.get('isV2KV')) { @@ -23,9 +23,9 @@ export default Route.extend(UnloadModelRoute, { }, model(params) { - let { secret } = params; + const { secret } = params; const { backend } = this.paramsFor('vault.cluster.secrets.backend'); - let id = normalizePath(secret); + const id = normalizePath(secret); return this.store.queryRecord('secret-v2', { id, backend }); }, }); 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 ef750545be..6b3b98fd35 100644 --- a/ui/app/routes/vault/cluster/settings/configure-secret-backend.js +++ b/ui/app/routes/vault/cluster/settings/configure-secret-backend.js @@ -10,7 +10,7 @@ export default Route.extend({ model() { const { backend } = this.paramsFor(this.routeName); return this.store.query('secret-engine', { path: backend }).then((modelList) => { - let model = modelList && modelList.get('firstObject'); + const model = modelList && modelList.get('firstObject'); if (!model || !CONFIGURABLE_BACKEND_TYPES.includes(model.get('type'))) { const error = new AdapterError(); set(error, 'httpStatus', 404); diff --git a/ui/app/serializers/application.js b/ui/app/serializers/application.js index ae257b9610..1e1055a6d9 100644 --- a/ui/app/serializers/application.js +++ b/ui/app/serializers/application.js @@ -10,11 +10,11 @@ export default JSONSerializer.extend({ normalizeItems(payload) { if (payload.data && payload.data.keys && Array.isArray(payload.data.keys)) { - let models = payload.data.keys.map((key) => { + const models = payload.data.keys.map((key) => { if (typeof key !== 'string') { return key; } - let pk = this.primaryKey || 'id'; + const pk = this.primaryKey || 'id'; let model = { [pk]: key }; // if we've added _requestQuery in the adapter, we want // attach it to the individual models diff --git a/ui/app/serializers/auth-method.js b/ui/app/serializers/auth-method.js index f68e50e37a..e6ed6d63f6 100644 --- a/ui/app/serializers/auth-method.js +++ b/ui/app/serializers/auth-method.js @@ -14,7 +14,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { return this._super(modelClass, data); }, normalizeBackend(path, backend) { - let struct = { ...backend }; + const struct = { ...backend }; // strip the trailing slash off of the path so we // can navigate to it without getting `//` in the url struct.id = path.slice(0, -1); diff --git a/ui/app/serializers/capabilities.js b/ui/app/serializers/capabilities.js index 0a9351c867..f25f45a1f6 100644 --- a/ui/app/serializers/capabilities.js +++ b/ui/app/serializers/capabilities.js @@ -8,7 +8,7 @@ export default ApplicationSerializer.extend({ if (id) { payload.path = id; } - let response = { + const response = { ...payload.data, path: payload.path, }; diff --git a/ui/app/serializers/clients/activity.js b/ui/app/serializers/clients/activity.js index a05dba9ccb..9748af84fc 100644 --- a/ui/app/serializers/clients/activity.js +++ b/ui/app/serializers/clients/activity.js @@ -7,8 +7,8 @@ export default class ActivitySerializer extends ApplicationSerializer { if (payload.id === 'no-data') { return super.normalizeResponse(store, primaryModelClass, payload, id, requestType); } - let response_timestamp = formatISO(new Date()); - let transformedPayload = { + const response_timestamp = formatISO(new Date()); + const transformedPayload = { ...payload, response_timestamp, by_namespace: formatByNamespace(payload.data.by_namespace), diff --git a/ui/app/serializers/clients/config.js b/ui/app/serializers/clients/config.js index e1d0cdc3a0..50bcb6331f 100644 --- a/ui/app/serializers/clients/config.js +++ b/ui/app/serializers/clients/config.js @@ -17,7 +17,7 @@ export default ApplicationSerializer.extend({ }, serialize() { - let json = this._super(...arguments); + const json = this._super(...arguments); if (json.enabled === 'On' || json.enabled === 'Off') { const oldEnabled = json.enabled; json.enabled = oldEnabled === 'On' ? 'enable' : 'disable'; diff --git a/ui/app/serializers/clients/monthly.js b/ui/app/serializers/clients/monthly.js index 90a285956f..9f114e5946 100644 --- a/ui/app/serializers/clients/monthly.js +++ b/ui/app/serializers/clients/monthly.js @@ -7,10 +7,10 @@ export default class MonthlySerializer extends ApplicationSerializer { if (payload.id === 'no-data') { return super.normalizeResponse(store, primaryModelClass, payload, id, requestType); } - let response_timestamp = formatISO(new Date()); + const response_timestamp = formatISO(new Date()); // TODO CMB: the following is assumed, need to confirm // the months array will always include a single object: a timestamp of the current month and new/total count data, if available - let transformedPayload = { + const transformedPayload = { ...payload, response_timestamp, by_namespace: formatByNamespace(payload.data.by_namespace), diff --git a/ui/app/serializers/clients/version-history.js b/ui/app/serializers/clients/version-history.js index 5e13f629cd..465fcf1e66 100644 --- a/ui/app/serializers/clients/version-history.js +++ b/ui/app/serializers/clients/version-history.js @@ -4,7 +4,7 @@ export default ApplicationSerializer.extend({ normalizeItems(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { return payload.data.keys.map((key) => { - let model = payload.data.key_info[key]; + const model = payload.data.key_info[key]; model.id = key; return model; }); diff --git a/ui/app/serializers/control-group.js b/ui/app/serializers/control-group.js index 0bb5273f95..1046e6cd96 100644 --- a/ui/app/serializers/control-group.js +++ b/ui/app/serializers/control-group.js @@ -8,9 +8,9 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { }, normalizeResponse(store, primaryModelClass, payload) { - let entity = payload?.data?.request_entity; + const entity = payload?.data?.request_entity; if (Array.isArray(payload.data.authorizations)) { - for (let authorization of payload.data.authorizations) { + for (const authorization of payload.data.authorizations) { authorization.id = authorization.entity_id; authorization.name = authorization.entity_name; } diff --git a/ui/app/serializers/database/connection.js b/ui/app/serializers/database/connection.js index 3a6b9ecaaf..3720a8e238 100644 --- a/ui/app/serializers/database/connection.js +++ b/ui/app/serializers/database/connection.js @@ -20,7 +20,7 @@ export default RESTSerializer.extend({ return connections; } // Query single record response: - let response = { + const response = { id: payload.id, name: payload.id, backend: payload.backend, @@ -48,18 +48,18 @@ export default RESTSerializer.extend({ }, serialize(snapshot, requestType) { - let data = this._super(snapshot, requestType); + const data = this._super(snapshot, requestType); if (!data.plugin_name) { return data; } - let pluginType = AVAILABLE_PLUGIN_TYPES.find((plugin) => plugin.value === data.plugin_name); + const 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'); + const 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)); + const 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/credential.js b/ui/app/serializers/database/credential.js index c0c157fb2a..250873e418 100644 --- a/ui/app/serializers/database/credential.js +++ b/ui/app/serializers/database/credential.js @@ -22,7 +22,7 @@ export default RESTSerializer.extend({ normalizeResponse(store, primaryModelClass, payload, id, requestType) { const credentials = this.normalizePayload(payload); const { modelName } = primaryModelClass; - let transformedPayload = { [modelName]: credentials }; + const transformedPayload = { [modelName]: credentials }; return this._super(store, primaryModelClass, transformedPayload, id, requestType); }, diff --git a/ui/app/serializers/database/role.js b/ui/app/serializers/database/role.js index 5b94fc2a79..1ca5b3e9ef 100644 --- a/ui/app/serializers/database/role.js +++ b/ui/app/serializers/database/role.js @@ -70,7 +70,7 @@ export default RESTSerializer.extend({ }, serialize(snapshot, requestType) { - let data = this._super(snapshot, requestType); + const data = this._super(snapshot, requestType); if (data.database) { const db = data.database[0]; data.db_name = db; diff --git a/ui/app/serializers/identity/_base.js b/ui/app/serializers/identity/_base.js index c28231d69a..89efa631a4 100644 --- a/ui/app/serializers/identity/_base.js +++ b/ui/app/serializers/identity/_base.js @@ -5,7 +5,7 @@ export default ApplicationSerializer.extend({ normalizeItems(payload) { if (payload.data.keys && Array.isArray(payload.data.keys)) { return payload.data.keys.map((key) => { - let model = payload.data.key_info[key]; + const model = payload.data.key_info[key]; model.id = key; return model; }); diff --git a/ui/app/serializers/identity/group.js b/ui/app/serializers/identity/group.js index 9a4b576185..80683139b4 100644 --- a/ui/app/serializers/identity/group.js +++ b/ui/app/serializers/identity/group.js @@ -14,7 +14,7 @@ export default IdentitySerializer.extend(EmbeddedRecordsMixin, { }, serialize() { - let json = this._super(...arguments); + const json = this._super(...arguments); delete json.alias; if (json.type === 'external') { delete json.member_entity_ids; diff --git a/ui/app/serializers/keymgmt/key.js b/ui/app/serializers/keymgmt/key.js index 6c8dcba5f7..4500e74e6f 100644 --- a/ui/app/serializers/keymgmt/key.js +++ b/ui/app/serializers/keymgmt/key.js @@ -2,12 +2,12 @@ import ApplicationSerializer from '../application'; export default class KeymgmtKeySerializer extends ApplicationSerializer { normalizeItems(payload) { - let normalized = super.normalizeItems(payload); + const normalized = super.normalizeItems(payload); // Transform versions from object with number keys to array with key ids if (normalized.versions) { let lastRotated; let created; - let versions = []; + const versions = []; Object.keys(normalized.versions).forEach((key, i, arr) => { versions.push({ id: parseInt(key, 10), diff --git a/ui/app/serializers/keymgmt/provider.js b/ui/app/serializers/keymgmt/provider.js index 81b2574f83..d558079b3b 100644 --- a/ui/app/serializers/keymgmt/provider.js +++ b/ui/app/serializers/keymgmt/provider.js @@ -4,7 +4,7 @@ export default class KeymgmtProviderSerializer extends ApplicationSerializer { primaryKey = 'name'; normalizeItems(payload) { - let normalized = super.normalizeItems(payload); + const normalized = super.normalizeItems(payload); if (Array.isArray(normalized)) { normalized.forEach((provider) => { provider.id = provider.name; diff --git a/ui/app/serializers/mfa-method.js b/ui/app/serializers/mfa-method.js index f04374bc93..8356047e5e 100644 --- a/ui/app/serializers/mfa-method.js +++ b/ui/app/serializers/mfa-method.js @@ -4,8 +4,8 @@ export default class KeymgmtKeySerializer extends ApplicationSerializer { normalizeItems(payload) { if (!payload?.data) return payload; if (payload.data.keys && Array.isArray(payload.data.keys)) { - let data = payload.data.keys.map((key) => { - let model = payload.data.key_info[key]; + const data = payload.data.keys.map((key) => { + const model = payload.data.key_info[key]; model.id = key; return model; }); diff --git a/ui/app/serializers/namespace.js b/ui/app/serializers/namespace.js index ced413aee1..9b8172fb4d 100644 --- a/ui/app/serializers/namespace.js +++ b/ui/app/serializers/namespace.js @@ -15,8 +15,8 @@ export default ApplicationSerializer.extend({ normalizeResponse(store, primaryModelClass, payload, id, requestType) { const nullResponses = ['deleteRecord', 'createRecord']; - let cid = (id || payload.id || '').replace(/\/$/, ''); - let normalizedPayload = nullResponses.includes(requestType) + const cid = (id || payload.id || '').replace(/\/$/, ''); + const normalizedPayload = nullResponses.includes(requestType) ? { id: cid, path: cid } : this.normalizeList(payload); return this._super(store, primaryModelClass, normalizedPayload, id, requestType); diff --git a/ui/app/serializers/pki/cert.js b/ui/app/serializers/pki/cert.js index 3a91a31605..451e511ce0 100644 --- a/ui/app/serializers/pki/cert.js +++ b/ui/app/serializers/pki/cert.js @@ -22,8 +22,8 @@ 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 model = { + const ret = payload.data.keys.map((key) => { + const model = { id_for_nav: `cert/${key}`, id: key, }; diff --git a/ui/app/serializers/policy.js b/ui/app/serializers/policy.js index 10c5685d69..6e39dd45ce 100644 --- a/ui/app/serializers/policy.js +++ b/ui/app/serializers/policy.js @@ -10,7 +10,7 @@ export default ApplicationSerializer.extend({ normalizeResponse(store, primaryModelClass, payload, id, requestType) { const nullResponses = ['deleteRecord']; - let normalizedPayload = nullResponses.includes(requestType) + const normalizedPayload = nullResponses.includes(requestType) ? { name: id } : this.normalizePolicies(payload); return this._super(store, primaryModelClass, normalizedPayload, id, requestType); diff --git a/ui/app/serializers/role-aws.js b/ui/app/serializers/role-aws.js index e479a61f86..1a769aad6e 100644 --- a/ui/app/serializers/role-aws.js +++ b/ui/app/serializers/role-aws.js @@ -1,9 +1,8 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { - let ret; - ret = payload.data.keys.map((key) => { - let model = { + return payload.data.keys.map((key) => { + const model = { id: key, }; if (payload.backend) { @@ -11,11 +10,10 @@ export default ApplicationSerializer.extend({ } return model; }); - return ret; }, normalizeItems() { - let normalized = this._super(...arguments); + const normalized = this._super(...arguments); // most roles will only have one in this array, // we'll default to the first, and keep the array on the // model and show a warning if there's more than one so that diff --git a/ui/app/serializers/role.js b/ui/app/serializers/role.js index 27d9d3653b..603f97f49a 100644 --- a/ui/app/serializers/role.js +++ b/ui/app/serializers/role.js @@ -2,8 +2,6 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { - let ret; - if (payload.zero_address_roles) { payload.zero_address_roles.forEach((role) => { // mutate key_info object to add zero_address info @@ -12,7 +10,7 @@ export default ApplicationSerializer.extend({ } if (!payload.data.key_info) { return payload.data.keys.map((key) => { - let model = { + const model = { id: key, }; if (payload.backend) { @@ -22,8 +20,8 @@ export default ApplicationSerializer.extend({ }); } - ret = payload.data.keys.map((key) => { - let model = { + const ret = payload.data.keys.map((key) => { + const model = { id: key, key_type: payload.data.key_info[key].key_type, zero_address: payload.data.key_info[key].zero_address, diff --git a/ui/app/serializers/secret-engine.js b/ui/app/serializers/secret-engine.js index a6010bd016..4c15f0121a 100644 --- a/ui/app/serializers/secret-engine.js +++ b/ui/app/serializers/secret-engine.js @@ -20,7 +20,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { normalizeBackend(path, backend) { let struct = {}; - for (let attribute in backend) { + for (const attribute in backend) { struct[attribute] = backend[attribute]; } //queryRecord adds path to the response @@ -67,8 +67,8 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, { }, serialize(snapshot) { - let type = snapshot.record.get('engineType'); - let data = this._super(...arguments); + const type = snapshot.record.get('engineType'); + const data = this._super(...arguments); // move version back to options data.options = data.version ? { version: data.version } : {}; delete data.version; diff --git a/ui/app/serializers/secret-v2-version.js b/ui/app/serializers/secret-v2-version.js index 4cf77f839e..97224cc11c 100644 --- a/ui/app/serializers/secret-v2-version.js +++ b/ui/app/serializers/secret-v2-version.js @@ -5,7 +5,7 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ secretDataPath: 'data.data', normalizeItems(payload) { - let path = this.secretDataPath; + const path = this.secretDataPath; // move response that is the contents of the secret from the dataPath // to `secret_data` so it will be `secretData` in the model payload.secret_data = get(payload, path); @@ -17,7 +17,7 @@ export default ApplicationSerializer.extend({ return payload; }, serialize(snapshot) { - let secret = snapshot.belongsTo('secret'); + const secret = snapshot.belongsTo('secret'); // if both models failed to read from the server, we need to write without CAS if (secret.record.failedServerRead && snapshot.record.failedServerRead) { return { diff --git a/ui/app/serializers/secret-v2.js b/ui/app/serializers/secret-v2.js index 9af7b8905d..591ef8e61d 100644 --- a/ui/app/serializers/secret-v2.js +++ b/ui/app/serializers/secret-v2.js @@ -31,7 +31,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) => { - let body = payload.data.versions[version]; + const body = payload.data.versions[version]; body.version = version; body.path = payload.id; body.id = JSON.stringify([payload.backend, payload.id, version]); diff --git a/ui/app/serializers/secret.js b/ui/app/serializers/secret.js index 2a3a19dc8a..34ea8a519b 100644 --- a/ui/app/serializers/secret.js +++ b/ui/app/serializers/secret.js @@ -27,7 +27,7 @@ export default ApplicationSerializer.extend({ return { id: fullSecretPath, backend: payload.backend }; }); } - let path = this.secretDataPath; + const path = this.secretDataPath; // move response that is the contents of the secret from the dataPath // to `secret_data` so it will be `secretData` in the model payload.secret_data = get(payload, path); diff --git a/ui/app/serializers/ssh.js b/ui/app/serializers/ssh.js index eb69b6fd16..42d4c56ec1 100644 --- a/ui/app/serializers/ssh.js +++ b/ui/app/serializers/ssh.js @@ -28,8 +28,8 @@ export default RESTSerializer.extend({ normalizeResponse(store, primaryModelClass, payload, id, requestType) { const responseJSON = this.normalizeItems(payload); const { modelName } = primaryModelClass; - let transformedPayload = { [modelName]: responseJSON }; - let ret = this._super(store, primaryModelClass, transformedPayload, id, requestType); + const transformedPayload = { [modelName]: responseJSON }; + const ret = this._super(store, primaryModelClass, transformedPayload, id, requestType); return ret; }, diff --git a/ui/app/serializers/transform.js b/ui/app/serializers/transform.js index e86c3a3ebf..3a1b2e173a 100644 --- a/ui/app/serializers/transform.js +++ b/ui/app/serializers/transform.js @@ -9,7 +9,7 @@ export default ApplicationSerializer.extend({ }, serialize() { - let json = this._super(...arguments); + const json = this._super(...arguments); if (json.template && Array.isArray(json.template)) { // Transformations should only ever have one template json.template = json.template[0]; @@ -18,9 +18,8 @@ export default ApplicationSerializer.extend({ }, extractLazyPaginatedData(payload) { - let ret; - ret = payload.data.keys.map((key) => { - let model = { + return payload.data.keys.map((key) => { + const model = { id: key, }; if (payload.backend) { @@ -28,6 +27,5 @@ export default ApplicationSerializer.extend({ } return model; }); - return ret; }, }); diff --git a/ui/app/serializers/transform/alphabet.js b/ui/app/serializers/transform/alphabet.js index 957917b6c2..e44accb06e 100644 --- a/ui/app/serializers/transform/alphabet.js +++ b/ui/app/serializers/transform/alphabet.js @@ -7,9 +7,8 @@ export default ApplicationSerializer.extend({ }, extractLazyPaginatedData(payload) { - let ret; - ret = payload.data.keys.map((key) => { - let model = { + return payload.data.keys.map((key) => { + const model = { id: key, }; if (payload.backend) { @@ -17,6 +16,5 @@ export default ApplicationSerializer.extend({ } return model; }); - return ret; }, }); diff --git a/ui/app/serializers/transform/role.js b/ui/app/serializers/transform/role.js index 29fcb4b040..2153ca8361 100644 --- a/ui/app/serializers/transform/role.js +++ b/ui/app/serializers/transform/role.js @@ -2,9 +2,8 @@ import ApplicationSerializer from '../application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { - let ret; - ret = payload.data.keys.map((key) => { - let model = { + return payload.data.keys.map((key) => { + const model = { id: key, }; if (payload.backend) { @@ -12,6 +11,5 @@ export default ApplicationSerializer.extend({ } return model; }); - return ret; }, }); diff --git a/ui/app/serializers/transform/template.js b/ui/app/serializers/transform/template.js index 749cbe6bed..31bc571863 100644 --- a/ui/app/serializers/transform/template.js +++ b/ui/app/serializers/transform/template.js @@ -14,7 +14,7 @@ export default ApplicationSerializer.extend({ }, serialize() { - let json = this._super(...arguments); + const json = this._super(...arguments); if (json.alphabet && Array.isArray(json.alphabet)) { // Templates should only ever have one alphabet json.alphabet = json.alphabet[0]; @@ -40,9 +40,8 @@ export default ApplicationSerializer.extend({ }, extractLazyPaginatedData(payload) { - let ret; - ret = payload.data.keys.map((key) => { - let model = { + return payload.data.keys.map((key) => { + const model = { id: key, }; if (payload.backend) { @@ -50,6 +49,5 @@ export default ApplicationSerializer.extend({ } return model; }); - return ret; }, }); diff --git a/ui/app/serializers/transit-key.js b/ui/app/serializers/transit-key.js index 127f49fa33..aa062c34b9 100644 --- a/ui/app/serializers/transit-key.js +++ b/ui/app/serializers/transit-key.js @@ -22,7 +22,7 @@ export default RESTSerializer.extend({ payload.type === 'chacha20-poly1305' || payload.type === 'aes128-gcm96' ) { - for (let version in payload.keys) { + for (const version in payload.keys) { payload.keys[version] = payload.keys[version] * 1000; } } diff --git a/ui/app/services/auth.js b/ui/app/services/auth.js index 6134ac014e..88c5061970 100644 --- a/ui/app/services/auth.js +++ b/ui/app/services/auth.js @@ -91,11 +91,12 @@ export default Service.extend({ }, }; - let namespace = typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; + const namespace = + typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; if (namespace) { defaults.headers['X-Vault-Namespace'] = namespace; } - let opts = assign(defaults, options); + const opts = assign(defaults, options); return fetch(url, { method: opts.method || 'GET', @@ -112,19 +113,19 @@ export default Service.extend({ }, renewCurrentToken() { - let namespace = this.authData.userRootNamespace; + const namespace = this.authData.userRootNamespace; const url = '/v1/auth/token/renew-self'; return this.ajax(url, 'POST', { namespace }); }, revokeCurrentToken() { - let namespace = this.authData.userRootNamespace; + const namespace = this.authData.userRootNamespace; const url = '/v1/auth/token/revoke-self'; return this.ajax(url, 'POST', { namespace }); }, calculateExpiration(resp) { - let now = this.now(); + const now = this.now(); const ttl = resp.ttl || resp.lease_duration; const tokenExpirationEpoch = now + ttl * 1e3; this.set('expirationCalcTS', now); @@ -135,9 +136,9 @@ export default Service.extend({ }, persistAuthData() { - let [firstArg, resp] = arguments; - let tokens = this.tokens; - let currentNamespace = this.namespaceService.path || ''; + const [firstArg, resp] = arguments; + const tokens = this.tokens; + const currentNamespace = this.namespaceService.path || ''; let tokenName; let options; let backend; @@ -149,7 +150,7 @@ export default Service.extend({ backend = options.backend; } - let currentBackend = BACKENDS.findBy('type', backend); + const currentBackend = BACKENDS.findBy('type', backend); let displayName; if (isArray(currentBackend.displayNamePath)) { displayName = currentBackend.displayNamePath.map((name) => get(resp, name)).join('/'); @@ -157,7 +158,7 @@ export default Service.extend({ displayName = get(resp, currentBackend.displayNamePath); } - let { entity_id, policies, renewable, namespace_path } = resp; + const { entity_id, policies, renewable, namespace_path } = resp; // here we prefer namespace_path if its defined, // else we look and see if there's already a namespace saved // and then finally we'll use the current query param if the others @@ -177,7 +178,7 @@ export default Service.extend({ if (typeof userRootNamespace === 'undefined') { userRootNamespace = currentNamespace; } - let data = { + const data = { userRootNamespace, displayName, backend: currentBackend, @@ -242,7 +243,7 @@ export default Service.extend({ renewAfterEpoch: computed('currentTokenName', 'expirationCalcTS', function () { const tokenName = this.currentTokenName; - let { expirationCalcTS } = this; + const { expirationCalcTS } = this; const data = this.getTokenData(tokenName); if (!tokenName || !data || !expirationCalcTS) { return null; @@ -336,7 +337,7 @@ export default Service.extend({ if (mfa_requirement) { const { mfa_request_id, mfa_constraints } = mfa_requirement; const constraints = []; - for (let key in mfa_constraints) { + for (const key in mfa_constraints) { const methods = mfa_constraints[key].any; const isMulti = methods.length > 1; diff --git a/ui/app/services/console.js b/ui/app/services/console.js index 5880074d61..cfca52695e 100644 --- a/ui/app/services/console.js +++ b/ui/app/services/console.js @@ -37,7 +37,7 @@ export default Service.extend({ commandIndex: null, shiftCommandIndex(keyCode, setCommandFn = () => {}) { - let [newIndex, newCommand] = shiftCommandIndex(keyCode, this.commandHistory, this.commandIndex); + const [newIndex, newCommand] = shiftCommandIndex(keyCode, this.commandHistory, this.commandIndex); if (newCommand !== undefined && newIndex !== undefined) { this.set('commandIndex', newIndex); setCommandFn(newCommand); @@ -45,7 +45,7 @@ export default Service.extend({ }, clearLog(clearAll = false) { - let log = this.log; + const log = this.log; let history; if (!clearAll) { history = this.commandHistory.slice(); @@ -58,7 +58,7 @@ export default Service.extend({ }, logAndOutput(command, logContent) { - let log = this.log; + const log = this.log; if (command) { log.pushObject({ type: 'command', content: command }); this.set('commandIndex', null); @@ -69,10 +69,10 @@ export default Service.extend({ }, ajax(operation, path, options = {}) { - let verb = VERBS[operation]; - let adapter = this.adapter(); - let url = adapter.buildURL(encodePath(path)); - let { data, wrapTTL } = options; + const verb = VERBS[operation]; + const adapter = this.adapter(); + const url = adapter.buildURL(encodePath(path)); + const { data, wrapTTL } = options; return adapter.ajax(url, verb, { data, wrapTTL, @@ -92,7 +92,7 @@ export default Service.extend({ }, list(path, data, wrapTTL) { - let listPath = ensureTrailingSlash(sanitizePath(path)); + const listPath = ensureTrailingSlash(sanitizePath(path)); return this.ajax('list', listPath, { data: { list: true, diff --git a/ui/app/services/control-group.js b/ui/app/services/control-group.js index 2ac6a37d9c..f51872c666 100644 --- a/ui/app/services/control-group.js +++ b/ui/app/services/control-group.js @@ -30,31 +30,31 @@ export default Service.extend({ }, keyFromAccessor(accessor) { - let keys = this.storage().keys() || []; - let returnKey = keys + const keys = this.storage().keys() || []; + const returnKey = keys .filter((k) => k.startsWith(CONTROL_GROUP_PREFIX)) .find((key) => key.replace(CONTROL_GROUP_PREFIX, '').startsWith(accessor)); return returnKey ? returnKey : null; }, storeControlGroupToken(info) { - let key = storageKey(info.accessor, info.creation_path); + const key = storageKey(info.accessor, info.creation_path); this.storage().setItem(key, info); }, deleteControlGroupToken(accessor) { this.unmarkTokenForUnwrap(); - let key = this.keyFromAccessor(accessor); + const key = this.keyFromAccessor(accessor); this.storage().removeItem(key); }, deleteTokens() { - let keys = this.storage().keys() || []; + const keys = this.storage().keys() || []; keys.filter((k) => k.startsWith(CONTROL_GROUP_PREFIX)).forEach((key) => this.storage().removeItem(key)); }, wrapInfoForAccessor(accessor) { - let key = this.keyFromAccessor(accessor); + const key = this.keyFromAccessor(accessor); return key ? this.storage().getItem(key) : null; }, @@ -73,16 +73,16 @@ export default Service.extend({ } let pathForUrl = parseURL(url).pathname; pathForUrl = pathForUrl.replace('/v1/', ''); - let tokenInfo = this.tokenToUnwrap; + const tokenInfo = this.tokenToUnwrap; if (tokenInfo && tokenInfo.creation_path === pathForUrl) { - let { token, accessor, creation_time } = tokenInfo; + const { token, accessor, creation_time } = tokenInfo; return { token, accessor, creationTime: creation_time }; } return null; }, checkForControlGroup(callbackArgs, response, wasWrapTTLRequested) { - let creationPath = response && response?.wrap_info?.creation_path; + const creationPath = response && response?.wrap_info?.creation_path; if ( this.version.isOSS || wasWrapTTLRequested || @@ -92,25 +92,25 @@ export default Service.extend({ ) { return RSVP.resolve(...callbackArgs); } - let error = new ControlGroupError(response.wrap_info); + const error = new ControlGroupError(response.wrap_info); return RSVP.reject(error); }, handleError(error) { - let { accessor, token, creation_path, creation_time, ttl } = error; - let data = { accessor, token, creation_path, creation_time, ttl }; + const { accessor, token, creation_path, creation_time, ttl } = error; + const data = { accessor, token, creation_path, creation_time, ttl }; data.uiParams = { url: this.router.currentURL }; this.storeControlGroupToken(data); return this.router.transitionTo('vault.cluster.access.control-group-accessor', accessor); }, logFromError(error) { - let { accessor, token, creation_path, creation_time, ttl } = error; - let data = { accessor, token, creation_path, creation_time, ttl }; + const { accessor, token, creation_path, creation_time, ttl } = error; + const data = { accessor, token, creation_path, creation_time, ttl }; this.storeControlGroupToken(data); - let href = this.router.urlFor('vault.cluster.access.control-group-accessor', accessor); - let lines = [ + const href = this.router.urlFor('vault.cluster.access.control-group-accessor', accessor); + const lines = [ `A Control Group was encountered at ${error.creation_path}.`, `The Control Group Token is ${error.token}.`, `The Accessor is ${error.accessor}.`, diff --git a/ui/app/services/csp-event.js b/ui/app/services/csp-event.js index d2c0ba1883..961b536508 100644 --- a/ui/app/services/csp-event.js +++ b/ui/app/services/csp-event.js @@ -24,7 +24,7 @@ export default Service.extend({ this.events.clear(); while (true) { - let event = yield waitForEvent(window.document, 'securitypolicyviolation'); + const event = yield waitForEvent(window.document, 'securitypolicyviolation'); this.events.addObject(event); } }), diff --git a/ui/app/services/download-csv.js b/ui/app/services/download-csv.js index 2dfdecb898..7ca1cd5e7e 100644 --- a/ui/app/services/download-csv.js +++ b/ui/app/services/download-csv.js @@ -9,9 +9,9 @@ import Service from '@ember/service'; export default class DownloadCsvService extends Service { download(filename, content) { // even though Blob type 'text/csv' is specified below, some browsers (ex. Firefox) require the filename has an explicit extension - let formattedFilename = `${filename?.replace(/\s+/g, '-')}.csv` || 'vault-data.csv'; - let { document, URL } = window; - let downloadElement = document.createElement('a'); + const formattedFilename = `${filename?.replace(/\s+/g, '-')}.csv` || 'vault-data.csv'; + const { document, URL } = window; + const downloadElement = document.createElement('a'); downloadElement.download = formattedFilename; downloadElement.href = URL.createObjectURL( new Blob([content], { diff --git a/ui/app/services/namespace.js b/ui/app/services/namespace.js index 7a27d779c6..e4f4172b1f 100644 --- a/ui/app/services/namespace.js +++ b/ui/app/services/namespace.js @@ -27,17 +27,17 @@ export default Service.extend({ // uses the adapter and the raw response here since // models get wiped when switching namespaces and we // want to keep track of these separately - let store = this.store; - let adapter = store.adapterFor('namespace'); - let userRoot = this.auth.authData.userRootNamespace; + const store = this.store; + const adapter = store.adapterFor('namespace'); + const userRoot = this.auth.authData.userRootNamespace; try { - let ns = yield adapter.findAll(store, 'namespace', null, { + const ns = yield adapter.findAll(store, 'namespace', null, { adapterOptions: { forUser: true, namespace: userRoot, }, }); - let keys = ns.data.keys || []; + const keys = ns.data.keys || []; this.set( 'accessibleNamespaces', keys.map((n) => { diff --git a/ui/app/services/path-help.js b/ui/app/services/path-help.js index e577bff064..b295b25a67 100644 --- a/ui/app/services/path-help.js +++ b/ui/app/services/path-help.js @@ -27,15 +27,15 @@ export default Service.extend({ attrs: null, dynamicApiPath: '', ajax(url, options = {}) { - let appAdapter = getOwner(this).lookup(`adapter:application`); - let { data } = options; + const appAdapter = getOwner(this).lookup(`adapter:application`); + const { data } = options; return appAdapter.ajax(url, 'GET', { data, }); }, getNewModel(modelType, backend, apiPath, itemType) { - let owner = getOwner(this); + const owner = getOwner(this); const modelName = `model:${modelType}`; const modelFactory = owner.factoryFor(modelName); @@ -74,9 +74,9 @@ export default Service.extend({ const adapter = this.getNewAdapter(pathInfo, itemType); owner.register(`adapter:${modelType}`, adapter); } - let path, paths; + let path; // if we have an item we want the create info for that itemType - paths = itemType ? this.filterPathsByItemType(pathInfo, itemType) : pathInfo.paths; + const paths = itemType ? this.filterPathsByItemType(pathInfo, itemType) : pathInfo.paths; 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; @@ -156,14 +156,14 @@ export default Service.extend({ }, getPaths(apiPath, backend, itemType, itemID) { - let debugString = + const debugString = itemID && itemType ? `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) => { const pathInfo = help.openapi.paths; - let paths = Object.entries(pathInfo); + const paths = Object.entries(pathInfo); return paths.reduce(this.reducePathsByPathName, { apiPath, @@ -188,12 +188,12 @@ export default Service.extend({ const path = Object.keys(help.openapi.paths)[0]; // do this or look at name const pathInfo = help.openapi.paths[path]; const params = pathInfo.parameters; - let paramProp = {}; + const paramProp = {}; // include url params if (params) { const { name, schema, description } = params[0]; - let label = capitalize(name.split('_').join(' ')); + const label = capitalize(name.split('_').join(' ')); paramProp[name] = { 'x-vault-displayAttrs': { @@ -211,7 +211,7 @@ export default Service.extend({ if (schema.$ref) { // $ref will be shaped like `#/components/schemas/MyResponseType // which maps to the location of the item within the openApi response - let loc = schema.$ref.replace('#/', '').split('/'); + const loc = schema.$ref.replace('#/', '').split('/'); props = loc.reduce((prev, curr) => { return prev[curr] || {}; }, help.openapi).properties; @@ -227,7 +227,7 @@ export default Service.extend({ getNewAdapter(pathInfo, itemType) { // we need list and create paths to set the correct urls for actions - let paths = this.filterPathsByItemType(pathInfo, itemType); + const paths = this.filterPathsByItemType(pathInfo, itemType); let { apiPath } = pathInfo; const getPath = paths.find((path) => path.operations.includes('get')); @@ -297,7 +297,7 @@ export default Service.extend({ registerNewModelWithProps(helpUrl, backend, newModel, modelName) { return this.getProps(helpUrl, backend).then((props) => { const { attrs, newFields } = combineAttributes(newModel.attributes, props); - let owner = getOwner(this); + const owner = getOwner(this); newModel = newModel.extend(attrs, { newFields }); // if our newModel doesn't have fieldGroups already // we need to create them @@ -346,10 +346,10 @@ export default Service.extend({ }); }, getFieldGroups(newModel) { - let groups = { + const groups = { default: [], }; - let fieldGroups = []; + const fieldGroups = []; newModel.attributes.forEach((attr) => { // if the attr comes in with a fieldGroup from OpenAPI, // add it to that group @@ -364,7 +364,7 @@ export default Service.extend({ groups.default.push(attr.name); } }); - for (let group in groups) { + for (const group in groups) { fieldGroups.push({ [group]: groups[group] }); } return fieldToAttrs(newModel, fieldGroups); diff --git a/ui/app/services/permissions.js b/ui/app/services/permissions.js index a8d50b953c..8d1b03f08b 100644 --- a/ui/app/services/permissions.js +++ b/ui/app/services/permissions.js @@ -69,7 +69,7 @@ export default Service.extend({ } try { - let resp = yield this.store.adapterFor('permissions').query(); + const resp = yield this.store.adapterFor('permissions').query(); this.setPaths(resp); return; } catch (err) { @@ -93,7 +93,7 @@ export default Service.extend({ hasNavPermission(navItem, routeParams) { if (routeParams) { // viewing the entity and groups pages require the list capability, while the others require the default, which is anything other than deny - let capability = routeParams === 'entities' || routeParams === 'groups' ? ['list'] : [null]; + const capability = routeParams === 'entities' || routeParams === 'groups' ? ['list'] : [null]; return this.hasPermission(API_PATHS[navItem][routeParams], capability); } diff --git a/ui/app/services/store.js b/ui/app/services/store.js index bd5c9aed9a..91dac53f2d 100644 --- a/ui/app/services/store.js +++ b/ui/app/services/store.js @@ -161,7 +161,7 @@ export default Store.extend({ 'query' ) ); - let model = this.peekAll(modelName).toArray(); + const model = this.peekAll(modelName).toArray(); model.set('meta', response.meta); resolve(model); }); @@ -184,7 +184,7 @@ export default Store.extend({ }, clearDataset(modelName) { - let cacheList = this.lazyCaches; + const cacheList = this.lazyCaches; if (!cacheList.size) return; if (modelName && cacheList.has(modelName)) { cacheList.delete(modelName); diff --git a/ui/app/services/version.js b/ui/app/services/version.js index 3d5f03e371..682940ddfe 100644 --- a/ui/app/services/version.js +++ b/ui/app/services/version.js @@ -51,7 +51,7 @@ export default Service.extend({ if (this.version) { return; } - let response = yield this.store.adapterFor('cluster').health(); + const response = yield this.store.adapterFor('cluster').health(); this.setVersion(response); return; }), @@ -61,7 +61,7 @@ export default Service.extend({ return; } try { - let response = yield this.store.adapterFor('cluster').features(); + const response = yield this.store.adapterFor('cluster').features(); this.setFeatures(response); return; } catch (err) { diff --git a/ui/app/services/wizard.js b/ui/app/services/wizard.js index d1f272aa55..79296f126c 100644 --- a/ui/app/services/wizard.js +++ b/ui/app/services/wizard.js @@ -30,7 +30,7 @@ export default Service.extend(DEFAULTS, { initializeMachines() { if (!this.storageHasKey(TUTORIAL_STATE)) { - let state = TutorialMachine.initialState; + const state = TutorialMachine.initialState; this.saveState('currentState', state.value); this.saveExtState(TUTORIAL_STATE, state.value); } @@ -38,7 +38,7 @@ export default Service.extend(DEFAULTS, { if (this.storageHasKey(COMPONENT_STATE)) { this.set('componentState', this.getExtState(COMPONENT_STATE)); } - let stateNodes = TutorialMachine.getStateNodes(this.currentState); + const stateNodes = TutorialMachine.getStateNodes(this.currentState); this.executeActions( stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), null, @@ -60,7 +60,7 @@ export default Service.extend(DEFAULTS, { }, clearFeatureData() { - let storage = this.storage(); + const storage = this.storage(); // empty storage [FEATURE_LIST, FEATURE_STATE, FEATURE_STATE_HISTORY, COMPLETED_FEATURES].forEach((key) => storage.removeItem(key) @@ -74,7 +74,7 @@ export default Service.extend(DEFAULTS, { restartGuide() { this.clearFeatureData(); - let storage = this.storage(); + const storage = this.storage(); // empty storage [TUTORIAL_STATE, COMPONENT_STATE, RESUME_URL, RESUME_ROUTE].forEach((key) => storage.removeItem(key)); // reset wizard state @@ -91,17 +91,17 @@ export default Service.extend(DEFAULTS, { this.featureMachineHistory === null && (state === 'idle' || state === 'wrap') ) { - let newHistory = [state]; + const newHistory = [state]; this.set('featureMachineHistory', newHistory); } else { if (this.featureMachineHistory) { if (!this.featureMachineHistory.includes(state)) { - let newHistory = this.featureMachineHistory.addObject(state); + const newHistory = this.featureMachineHistory.addObject(state); this.set('featureMachineHistory', newHistory); } else { //we're repeating steps - let stepIndex = this.featureMachineHistory.indexOf(state); - let newHistory = this.featureMachineHistory.splice(0, stepIndex + 1); + const stepIndex = this.featureMachineHistory.indexOf(state); + const newHistory = this.featureMachineHistory.splice(0, stepIndex + 1); this.set('featureMachineHistory', newHistory); } } @@ -117,7 +117,7 @@ export default Service.extend(DEFAULTS, { } let stateKey = ''; while (typeOf(state) === 'object') { - let newState = Object.keys(state); + const newState = Object.keys(state); stateKey += newState + '.'; state = state[newState]; } @@ -134,7 +134,7 @@ export default Service.extend(DEFAULTS, { this.set('componentState', extendedState); this.saveExtState(COMPONENT_STATE, extendedState); } - let { actions, value } = TutorialMachine.transition(currentState, event); + const { actions, value } = TutorialMachine.transition(currentState, event); this.saveState('currentState', value); this.saveExtState(TUTORIAL_STATE, this.currentState); this.executeActions(actions, event, 'tutorial'); @@ -149,7 +149,7 @@ export default Service.extend(DEFAULTS, { this.saveExtState(COMPONENT_STATE, extendedState); } - let { actions, value } = FeatureMachine.transition(currentState, event, this.componentState); + const { actions, value } = FeatureMachine.transition(currentState, event, this.componentState); this.saveState('featureState', value); this.saveExtState(FEATURE_STATE, value); this.executeActions(actions, event, 'feature'); @@ -181,9 +181,9 @@ export default Service.extend(DEFAULTS, { executeActions(actions, event, machineType) { let transitionURL; let expectedRouteName; - let router = this.router; + const router = this.router; - for (let action of actions) { + for (const action of actions) { let type = action; if (action.type) { type = action.type; @@ -247,7 +247,7 @@ export default Service.extend(DEFAULTS, { }, handlePaused() { - let expected = this.expectedURL; + const expected = this.expectedURL; if (expected) { this.saveExtState(RESUME_URL, this.expectedURL); this.saveExtState(RESUME_ROUTE, this.expectedRouteName); @@ -255,7 +255,7 @@ export default Service.extend(DEFAULTS, { }, handleResume() { - let resumeURL = this.storage().getItem(RESUME_URL); + const resumeURL = this.storage().getItem(RESUME_URL); if (!resumeURL) { return; } @@ -288,7 +288,7 @@ export default Service.extend(DEFAULTS, { return; } this.startFeature(); - let nextFeature = this.featureList.length > 1 ? capitalize(this.featureList.objectAt(1)) : 'Finish'; + const nextFeature = this.featureList.length > 1 ? capitalize(this.featureList.objectAt(1)) : 'Finish'; this.set('nextFeature', nextFeature); let next; if (this.currentMachine === 'secrets' && this.featureState === 'display') { @@ -297,7 +297,7 @@ export default Service.extend(DEFAULTS, { next = FeatureMachine.transition(this.featureState, 'CONTINUE', this.componentState); } this.saveState('nextStep', next.value); - let stateNodes = FeatureMachine.getStateNodes(this.featureState); + const stateNodes = FeatureMachine.getStateNodes(this.featureState); this.executeActions( stateNodes.reduce((acc, node) => acc.concat(node.onEntry), []), null, @@ -325,10 +325,10 @@ export default Service.extend(DEFAULTS, { }, completeFeature() { - let features = this.featureList; - let done = features.shift(); + const features = this.featureList; + const done = features.shift(); if (!this.getExtState(COMPLETED_FEATURES)) { - let completed = []; + const completed = []; completed.push(done); this.saveExtState(COMPLETED_FEATURES, completed); } else { diff --git a/ui/app/utils/api-path.js b/ui/app/utils/api-path.js index 431d0acf83..8dcff11026 100644 --- a/ui/app/utils/api-path.js +++ b/ui/app/utils/api-path.js @@ -10,8 +10,8 @@ import { assert } from '@ember/debug'; export default function apiPath(strings, ...keys) { return function (data) { - let dict = data || {}; - let result = [strings[0]]; + const dict = data || {}; + const result = [strings[0]]; assert( `Expected ${keys.length} keys in apiPath context, only recieved ${Object.keys(data).join(',')}`, Object.keys(data).length >= keys.length diff --git a/ui/app/utils/chart-helpers.js b/ui/app/utils/chart-helpers.js index 25dc57460e..3071f4f8b1 100644 --- a/ui/app/utils/chart-helpers.js +++ b/ui/app/utils/chart-helpers.js @@ -32,6 +32,6 @@ export function calculateAverage(dataset, objectKey) { // if an array of objects, objectKey of the integer we want to calculate, ex: 'entity_clients' // if d[objectKey] is undefined there is no value, so return 0 const getIntegers = objectKey ? dataset?.map((d) => (d[objectKey] ? d[objectKey] : 0)) : dataset; - let checkIntegers = getIntegers.every((n) => Number.isInteger(n)); // decimals will be false + const checkIntegers = getIntegers.every((n) => Number.isInteger(n)); // decimals will be false return checkIntegers ? Math.round(mean(getIntegers)) : null; } diff --git a/ui/app/utils/openapi-to-attrs.js b/ui/app/utils/openapi-to-attrs.js index 4672e14714..7fd60ceebc 100644 --- a/ui/app/utils/openapi-to-attrs.js +++ b/ui/app/utils/openapi-to-attrs.js @@ -3,7 +3,7 @@ import { assign } from '@ember/polyfills'; import { camelize, capitalize } from '@ember/string'; export const expandOpenApiProps = function (props) { - let attrs = {}; + const attrs = {}; // expand all attributes for (const propName in props) { const prop = props[propName]; @@ -25,7 +25,7 @@ export const expandOpenApiProps = function (props) { editType = items.type + capitalize(type); } - let attrDefn = { + const attrDefn = { editType, helpText: description, possibleValues: prop['enum'], @@ -58,7 +58,7 @@ export const expandOpenApiProps = function (props) { } // loop to remove empty vals - for (let attrProp in attrDefn) { + for (const attrProp in attrDefn) { if (attrDefn[attrProp] == null) { delete attrDefn[attrProp]; } @@ -69,8 +69,8 @@ export const expandOpenApiProps = function (props) { }; export const combineAttributes = function (oldAttrs, newProps) { - let newAttrs = {}; - let newFields = []; + const newAttrs = {}; + const newFields = []; if (oldAttrs) { oldAttrs.forEach(function (value, name) { if (newProps[name]) { @@ -80,7 +80,7 @@ export const combineAttributes = function (oldAttrs, newProps) { } }); } - for (let prop in newProps) { + for (const prop in newProps) { if (newAttrs[prop]) { continue; } else { @@ -92,7 +92,7 @@ export const combineAttributes = function (oldAttrs, newProps) { }; export const combineFields = function (currentFields, newFields, excludedFields) { - let otherFields = newFields.filter((field) => { + const otherFields = newFields.filter((field) => { return !currentFields.includes(field) && !excludedFields.includes(field); }); if (otherFields.length) { @@ -103,11 +103,11 @@ export const combineFields = function (currentFields, newFields, excludedFields) export const combineFieldGroups = function (currentGroups, newFields, excludedFields) { let allFields = []; - for (let group of currentGroups) { - let fieldName = Object.keys(group)[0]; + for (const group of currentGroups) { + const fieldName = Object.keys(group)[0]; allFields = allFields.concat(group[fieldName]); } - let otherFields = newFields.filter((field) => { + const otherFields = newFields.filter((field) => { return !allFields.includes(field) && !excludedFields.includes(field); }); if (otherFields.length) { diff --git a/ui/app/utils/remove-record.js b/ui/app/utils/remove-record.js index 257276c4d5..b70120a9f6 100644 --- a/ui/app/utils/remove-record.js +++ b/ui/app/utils/remove-record.js @@ -1,7 +1,7 @@ // Unlinks a record from all its relationships and unloads it from // the store. export default function removeRecord(store, record) { - let id = record.path || record.id; + const id = record.path || record.id; if (id) { // Collect relationship property names and types const relationshipMeta = []; diff --git a/ui/app/utils/trim-right.js b/ui/app/utils/trim-right.js index 4d5fcf078f..cd1eeb6fb0 100644 --- a/ui/app/utils/trim-right.js +++ b/ui/app/utils/trim-right.js @@ -2,7 +2,7 @@ // if isExtension is true, the first char of that string will be escaped // in the regex export default function (str, endings = [], isExtension = true) { - let prefix = isExtension ? '\\' : ''; - let trimRegex = new RegExp(endings.map((ext) => `${prefix}${ext}$`).join('|')); + const prefix = isExtension ? '\\' : ''; + const trimRegex = new RegExp(endings.map((ext) => `${prefix}${ext}$`).join('|')); return str.replace(trimRegex, ''); } diff --git a/ui/app/utils/validators.js b/ui/app/utils/validators.js index 1842f94106..bc9e633e98 100644 --- a/ui/app/utils/validators.js +++ b/ui/app/utils/validators.js @@ -21,7 +21,7 @@ export const number = (value, { nullable = false } = {}) => { }; export const containsWhiteSpace = (value) => { - let validation = new RegExp('\\s', 'g'); // search for whitespace + const validation = new RegExp('\\s', 'g'); // search for whitespace return !validation.test(value); }; diff --git a/ui/blueprints/component/index.js b/ui/blueprints/component/index.js index 35948a6cf1..a626b0b23a 100644 --- a/ui/blueprints/component/index.js +++ b/ui/blueprints/component/index.js @@ -20,7 +20,7 @@ module.exports = { ], filesPath: function () { - let filesDirectory = 'files'; + const filesDirectory = 'files'; return path.join(this.path, filesDirectory); }, diff --git a/ui/config/environment.js b/ui/config/environment.js index 1ffd9ed1c2..bf5d0ab607 100644 --- a/ui/config/environment.js +++ b/ui/config/environment.js @@ -2,7 +2,7 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'vault', environment, rootURL: '/ui/', diff --git a/ui/ember-cli-build.js b/ui/ember-cli-build.js index 1922f23fa6..7468f378f4 100644 --- a/ui/ember-cli-build.js +++ b/ui/ember-cli-build.js @@ -63,7 +63,7 @@ const appConfig = { }; module.exports = function (defaults) { - let app = new EmberApp(defaults, appConfig); + const app = new EmberApp(defaults, appConfig); app.import('vendor/string-includes.js'); app.import('node_modules/string.prototype.endswith/endswith.js'); diff --git a/ui/lib/core/addon/components/chevron.js b/ui/lib/core/addon/components/chevron.js index 4e16f0c623..53892e8461 100644 --- a/ui/lib/core/addon/components/chevron.js +++ b/ui/lib/core/addon/components/chevron.js @@ -26,7 +26,7 @@ export default Component.extend({ direction: 'right', isButton: false, glyph: computed('direction', function () { - let { direction } = this; + const { direction } = this; assert( `The direction property of ${this.toString()} must be one of the following: ${DIRECTIONS.join(', ')}`, DIRECTIONS.includes(direction) diff --git a/ui/lib/core/addon/components/confirm.js b/ui/lib/core/addon/components/confirm.js index 0c568c60c5..fba414479e 100644 --- a/ui/lib/core/addon/components/confirm.js +++ b/ui/lib/core/addon/components/confirm.js @@ -44,8 +44,7 @@ export default Component.extend({ this.updateHeight(); }, updateHeight: function () { - let height; - height = this.openTrigger + const height = this.openTrigger ? this.element.querySelector('.confirm-overlay').clientHeight : this.element.querySelector('.confirm').clientHeight; this.set('height', height); diff --git a/ui/lib/core/addon/components/download-button.js b/ui/lib/core/addon/components/download-button.js index 1f4186977b..326ea6fc5c 100644 --- a/ui/lib/core/addon/components/download-button.js +++ b/ui/lib/core/addon/components/download-button.js @@ -14,8 +14,8 @@ export default Component.extend({ fileLike: computed('data', 'mime', 'stringify', 'download', function () { let file; let data = this.data; - let filename = this.download; - let mime = this.mime; + const filename = this.download; + const mime = this.mime; if (this.stringify) { data = JSON.stringify(data, null, 2); } @@ -37,7 +37,7 @@ export default Component.extend({ return; } event.preventDefault(); - let file = this.fileLike; + const file = this.fileLike; //lol whyyyy window.navigator.msSaveOrOpenBlob(file, file.name); }, diff --git a/ui/lib/core/addon/components/edit-form.js b/ui/lib/core/addon/components/edit-form.js index 1762b71d2e..cdce64c878 100644 --- a/ui/lib/core/addon/components/edit-form.js +++ b/ui/lib/core/addon/components/edit-form.js @@ -35,8 +35,8 @@ export default Component.extend({ save: task( waitFor(function* (model, options = { method: 'save' }) { - let { method } = options; - let messageKey = method === 'save' ? 'successMessage' : 'deleteSuccessMessage'; + const { method } = options; + const messageKey = method === 'save' ? 'successMessage' : 'deleteSuccessMessage'; try { yield model[method](); } catch (err) { @@ -62,7 +62,7 @@ export default Component.extend({ willDestroy() { this._super(...arguments); - let { model } = this; + const { model } = this; if (!model) return; if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) { model.rollbackAttributes(); diff --git a/ui/lib/core/addon/components/form-field.js b/ui/lib/core/addon/components/form-field.js index 82d39a4186..7ddf1e47d9 100644 --- a/ui/lib/core/addon/components/form-field.js +++ b/ui/lib/core/addon/components/form-field.js @@ -109,20 +109,20 @@ export default class FormFieldComponent extends Component { } @action setAndBroadcastBool(trueVal, falseVal, event) { - let valueToSet = event.target.checked === true ? trueVal : falseVal; + const valueToSet = event.target.checked === true ? trueVal : falseVal; this.setAndBroadcast(valueToSet); } @action setAndBroadcastTtl(value) { const alwaysSendValue = this.valuePath === 'expiry' || this.valuePath === 'safetyBuffer'; - let valueToSet = value.enabled === true || alwaysSendValue ? `${value.seconds}s` : 0; + const valueToSet = value.enabled === true || alwaysSendValue ? `${value.seconds}s` : 0; this.setAndBroadcast(`${valueToSet}`); } @action codemirrorUpdated(isString, value, codemirror) { codemirror.performLint(); const hasErrors = codemirror.state.lint.marked.length > 0; - let valToSet = isString ? value : JSON.parse(value); + const valToSet = isString ? value : JSON.parse(value); if (!hasErrors) { this.args.model.set(this.valuePath, valToSet); diff --git a/ui/lib/core/addon/components/info-table-item-array.js b/ui/lib/core/addon/components/info-table-item-array.js index 2b1b23e236..7c4f7dbb24 100644 --- a/ui/lib/core/addon/components/info-table-item-array.js +++ b/ui/lib/core/addon/components/info-table-item-array.js @@ -54,7 +54,7 @@ export default class InfoTableItemArray extends Component { } get displayArrayTruncated() { - let { displayArray } = this.args; + const { displayArray } = this.args; if (!displayArray) return null; if (displayArray.length >= 10 && !this.args.doNotTruncate) { // if array greater than 10 in length only display the first 5 @@ -65,9 +65,9 @@ export default class InfoTableItemArray extends Component { @action async fetchOptions() { if (this.args.isLink && this.args.modelType) { - let queryOptions = this.args.backend ? { backend: this.args.backend } : {}; + const queryOptions = this.args.backend ? { backend: this.args.backend } : {}; - let modelRecords = await this.store.query(this.args.modelType, queryOptions).catch((err) => { + const modelRecords = await this.store.query(this.args.modelType, queryOptions).catch((err) => { if (err.httpStatus === 404) { return []; } else { diff --git a/ui/lib/core/addon/components/info-table-row.js b/ui/lib/core/addon/components/info-table-row.js index b057b18a8c..9607187833 100644 --- a/ui/lib/core/addon/components/info-table-row.js +++ b/ui/lib/core/addon/components/info-table-row.js @@ -41,7 +41,7 @@ export default class InfoTableRowComponent extends Component { } get valueIsEmpty() { - let { value } = this.args; + const { value } = this.args; if (typeOf(value) === 'array' && value.length === 0) { return true; } diff --git a/ui/lib/core/addon/components/key-value-header.js b/ui/lib/core/addon/components/key-value-header.js index 90171a556c..fbc5c3ca08 100644 --- a/ui/lib/core/addon/components/key-value-header.js +++ b/ui/lib/core/addon/components/key-value-header.js @@ -40,7 +40,7 @@ export default class KeyValueHeader extends Component { } get secretPath() { - let crumbs = []; + const crumbs = []; const root = this.args.root; const baseKey = this.args.baseKey?.display || this.args.baseKey?.id; const baseKeyModel = encodePath(this.args.baseKey?.id); diff --git a/ui/lib/core/addon/components/list-item.js b/ui/lib/core/addon/components/list-item.js index 2f379ecfb6..336e408ecb 100644 --- a/ui/lib/core/addon/components/list-item.js +++ b/ui/lib/core/addon/components/list-item.js @@ -14,13 +14,13 @@ export default Component.extend({ hasMenu: true, callMethod: task(function* (method, model, successMessage, failureMessage, successCallback = () => {}) { - let flash = this.flashMessages; + const flash = this.flashMessages; try { yield model[method](); flash.success(successMessage); successCallback(); } catch (e) { - let errString = e.errors.join(' '); + const errString = e.errors.join(' '); flash.danger(failureMessage + ' ' + errString); model.rollbackAttributes(); } diff --git a/ui/lib/core/addon/components/list-pagination.js b/ui/lib/core/addon/components/list-pagination.js index f41c901270..206936ff1f 100644 --- a/ui/lib/core/addon/components/list-pagination.js +++ b/ui/lib/core/addon/components/list-pagination.js @@ -25,7 +25,7 @@ export default Component.extend({ const { spread, page, lastPage } = this; let lower = Math.max(2, page - spread); - let upper = Math.min(lastPage - 1, lower + spread * 2); + const upper = Math.min(lastPage - 1, lower + spread * 2); // we're closer to lastPage than the spread if (upper - lower < 5) { lower = upper - 4; diff --git a/ui/lib/core/addon/components/list-view.js b/ui/lib/core/addon/components/list-view.js index e479e99fc3..719f14bcbe 100644 --- a/ui/lib/core/addon/components/list-view.js +++ b/ui/lib/core/addon/components/list-view.js @@ -36,17 +36,17 @@ export default class ListView extends Component { } get showPagination() { - let meta = this.args.items.meta; + const meta = this.args.items.meta; return this.args.paginationRouteName && meta && meta.lastPage > 1 && meta.total > 0; } get emptyTitle() { - let items = pluralize(this.itemNoun); + const items = pluralize(this.itemNoun); return `No ${items} yet`; } get emptyMessage() { - let items = pluralize(this.itemNoun); + const items = pluralize(this.itemNoun); return `Your ${items} will be listed here. Add your first ${this.itemNoun} to get started.`; } } diff --git a/ui/lib/core/addon/components/masked-input.js b/ui/lib/core/addon/components/masked-input.js index 30ea93feca..a31593f4c2 100644 --- a/ui/lib/core/addon/components/masked-input.js +++ b/ui/lib/core/addon/components/masked-input.js @@ -47,7 +47,7 @@ export default Component.extend({ this.toggleProperty('showValue'); }, updateValue(e) { - let value = e.target.value; + const value = e.target.value; this.set('value', value); this.onChange(value); }, diff --git a/ui/lib/core/addon/components/message-error.js b/ui/lib/core/addon/components/message-error.js index cdd7b1812d..6288bd59ed 100644 --- a/ui/lib/core/addon/components/message-error.js +++ b/ui/lib/core/addon/components/message-error.js @@ -19,7 +19,7 @@ import { setComponentTemplate } from '@ember/component'; class MessageError extends Component { get displayErrors() { - let { errorMessage, errors, model } = this.args; + const { errorMessage, errors, model } = this.args; if (errorMessage) { return [errorMessage]; } @@ -29,7 +29,7 @@ class MessageError extends Component { } if (model?.isError) { - let adapterError = model?.adapterError; + const adapterError = model?.adapterError; if (!adapterError) { return null; } diff --git a/ui/lib/core/addon/components/namespace-reminder.js b/ui/lib/core/addon/components/namespace-reminder.js index 20c73b36be..68284344fa 100644 --- a/ui/lib/core/addon/components/namespace-reminder.js +++ b/ui/lib/core/addon/components/namespace-reminder.js @@ -12,7 +12,7 @@ export default Component.extend({ noun: null, mode: 'edit', modeVerb: computed('mode', function () { - let mode = this.mode; + const mode = this.mode; if (!mode) { return ''; } diff --git a/ui/lib/core/addon/components/navigate-input.js b/ui/lib/core/addon/components/navigate-input.js index 578a631815..557cfcce9f 100644 --- a/ui/lib/core/addon/components/navigate-input.js +++ b/ui/lib/core/addon/components/navigate-input.js @@ -55,7 +55,7 @@ export default Component.extend(FocusOnInsertMixin, { firstPartialMatch: null, transitionToRoute(...args) { - let params = args.map((param, index) => { + const params = args.map((param, index) => { if (index === 0 || typeof param !== 'string') { return param; } @@ -80,19 +80,19 @@ export default Component.extend(FocusOnInsertMixin, { return `cert/${key}`; }, onEnter: function (val) { - let { baseKey, mode } = this; - let extraParams = this.extraNavParams; + const { baseKey, mode } = this; + const extraParams = this.extraNavParams; if (mode.startsWith('secrets') && (!val || val === baseKey)) { return; } if (this.filterMatchesKey && !utils.keyIsFolder(val)) { - let params = [routeFor('show', mode, this.urls), extraParams, this.keyForNav(val)].compact(); + const params = [routeFor('show', mode, this.urls), extraParams, this.keyForNav(val)].compact(); this.transitionToRoute(...params); } else { if (mode === 'policies') { return; } - let route = routeFor('create', mode, this.urls); + const route = routeFor('create', mode, this.urls); if (baseKey) { this.transitionToRoute(route, this.keyForNav(baseKey), { queryParams: { @@ -154,7 +154,7 @@ export default Component.extend(FocusOnInsertMixin, { navigate(key, mode, pageFilter) { const route = routeFor(key ? 'list' : 'list-root', mode, this.urls); - let args = [route]; + const args = [route]; if (key) { args.push(key); } @@ -204,7 +204,7 @@ export default Component.extend(FocusOnInsertMixin, { handleKeyUp: function (event) { var keyCode = event.keyCode; - let val = event.target.value; + const val = event.target.value; if (keyCode === keys.ENTER) { this.onEnter(val); } diff --git a/ui/lib/core/addon/components/radio-select-ttl-or-string.js b/ui/lib/core/addon/components/radio-select-ttl-or-string.js index e63869bbfa..2686f7301f 100644 --- a/ui/lib/core/addon/components/radio-select-ttl-or-string.js +++ b/ui/lib/core/addon/components/radio-select-ttl-or-string.js @@ -38,7 +38,7 @@ export default class RadioSelectTtlOrString extends Component { } @action setAndBroadcastTtl(value) { - let valueToSet = value.enabled === true ? `${value.seconds}s` : 0; + const valueToSet = value.enabled === true ? `${value.seconds}s` : 0; if (this.groupValue === 'specificDate') { // do not save ttl on the model until the ttl radio button is selected return; diff --git a/ui/lib/core/addon/components/replication-page.js b/ui/lib/core/addon/components/replication-page.js index 354c0dc6f9..890c313fce 100644 --- a/ui/lib/core/addon/components/replication-page.js +++ b/ui/lib/core/addon/components/replication-page.js @@ -107,7 +107,7 @@ export default Component.extend({ return; } if (isSummaryDashboard) { - let combinedObject = {}; + const combinedObject = {}; combinedObject.dr = model['dr']; combinedObject.performance = model['performance']; return combinedObject; diff --git a/ui/lib/core/addon/components/search-select-with-modal.js b/ui/lib/core/addon/components/search-select-with-modal.js index ca66100e5f..9f6d27b058 100644 --- a/ui/lib/core/addon/components/search-select-with-modal.js +++ b/ui/lib/core/addon/components/search-select-with-modal.js @@ -75,8 +75,8 @@ export default class SearchSelectWithModal extends Component { @action async fetchOptions() { try { - let queryOptions = {}; - let options = await this.store.query(this.args.model, queryOptions); + const queryOptions = {}; + const options = await this.store.query(this.args.model, queryOptions); this.formatOptions(options); } catch (err) { if (err.httpStatus === 404) { @@ -107,7 +107,7 @@ export default class SearchSelectWithModal extends Component { if (this.selectedOptions.length > 0) { this.selectedOptions = this.selectedOptions.map((option) => { - let matchingOption = options.findBy('id', option); + const matchingOption = options.findBy('id', option); options.removeObject(matchingOption); return { id: option, @@ -136,7 +136,7 @@ export default class SearchSelectWithModal extends Component { if (options && options.length && options.firstObject.groupName) { return !options.some((group) => group.options.findBy('id', id)); } - let existingOption = + const existingOption = this.allOptions && (this.allOptions.findBy('id', id) || this.allOptions.findBy('name', id)); return !existingOption; } @@ -192,7 +192,7 @@ export default class SearchSelectWithModal extends Component { if (selection && selection.__isSuggestion__) { const name = selection.__value__; this.showModal = true; - let createRecord = await this.store.createRecord(this.args.model); + const createRecord = await this.store.createRecord(this.args.model); createRecord.name = name; this.newModelRecord = createRecord; } else { diff --git a/ui/lib/core/addon/components/search-select.js b/ui/lib/core/addon/components/search-select.js index 9b0bbb5911..ab915dbe75 100644 --- a/ui/lib/core/addon/components/search-select.js +++ b/ui/lib/core/addon/components/search-select.js @@ -94,9 +94,9 @@ export default class SearchSelect extends Component { // inputValues are initially an array of strings from @inputValue // map over so selectedOptions are objects return inputValues.map((option) => { - let matchingOption = this.dropdownOptions.findBy(this.idKey, option); + const matchingOption = this.dropdownOptions.findBy(this.idKey, option); // tooltip text comes from return of parent function - let addTooltip = this.args.renderInfoTooltip + const addTooltip = this.args.renderInfoTooltip ? this.args.renderInfoTooltip(option, this.dropdownOptions) : false; @@ -140,7 +140,7 @@ export default class SearchSelect extends Component { return; } - for (let modelType of this.args.models) { + for (const modelType of this.args.models) { try { let queryParams = {}; if (this.args.backend) { @@ -150,7 +150,7 @@ export default class SearchSelect extends Component { queryParams = this.args.queryObject; } // fetch options from the store - let options = yield this.store.query(modelType, queryParams); + const options = yield this.store.query(modelType, queryParams); // store both select + unselected options in tracked property used by wildcard filter this.allOptions = [...this.allOptions, ...options.mapBy('id')]; @@ -194,7 +194,7 @@ export default class SearchSelect extends Component { if (searchResults && searchResults.length && searchResults.firstObject.groupName) { return !searchResults.some((group) => group.options.findBy('id', id)); } - let existingOption = + const existingOption = this.dropdownOptions && (this.dropdownOptions.findBy('id', id) || this.dropdownOptions.findBy('name', id)); if (this.args.disallowNewItems && !existingOption) { diff --git a/ui/lib/core/addon/components/secret-list-header-tab.js b/ui/lib/core/addon/components/secret-list-header-tab.js index ef281b5d13..dcc615afca 100644 --- a/ui/lib/core/addon/components/secret-list-header-tab.js +++ b/ui/lib/core/addon/components/secret-list-header-tab.js @@ -38,9 +38,9 @@ export default class SecretListHeaderTab extends Component { } async fetchCapabilities() { - let capabilitiesArray = ['canList', 'canCreate', 'canUpdate']; - let checkCapabilities = function (object) { - let array = []; + const capabilitiesArray = ['canList', 'canCreate', 'canUpdate']; + const checkCapabilities = function (object) { + const array = []; // we only want to look at the canList, canCreate and canUpdate on the capabilities record capabilitiesArray.forEach((item) => { // object is sometimes null @@ -50,19 +50,19 @@ 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. + const 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/'); - let peekRecordStaticRoles = this.store.peekRecord('capabilities', 'database/static-roles/'); - let peekRecordConnections = this.store.peekRecord('capabilities', 'database/config/'); + const peekRecordRoles = this.store.peekRecord('capabilities', 'database/roles/'); + const peekRecordStaticRoles = this.store.peekRecord('capabilities', 'database/static-roles/'); + const peekRecordConnections = this.store.peekRecord('capabilities', 'database/config/'); // peekRecord if the capabilities store data is there for the connections (config) and roles model if ( (peekRecordRoles && this.args.path === 'roles') || (peekRecordStaticRoles && this.args.path === 'roles') ) { - let roles = checker(checkCapabilities(peekRecordRoles)); - let staticRoles = checker(checkCapabilities(peekRecordStaticRoles)); + const roles = checker(checkCapabilities(peekRecordRoles)); + const staticRoles = checker(checkCapabilities(peekRecordStaticRoles)); this.dontShowTab = roles && staticRoles; return; @@ -72,7 +72,7 @@ export default class SecretListHeaderTab extends Component { return; } // otherwise queryRecord and create an instance on the capabilities. - let response = await this.store.queryRecord( + const response = await this.store.queryRecord( 'capabilities', this.pathQuery(this.args.id, this.args.path) ); diff --git a/ui/lib/core/addon/components/shamir-flow.js b/ui/lib/core/addon/components/shamir-flow.js index 461026573b..436d595455 100644 --- a/ui/lib/core/addon/components/shamir-flow.js +++ b/ui/lib/core/addon/components/shamir-flow.js @@ -66,9 +66,9 @@ export default Component.extend(DEFAULTS, { hasProgress: gt('progress', 0), actionSuccess(resp) { - let { onUpdate, isComplete, onShamirSuccess, thresholdPath } = this; - let threshold = get(resp, thresholdPath); - let props = { + const { onUpdate, isComplete, onShamirSuccess, thresholdPath } = this; + const threshold = get(resp, thresholdPath); + const props = { ...resp, threshold, }; @@ -100,7 +100,7 @@ export default Component.extend(DEFAULTS, { }, generateStep: computed('generateWithPGP', 'haveSavedPGPKey', 'pgp_key', function () { - let { generateWithPGP, pgp_key, haveSavedPGPKey } = this; + const { generateWithPGP, pgp_key, haveSavedPGPKey } = this; if (!generateWithPGP && !pgp_key) { return 'chooseMethod'; } diff --git a/ui/lib/core/addon/components/toggle.js b/ui/lib/core/addon/components/toggle.js index be9c1f79aa..d40edc6f98 100644 --- a/ui/lib/core/addon/components/toggle.js +++ b/ui/lib/core/addon/components/toggle.js @@ -36,8 +36,8 @@ export default class ToggleComponent extends Component { return `toggle-${this.name.replace(/\W/g, '')}`; } get inputClasses() { - let size = this.args.size || 'normal'; - let status = this.args.status || 'normal'; + const size = this.args.size || 'normal'; + const status = this.args.status || 'normal'; const sizeClass = `is-${size}`; const statusClass = `is-${status}`; return `toggle ${statusClass} ${sizeClass}`; diff --git a/ui/lib/core/addon/components/ttl-form.js b/ui/lib/core/addon/components/ttl-form.js index e6688ebfee..a3a9642d10 100644 --- a/ui/lib/core/addon/components/ttl-form.js +++ b/ui/lib/core/addon/components/ttl-form.js @@ -52,7 +52,7 @@ export default Component.extend({ ]; }), handleChange() { - let { time, unit, seconds } = this; + const { time, unit, seconds } = this; const ttl = { seconds, timeString: time + unit, @@ -68,8 +68,7 @@ export default Component.extend({ }, updateTime: task(function* (newTime) { this.set('errorMessage', ''); - let parsedTime; - parsedTime = parseInt(newTime, 10); + const parsedTime = parseInt(newTime, 10); if (!newTime) { this.set('errorMessage', 'This field is required'); return; diff --git a/ui/lib/core/addon/components/ttl-picker.js b/ui/lib/core/addon/components/ttl-picker.js index 99086b00ab..86572b5a27 100644 --- a/ui/lib/core/addon/components/ttl-picker.js +++ b/ui/lib/core/addon/components/ttl-picker.js @@ -94,7 +94,7 @@ export default Component.extend({ }, parseAndSetTime() { - let value = this.initialValue; + const value = this.initialValue; let seconds = typeOf(value) === 'number' ? value : 30; try { seconds = Duration.parse(value).seconds(); diff --git a/ui/lib/core/addon/components/ttl-picker2.js b/ui/lib/core/addon/components/ttl-picker2.js index d7b17c2750..9c4f57f64e 100644 --- a/ui/lib/core/addon/components/ttl-picker2.js +++ b/ui/lib/core/addon/components/ttl-picker2.js @@ -39,7 +39,7 @@ const convertFromSeconds = (seconds, unit) => { }; const goSafeConvertFromSeconds = (seconds, unit) => { // Go only accepts s, m, or h units - let u = unit === 'd' ? 'h' : unit; + const u = unit === 'd' ? 'h' : unit; return convertFromSeconds(seconds, u) + u; }; @@ -127,7 +127,7 @@ export default TtlForm.extend({ ]; }), handleChange() { - let { time, unit, enableTTL, seconds } = this; + const { time, unit, enableTTL, seconds } = this; const ttl = { enabled: this.hideToggle || enableTTL, seconds, diff --git a/ui/lib/core/addon/components/upgrade-page.js b/ui/lib/core/addon/components/upgrade-page.js index ef5051c386..88e2ed4d9e 100644 --- a/ui/lib/core/addon/components/upgrade-page.js +++ b/ui/lib/core/addon/components/upgrade-page.js @@ -6,7 +6,7 @@ export default Component.extend({ layout, title: 'Vault Enterprise', featureName: computed('title', function () { - let title = this.title; + const title = this.title; return title === 'Vault Enterprise' ? 'this feature' : title; }), minimumEdition: 'Vault Enterprise', diff --git a/ui/lib/core/addon/helpers/changelog-url-for.js b/ui/lib/core/addon/helpers/changelog-url-for.js index 7f64af7571..9eb31ee83c 100644 --- a/ui/lib/core/addon/helpers/changelog-url-for.js +++ b/ui/lib/core/addon/helpers/changelog-url-for.js @@ -14,11 +14,11 @@ etc. */ export function changelogUrlFor([version]) { - let url = 'https://www.github.com/hashicorp/vault/blob/main/CHANGELOG.md#'; + const url = 'https://www.github.com/hashicorp/vault/blob/main/CHANGELOG.md#'; if (!version) return url; try { // strip the '+prem' from enterprise versions and remove periods - let versionNumber = version.split('+')[0].split('.').join(''); + const versionNumber = version.split('+')[0].split('.').join(''); // only recent versions have a predictable url if (versionNumber >= '143') { diff --git a/ui/lib/core/addon/helpers/options-for-backend.js b/ui/lib/core/addon/helpers/options-for-backend.js index 64728d8f59..f6fe2bed90 100644 --- a/ui/lib/core/addon/helpers/options-for-backend.js +++ b/ui/lib/core/addon/helpers/options-for-backend.js @@ -203,7 +203,7 @@ export function optionsForBackend([backend, tab, isEngine]) { let backendOptions; if (selected && selected.tabs) { - let tabData = + const tabData = selected.tabs.findBy('name', tab) || selected.tabs.findBy('modelPrefix', tab) || selected.tabs[0]; backendOptions = assign({}, selected, tabData); } else if (selected) { diff --git a/ui/lib/core/addon/mixins/list-controller.js b/ui/lib/core/addon/mixins/list-controller.js index ed5f39d8a2..1f25e40b1f 100644 --- a/ui/lib/core/addon/mixins/list-controller.js +++ b/ui/lib/core/addon/mixins/list-controller.js @@ -17,21 +17,21 @@ export default Mixin.create({ isLoading: false, filterMatchesKey: computed('filter', 'model', 'model.[]', function () { - let { filter, model: content } = this; + const { filter, model: content } = this; return !!(content.length && content.findBy('id', filter)); }), firstPartialMatch: computed('filter', 'model', 'model.[]', 'filterMatchesKey', function () { - let { filter, filterMatchesKey, model: content } = this; - let re = new RegExp('^' + escapeStringRegexp(filter)); - let matchSet = content.filter((key) => re.test(key.id)); - let match = matchSet[0]; + const { filter, filterMatchesKey, model: content } = this; + const re = new RegExp('^' + escapeStringRegexp(filter)); + const matchSet = content.filter((key) => re.test(key.id)); + const match = matchSet[0]; if (filterMatchesKey || !match) { return null; } - let sharedPrefix = commonPrefix(content); + const sharedPrefix = commonPrefix(content); // if we already are filtering the prefix, then next we want // the exact match if (filter === sharedPrefix || matchSet.length === 1) { diff --git a/ui/lib/core/addon/mixins/list-route.js b/ui/lib/core/addon/mixins/list-route.js index c489dc1efb..8f6bbc4280 100644 --- a/ui/lib/core/addon/mixins/list-route.js +++ b/ui/lib/core/addon/mixins/list-route.js @@ -11,7 +11,7 @@ export default Mixin.create({ }, setupController(controller, resolvedModel) { - let { pageFilter } = this.paramsFor(this.routeName); + const { pageFilter } = this.paramsFor(this.routeName); this._super(...arguments); controller.setProperties({ filter: pageFilter || '', diff --git a/ui/lib/core/addon/mixins/replication-actions.js b/ui/lib/core/addon/mixins/replication-actions.js index de5620ad1c..16c1a6e6fa 100644 --- a/ui/lib/core/addon/mixins/replication-actions.js +++ b/ui/lib/core/addon/mixins/replication-actions.js @@ -12,7 +12,7 @@ export default Mixin.create({ onDisable() {}, onPromote() {}, submitHandler: task(function* (action, clusterMode, data, event) { - let replicationMode = (data && data.replicationMode) || this.replicationMode; + const replicationMode = (data && data.replicationMode) || this.replicationMode; if (event && event.preventDefault) { event.preventDefault(); } diff --git a/ui/lib/core/addon/utils/client-count-utils.js b/ui/lib/core/addon/utils/client-count-utils.js index 877c9016fc..c4cf652855 100644 --- a/ui/lib/core/addon/utils/client-count-utils.js +++ b/ui/lib/core/addon/utils/client-count-utils.js @@ -8,11 +8,11 @@ export const formatByMonths = (monthsArray) => { const sortedPayload = sortMonthsByTimestamp(monthsArray); return sortedPayload?.map((m) => { const month = parseAPITimestamp(m.timestamp, 'M/yy'); - let totalClientsByNamespace = formatByNamespace(m.namespaces); - let newClientsByNamespace = formatByNamespace(m.new_clients?.namespaces); + const totalClientsByNamespace = formatByNamespace(m.namespaces); + const newClientsByNamespace = formatByNamespace(m.new_clients?.namespaces); if (Object.keys(m).includes('counts')) { - let totalCounts = flattenDataset(m); - let newCounts = m.new_clients ? flattenDataset(m.new_clients) : {}; + const totalCounts = flattenDataset(m); + const newCounts = m.new_clients ? flattenDataset(m.new_clients) : {}; return { month, ...totalCounts, @@ -33,8 +33,8 @@ export const formatByNamespace = (namespaceArray) => { return namespaceArray?.map((ns) => { // 'namespace_path' is an empty string for root if (ns['namespace_id'] === 'root') ns['namespace_path'] = 'root'; - let label = ns['namespace_path']; - let flattenedNs = flattenDataset(ns); + const label = ns['namespace_path']; + const flattenedNs = flattenDataset(ns); // if no mounts, mounts will be an empty array flattenedNs.mounts = []; if (ns?.mounts && ns.mounts.length > 0) { @@ -57,7 +57,7 @@ export const formatByNamespace = (namespaceArray) => { export const homogenizeClientNaming = (object) => { // if new key names exist, only return those key/value pairs if (Object.keys(object).includes('entity_clients')) { - let { clients, entity_clients, non_entity_clients } = object; + const { clients, entity_clients, non_entity_clients } = object; return { clients, entity_clients, @@ -66,7 +66,7 @@ export const homogenizeClientNaming = (object) => { } // if object only has outdated key names, update naming if (Object.keys(object).includes('distinct_entities')) { - let { clients, distinct_entities, non_entity_tokens } = object; + const { clients, distinct_entities, non_entity_tokens } = object; return { clients, entity_clients: distinct_entities, @@ -78,7 +78,7 @@ export const homogenizeClientNaming = (object) => { export const flattenDataset = (object) => { if (object?.counts) { - let flattenedObject = {}; + const flattenedObject = {}; Object.keys(object['counts']).forEach((key) => (flattenedObject[key] = object['counts'][key])); return homogenizeClientNaming(flattenedObject); } @@ -98,12 +98,12 @@ export const namespaceArrayToObject = (totalClientsByNamespace, newClientsByName // FIRST: iterate and nest respective 'new_clients' data within each namespace and mount object // note: this is happening within the month object const nestNewClientsWithinNamespace = totalClientsByNamespace?.map((ns) => { - let newNamespaceCounts = newClientsByNamespace?.find((n) => n.label === ns.label); + const newNamespaceCounts = newClientsByNamespace?.find((n) => n.label === ns.label); if (newNamespaceCounts) { - let { label, clients, entity_clients, non_entity_clients } = newNamespaceCounts; - let newClientsByMount = [...newNamespaceCounts?.mounts]; - let nestNewClientsWithinMounts = ns.mounts?.map((mount) => { - let new_clients = newClientsByMount?.find((m) => m.label === mount.label) || {}; + const { label, clients, entity_clients, non_entity_clients } = newNamespaceCounts; + const newClientsByMount = [...newNamespaceCounts?.mounts]; + const nestNewClientsWithinMounts = ns.mounts?.map((mount) => { + const new_clients = newClientsByMount?.find((m) => m.label === mount.label) || {}; return { ...mount, new_clients, @@ -126,10 +126,10 @@ export const namespaceArrayToObject = (totalClientsByNamespace, newClientsByName }; }); // SECOND: create a new object (namespace_by_key) in which each namespace label is a key - let namespaces_by_key = {}; + const namespaces_by_key = {}; nestNewClientsWithinNamespace?.forEach((namespaceObject) => { // THIRD: make another object within the namespace where each mount label is a key - let mounts_by_key = {}; + const mounts_by_key = {}; namespaceObject.mounts.forEach((mountObject) => { mounts_by_key[mountObject.label] = { month, @@ -138,7 +138,7 @@ export const namespaceArrayToObject = (totalClientsByNamespace, newClientsByName }; }); - let { label, clients, entity_clients, non_entity_clients, new_clients } = namespaceObject; + const { label, clients, entity_clients, non_entity_clients, new_clients } = namespaceObject; namespaces_by_key[label] = { month, clients, diff --git a/ui/lib/core/addon/utils/common-prefix.js b/ui/lib/core/addon/utils/common-prefix.js index c943a7cd30..888ee559e0 100644 --- a/ui/lib/core/addon/utils/common-prefix.js +++ b/ui/lib/core/addon/utils/common-prefix.js @@ -5,11 +5,11 @@ export default function (arr = [], attribute = 'id') { // this assumes an already sorted array // if the array is sorted, we want to compare the first and last // item in the array - if they share a prefix, all of the items do - let firstString = arr[0][attribute]; - let lastString = arr[arr.length - 1][attribute]; + const firstString = arr[0][attribute]; + const lastString = arr[arr.length - 1][attribute]; // the longest the shared prefix could be is the length of the match - let targetLength = firstString.length; + const targetLength = firstString.length; let prefixLength = 0; // walk the two strings, and if they match at the current length, // increment the prefixLength and try again diff --git a/ui/lib/core/addon/utils/date-formatters.js b/ui/lib/core/addon/utils/date-formatters.js index 25736d3f4f..f8a6bb9bfd 100644 --- a/ui/lib/core/addon/utils/date-formatters.js +++ b/ui/lib/core/addon/utils/date-formatters.js @@ -18,7 +18,7 @@ export const ARRAY_OF_MONTHS = [ // convert API timestamp ( '2021-03-21T00:00:00Z' ) to date object, optionally format export const parseAPITimestamp = (timestamp, style) => { if (typeof timestamp !== 'string') return; - let date = parseISO(timestamp.split('T')[0]); + const date = parseISO(timestamp.split('T')[0]); if (!style) return date; return format(date, style); }; @@ -30,14 +30,14 @@ export const parseRFC3339 = (timestamp) => { // return if already formatted correctly return timestamp; } - let date = parseAPITimestamp(timestamp); + const date = parseAPITimestamp(timestamp); return date ? [`${date.getFullYear()}`, date.getMonth()] : null; }; // convert M/yy (format of dates in charts) to 'Month yyyy' (format in tooltip) export function formatChartDate(date) { - let array = date.split('/'); + const array = date.split('/'); array.splice(1, 0, '01'); - let dateString = array.join('/'); + const dateString = array.join('/'); return format(new Date(dateString), 'MMMM yyyy'); } diff --git a/ui/lib/core/addon/utils/parse-url.js b/ui/lib/core/addon/utils/parse-url.js index 7289e696f9..9ccb28f19a 100644 --- a/ui/lib/core/addon/utils/parse-url.js +++ b/ui/lib/core/addon/utils/parse-url.js @@ -1,9 +1,9 @@ // adapted from https://gist.github.com/jed/964849 -let fn = (function (anchor) { +const fn = (function (anchor) { return function (url) { anchor.href = url; - let parts = {}; - for (let prop in anchor) { + const parts = {}; + for (const prop in anchor) { if ('' + anchor[prop] === anchor[prop]) { parts[prop] = anchor[prop]; } diff --git a/ui/lib/kmip/addon/routes/configure.js b/ui/lib/kmip/addon/routes/configure.js index 02395b88d2..2f229bfaed 100644 --- a/ui/lib/kmip/addon/routes/configure.js +++ b/ui/lib/kmip/addon/routes/configure.js @@ -11,7 +11,7 @@ export default Route.extend({ model() { return this.store.findRecord('kmip/config', this.secretMountPath.currentPath).catch((err) => { if (err.httpStatus === 404) { - let model = this.store.createRecord('kmip/config'); + const model = this.store.createRecord('kmip/config'); model.set('id', this.secretMountPath.currentPath); return model; } else { diff --git a/ui/lib/kmip/addon/routes/credentials/generate.js b/ui/lib/kmip/addon/routes/credentials/generate.js index 1dec607b66..3e2c6f8ebe 100644 --- a/ui/lib/kmip/addon/routes/credentials/generate.js +++ b/ui/lib/kmip/addon/routes/credentials/generate.js @@ -16,7 +16,7 @@ export default Route.extend({ setupController(controller) { this._super(...arguments); - let { scope_name: scope, role_name: role } = this.paramsFor('credentials'); + const { scope_name: scope, role_name: role } = this.paramsFor('credentials'); controller.setProperties({ role, scope }); }, }); diff --git a/ui/lib/kmip/addon/routes/credentials/index.js b/ui/lib/kmip/addon/routes/credentials/index.js index 6cb0b971ed..4efd38a6f6 100644 --- a/ui/lib/kmip/addon/routes/credentials/index.js +++ b/ui/lib/kmip/addon/routes/credentials/index.js @@ -6,14 +6,14 @@ export default Route.extend(ListRoute, { store: service(), secretMountPath: service(), credParams() { - let { role_name: role, scope_name: scope } = this.paramsFor('credentials'); + const { role_name: role, scope_name: scope } = this.paramsFor('credentials'); return { role, scope, }; }, model(params) { - let { role, scope } = this.credParams(); + const { role, scope } = this.credParams(); return this.store .lazyPaginatedQuery('kmip/credential', { role, @@ -33,7 +33,7 @@ export default Route.extend(ListRoute, { }, setupController(controller) { - let { role, scope } = this.credParams(); + const { role, scope } = this.credParams(); this._super(...arguments); controller.setProperties({ role, scope }); }, diff --git a/ui/lib/kmip/addon/routes/credentials/show.js b/ui/lib/kmip/addon/routes/credentials/show.js index 682543389e..bea180ff1e 100644 --- a/ui/lib/kmip/addon/routes/credentials/show.js +++ b/ui/lib/kmip/addon/routes/credentials/show.js @@ -5,14 +5,14 @@ export default Route.extend({ store: service(), secretMountPath: service(), credParams() { - let { role_name: role, scope_name: scope } = this.paramsFor('credentials'); + const { role_name: role, scope_name: scope } = this.paramsFor('credentials'); return { role, scope, }; }, model(params) { - let { role, scope } = this.credParams(); + const { role, scope } = this.credParams(); return this.store.queryRecord('kmip/credential', { role, scope, @@ -22,7 +22,7 @@ export default Route.extend({ }, setupController(controller) { - let { role, scope } = this.credParams(); + const { role, scope } = this.credParams(); this._super(...arguments); controller.setProperties({ role, scope }); }, diff --git a/ui/lib/kmip/addon/routes/role.js b/ui/lib/kmip/addon/routes/role.js index c9155e006c..004dc1abe2 100644 --- a/ui/lib/kmip/addon/routes/role.js +++ b/ui/lib/kmip/addon/routes/role.js @@ -20,7 +20,7 @@ export default class KmipRoleRoute extends Route { setupController(controller) { super.setupController(...arguments); - let { scope_name: scope, role_name: role } = this.paramsFor('role'); + const { scope_name: scope, role_name: role } = this.paramsFor('role'); controller.setProperties({ role, scope }); } } diff --git a/ui/lib/kmip/addon/routes/role/edit.js b/ui/lib/kmip/addon/routes/role/edit.js index bede947e22..fddb9f7a55 100644 --- a/ui/lib/kmip/addon/routes/role/edit.js +++ b/ui/lib/kmip/addon/routes/role/edit.js @@ -19,7 +19,7 @@ export default Route.extend({ setupController(controller) { this._super(...arguments); - let { scope_name: scope, role_name: role } = this.paramsFor(this.routeName); + const { scope_name: scope, role_name: role } = this.paramsFor(this.routeName); controller.setProperties({ role, scope }); }, }); diff --git a/ui/lib/kmip/addon/routes/scope/roles/create.js b/ui/lib/kmip/addon/routes/scope/roles/create.js index 467dcf1523..d190c43c49 100644 --- a/ui/lib/kmip/addon/routes/scope/roles/create.js +++ b/ui/lib/kmip/addon/routes/scope/roles/create.js @@ -13,7 +13,7 @@ export default Route.extend({ return this.pathHelp.getNewModel('kmip/role', this.secretMountPath.currentPath); }, model() { - let model = this.store.createRecord('kmip/role', { + const model = this.store.createRecord('kmip/role', { backend: this.secretMountPath.currentPath, scope: this.scope(), }); diff --git a/ui/lib/kmip/addon/routes/scopes/create.js b/ui/lib/kmip/addon/routes/scopes/create.js index 5f46aefa8f..59eb83d6ca 100644 --- a/ui/lib/kmip/addon/routes/scopes/create.js +++ b/ui/lib/kmip/addon/routes/scopes/create.js @@ -8,7 +8,7 @@ export default Route.extend({ this.store.unloadAll('kmip/scope'); }, model() { - let model = this.store.createRecord('kmip/scope', { + const model = this.store.createRecord('kmip/scope', { backend: this.secretMountPath.currentPath, }); return model; diff --git a/ui/lib/kmip/config/environment.js b/ui/lib/kmip/config/environment.js index 5a667362d2..0937f3739f 100644 --- a/ui/lib/kmip/config/environment.js +++ b/ui/lib/kmip/config/environment.js @@ -2,7 +2,7 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'kmip', environment, }; diff --git a/ui/lib/open-api-explorer/addon/components/swagger-ui.js b/ui/lib/open-api-explorer/addon/components/swagger-ui.js index 6404410a57..47567627f5 100644 --- a/ui/lib/open-api-explorer/addon/components/swagger-ui.js +++ b/ui/lib/open-api-explorer/addon/components/swagger-ui.js @@ -13,7 +13,7 @@ const SearchFilterPlugin = () => { return ( taggedOps .map((tagObj) => { - let operations = tagObj.get('operations').filter((operationObj) => { + const operations = tagObj.get('operations').filter((operationObj) => { return operationObj.get('path').includes(phrase); }); return tagObj.set('operations', operations); @@ -47,14 +47,14 @@ const CONFIG = (SwaggerUIBundle, componentInstance, initialFilter) => { // and namepace headers for things to work properly req.headers['X-Vault-Token'] = componentInstance.auth.currentToken; - let namespace = componentInstance.namespaceService.path; + const namespace = componentInstance.namespaceService.path; if (namespace && !APP.NAMESPACE_ROOT_URLS.some((str) => req.url.includes(str))) { req.headers['X-Vault-Namespace'] = namespace; } // we want to link to the right JSON in swagger UI so // it's already been pre-pended if (!req.loadSpec) { - let { protocol, host, pathname } = parseURL(req.url); + const { protocol, host, pathname } = parseURL(req.url); //paths in the spec don't have /v1 in them, so we need to add that here // http(s): vlt.io:4200 /sys/mounts req.url = `${protocol}//${host}/v1${pathname}`; @@ -78,7 +78,7 @@ export default Component.extend({ const { default: SwaggerUIBundle } = await import('swagger-ui-dist/swagger-ui-bundle.js'); this._super(...arguments); // trim any initial slashes - let initialFilter = this.initialFilter.replace(/^(\/)+/, ''); + const initialFilter = this.initialFilter.replace(/^(\/)+/, ''); SwaggerUIBundle(CONFIG(SwaggerUIBundle, this, initialFilter)); }, @@ -88,14 +88,14 @@ export default Component.extend({ this.onFilterChange(e.target.value || ''); }, proxyEvent(e) { - let swaggerInput = this.element.querySelector('.operation-filter-input'); + const swaggerInput = this.element.querySelector('.operation-filter-input'); // if this breaks because of a react upgrade, // change this to //let originalSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set; //originalSetter.call(swaggerInput, e.target.value); // see post on triggering react events externally for an explanation of // why this works: https://stackoverflow.com/a/46012210 - let evt = new Event('input', { bubbles: true }); + const evt = new Event('input', { bubbles: true }); evt.simulated = true; swaggerInput.value = e.target.value.replace(/^(\/)+/, ''); swaggerInput.dispatchEvent(evt); diff --git a/ui/lib/open-api-explorer/addon/routes/index.js b/ui/lib/open-api-explorer/addon/routes/index.js index fef65b0eae..277ae87c30 100644 --- a/ui/lib/open-api-explorer/addon/routes/index.js +++ b/ui/lib/open-api-explorer/addon/routes/index.js @@ -7,7 +7,7 @@ export default Route.extend({ // query params, so here we're no-op'ing the model hook model() {}, afterModel() { - let warning = `The "Try it out" functionality in this API explorer will make requests to this Vault server on your behalf. + const warning = `The "Try it out" functionality in this API explorer will make requests to this Vault server on your behalf. IF YOUR TOKEN HAS THE PROPER CAPABILITIES, THIS WILL CREATE AND DELETE ITEMS ON THE VAULT SERVER. diff --git a/ui/lib/open-api-explorer/config/environment.js b/ui/lib/open-api-explorer/config/environment.js index 4a78890a89..3504ee5166 100644 --- a/ui/lib/open-api-explorer/config/environment.js +++ b/ui/lib/open-api-explorer/config/environment.js @@ -2,7 +2,7 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'open-api-explorer', environment, APP: { diff --git a/ui/lib/pki/addon/components/pki-key-usage.js b/ui/lib/pki/addon/components/pki-key-usage.js index 7281fa8e50..d9ed68e0df 100644 --- a/ui/lib/pki/addon/components/pki-key-usage.js +++ b/ui/lib/pki/addon/components/pki-key-usage.js @@ -65,8 +65,8 @@ export default class PkiKeyUsage extends Component { } _amendList(checkboxName, value, type) { - let keyUsageList = this.args.model.keyUsage; - let extKeyUsageList = this.args.model.extKeyUsage; + const keyUsageList = this.args.model.keyUsage; + const extKeyUsageList = this.args.model.extKeyUsage; /* Process: 1. We first check if the checkbox change is coming from the checkbox options of key_usage or ext_key_usage. @@ -75,12 +75,12 @@ export default class PkiKeyUsage extends Component { 3. Then if the value of checkbox is "true" we add it to the arrayList, otherwise remove it. */ if (type === 'keyUsage') { - let keyUsageListArray = Array.isArray(keyUsageList) ? keyUsageList : keyUsageList.split(','); + const keyUsageListArray = Array.isArray(keyUsageList) ? keyUsageList : keyUsageList.split(','); return value ? keyUsageListArray.addObject(checkboxName) : keyUsageListArray.removeObject(checkboxName); } else { // because there is no default on init for ext_key_usage property (set normally by OpenAPI) we define it as an empty array if it is undefined. - let extKeyUsageListArray = !extKeyUsageList ? [] : extKeyUsageList; + const extKeyUsageListArray = !extKeyUsageList ? [] : extKeyUsageList; return value ? extKeyUsageListArray.addObject(checkboxName) diff --git a/ui/lib/pki/config/environment.js b/ui/lib/pki/config/environment.js index 9d47f12d12..c5c80e6479 100644 --- a/ui/lib/pki/config/environment.js +++ b/ui/lib/pki/config/environment.js @@ -2,7 +2,7 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'pki', environment, }; diff --git a/ui/lib/replication/addon/components/path-filter-config-list.js b/ui/lib/replication/addon/components/path-filter-config-list.js index 753447b00e..c7c54a0bde 100644 --- a/ui/lib/replication/addon/components/path-filter-config-list.js +++ b/ui/lib/replication/addon/components/path-filter-config-list.js @@ -25,15 +25,15 @@ export default Component.extend({ }, fetchMountsForNamespace: task(function* (ns) { - let adapter = this.store.adapterFor('application'); - let secret = []; - let auth = []; - let mounts = ns + const adapter = this.store.adapterFor('application'); + const secret = []; + const auth = []; + const mounts = ns ? yield adapter.ajax('/v1/sys/internal/ui/mounts', 'GET', { namespace: ns }) : yield adapter.ajax('/v1/sys/internal/ui/mounts', 'GET'); ['secret', 'auth'].forEach((key) => { - for (let [id, info] of Object.entries(mounts.data[key])) { + for (const [id, info] of Object.entries(mounts.data[key])) { let longId; if (key === 'auth') { longId = ns ? `${ns}/auth/${id}` : `auth/${id}`; @@ -59,10 +59,10 @@ export default Component.extend({ }), filterOptions(list, term) { - let paths = this.config.paths; + const paths = this.config.paths; return list .map(({ groupName, options }) => { - let trimmedOptions = options.filter((op) => { + const trimmedOptions = options.filter((op) => { if (term) { return op.searchText.includes(term) && !paths.includes(op.id); } @@ -74,23 +74,23 @@ export default Component.extend({ }, setAutoCompleteOptions: task(function* (term) { - let { namespaces, lastOptions } = this; - let namespaceToFetch = namespaces.find((ns) => ns === term); + const { namespaces, lastOptions } = this; + const namespaceToFetch = namespaces.find((ns) => ns === term); let secretList = []; let authList = []; - let options = []; + const options = []; if (term) { yield timeout(200); } if (!term || (term && namespaceToFetch)) { // fetch auth and secret methods from sys/internal/ui/mounts for the given namespace - let result = yield this.fetchMountsForNamespace.perform(namespaceToFetch); + const result = yield this.fetchMountsForNamespace.perform(namespaceToFetch); secretList = result.secret; authList = result.auth; } var currentSecrets = lastOptions && lastOptions.findBy('groupName', 'Secret Engines'); var currentAuths = lastOptions && lastOptions.findBy('groupName', 'Auth Methods'); - let formattedNamespaces = namespaces.map((val) => { + const formattedNamespaces = namespaces.map((val) => { return { id: val, name: val, @@ -99,13 +99,13 @@ export default Component.extend({ }); options.push({ groupName: 'Namespaces', options: formattedNamespaces }); - let secretOptions = currentSecrets ? [...currentSecrets.options, ...secretList] : secretList; + const secretOptions = currentSecrets ? [...currentSecrets.options, ...secretList] : secretList; options.push({ groupName: 'Secret Engines', options: secretOptions.uniqBy('id') }); - let authOptions = currentAuths ? [...currentAuths.options, ...authList] : authList; + const authOptions = currentAuths ? [...currentAuths.options, ...authList] : authList; options.push({ groupName: 'Auth Methods', options: authOptions.uniqBy('id') }); - let filtered = term ? this.filterOptions(options, term) : this.filterOptions(options); + const filtered = term ? this.filterOptions(options, term) : this.filterOptions(options); if (!term) { this.set('autoCompleteOptions', filtered); } @@ -136,7 +136,7 @@ export default Component.extend({ } if (paths.length) { // remove the selected item from the default list of options - let filtered = this.filterOptions(this.autoCompleteOptions); + const filtered = this.filterOptions(this.autoCompleteOptions); this.set('autoCompleteOptions', filtered); } else { // if there's no paths, we need to re-fetch like on init diff --git a/ui/lib/replication/addon/controllers/mode/secondaries/config-edit.js b/ui/lib/replication/addon/controllers/mode/secondaries/config-edit.js index a6dc615cf9..fa5b4b39ae 100644 --- a/ui/lib/replication/addon/controllers/mode/secondaries/config-edit.js +++ b/ui/lib/replication/addon/controllers/mode/secondaries/config-edit.js @@ -20,7 +20,7 @@ export default Controller.extend({ saveConfig(config) { // if the mode is null, we want no filtering, so we should delete any existing config - let isDelete = config.mode === null; + const isDelete = config.mode === null; const flash = this.flashMessages; const id = config.id; const redirectArgs = isDelete diff --git a/ui/lib/replication/addon/routes/mode/secondaries/config-edit.js b/ui/lib/replication/addon/routes/mode/secondaries/config-edit.js index c0c38d85b0..b84f477264 100644 --- a/ui/lib/replication/addon/routes/mode/secondaries/config-edit.js +++ b/ui/lib/replication/addon/routes/mode/secondaries/config-edit.js @@ -13,7 +13,7 @@ export default Base.extend({ redirect(model) { const cluster = model.cluster; - let replicationMode = this.paramsFor('mode').replication_mode; + const replicationMode = this.paramsFor('mode').replication_mode; if ( !this.version.hasPerfReplication || replicationMode !== 'performance' || diff --git a/ui/lib/replication/config/environment.js b/ui/lib/replication/config/environment.js index 5b306f803d..32b7bfaf9f 100644 --- a/ui/lib/replication/config/environment.js +++ b/ui/lib/replication/config/environment.js @@ -2,7 +2,7 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'replication', environment, }; diff --git a/ui/lib/service-worker-authenticated-download/service-worker/index.js b/ui/lib/service-worker-authenticated-download/service-worker/index.js index 5e180c6b76..d4df8abb6b 100644 --- a/ui/lib/service-worker-authenticated-download/service-worker/index.js +++ b/ui/lib/service-worker-authenticated-download/service-worker/index.js @@ -23,7 +23,7 @@ function sendMessage(message) { function authenticateRequest(request) { // copy the reaquest headers so we can mutate them - let headers = new Headers(request.headers); + const headers = new Headers(request.headers); // get and set vault token so the request is authenticated return sendMessage({ action: 'getToken' }).then(function (token) { diff --git a/ui/mirage/handlers/clients.js b/ui/mirage/handlers/clients.js index ebb6009c55..a4fbc5c9bb 100644 --- a/ui/mirage/handlers/clients.js +++ b/ui/mirage/handlers/clients.js @@ -2792,8 +2792,8 @@ const MOCK_MONTHLY_DATA = [ ]; function generateNullMonths(startDate, endDate) { - let numberOfMonths = differenceInCalendarMonths(endDate, startDate); - let months = []; + const numberOfMonths = differenceInCalendarMonths(endDate, startDate); + const months = []; for (let i = 0; i < numberOfMonths; i++) { months.push({ timestamp: formatRFC3339(startOfMonth(addMonths(startDate, i))), @@ -2812,13 +2812,13 @@ const handleMockQuery = (queryStartTimestamp, queryEndTimestamp, monthlyData) => // monthlyData is oldest to newest const dataEarliestMonth = parseAPITimestamp(monthlyData[0].timestamp); const dataLatestMonth = parseAPITimestamp(monthlyData[monthlyData.length - 1].timestamp); - let transformedMonthlyArray = [...monthlyData]; + const transformedMonthlyArray = [...monthlyData]; // If query end is before last month in array, return only through end query if (isBefore(queryEndDate, dataLatestMonth)) { - let indexQueryStart = monthlyData.findIndex((e) => + const indexQueryStart = monthlyData.findIndex((e) => isSameMonth(queryStartDate, parseAPITimestamp(e.timestamp)) ); - let indexQueryEnd = monthlyData.findIndex((e) => + const indexQueryEnd = monthlyData.findIndex((e) => isSameMonth(queryEndDate, parseAPITimestamp(e.timestamp)) ); return transformedMonthlyArray.slice(indexQueryStart, indexQueryEnd + 1); @@ -2829,7 +2829,7 @@ const handleMockQuery = (queryStartTimestamp, queryEndTimestamp, monthlyData) => } // If query is after earliest month in array, return latest to month that matches query if (isAfter(queryStartDate, dataEarliestMonth)) { - let index = monthlyData.findIndex((e) => isSameMonth(queryStartDate, parseAPITimestamp(e.timestamp))); + const index = monthlyData.findIndex((e) => isSameMonth(queryStartDate, parseAPITimestamp(e.timestamp))); return transformedMonthlyArray.slice(index); } return transformedMonthlyArray; diff --git a/ui/mirage/handlers/kms.js b/ui/mirage/handlers/kms.js index 5bad5ede7a..10850ffd53 100644 --- a/ui/mirage/handlers/kms.js +++ b/ui/mirage/handlers/kms.js @@ -8,7 +8,7 @@ export default function (server) { }); server.get('keymgmt/key/:name', function (_, request) { - let name = request.params.name; + const name = request.params.name; return { data: { name, diff --git a/ui/mirage/handlers/mfa-config.js b/ui/mirage/handlers/mfa-config.js index 944e4429ce..b6a6626eb7 100644 --- a/ui/mirage/handlers/mfa-config.js +++ b/ui/mirage/handlers/mfa-config.js @@ -139,7 +139,7 @@ export default function (server) { 'identity_entity_ids', ]; let hasRequired = false; - for (let key of required) { + for (const key of required) { if (data[key]?.length) { hasRequired = true; break; diff --git a/ui/mirage/handlers/mfa-login.js b/ui/mirage/handlers/mfa-login.js index b17319e2e6..61dd66bb99 100644 --- a/ui/mirage/handlers/mfa-login.js +++ b/ui/mirage/handlers/mfa-login.js @@ -18,7 +18,7 @@ export const validationHandler = (schema, req) => { return new Response(404, {}, { errors: ['MFA Request ID not found'] }); } // validate request body - for (let constraintId in mfa_payload) { + for (const constraintId in mfa_payload) { // ensure ids were passed in map const method = mfaRequest.methods.find(({ id }) => id === constraintId); if (!method) { diff --git a/ui/scripts/start-vault.js b/ui/scripts/start-vault.js index 270bc46a22..d5ad78e496 100755 --- a/ui/scripts/start-vault.js +++ b/ui/scripts/start-vault.js @@ -21,7 +21,7 @@ async function processLines(input, eachLine = () => {}) { (async function () { try { - let vault = testHelper.run( + const vault = testHelper.run( 'vault', [ 'server', diff --git a/ui/scripts/test-helper.js b/ui/scripts/test-helper.js index b125ddcf10..e5bb846349 100644 --- a/ui/scripts/test-helper.js +++ b/ui/scripts/test-helper.js @@ -17,7 +17,7 @@ function writeKeysFile(unsealKeys, rootToken, filePath) { if (filePath === undefined) { filePath = path.join(process.cwd(), 'tests/helpers/vault-keys.js'); } - let keys = {}; + const keys = {}; keys.unsealKeys = unsealKeys; keys.rootToken = rootToken; @@ -42,7 +42,7 @@ function run(command, args = [], shareStd = true) { if (shareStd) { return execa(command, args, { cleanup: true, stdin: 'inherit', stdout: 'inherit', stderr: 'inherit' }); } - let p = execa(command, args, { cleanup: true }); + const p = execa(command, args, { cleanup: true }); p.stdout.pipe(process.stdout); p.stderr.pipe(process.stderr); return p; diff --git a/ui/tests/acceptance/access/identity/_shared-alias-tests.js b/ui/tests/acceptance/access/identity/_shared-alias-tests.js index 842491ee31..64b6ac702b 100644 --- a/ui/tests/acceptance/access/identity/_shared-alias-tests.js +++ b/ui/tests/acceptance/access/identity/_shared-alias-tests.js @@ -6,9 +6,6 @@ import createItemPage from 'vault/tests/pages/access/identity/create'; import showItemPage from 'vault/tests/pages/access/identity/show'; export const testAliasCRUD = async function (name, itemType, assert) { - let itemID; - let aliasID; - let idRow; if (itemType === 'groups') { await createItemPage.createItem(itemType, 'external'); await settled(); @@ -16,8 +13,8 @@ export const testAliasCRUD = async function (name, itemType, assert) { await createItemPage.createItem(itemType); await settled(); } - idRow = showItemPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; - itemID = idRow.rowValue; + let idRow = showItemPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; + const itemID = idRow.rowValue; await page.visit({ item_type: itemType, id: itemID }); await settled(); await page.editForm.name(name).submit(); @@ -28,7 +25,7 @@ export const testAliasCRUD = async function (name, itemType, assert) { ); idRow = aliasShowPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; - aliasID = idRow.rowValue; + const aliasID = idRow.rowValue; assert.strictEqual( currentRouteName(), 'vault.cluster.access.identity.aliases.show', @@ -44,7 +41,7 @@ export const testAliasCRUD = async function (name, itemType, assert) { `${itemType}: lists the entity in the entity list` ); - let item = aliasIndexPage.items.filterBy('name', name)[0]; + const item = aliasIndexPage.items.filterBy('name', name)[0]; await item.menu(); await settled(); await aliasIndexPage.delete(); @@ -64,9 +61,6 @@ export const testAliasCRUD = async function (name, itemType, assert) { }; export const testAliasDeleteFromForm = async function (name, itemType, assert) { - let itemID; - let aliasID; - let idRow; if (itemType === 'groups') { await createItemPage.createItem(itemType, 'external'); await settled(); @@ -74,14 +68,14 @@ export const testAliasDeleteFromForm = async function (name, itemType, assert) { await createItemPage.createItem(itemType); await settled(); } - idRow = showItemPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; - itemID = idRow.rowValue; + let idRow = showItemPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; + const itemID = idRow.rowValue; await page.visit({ item_type: itemType, id: itemID }); await settled(); await page.editForm.name(name).submit(); await settled(); idRow = aliasShowPage.rows.filterBy('hasLabel').filterBy('rowLabel', 'ID')[0]; - aliasID = idRow.rowValue; + const aliasID = idRow.rowValue; await aliasShowPage.edit(); await settled(); assert.strictEqual( diff --git a/ui/tests/acceptance/access/identity/entities/aliases/create-test.js b/ui/tests/acceptance/access/identity/entities/aliases/create-test.js index 4c513ec8c3..bea4555eb4 100644 --- a/ui/tests/acceptance/access/identity/entities/aliases/create-test.js +++ b/ui/tests/acceptance/access/identity/entities/aliases/create-test.js @@ -14,14 +14,14 @@ module('Acceptance | /access/identity/entities/aliases/add', function (hooks) { test('it allows create, list, delete of an entity alias', async function (assert) { assert.expect(6); - let name = `alias-${Date.now()}`; + const name = `alias-${Date.now()}`; await testAliasCRUD(name, 'entities', assert); await settled(); }); test('it allows delete from the edit form', async function (assert) { assert.expect(4); - let name = `alias-${Date.now()}`; + const name = `alias-${Date.now()}`; await testAliasDeleteFromForm(name, 'entities', assert); await settled(); }); diff --git a/ui/tests/acceptance/access/identity/entities/create-test.js b/ui/tests/acceptance/access/identity/entities/create-test.js index c12da48203..85c3657fc4 100644 --- a/ui/tests/acceptance/access/identity/entities/create-test.js +++ b/ui/tests/acceptance/access/identity/entities/create-test.js @@ -23,13 +23,13 @@ module('Acceptance | /access/identity/entities/create', function (hooks) { test('it allows create, list, delete of an entity', async function (assert) { assert.expect(6); - let name = `entity-${Date.now()}`; + const name = `entity-${Date.now()}`; await testCRUD(name, 'entities', assert); }); test('it can be deleted from the edit form', async function (assert) { assert.expect(6); - let name = `entity-${Date.now()}`; + const name = `entity-${Date.now()}`; await testDeleteFromForm(name, 'entities', assert); }); }); diff --git a/ui/tests/acceptance/access/identity/groups/aliases/create-test.js b/ui/tests/acceptance/access/identity/groups/aliases/create-test.js index 6ea9c352ba..202dace261 100644 --- a/ui/tests/acceptance/access/identity/groups/aliases/create-test.js +++ b/ui/tests/acceptance/access/identity/groups/aliases/create-test.js @@ -14,7 +14,7 @@ module('Acceptance | /access/identity/groups/aliases/add', function (hooks) { test('it allows create, list, delete of an entity alias', async function (assert) { // TODO figure out what is wrong with this test assert.expect(6); - let name = `alias-${Date.now()}`; + const name = `alias-${Date.now()}`; await testAliasCRUD(name, 'groups', assert); await settled(); }); @@ -22,7 +22,7 @@ module('Acceptance | /access/identity/groups/aliases/add', function (hooks) { test('it allows delete from the edit form', async function (assert) { // TODO figure out what is wrong with this test assert.expect(4); - let name = `alias-${Date.now()}`; + const name = `alias-${Date.now()}`; await testAliasDeleteFromForm(name, 'groups', assert); await settled(); }); diff --git a/ui/tests/acceptance/access/identity/groups/create-test.js b/ui/tests/acceptance/access/identity/groups/create-test.js index 383800a26a..07506e7907 100644 --- a/ui/tests/acceptance/access/identity/groups/create-test.js +++ b/ui/tests/acceptance/access/identity/groups/create-test.js @@ -23,13 +23,13 @@ module('Acceptance | /access/identity/groups/create', function (hooks) { test('it allows create, list, delete of an group', async function (assert) { assert.expect(6); - let name = `group-${Date.now()}`; + const name = `group-${Date.now()}`; await testCRUD(name, 'groups', assert); }); test('it can be deleted from the group edit form', async function (assert) { assert.expect(6); - let name = `group-${Date.now()}`; + const name = `group-${Date.now()}`; await testDeleteFromForm(name, 'groups', assert); }); }); diff --git a/ui/tests/acceptance/auth-list-test.js b/ui/tests/acceptance/auth-list-test.js index 0244e2f5a7..e2cddb3863 100644 --- a/ui/tests/acceptance/auth-list-test.js +++ b/ui/tests/acceptance/auth-list-test.js @@ -72,8 +72,8 @@ module('Acceptance | auth backend list', function (hooks) { await triggerKeyEvent('[data-test-textarea]', 'keyup', 65); // test for modified helpText on generated token policies await click('[data-test-toggle-group="Tokens"]'); - let policyFormField = document.querySelector('[data-test-input="tokenPolicies"]'); - let tooltipTrigger = policyFormField.querySelector('[data-test-tool-tip-trigger]'); + const policyFormField = document.querySelector('[data-test-input="tokenPolicies"]'); + const tooltipTrigger = policyFormField.querySelector('[data-test-tool-tip-trigger]'); await triggerEvent(tooltipTrigger, 'mouseenter'); assert .dom('[data-test-info-tooltip-content]') @@ -102,11 +102,11 @@ module('Acceptance | auth backend list', function (hooks) { await visit('/vault/access'); - let supportManaged = supportedManagedAuthBackends(); - let backends = supportedAuthBackends(); + const supportManaged = supportedManagedAuthBackends(); + const backends = supportedAuthBackends(); - for (let backend of backends) { - let { type } = backend; + for (const backend of backends) { + const { type } = backend; if (type !== 'token') { await enablePage.enable(type, type); diff --git a/ui/tests/acceptance/auth-test.js b/ui/tests/acceptance/auth-test.js index 9c60fbe1f0..1228a797b9 100644 --- a/ui/tests/acceptance/auth-test.js +++ b/ui/tests/acceptance/auth-test.js @@ -35,11 +35,11 @@ module('Acceptance | auth', function (hooks) { }); test('auth query params', async function (assert) { - let backends = supportedAuthBackends(); + const backends = supportedAuthBackends(); assert.expect(backends.length + 1); await visit('/vault/auth'); assert.strictEqual(currentURL(), '/vault/auth?with=token'); - for (let backend of backends.reverse()) { + for (const backend of backends.reverse()) { await component.selectMethod(backend.type); assert.strictEqual( currentURL(), @@ -59,9 +59,9 @@ module('Acceptance | auth', function (hooks) { test('it sends the right attributes when authenticating', async function (assert) { assert.expect(8); - let backends = supportedAuthBackends(); + const backends = supportedAuthBackends(); await visit('/vault/auth'); - for (let backend of backends.reverse()) { + for (const backend of backends.reverse()) { await component.selectMethod(backend.type); if (backend.type === 'github') { await component.token('token'); @@ -70,7 +70,7 @@ module('Acceptance | auth', function (hooks) { await jwtComponent.role('test'); } await component.login(); - let lastRequest = this.server.passthroughRequests[this.server.passthroughRequests.length - 1]; + const lastRequest = this.server.passthroughRequests[this.server.passthroughRequests.length - 1]; let body = JSON.parse(lastRequest.requestBody); // Note: x-vault-token used to be lowercase prior to upgrade if (backend.type === 'token') { @@ -81,7 +81,7 @@ module('Acceptance | auth', function (hooks) { } else if (backend.type === 'github') { assert.ok(Object.keys(body).includes('token'), 'GitHub includes token'); } else if (backend.type === 'jwt' || backend.type === 'oidc') { - let authReq = this.server.passthroughRequests[this.server.passthroughRequests.length - 2]; + const authReq = this.server.passthroughRequests[this.server.passthroughRequests.length - 2]; body = JSON.parse(authReq.requestBody); assert.ok(Object.keys(body).includes('role'), `${backend.type} includes role`); } else { @@ -91,13 +91,13 @@ module('Acceptance | auth', function (hooks) { }); test('it shows the token warning beacon on the menu', async function (assert) { - let authService = this.owner.lookup('service:auth'); + const authService = this.owner.lookup('service:auth'); await authPage.login(); await settled(); await consoleComponent.runCommands([ 'write -field=client_token auth/token/create policies=default ttl=1h', ]); - let token = consoleComponent.lastTextOutput; + const token = consoleComponent.lastTextOutput; await logout.visit(); await settled(); await authPage.login(token); diff --git a/ui/tests/acceptance/client-history-test.js b/ui/tests/acceptance/client-history-test.js index e18f329199..cb575bb91e 100644 --- a/ui/tests/acceptance/client-history-test.js +++ b/ui/tests/acceptance/client-history-test.js @@ -210,7 +210,7 @@ module('Acceptance | clients history tab', function (hooks) { 3, `line chart plots 3 points to match query` ); - let xAxisLabels = findAll('[data-test-line-chart="x-axis-labels"] g.tick text'); + const xAxisLabels = findAll('[data-test-line-chart="x-axis-labels"] g.tick text'); assert .dom(xAxisLabels[xAxisLabels.length - 1]) .hasText(`${format(subMonths(LAST_MONTH, 2), 'M/yy')}`, 'x-axis labels end with queried end month'); diff --git a/ui/tests/acceptance/cluster-test.js b/ui/tests/acceptance/cluster-test.js index 7180b175e4..bca59ffe3c 100644 --- a/ui/tests/acceptance/cluster-test.js +++ b/ui/tests/acceptance/cluster-test.js @@ -27,7 +27,7 @@ const authAccessor = async function (path) { }; const setupUser = async function () { - let authMethodPath = `userpass-${new Date().getTime()}`; + const authMethodPath = `userpass-${new Date().getTime()}`; await authAccessor(authMethodPath); }; diff --git a/ui/tests/acceptance/console-test.js b/ui/tests/acceptance/console-test.js index 6f64a1888f..684a90aa94 100644 --- a/ui/tests/acceptance/console-test.js +++ b/ui/tests/acceptance/console-test.js @@ -18,12 +18,12 @@ module('Acceptance | console', function (hooks) { test("refresh reloads the current route's data", async function (assert) { await enginesPage.visit(); await settled(); - let numEngines = enginesPage.rows.length; + const numEngines = enginesPage.rows.length; await consoleComponent.toggle(); await settled(); - let now = Date.now(); - for (let num of [1, 2, 3]) { - let inputString = `write sys/mounts/${now + num} type=kv`; + const now = Date.now(); + for (const num of [1, 2, 3]) { + const inputString = `write sys/mounts/${now + num} type=kv`; await consoleComponent.runCommands(inputString); await settled(); } @@ -76,7 +76,7 @@ module('Acceptance | console', function (hooks) { await settled(); await consoleComponent.runCommands('read -field=orphan /auth/token/lookup-self'); await settled(); - let consoleOut = document.querySelector('.console-ui-output>pre'); + const consoleOut = document.querySelector('.console-ui-output>pre'); // have to wrap in a later so that we can wait for the CSS transition to finish await waitUntil(() => consoleOut.innerText); assert.strictEqual(consoleOut.innerText.match(/^(true|false)$/g).length, 1); diff --git a/ui/tests/acceptance/enterprise-control-groups-test.js b/ui/tests/acceptance/enterprise-control-groups-test.js index 6c8fdb39e1..fccafad8d7 100644 --- a/ui/tests/acceptance/enterprise-control-groups-test.js +++ b/ui/tests/acceptance/enterprise-control-groups-test.js @@ -69,7 +69,6 @@ module('Acceptance | Enterprise | control groups', function (hooks) { const ADMIN_USER = 'authorizer'; const ADMIN_PASSWORD = 'test'; const setupControlGroup = async (context) => { - let userpassAccessor; await visit('/vault/secrets'); await consoleComponent.toggle(); await settled(); @@ -89,14 +88,14 @@ module('Acceptance | Enterprise | control groups', function (hooks) { 'read -field=accessor sys/internal/ui/mounts/auth/userpass', ]); await settled(); - userpassAccessor = consoleComponent.lastTextOutput; + const userpassAccessor = consoleComponent.lastTextOutput; await consoleComponent.runCommands([ // lookup entity id for our authorizer `write -field=id identity/lookup/entity name=${ADMIN_USER}`, ]); await settled(); - let authorizerEntityId = consoleComponent.lastTextOutput; + const authorizerEntityId = consoleComponent.lastTextOutput; await consoleComponent.runCommands([ // create alias for authorizor and add them to the managers group `write identity/alias mount_accessor=${userpassAccessor} entity_id=${authorizerEntityId} name=${ADMIN_USER}`, @@ -136,17 +135,15 @@ module('Acceptance | Enterprise | control groups', function (hooks) { }); const workflow = async (assert, context, shouldStoreToken) => { - let controlGroupToken; - let accessor; - let url = '/vault/secrets/kv/show/foo'; + const url = '/vault/secrets/kv/show/foo'; await setupControlGroup(context); await settled(); // as the requestor, go to the URL that's blocked by the control group // and store the values await visit(url); - accessor = controlGroupComponent.accessor; - controlGroupToken = controlGroupComponent.token; + const accessor = controlGroupComponent.accessor; + const controlGroupToken = controlGroupComponent.token; await authPage.logout(); await settled(); // log in as the admin, navigate to the accessor page, @@ -217,7 +214,7 @@ module('Acceptance | Enterprise | control groups', function (hooks) { await settled(); await consoleComponent.runCommands('read kv/foo'); await settled(); - let output = consoleComponent.lastLogOutput; + const output = consoleComponent.lastLogOutput; assert.ok(output.includes('A Control Group was encountered at kv/foo')); assert.ok(output.includes('The Control Group Token is')); assert.ok(output.includes('The Accessor is')); diff --git a/ui/tests/acceptance/enterprise-kmip-test.js b/ui/tests/acceptance/enterprise-kmip-test.js index a8d88cff70..ea794d98ff 100644 --- a/ui/tests/acceptance/enterprise-kmip-test.js +++ b/ui/tests/acceptance/enterprise-kmip-test.js @@ -20,15 +20,15 @@ const getRandomPort = () => { const mount = async (shouldConfig = true) => { const now = Date.now(); - let path = `kmip-${now}`; - let addr = `127.0.0.1:${getRandomPort()}`; // use random port + const path = `kmip-${now}`; + const addr = `127.0.0.1:${getRandomPort()}`; // use random port await settled(); - let commands = shouldConfig + const commands = shouldConfig ? [`write sys/mounts/${path} type=kmip`, `write ${path}/config listen_addrs=${addr}`] : [`write sys/mounts/${path} type=kmip`]; await uiConsole.runCommands(commands); await settled(); - let res = uiConsole.lastLogOutput; + const res = uiConsole.lastLogOutput; if (res.includes('Error')) { throw new Error(`Error mounting secrets engine: ${res}`); } @@ -36,13 +36,13 @@ const mount = async (shouldConfig = true) => { }; const createScope = async () => { - let path = await mount(); + const path = await mount(); await settled(); - let scope = `scope-${Date.now()}`; + const scope = `scope-${Date.now()}`; await settled(); await uiConsole.runCommands([`write ${path}/scope/${scope} -force`]); await settled(); - let res = uiConsole.lastLogOutput; + const res = uiConsole.lastLogOutput; if (res.includes('Error')) { throw new Error(`Error creating scope: ${res}`); } @@ -50,12 +50,12 @@ const createScope = async () => { }; const createRole = async () => { - let { path, scope } = await createScope(); + const { path, scope } = await createScope(); await settled(); - let role = `role-${Date.now()}`; + const role = `role-${Date.now()}`; await uiConsole.runCommands([`write ${path}/scope/${scope}/role/${role} operation_all=true`]); await settled(); - let res = uiConsole.lastLogOutput; + const res = uiConsole.lastLogOutput; if (res.includes('Error')) { throw new Error(`Error creating role: ${res}`); } @@ -63,12 +63,12 @@ const createRole = async () => { }; const generateCreds = async () => { - let { path, scope, role } = await createRole(); + const { path, scope, role } = await createRole(); await settled(); await uiConsole.runCommands([ `write ${path}/scope/${scope}/role/${role}/credential/generate format=pem -field=serial_number`, ]); - let serial = uiConsole.lastLogOutput; + const serial = uiConsole.lastLogOutput; if (serial.includes('Error')) { throw new Error(`Credential generation failed with error: ${serial}`); } @@ -83,7 +83,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it enables KMIP secrets engine', async function (assert) { - let path = `kmip-${Date.now()}`; + const path = `kmip-${Date.now()}`; await mountSecrets.enable('kmip', path); await settled(); assert.strictEqual( @@ -95,7 +95,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can configure a KMIP secrets engine', async function (assert) { - let path = await mount(false); + const path = await mount(false); await scopesPage.visit({ backend: path }); await settled(); await scopesPage.configurationLink(); @@ -114,7 +114,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { `/vault/secrets/${path}/kmip/configure`, 'configuration navigates to the configure page' ); - let addr = `127.0.0.1:${getRandomPort()}`; + const addr = `127.0.0.1:${getRandomPort()}`; await fillIn('[data-test-string-list-input="0"]', addr); await scopesPage.submit(); @@ -128,7 +128,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can revoke from the credentials show page', async function (assert) { - let { path, scope, role, serial } = await generateCreds(); + const { path, scope, role, serial } = await generateCreds(); await settled(); await credentialsPage.visitDetail({ backend: path, scope, role, serial }); await settled(); @@ -146,7 +146,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can create a scope', async function (assert) { - let path = await mount(this); + const path = await mount(this); await scopesPage.visit({ backend: path }); await settled(); await scopesPage.createLink(); @@ -171,7 +171,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can delete a scope from the list', async function (assert) { - let { path } = await createScope(); + const { path } = await createScope(); await scopesPage.visit({ backend: path }); await settled(); // delete the scope @@ -187,17 +187,17 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { test('it can create a role', async function (assert) { // moving create scope here to help with flaky test - let path = await mount(); + const path = await mount(); await settled(); - let scope = `scope-for-can-create-role`; + const scope = `scope-for-can-create-role`; await settled(); await uiConsole.runCommands([`write ${path}/scope/${scope} -force`]); await settled(); - let res = uiConsole.lastLogOutput; + const res = uiConsole.lastLogOutput; if (res.includes('Error')) { throw new Error(`Error creating scope: ${res}`); } - let role = `role-new-role`; + const role = `role-new-role`; await rolesPage.visit({ backend: path, scope }); await settled(); assert.ok(rolesPage.isEmpty, 'renders the empty role page'); @@ -223,7 +223,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can delete a role from the list', async function (assert) { - let { path, scope } = await createRole(); + const { path, scope } = await createRole(); await rolesPage.visit({ backend: path, scope }); await settled(); // delete the role @@ -238,7 +238,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can delete a role from the detail page', async function (assert) { - let { path, scope, role } = await createRole(); + const { path, scope, role } = await createRole(); await settled(); await rolesPage.visitDetail({ backend: path, scope, role }); await settled(); @@ -269,7 +269,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { test('it can create a credential', async function (assert) { // TODO come back and figure out why issue here with test - let { path, scope, role } = await createRole(); + const { path, scope, role } = await createRole(); await credentialsPage.visit({ backend: path, scope, role }); await settled(); assert.ok(credentialsPage.isEmpty, 'renders empty creds page'); @@ -293,7 +293,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { }); test('it can revoke a credential from the list', async function (assert) { - let { path, scope, role } = await generateCreds(); + const { path, scope, role } = await generateCreds(); await credentialsPage.visit({ backend: path, scope, role }); // revoke the credentials await settled(); diff --git a/ui/tests/acceptance/enterprise-namespaces-test.js b/ui/tests/acceptance/enterprise-namespaces-test.js index 3b4147af0b..947821bcd8 100644 --- a/ui/tests/acceptance/enterprise-namespaces-test.js +++ b/ui/tests/acceptance/enterprise-namespaces-test.js @@ -21,10 +21,10 @@ module('Acceptance | Enterprise | namespaces', function (hooks) { }); test('it clears namespaces when you log out', async function (assert) { - let ns = 'foo'; + const ns = 'foo'; await createNS(ns); await shell.runCommands(`write -field=client_token auth/token/create policies=default`); - let token = shell.lastLogOutput; + const token = shell.lastLogOutput; await logout.visit(); await authPage.login(token); assert.dom('[data-test-namespace-toggle]').doesNotExist('does not show the namespace picker'); @@ -32,8 +32,8 @@ module('Acceptance | Enterprise | namespaces', function (hooks) { }); test('it shows nested namespaces if you log in with a namspace starting with a /', async function (assert) { - let nses = ['beep', 'boop', 'bop']; - for (let [i, ns] of nses.entries()) { + const nses = ['beep', 'boop', 'bop']; + for (const [i, ns] of nses.entries()) { await createNS(ns); await settled(); // this is usually triggered when creating a ns in the form, here we'll trigger a reload of the @@ -43,8 +43,8 @@ module('Acceptance | Enterprise | namespaces', function (hooks) { break; } // the namespace path will include all of the namespaces up to this point - let targetNamespace = nses.slice(0, i + 1).join('/'); - let url = `/vault/secrets?namespace=${targetNamespace}`; + const targetNamespace = nses.slice(0, i + 1).join('/'); + const url = `/vault/secrets?namespace=${targetNamespace}`; // check if namespace is in the toggle await click('[data-test-namespace-toggle]'); @@ -81,7 +81,7 @@ module('Acceptance | Enterprise | namespaces', function (hooks) { .doesNotExist('Managed namespace toolbar does not exist'); assert.dom('input#namespace').hasAttribute('placeholder', '/ (Root)'); await fillIn('input#namespace', '/foo'); - let encodedNamespace = encodeURIComponent('/foo'); + const encodedNamespace = encodeURIComponent('/foo'); assert.strictEqual( currentURL(), `/vault/auth?namespace=${encodedNamespace}&with=token`, diff --git a/ui/tests/acceptance/enterprise-replication-test.js b/ui/tests/acceptance/enterprise-replication-test.js index b665fc9790..2087ab0780 100644 --- a/ui/tests/acceptance/enterprise-replication-test.js +++ b/ui/tests/acceptance/enterprise-replication-test.js @@ -64,7 +64,6 @@ module('Acceptance | Enterprise | replication', function (hooks) { assert.expect(17); const secondaryName = 'firstSecondary'; const mode = 'deny'; - let mountPath; // confirm unable to visit dr secondary details page when both replications are disabled await visit('/vault/replication-dr-promote/details'); @@ -106,7 +105,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('#deny'); await clickTrigger(); - mountPath = searchSelect.options.objectAt(0).text; + const mountPath = searchSelect.options.objectAt(0).text; await searchSelect.options.objectAt(0).click(); await click('[data-test-secondary-add]'); @@ -275,7 +274,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await pollCluster(this.owner); await settled(); - let modalDefaultTtl = document.querySelector('[data-test-row-value="TTL"]').innerText; + const modalDefaultTtl = document.querySelector('[data-test-row-value="TTL"]').innerText; // checks on secondary token modal assert.dom('#modal-wormhole').exists(); assert.strictEqual(modalDefaultTtl, '1800s', 'shows the correct TTL of 1800s'); @@ -293,7 +292,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await pollCluster(this.owner); await settled(); - let modalTtl = document.querySelector('[data-test-row-value="TTL"]').innerText; + const modalTtl = document.querySelector('[data-test-row-value="TTL"]').innerText; assert.strictEqual(modalTtl, '180s', 'shows the correct TTL of 180s'); await click('[data-test-modal-background="Copy your token"]'); diff --git a/ui/tests/acceptance/enterprise-transform-test.js b/ui/tests/acceptance/enterprise-transform-test.js index da0335a458..a5a6830433 100644 --- a/ui/tests/acceptance/enterprise-transform-test.js +++ b/ui/tests/acceptance/enterprise-transform-test.js @@ -15,7 +15,7 @@ import searchSelect from 'vault/tests/pages/components/search-select'; const searchSelectComponent = create(searchSelect); const mount = async () => { - let path = `transform-${Date.now()}`; + const path = `transform-${Date.now()}`; await mountSecrets.enable('transform', path); await settled(); return path; @@ -61,7 +61,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { }); test('it enables Transform secrets engine and shows tabs', async function (assert) { - let backend = `transform-${Date.now()}`; + const backend = `transform-${Date.now()}`; await mountSecrets.enable('transform', backend); await settled(); assert.strictEqual( @@ -79,7 +79,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { }); test('it can create a transformation and add itself to the role attached', async function (assert) { - let backend = await mount(); + const backend = await mount(); const transformationName = 'foo'; const roleName = 'foo-role'; await settled(); @@ -129,7 +129,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { test('it can create a role and add itself to the transformation attached', async function (assert) { const roleName = 'my-role'; - let backend = await mount(); + const backend = await mount(); // create transformation without role await newTransformation(backend, 'a-transformation', true); await click(`[data-test-secret-breadcrumb="${backend}"]`); @@ -168,8 +168,8 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { test('it adds a role to a transformation when added to a role', async function (assert) { const roleName = 'role-test'; - let backend = await mount(); - let transformation = await newTransformation(backend, 'b-transformation', true); + const backend = await mount(); + const transformation = await newTransformation(backend, 'b-transformation', true); await newRole(backend, roleName); await transformationsPage.visitShow({ backend, id: transformation }); await settled(); @@ -178,9 +178,9 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { test('it shows a message if an update fails after save', async function (assert) { const roleName = 'role-remove'; - let backend = await mount(); + const backend = await mount(); // Create transformation - let transformation = await newTransformation(backend, 'c-transformation', true); + const transformation = await newTransformation(backend, 'c-transformation', true); // create role await newRole(backend, roleName); await settled(); @@ -215,7 +215,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { test('it allows creation and edit of a template', async function (assert) { const templateName = 'my-template'; - let backend = await mount(); + const backend = await mount(); await click('[data-test-secret-list-tab="Templates"]'); assert.strictEqual( @@ -257,7 +257,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { test('it allows creation and edit of an alphabet', async function (assert) { const alphabetName = 'vowels-only'; - let backend = await mount(); + const backend = await mount(); await click('[data-test-secret-list-tab="Alphabets"]'); assert.strictEqual( diff --git a/ui/tests/acceptance/init-test.js b/ui/tests/acceptance/init-test.js index 24f5fd3ce6..3f72fcc24b 100644 --- a/ui/tests/acceptance/init-test.js +++ b/ui/tests/acceptance/init-test.js @@ -62,12 +62,12 @@ const SEAL_STATUS_RESPONSE = { module('Acceptance | init', function (hooks) { setupApplicationTest(hooks); - let setInitResponse = (server, resp) => { + const setInitResponse = (server, resp) => { server.put('/v1/sys/init', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify(resp)]; }); }; - let setStatusResponse = (server, resp) => { + const setStatusResponse = (server, resp) => { server.get('/v1/sys/seal-status', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify(resp)]; }); @@ -97,7 +97,7 @@ module('Acceptance | init', function (hooks) { assert.strictEqual(initPage.buttonText, 'Continue to Authenticate', 'links to authenticate'); let { requestBody } = this.server.handledRequests.findBy('url', '/v1/sys/init'); requestBody = JSON.parse(requestBody); - for (let attr of ['recovery_shares', 'recovery_threshold']) { + for (const attr of ['recovery_shares', 'recovery_threshold']) { assert.ok(requestBody[attr], `requestBody includes cloud seal specific attribute: ${attr}`); } }); @@ -113,7 +113,7 @@ module('Acceptance | init', function (hooks) { let { requestBody } = this.server.handledRequests.findBy('url', '/v1/sys/init'); requestBody = JSON.parse(requestBody); - for (let attr of ['recovery_shares', 'recovery_threshold']) { + for (const attr of ['recovery_shares', 'recovery_threshold']) { assert.notOk(requestBody[attr], `requestBody does not include cloud seal specific attribute: ${attr}`); } }); diff --git a/ui/tests/acceptance/managed-namespace-test.js b/ui/tests/acceptance/managed-namespace-test.js index 9994eeafc8..74203f85cc 100644 --- a/ui/tests/acceptance/managed-namespace-test.js +++ b/ui/tests/acceptance/managed-namespace-test.js @@ -43,7 +43,7 @@ module('Acceptance | Enterprise | Managed namespace root', function (hooks) { assert.dom('[data-test-managed-namespace-root]').hasText('/admin', 'Shows /admin namespace prefix'); assert.dom('input#namespace').hasAttribute('placeholder', '/ (Default)'); await fillIn('input#namespace', '/foo'); - let encodedNamespace = encodeURIComponent('admin/foo'); + const encodedNamespace = encodeURIComponent('admin/foo'); assert.strictEqual( currentURL(), `/vault/auth?namespace=${encodedNamespace}&with=token`, diff --git a/ui/tests/acceptance/mfa-method-test.js b/ui/tests/acceptance/mfa-method-test.js index afec761db7..b69b3c5147 100644 --- a/ui/tests/acceptance/mfa-method-test.js +++ b/ui/tests/acceptance/mfa-method-test.js @@ -264,7 +264,7 @@ module('Acceptance | mfa-method', function (hooks) { .hasValue(model.period.toString(), 'Period form field is populated with model value'); assert.dom('[data-test-select="ttl-unit"]').hasValue('s', 'Correct time unit is shown for period'); } else if (key === 'algorithm' || key === 'digits' || key === 'skew') { - let radioElem = this.element.querySelector(`input[name=${key}]:checked`); + const radioElem = this.element.querySelector(`input[name=${key}]:checked`); assert .dom(radioElem) .hasValue(model[key].toString(), `${key} form field is populated with model value`); @@ -276,7 +276,7 @@ module('Acceptance | mfa-method', function (hooks) { }); await fillIn('[data-test-input="issuer"]', 'foo'); - let SHA1radioBtn = this.element.querySelectorAll('input[name=algorithm]')[0]; + const SHA1radioBtn = this.element.querySelectorAll('input[name=algorithm]')[0]; await click(SHA1radioBtn); await fillIn('[data-test-input="max_validation_attempts"]', 10); await click('[data-test-mfa-method-save]'); diff --git a/ui/tests/acceptance/mfa-setup-test.js b/ui/tests/acceptance/mfa-setup-test.js index 73c5ccf99d..28bb9a61a5 100644 --- a/ui/tests/acceptance/mfa-setup-test.js +++ b/ui/tests/acceptance/mfa-setup-test.js @@ -30,7 +30,7 @@ const writeUserWithPolicy = async function (path) { }; const setupUser = async function () { - let path = `userpass-${new Date().getTime()}`; + const path = `userpass-${new Date().getTime()}`; await writePolicy(path); await writeUserWithPolicy(path); await click('[data-test-save-config="true"]'); diff --git a/ui/tests/acceptance/oidc-provider-test.js b/ui/tests/acceptance/oidc-provider-test.js index 30345e7cdd..6d7a22e433 100644 --- a/ui/tests/acceptance/oidc-provider-test.js +++ b/ui/tests/acceptance/oidc-provider-test.js @@ -66,19 +66,19 @@ const entityAlias = async function (entityId, accessor, groupId) { return consoleComponent.lastLogOutput.includes('Success'); }; const setupWebapp = async function (redirect) { - let webappName = 'my-webapp'; + const webappName = 'my-webapp'; await consoleComponent.runCommands([ `write identity/oidc/client/${webappName} redirect_uris="${redirect}" assignments="my-assignment" key="sigkey" id_token_ttl="30m" access_token_ttl="1h"`, `read -field=client_id identity/oidc/client/${webappName}`, ]); - let output = consoleComponent.lastLogOutput; + const output = consoleComponent.lastLogOutput; if (output.includes('error occurred')) { throw new Error(`OIDC setup failed: ${output}`); } return output; }; const setupProvider = async function (clientId) { - let providerName = `my-provider`; + const providerName = `my-provider`; await consoleComponent.runCommands( `write identity/oidc/provider/${providerName} allowed_client_ids="${clientId}" scopes="user,groups"` ); @@ -86,7 +86,7 @@ const setupProvider = async function (clientId) { }; const getAuthzUrl = (providerName, redirect, clientId, params) => { - let queryParams = { + const queryParams = { client_id: clientId, nonce: 'abc123', redirect_uri: encodeURIComponent(redirect), @@ -95,7 +95,7 @@ const getAuthzUrl = (providerName, redirect, clientId, params) => { state: 'foobar', ...params, }; - let queryString = Object.keys(queryParams).reduce((prev, key, idx) => { + const queryString = Object.keys(queryParams).reduce((prev, key, idx) => { if (idx === 0) { return `${prev}${key}=${queryParams[key]}`; } @@ -108,11 +108,11 @@ const setupOidc = async function () { const callback = 'http://127.0.0.1:8251/callback'; const entityId = await oidcEntity('oidc', OIDC_POLICY); const groupId = await oidcGroup(entityId); - let authMethodPath = `userpass-${new Date().getTime()}`; + const authMethodPath = `userpass-${new Date().getTime()}`; const accessor = await authAccessor(authMethodPath); await entityAlias(entityId, accessor, groupId); const clientId = await setupWebapp(callback); - let providerName = await setupProvider(clientId); + const providerName = await setupProvider(clientId); return { providerName, callback, @@ -131,11 +131,11 @@ module('Acceptance | oidc provider', function (hooks) { }); test('OIDC Provider logs in and redirects correctly', async function (assert) { - let { providerName, callback, clientId, authMethodPath } = await setupOidc(); + const { providerName, callback, clientId, authMethodPath } = await setupOidc(); await logout.visit(); await settled(); - let url = getAuthzUrl(providerName, callback, clientId); + const url = getAuthzUrl(providerName, callback, clientId); await visit(url); assert.ok(currentURL().startsWith('/vault/auth'), 'redirects to auth when no token'); diff --git a/ui/tests/acceptance/policies/index-test.js b/ui/tests/acceptance/policies/index-test.js index ca2eb927e6..65cbde00a6 100644 --- a/ui/tests/acceptance/policies/index-test.js +++ b/ui/tests/acceptance/policies/index-test.js @@ -35,12 +35,12 @@ module('Acceptance | policies/acl', function (hooks) { test('it allows deletion of policies with dots in names', async function (assert) { const POLICY = 'path "*" { capabilities = ["list"]}'; - let policyName = 'list.policy'; + const policyName = 'list.policy'; await consoleComponent.runCommands([`write sys/policies/acl/${policyName} policy=${btoa(POLICY)}`]); await settled(); await page.visit({ type: 'acl' }); await settled(); - let policy = page.row.filterBy('name', policyName)[0]; + const policy = page.row.filterBy('name', policyName)[0]; assert.ok(policy, 'policy is shown in the list'); await policy.menu(); await settled(); diff --git a/ui/tests/acceptance/redirect-to-test.js b/ui/tests/acceptance/redirect-to-test.js index 10e84ebbc1..4438db551b 100644 --- a/ui/tests/acceptance/redirect-to-test.js +++ b/ui/tests/acceptance/redirect-to-test.js @@ -23,7 +23,7 @@ const wrappedAuth = async () => { await consoleComponent.runCommands(`write -field=token auth/token/create policies=default -wrap-ttl=5m`); await settled(); // because of flaky test, trying to capture the token using a dom selector instead of the page object - let token = document.querySelector('[data-test-component="console/log-text"] pre').textContent; + const token = document.querySelector('[data-test-component="console/log-text"] pre').textContent; if (token.includes('Error')) { throw new Error(`Error mounting secrets engine: ${token}`); } @@ -37,7 +37,7 @@ const setupWrapping = async () => { await settled(); await auth.tokenInput('root').submit(); await settled(); - let wrappedToken = await wrappedAuth(); + const wrappedToken = await wrappedAuth(); return wrappedToken; }; module('Acceptance | redirect_to query param functionality', function (hooks) { @@ -50,7 +50,7 @@ module('Acceptance | redirect_to query param functionality', function (hooks) { localStorage.clear(); }); test('redirect to a route after authentication', async function (assert) { - let url = '/vault/secrets/secret/create'; + const url = '/vault/secrets/secret/create'; await visit(url); assert.ok( currentURL().includes(`redirect_to=${encodeURIComponent(url)}`), @@ -63,13 +63,13 @@ module('Acceptance | redirect_to query param functionality', function (hooks) { }); test('redirect from root does not include redirect_to', async function (assert) { - let url = '/'; + const url = '/'; await visit(url); assert.ok(currentURL().indexOf('redirect_to') < 0, 'there is no redirect_to query param'); }); test('redirect to a route after authentication with a query param', async function (assert) { - let url = '/vault/secrets/secret/create?initialKey=hello'; + const url = '/vault/secrets/secret/create?initialKey=hello'; await visit(url); assert.ok( currentURL().includes(`?redirect_to=${encodeURIComponent(url)}`), @@ -81,8 +81,8 @@ module('Acceptance | redirect_to query param functionality', function (hooks) { }); test('redirect to logout with wrapped token authenticates you', async function (assert) { - let wrappedToken = await setupWrapping(); - let url = '/vault/secrets/cubbyhole/create'; + const wrappedToken = await setupWrapping(); + const url = '/vault/secrets/cubbyhole/create'; await auth.logout({ redirect_to: url, diff --git a/ui/tests/acceptance/secrets/backend/alicloud/secret-test.js b/ui/tests/acceptance/secrets/backend/alicloud/secret-test.js index 888874ad57..1b01d1a1d0 100644 --- a/ui/tests/acceptance/secrets/backend/alicloud/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/alicloud/secret-test.js @@ -13,7 +13,7 @@ module('Acceptance | alicloud/enable', function (hooks) { }); test('enable alicloud', async function (assert) { - let enginePath = `alicloud-${new Date().getTime()}`; + const enginePath = `alicloud-${new Date().getTime()}`; await mountSecrets.visit(); await settled(); await mountSecrets.selectType('alicloud'); diff --git a/ui/tests/acceptance/secrets/backend/database/secret-test.js b/ui/tests/acceptance/secrets/backend/database/secret-test.js index 11384f702f..f97164612c 100644 --- a/ui/tests/acceptance/secrets/backend/database/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/database/secret-test.js @@ -23,7 +23,7 @@ const MODEL = { }; const mount = async () => { - let path = `database-${Date.now()}`; + const path = `database-${Date.now()}`; await mountSecrets.enable('database', path); await settled(); return path; @@ -245,7 +245,7 @@ module('Acceptance | secrets/database/*', function (hooks) { }); test('can enable the database secrets engine', async function (assert) { - let backend = `database-${Date.now()}`; + const backend = `database-${Date.now()}`; await mountSecrets.enable('database', backend); await settled(); assert.strictEqual( @@ -266,7 +266,7 @@ module('Acceptance | secrets/database/*', function (hooks) { test('Connection create and edit form for each plugin', async function (assert) { assert.expect(160); const backend = await mount(); - for (let testCase of connectionTests) { + for (const testCase of connectionTests) { await connectionPage.visitCreate({ backend }); assert.strictEqual(currentURL(), `/vault/secrets/${backend}/create`, 'Correct creation URL'); assert @@ -423,7 +423,7 @@ module('Acceptance | secrets/database/*', function (hooks) { `write sys/policies/acl/test-policy policy=${btoa(CONNECTION_VIEW_ONLY)}`, 'write -field=client_token auth/token/create policies=test-policy ttl=1h', ]); - let token = consoleComponent.lastTextOutput; + const token = consoleComponent.lastTextOutput; await logout.visit(); await authPage.login(token); await connectionPage.visitShow({ backend, id: connection }); @@ -484,7 +484,7 @@ module('Acceptance | secrets/database/*', function (hooks) { test('root and limited access', async function (assert) { this.set('model', MODEL); - let backend = 'database'; + const backend = 'database'; const NO_ROLES_POLICY = ` path "database/roles/*" { capabilities = ["delete"] @@ -504,7 +504,7 @@ module('Acceptance | secrets/database/*', function (hooks) { `write sys/policies/acl/test-policy policy=${btoa(NO_ROLES_POLICY)}`, 'write -field=client_token auth/token/create policies=test-policy ttl=1h', ]); - let token = consoleComponent.lastTextOutput; + const token = consoleComponent.lastTextOutput; // test root user flow await settled(); diff --git a/ui/tests/acceptance/secrets/backend/engines-test.js b/ui/tests/acceptance/secrets/backend/engines-test.js index 8875484a4a..2a5a0feba1 100644 --- a/ui/tests/acceptance/secrets/backend/engines-test.js +++ b/ui/tests/acceptance/secrets/backend/engines-test.js @@ -14,14 +14,14 @@ module('Acceptance | engine/disable', function (hooks) { test('disable engine', async function (assert) { // first mount an engine so we can disable it. - let enginePath = `alicloud-${new Date().getTime()}`; + const enginePath = `alicloud-${new Date().getTime()}`; await mountSecrets.enable('alicloud', enginePath); await settled(); assert.ok(backendsPage.rows.filterBy('path', `${enginePath}/`)[0], 'shows the mounted engine'); await backendsPage.visit(); await settled(); - let row = backendsPage.rows.filterBy('path', `${enginePath}/`)[0]; + const row = backendsPage.rows.filterBy('path', `${enginePath}/`)[0]; await row.menu(); await settled(); await backendsPage.disableButton(); diff --git a/ui/tests/acceptance/secrets/backend/gcpkms/secrets-test.js b/ui/tests/acceptance/secrets/backend/gcpkms/secrets-test.js index 7604465d0b..ff8eb0aaa5 100644 --- a/ui/tests/acceptance/secrets/backend/gcpkms/secrets-test.js +++ b/ui/tests/acceptance/secrets/backend/gcpkms/secrets-test.js @@ -14,7 +14,7 @@ module('Acceptance | gcpkms/enable', function (hooks) { test('enable gcpkms', async function (assert) { // Error: Cannot call `visit` without having first called `setupApplicationContext`. - let enginePath = `gcpkms-${new Date().getTime()}`; + const enginePath = `gcpkms-${new Date().getTime()}`; await mountSecrets.visit(); await settled(); await mountSecrets.selectType('gcpkms'); diff --git a/ui/tests/acceptance/secrets/backend/kv/diff-test.js b/ui/tests/acceptance/secrets/backend/kv/diff-test.js index 3ad7726b6f..ee72121476 100644 --- a/ui/tests/acceptance/secrets/backend/kv/diff-test.js +++ b/ui/tests/acceptance/secrets/backend/kv/diff-test.js @@ -44,8 +44,8 @@ module('Acceptance | kv2 diff view', function (hooks) { // add another version await click('[data-test-secret-edit="true"]'); - let secondKey = document.querySelectorAll('[data-test-secret-key]')[1]; - let secondValue = document.querySelectorAll('.masked-value')[1]; + const secondKey = document.querySelectorAll('[data-test-secret-key]')[1]; + const secondValue = document.querySelectorAll('.masked-value')[1]; await fillIn(secondKey, 'version2'); await fillIn(secondValue, 'world!'); await click('[data-test-secret-save]'); @@ -56,7 +56,7 @@ module('Acceptance | kv2 diff view', function (hooks) { await click('[data-test-view-diff]'); - let diffBetweenVersion2and1 = document.querySelector('.jsondiffpatch-added').innerText; + const diffBetweenVersion2and1 = document.querySelector('.jsondiffpatch-added').innerText; assert.strictEqual(diffBetweenVersion2and1, 'version2"world!"', 'shows the correct added part'); await click('[data-test-popup-menu-trigger="right-version"]'); diff --git a/ui/tests/acceptance/secrets/backend/kv/secret-test.js b/ui/tests/acceptance/secrets/backend/kv/secret-test.js index d62c2472f2..94ec904e50 100644 --- a/ui/tests/acceptance/secrets/backend/kv/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/kv/secret-test.js @@ -111,7 +111,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { test('it can create a secret with a non default max version and add metadata', async function (assert) { const enginePath = `kv-${new Date().getTime()}`; const secretPath = 'maxVersions'; - let maxVersions = 101; + const maxVersions = 101; await mountSecrets.visit(); await mountSecrets.enable('kv', enginePath); await settled(); @@ -125,7 +125,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await settled(); await editPage.metadataTab(); await settled(); - let savedMaxVersions = Number( + const savedMaxVersions = Number( document.querySelector('[data-test-value-div="Maximum versions"]').innerText ); assert.strictEqual( @@ -138,8 +138,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await fillIn('[data-test-kv-key]', 'key'); await fillIn('[data-test-kv-value]', 'value'); await click('[data-test-save-metadata]'); - let key = document.querySelector('[data-test-row-label="key"]').innerText; - let value = document.querySelector('[data-test-row-value="key"]').innerText; + const key = document.querySelector('[data-test-row-label="key"]').innerText; + const value = document.querySelector('[data-test-row-value="key"]').innerText; assert.strictEqual(key, 'key', 'metadata key displays after adding it.'); assert.strictEqual(value, 'value', 'metadata value displays after adding it.'); }); @@ -173,7 +173,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { test('it can mount a KV 2 secret engine with config metadata', async function (assert) { const enginePath = `kv-${new Date().getTime()}`; - let maxVersion = '101'; + const maxVersion = '101'; await mountSecrets.visit(); await click('[data-test-mount-type="kv"]'); @@ -188,11 +188,11 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await click('[data-test-configuration-tab]'); - let cas = document.querySelector('[data-test-value-div="Require Check and Set"]').innerText; - let deleteVersionAfter = document.querySelector( + const cas = document.querySelector('[data-test-value-div="Require Check and Set"]').innerText; + const deleteVersionAfter = document.querySelector( '[data-test-value-div="Automate secret deletion"]' ).innerText; - let savedMaxVersion = document.querySelector( + const savedMaxVersion = document.querySelector( '[data-test-value-div="Maximum number of versions"]' ).innerText; @@ -212,7 +212,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { test('it can create a secret and metadata can be created and edited', async function (assert) { const enginePath = `kv-${new Date().getTime()}`; const secretPath = 'metadata'; - let maxVersions = 101; + const maxVersions = 101; await mountSecrets.visit(); await mountSecrets.enable('kv', enginePath); await settled(); @@ -226,7 +226,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await settled(); await editPage.metadataTab(); await settled(); - let savedMaxVersions = Number(document.querySelectorAll('[data-test-value-div]')[0].innerText); + const savedMaxVersions = Number(document.querySelectorAll('[data-test-value-div]')[0].innerText); assert.strictEqual( maxVersions, savedMaxVersions, @@ -271,8 +271,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { test('it navigates to version history and to a specific version', async function (assert) { const enginePath = `kv-${new Date().getTime()}`; const secretPath = `specific-version`; - let today = new Date(); - let month = today.toString().split(' ')[1]; + const today = new Date(); + const month = today.toString().split(' ')[1]; await mountSecrets.visit(); await mountSecrets.enable('kv', enginePath); await settled(); @@ -349,7 +349,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await listPage.visitRoot({ backend: enginePath }); await listPage.secrets.filterBy('text', '1/')[0].click(); await listPage.secrets.filterBy('text', '2/')[0].click(); - let secretLink = listPage.secrets.filterBy('text', '3/')[0]; + const secretLink = listPage.secrets.filterBy('text', '3/')[0]; assert.ok(secretLink, 'link to the 3/ branch displays properly'); await listPage.secrets.filterBy('text', '3/')[0].click(); @@ -414,12 +414,12 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { }); test('it can edit via the JSON input', async function (assert) { - let content = JSON.stringify({ foo: 'fa', bar: 'boo' }); + const content = JSON.stringify({ foo: 'fa', bar: 'boo' }); const secretPath = `kv-path-${new Date().getTime()}`; await listPage.visitRoot({ backend: 'secret' }); await listPage.create(); await editPage.path(secretPath).toggleJSON(); - let instance = document.querySelector('.CodeMirror').CodeMirror; + const instance = document.querySelector('.CodeMirror').CodeMirror; instance.setValue(content); await editPage.save(); @@ -429,7 +429,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { 'redirects to the show page' ); assert.ok(showPage.editIsPresent, 'shows the edit button'); - let savedInstance = document.querySelector('.CodeMirror').CodeMirror; + const savedInstance = document.querySelector('.CodeMirror').CodeMirror; assert.strictEqual( savedInstance.options.value, JSON.stringify({ bar: 'boo', foo: 'fa' }, null, 2), @@ -438,8 +438,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { }); test('paths are properly encoded', async function (assert) { - let backend = 'kv'; - let paths = [ + const backend = 'kv'; + const paths = [ '(', ')', '"', @@ -463,9 +463,9 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { ].map((char) => `${char}some`); assert.expect(paths.length * 2); const secretPath = '2'; - let commands = paths.map((path) => `write '${backend}/${path}/${secretPath}' 3=4`); + const commands = paths.map((path) => `write '${backend}/${path}/${secretPath}' 3=4`); await consoleComponent.runCommands(['write sys/mounts/kv type=kv', ...commands]); - for (let path of paths) { + for (const path of paths) { await listPage.visit({ backend, id: path }); assert.ok(listPage.secrets.filterBy('text', '2')[0], `${path}: secret is displayed properly`); await listPage.secrets.filterBy('text', '2')[0].click(); @@ -504,7 +504,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { await click('[data-test-version]'); // perform encode function that should be done by the encodePath - let encodedSecretPath = secretPath.replace(/ /g, '%20'); + const encodedSecretPath = secretPath.replace(/ /g, '%20'); assert.strictEqual(currentURL(), `/vault/secrets/${enginePath}/show/${encodedSecretPath}?version=1`); }); @@ -512,8 +512,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { test('creating a secret with a single or double quote works properly', async function (assert) { assert.expect(4); await consoleComponent.runCommands('write sys/mounts/kv type=kv'); - let paths = ["'some", '"some']; - for (let path of paths) { + const paths = ["'some", '"some']; + for (const path of paths) { await listPage.visitRoot({ backend: 'kv' }); await listPage.create(); await editPage.createSecret(`${path}/2`, 'foo', 'bar'); @@ -745,7 +745,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { assert.dom('[data-test-secret-v2-delete="true"]').exists('drop down delete shows'); await showPage.deleteSecretV2(); // unable to reload page in test scenario so going to list and back to secret to confirm deletion - let url = `/vault/secrets/${enginePath}/list`; + const url = `/vault/secrets/${enginePath}/list`; await visit(url); await click(`[data-test-secret-link="${secretPath}"]`); @@ -902,7 +902,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { } `; - let version = backend === 'kv-v2' ? 2 : 1; + const version = backend === 'kv-v2' ? 2 : 1; let policy; if (backend === 'kv-v2' && canReadMeta) { policy = V2_WRITE_WITH_META_READ_POLICY; @@ -915,8 +915,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { return await mountEngineGeneratePolicyToken(backend, 'nonexistent-secret', policy, version); }; test('write without read: version 2', async function (assert) { - let backend = 'kv-v2'; - let userToken = await setupNoRead(backend); + const backend = 'kv-v2'; + const userToken = await setupNoRead(backend); await writeSecret(backend, 'secret', 'foo', 'bar'); await logout.visit(); await authPage.login(userToken); @@ -937,8 +937,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { }); test('write without read: version 2 with metadata read', async function (assert) { - let backend = 'kv-v2'; - let userToken = await setupNoRead(backend, true); + const backend = 'kv-v2'; + const userToken = await setupNoRead(backend, true); await writeSecret(backend, 'secret', 'foo', 'bar'); await logout.visit(); await authPage.login(userToken); @@ -961,8 +961,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { }); test('write without read: version 1', async function (assert) { - let backend = 'kv-v1'; - let userToken = await setupNoRead(backend); + const backend = 'kv-v1'; + const userToken = await setupNoRead(backend); await writeSecret(backend, 'secret', 'foo', 'bar'); await logout.visit(); await authPage.login(userToken); diff --git a/ui/tests/acceptance/secrets/backend/pki/role-test.js b/ui/tests/acceptance/secrets/backend/pki/role-test.js index fcfc8430fd..4007738624 100644 --- a/ui/tests/acceptance/secrets/backend/pki/role-test.js +++ b/ui/tests/acceptance/secrets/backend/pki/role-test.js @@ -54,7 +54,7 @@ module('Acceptance | secrets/pki/create', function (hooks) { await listPage.visitRoot({ backend: path }); await settled(); assert.strictEqual(listPage.secrets.length, 1, 'shows role in the list'); - let secret = listPage.secrets.objectAt(0); + const secret = listPage.secrets.objectAt(0); await secret.menuToggle(); await settled(); assert.ok(listPage.menuItems.length > 0, 'shows links in the menu'); diff --git a/ui/tests/acceptance/secrets/backend/ssh/role-test.js b/ui/tests/acceptance/secrets/backend/ssh/role-test.js index 6cb265456e..a6c48f7f2b 100644 --- a/ui/tests/acceptance/secrets/backend/ssh/role-test.js +++ b/ui/tests/acceptance/secrets/backend/ssh/role-test.js @@ -49,7 +49,7 @@ module('Acceptance | secrets/ssh', function (hooks) { await listPage.visitRoot({ backend: path }); await settled(); assert.strictEqual(listPage.secrets.length, 1, 'shows role in the list'); - let secret = listPage.secrets.objectAt(0); + const secret = listPage.secrets.objectAt(0); await secret.menuToggle(); assert.ok(listPage.menuItems.length > 0, 'shows links in the menu'); }); diff --git a/ui/tests/acceptance/settings-test.js b/ui/tests/acceptance/settings-test.js index 99e67bc2d1..9fc5cbe28d 100644 --- a/ui/tests/acceptance/settings-test.js +++ b/ui/tests/acceptance/settings-test.js @@ -43,7 +43,7 @@ module('Acceptance | settings', function (hooks) { ); await settled(); assert.strictEqual(currentURL(), `/vault/secrets`, 'redirects to secrets page'); - let row = backendListPage.rows.filterBy('path', path + '/')[0]; + const row = backendListPage.rows.filterBy('path', path + '/')[0]; await row.menu(); await backendListPage.configLink(); assert.strictEqual(currentURL(), `/vault/secrets/${path}/configuration`, 'navigates to the config page'); diff --git a/ui/tests/acceptance/settings/auth/configure/section-test.js b/ui/tests/acceptance/settings/auth/configure/section-test.js index e6fe120cfe..b9b1bfba1c 100644 --- a/ui/tests/acceptance/settings/auth/configure/section-test.js +++ b/ui/tests/acceptance/settings/auth/configure/section-test.js @@ -35,20 +35,23 @@ module('Acceptance | settings/auth/configure/section', function (hooks) { `The configuration was saved successfully.`, 'success flash shows' ); - let tuneRequest = this.server.passthroughRequests.filterBy('url', `/v1/sys/mounts/auth/${path}/tune`)[0]; - let keys = Object.keys(JSON.parse(tuneRequest.requestBody)); + const tuneRequest = this.server.passthroughRequests.filterBy( + 'url', + `/v1/sys/mounts/auth/${path}/tune` + )[0]; + const keys = Object.keys(JSON.parse(tuneRequest.requestBody)); assert.ok(keys.includes('default_lease_ttl'), 'passes default_lease_ttl on tune'); assert.ok(keys.includes('max_lease_ttl'), 'passes max_lease_ttl on tune'); }); - for (let type of ['aws', 'azure', 'gcp', 'github', 'kubernetes']) { + for (const type of ['aws', 'azure', 'gcp', 'github', 'kubernetes']) { test(`it shows tabs for auth method: ${type}`, async function (assert) { - let path = `${type}-${Date.now()}`; + const path = `${type}-${Date.now()}`; await cli.consoleInput(`write sys/auth/${path} type=${type}`); await cli.enter(); await indexPage.visit({ path }); // aws has 4 tabs, the others will have 'Configuration' and 'Method Options' tabs - let numTabs = type === 'aws' ? 4 : 2; + const numTabs = type === 'aws' ? 4 : 2; assert.strictEqual(page.tabs.length, numTabs, 'shows correct number of tabs'); }); } diff --git a/ui/tests/acceptance/settings/configure-secret-backends/pki/section-cert-test.js b/ui/tests/acceptance/settings/configure-secret-backends/pki/section-cert-test.js index 27d692c198..d569325127 100644 --- a/ui/tests/acceptance/settings/configure-secret-backends/pki/section-cert-test.js +++ b/ui/tests/acceptance/settings/configure-secret-backends/pki/section-cert-test.js @@ -109,7 +109,6 @@ BXUV2Uwtxf+QCphnlht9muX2fsLIzDJea0JipWj1uf2H8OZsjE8= test('cert config: sign intermediate and set signed intermediate', async function (assert) { assert.expect(3); - let csrVal, intermediateCert; const rootPath = await mountAndNav(assert, 'root-'); await page.form.generateCA(); await settled(); @@ -118,7 +117,7 @@ BXUV2Uwtxf+QCphnlht9muX2fsLIzDJea0JipWj1uf2H8OZsjE8= await settled(); // cache csr await click('.masked-input-toggle'); - csrVal = document.querySelector('.masked-value').innerText; + const csrVal = document.querySelector('.masked-value').innerText; await page.form.back(); await settled(); await page.visit({ backend: rootPath }); @@ -130,7 +129,7 @@ BXUV2Uwtxf+QCphnlht9muX2fsLIzDJea0JipWj1uf2H8OZsjE8= assert.dom(SELECTORS.caChain).exists('full CA chain is shown'); assert.dom(SELECTORS.privateKey).doesNotExist('does not display empty private key'); await click('.masked-input-toggle'); - intermediateCert = document.querySelector('[data-test-masked-input]').innerText; + const intermediateCert = document.querySelector('[data-test-masked-input]').innerText; await page.form.back(); await settled(); await page.visit({ backend: intermediatePath }); diff --git a/ui/tests/acceptance/settings/mount-secret-backend-test.js b/ui/tests/acceptance/settings/mount-secret-backend-test.js index 06538cae66..48dd73fd55 100644 --- a/ui/tests/acceptance/settings/mount-secret-backend-test.js +++ b/ui/tests/acceptance/settings/mount-secret-backend-test.js @@ -100,7 +100,7 @@ module('Acceptance | settings/mount-secret-backend', function (hooks) { }); test('version 2 with no update to config endpoint still allows mount of secret engine', async function (assert) { - let enginePath = `kv-noUpdate-${new Date().getTime()}`; + const enginePath = `kv-noUpdate-${new Date().getTime()}`; const V2_POLICY = ` path "${enginePath}/*" { capabilities = ["list","create","read","sudo","delete"] @@ -123,7 +123,7 @@ module('Acceptance | settings/mount-secret-backend', function (hooks) { 'write -field=client_token auth/token/create policies=kv-v2-degrade', ]); await settled(); - let userToken = consoleComponent.lastLogOutput; + const userToken = consoleComponent.lastLogOutput; await logout.visit(); await authPage.login(userToken); // create the engine diff --git a/ui/tests/acceptance/ssh-test.js b/ui/tests/acceptance/ssh-test.js index abbcd91706..07a5d9fee0 100644 --- a/ui/tests/acceptance/ssh-test.js +++ b/ui/tests/acceptance/ssh-test.js @@ -31,7 +31,7 @@ module('Acceptance | ssh secret backend', function (hooks) { }, assertBeforeGenerate(assert) { assert.dom('[data-test-form-field-from-model]').exists('renders the FormFieldFromModel'); - let value = document.querySelector('[data-test-ttl-value="TTL"]').value; + const value = document.querySelector('[data-test-ttl-value="TTL"]').value; // confirms that the actions are correctly being passed down to the FormFieldFromModel component assert.strictEqual(value, '30', 'renders action updateTtl'); }, @@ -99,7 +99,7 @@ module('Acceptance | ssh secret backend', function (hooks) { assert.strictEqual(currentURL(), `/vault/secrets/${sshPath}/list`, `redirects to ssh index`); - for (let role of ROLES) { + for (const role of ROLES) { // create a role await click('[ data-test-secret-create]'); diff --git a/ui/tests/acceptance/transit-test.js b/ui/tests/acceptance/transit-test.js index 4c51f3d0c9..855d7f75f4 100644 --- a/ui/tests/acceptance/transit-test.js +++ b/ui/tests/acceptance/transit-test.js @@ -89,8 +89,8 @@ const keyTypes = [ }, ]; -let generateTransitKey = async function (key, now) { - let name = key.name(now); +const generateTransitKey = async function (key, now) { + const name = key.name(now); await click('[data-test-secret-create]'); await fillIn('[data-test-transit-key-name]', name); @@ -236,7 +236,7 @@ const testConvergentEncryption = async function (assert, keyName) { }, ]; - for (let testCase of tests) { + for (const testCase of tests) { await click('[data-test-transit-action-link="encrypt"]'); find('#plaintext-control .CodeMirror').CodeMirror.setValue(testCase.plaintext); @@ -301,10 +301,10 @@ module('Acceptance | transit', function (hooks) { await settled(); assert.strictEqual(secretListPage.menuItems.length, 2, 'shows 2 items in the menu'); }); - for (let key of keyTypes) { + for (const key of keyTypes) { test(`transit backend: ${key.type}`, async function (assert) { assert.expect(key.convergent ? 43 : 7); - let name = await generateTransitKey(key, now); + const name = await generateTransitKey(key, now); await visit(`vault/secrets/${path}/show/${name}`); const expectedRotateValue = key.autoRotate ? '30 days' : 'Key will not be automatically rotated'; diff --git a/ui/tests/acceptance/wrapped-token-test.js b/ui/tests/acceptance/wrapped-token-test.js index 5f6a052ac5..0dd18d3ca3 100644 --- a/ui/tests/acceptance/wrapped-token-test.js +++ b/ui/tests/acceptance/wrapped-token-test.js @@ -20,7 +20,7 @@ const setupWrapping = async () => { await settled(); await auth.tokenInput('root').submit(); await settled(); - let token = await wrappedAuth(); + const token = await wrappedAuth(); await auth.logout(); await settled(); return token; @@ -29,14 +29,14 @@ module('Acceptance | wrapped_token query param functionality', function (hooks) setupApplicationTest(hooks); test('it authenticates you if the query param is present', async function (assert) { - let token = await setupWrapping(); + const token = await setupWrapping(); await auth.visit({ wrapped_token: token }); await settled(); assert.strictEqual(currentURL(), '/vault/secrets', 'authenticates and redirects to home'); }); test('it authenticates when used with the with=token query param', async function (assert) { - let token = await setupWrapping(); + const token = await setupWrapping(); await auth.visit({ wrapped_token: token, with: 'token' }); await settled(); assert.strictEqual(currentURL(), '/vault/secrets', 'authenticates and redirects to home'); diff --git a/ui/tests/helpers/clients.js b/ui/tests/helpers/clients.js index f2f9dbcaa1..06b3d7e883 100644 --- a/ui/tests/helpers/clients.js +++ b/ui/tests/helpers/clients.js @@ -90,7 +90,7 @@ function generateNamespaceBlock(idx = 0, skipMounts = false) { }; if (!skipMounts) { mountCount = Math.floor((Math.random() + idx) * 20); - let mounts = []; + const mounts = []; Array.from(Array(mountCount)).forEach((v, index) => { mounts.push({ mount_path: `auth/authid${index}`, @@ -123,8 +123,8 @@ function generateCounts(max, arrayLength) { } function generateMonths(startDate, endDate, hasNoData = false) { - let numberOfMonths = differenceInCalendarMonths(endDate, startDate) + 1; - let months = []; + const numberOfMonths = differenceInCalendarMonths(endDate, startDate) + 1; + const months = []; for (let i = 0; i < numberOfMonths; i++) { if (hasNoData) { @@ -196,7 +196,7 @@ export function generateActivityResponse(nsCount = 1, startDate, endDate) { }, }; } - let namespaces = Array.from(Array(nsCount)).map((v, idx) => { + const namespaces = Array.from(Array(nsCount)).map((v, idx) => { return generateNamespaceBlock(idx); }); return { diff --git a/ui/tests/helpers/codemirror.js b/ui/tests/helpers/codemirror.js index 71b5f38bd0..1bfa141f7f 100644 --- a/ui/tests/helpers/codemirror.js +++ b/ui/tests/helpers/codemirror.js @@ -3,12 +3,12 @@ const invariant = (truthy, error) => { }; export default function (context, selector) { - let cmService = context.owner.lookup('service:code-mirror'); + const cmService = context.owner.lookup('service:code-mirror'); - let element = document.querySelector(selector); + const element = document.querySelector(selector); invariant(element, `Selector ${selector} matched no elements`); - let cm = cmService.instanceFor(element.id); + const cm = cmService.instanceFor(element.id); invariant(cm, `No registered CodeMirror instance for ${selector}`); return cm; diff --git a/ui/tests/integration/components/auth-config-form/options-test.js b/ui/tests/integration/components/auth-config-form/options-test.js index bd40cafd70..36a9b6f9c0 100644 --- a/ui/tests/integration/components/auth-config-form/options-test.js +++ b/ui/tests/integration/components/auth-config-form/options-test.js @@ -32,7 +32,7 @@ module('Integration | Component | auth-config-form options', function (hooks) { test('it submits data correctly', async function (assert) { assert.expect(1); - let model = EmberObject.create({ + const model = EmberObject.create({ tune() { return resolve(); }, diff --git a/ui/tests/integration/components/auth-form-test.js b/ui/tests/integration/components/auth-form-test.js index 7a3ef6ef45..9d2084931e 100644 --- a/ui/tests/integration/components/auth-form-test.js +++ b/ui/tests/integration/components/auth-form-test.js @@ -53,7 +53,7 @@ module('Integration | Component | auth form', function (hooks) { test('it renders with vault style errors', async function (assert) { assert.expect(1); - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/auth/**', () => { return [ 400, @@ -77,7 +77,7 @@ module('Integration | Component | auth form', function (hooks) { test('it renders AdapterError style errors', async function (assert) { assert.expect(1); - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/auth/**', () => { return [400, { 'Content-Type': 'application/json' }]; }); @@ -95,12 +95,12 @@ module('Integration | Component | auth form', function (hooks) { }); test('it renders no tabs when no methods are passed', async function (assert) { - let methods = { + const methods = { 'approle/': { type: 'approle', }, }; - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/sys/internal/ui/mounts', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify({ data: { auth: methods } })]; }); @@ -112,7 +112,7 @@ module('Integration | Component | auth form', function (hooks) { }); test('it renders all the supported methods and Other tab when methods are present', async function (assert) { - let methods = { + const methods = { 'foo/': { type: 'userpass', }, @@ -120,7 +120,7 @@ module('Integration | Component | auth form', function (hooks) { type: 'approle', }, }; - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/sys/internal/ui/mounts', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify({ data: { auth: methods } })]; }); @@ -136,13 +136,13 @@ module('Integration | Component | auth form', function (hooks) { }); test('it renders the description', async function (assert) { - let methods = { + const methods = { 'approle/': { type: 'userpass', description: 'app description', }, }; - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/sys/internal/ui/mounts', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify({ data: { auth: methods } })]; }); @@ -162,13 +162,13 @@ module('Integration | Component | auth form', function (hooks) { this.owner.unregister('service:auth'); this.owner.register('service:auth', workingAuthService); this.auth = this.owner.lookup('service:auth'); - let authSpy = sinon.spy(this.auth, 'authenticate'); - let methods = { + const authSpy = sinon.spy(this.auth, 'authenticate'); + const methods = { 'foo/': { type: 'userpass', }, }; - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/sys/internal/ui/mounts', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify({ data: { auth: methods } })]; }); @@ -181,19 +181,19 @@ module('Integration | Component | auth form', function (hooks) { await settled(); assert.ok(authSpy.calledOnce, 'a call to authenticate was made'); - let { data } = authSpy.getCall(0).args[0]; + const { data } = authSpy.getCall(0).args[0]; assert.strictEqual(data.path, 'foo', 'uses the id for the path'); authSpy.restore(); server.shutdown(); }); test('it renders no tabs when no supported methods are present in passed methods', async function (assert) { - let methods = { + const methods = { 'approle/': { type: 'approle', }, }; - let server = new Pretender(function () { + const server = new Pretender(function () { this.get('/v1/sys/internal/ui/mounts', () => { return [200, { 'Content-Type': 'application/json' }, JSON.stringify({ data: { auth: methods } })]; }); @@ -208,8 +208,8 @@ module('Integration | Component | auth form', function (hooks) { test('it makes a request to unwrap if passed a wrappedToken and logs in', async function (assert) { this.owner.register('service:auth', workingAuthService); this.auth = this.owner.lookup('service:auth'); - let authSpy = sinon.spy(this.auth, 'authenticate'); - let server = new Pretender(function () { + const authSpy = sinon.spy(this.auth, 'authenticate'); + const server = new Pretender(function () { this.post('/v1/sys/wrapping/unwrap', () => { return [ 200, @@ -223,7 +223,7 @@ module('Integration | Component | auth form', function (hooks) { }); }); - let wrappedToken = '54321'; + const wrappedToken = '54321'; this.set('wrappedToken', wrappedToken); this.set('cluster', EmberObject.create({})); await render(hbs``); @@ -245,7 +245,7 @@ module('Integration | Component | auth form', function (hooks) { }); test('it shows an error if unwrap errors', async function (assert) { - let server = new Pretender(function () { + const server = new Pretender(function () { this.post('/v1/sys/wrapping/unwrap', () => { return [ 400, diff --git a/ui/tests/integration/components/auth-jwt-test.js b/ui/tests/integration/components/auth-jwt-test.js index ab42543786..fb4e1891a7 100644 --- a/ui/tests/integration/components/auth-jwt-test.js +++ b/ui/tests/integration/components/auth-jwt-test.js @@ -34,11 +34,11 @@ const OIDC_AUTH_RESPONSE = { }; const renderIt = async (context, path = 'jwt') => { - let handler = (data, e) => { + const handler = (data, e) => { if (e && e.preventDefault) e.preventDefault(); return resolve(); }; - let fake = fakeWindow.create(); + const fake = fakeWindow.create(); context.set('window', fake); context.set('handler', sinon.spy(handler)); context.set('roleName', ''); @@ -150,7 +150,7 @@ module('Integration | Component | auth jwt', function (hooks) { return this.openSpy.calledOnce; }); cancelTimers(); - let call = this.openSpy.getCall(0); + const call = this.openSpy.getCall(0); assert.deepEqual( call.args, ['http://example.com', 'vaultOIDCWindow', 'width=500,height=600,resizable,scrollbars=yes,top=0,left=0'], diff --git a/ui/tests/integration/components/chevron-test.js b/ui/tests/integration/components/chevron-test.js index 20cc990839..e16d0049a8 100644 --- a/ui/tests/integration/components/chevron-test.js +++ b/ui/tests/integration/components/chevron-test.js @@ -20,9 +20,9 @@ module('Integration | Component | chevron', function (hooks) { await render(hbs``); assert.dom('.flight-icon').doesNotHaveClass('hs-icon-button-right', 'renders'); - let promise = waitForError(); + const promise = waitForError(); render(hbs``); - let err = await promise; + const err = await promise; assert.ok( err.message.includes('The direction property of { assert.dom(label).hasText(`${dataArray[index].clients}`, 'total value renders correct number'); }); - for (let [i, bar] of actionBars.entries()) { - let percent = Math.round((dataArray[i].clients / totalObject.clients) * 100); + for (const [i, bar] of actionBars.entries()) { + const percent = Math.round((dataArray[i].clients / totalObject.clients) * 100); await triggerEvent(bar, 'mouseover'); - let tooltip = document.querySelector('.ember-modal-dialog'); + const tooltip = document.querySelector('.ember-modal-dialog'); assert.dom(tooltip).includesText(`${percent}%`, 'tooltip renders correct percentage'); } }); @@ -74,10 +74,10 @@ module('Integration | Component | clients/horizontal-bar-chart', function (hooks assert.strictEqual(actionBars.length, dataArray.length, 'renders correct number of hover bars'); assert.strictEqual(dataBars.length, dataArray.length * 2, 'renders correct number of data bars'); - for (let [i, bar] of actionBars.entries()) { - let percent = Math.round((dataArray[i].clients / totalObject.clients) * 100); + for (const [i, bar] of actionBars.entries()) { + const percent = Math.round((dataArray[i].clients / totalObject.clients) * 100); await triggerEvent(bar, 'mouseover'); - let tooltip = document.querySelector('.ember-modal-dialog'); + const tooltip = document.querySelector('.ember-modal-dialog'); assert.dom(tooltip).includesText(`${percent}%`, 'tooltip renders correct percentage'); } }); diff --git a/ui/tests/integration/components/clients/line-chart-test.js b/ui/tests/integration/components/clients/line-chart-test.js index ce6983d96c..930b243678 100644 --- a/ui/tests/integration/components/clients/line-chart-test.js +++ b/ui/tests/integration/components/clients/line-chart-test.js @@ -144,10 +144,10 @@ module('Integration | Component | clients/line-chart', function (hooks) { `); const tooltipHoverCircles = findAll('[data-test-line-chart] circle.hover-circle'); - for (let [i, bar] of tooltipHoverCircles.entries()) { + for (const [i, bar] of tooltipHoverCircles.entries()) { await triggerEvent(bar, 'mouseover'); - let tooltip = document.querySelector('.ember-modal-dialog'); - let { month, clients, new_clients } = tooltipData[i]; + const tooltip = document.querySelector('.ember-modal-dialog'); + const { month, clients, new_clients } = tooltipData[i]; assert .dom(tooltip) .includesText( diff --git a/ui/tests/integration/components/clients/vertical-bar-chart-test.js b/ui/tests/integration/components/clients/vertical-bar-chart-test.js index 8264937635..58831c8725 100644 --- a/ui/tests/integration/components/clients/vertical-bar-chart-test.js +++ b/ui/tests/integration/components/clients/vertical-bar-chart-test.js @@ -38,9 +38,9 @@ module('Integration | Component | clients/vertical-bar-chart', function (hooks) assert.dom(e).hasText(`${barChartData[i].month}`, `renders x-axis label: ${barChartData[i].month}`); }); - for (let [i, bar] of tooltipHoverBars.entries()) { + for (const [i, bar] of tooltipHoverBars.entries()) { await triggerEvent(bar, 'mouseover'); - let tooltip = document.querySelector('.ember-modal-dialog'); + const tooltip = document.querySelector('.ember-modal-dialog'); assert .dom(tooltip) .includesText( @@ -77,9 +77,9 @@ module('Integration | Component | clients/vertical-bar-chart', function (hooks) assert.dom(e).hasText(`${barChartData[i].month}`, `renders x-axis label: ${barChartData[i].month}`); }); - for (let [i, bar] of tooltipHoverBars.entries()) { + for (const [i, bar] of tooltipHoverBars.entries()) { await triggerEvent(bar, 'mouseover'); - let tooltip = document.querySelector('.ember-modal-dialog'); + const tooltip = document.querySelector('.ember-modal-dialog'); assert .dom(tooltip) .includesText( diff --git a/ui/tests/integration/components/confirm-action-test.js b/ui/tests/integration/components/confirm-action-test.js index 3d24e8e571..c665e6ae1b 100644 --- a/ui/tests/integration/components/confirm-action-test.js +++ b/ui/tests/integration/components/confirm-action-test.js @@ -8,7 +8,7 @@ module('Integration | Component | confirm-action', function (hooks) { setupRenderingTest(hooks); test('it renders and on click shows the correct icon', async function (assert) { - let confirmAction = sinon.spy(); + const confirmAction = sinon.spy(); this.set('onConfirm', confirmAction); await render(hbs` { - let modelDefaults = { + const modelDefaults = { approved: false, requestPath: 'foo/bar', id: 'accessor', requestEntity: { id: 'requestor', name: 'entity8509' }, reload: sinon.stub(), }; - let authDataDefaults = { entity_id: 'requestor' }; + const authDataDefaults = { entity_id: 'requestor' }; return { model: { @@ -54,7 +54,7 @@ module('Integration | Component | control group', function (hooks) { }; test('requestor rendering', async function (assert) { - let { model, authData } = setup(); + const { model, authData } = setup(); this.set('model', model); this.set('auth.authData', authData); await render(hbs`{{control-group model=this.model}}`); @@ -68,7 +68,7 @@ module('Integration | Component | control group', function (hooks) { }); test('requestor rendering: with token', async function (assert) { - let { model, authData } = setup(); + const { model, authData } = setup(); this.set('model', model); this.set('auth.authData', authData); this.set('controlGroup.wrapInfo', { token: 'token' }); @@ -78,7 +78,7 @@ module('Integration | Component | control group', function (hooks) { }); test('requestor rendering: some approvals', async function (assert) { - let { model, authData } = setup({ authorizations: [{ name: 'manager 1' }, { name: 'manager 2' }] }); + const { model, authData } = setup({ authorizations: [{ name: 'manager 1' }, { name: 'manager 2' }] }); this.set('model', model); this.set('auth.authData', authData); await render(hbs`{{control-group model=this.model}}`); @@ -86,7 +86,7 @@ module('Integration | Component | control group', function (hooks) { }); test('requestor rendering: approved with no token', async function (assert) { - let { model, authData } = setup({ approved: true }); + const { model, authData } = setup({ approved: true }); this.set('model', model); this.set('auth.authData', authData); await render(hbs`{{control-group model=this.model}}`); @@ -99,7 +99,7 @@ module('Integration | Component | control group', function (hooks) { }); test('requestor rendering: approved with token', async function (assert) { - let { model, authData } = setup({ approved: true }); + const { model, authData } = setup({ approved: true }); this.set('model', model); this.set('auth.authData', authData); this.set('controlGroup.wrapInfo', { token: 'token' }); @@ -110,7 +110,7 @@ module('Integration | Component | control group', function (hooks) { }); test('authorizer rendering', async function (assert) { - let { model, authData } = setup({ canAuthorize: true }, { entity_id: 'manager' }); + const { model, authData } = setup({ canAuthorize: true }, { entity_id: 'manager' }); this.set('model', model); this.set('auth.authData', authData); @@ -131,7 +131,7 @@ module('Integration | Component | control group', function (hooks) { }); test('authorizer rendering:authorized', async function (assert) { - let { model, authData } = setup( + const { model, authData } = setup( { canAuthorize: true, authorizations: [{ id: 'manager', name: 'manager' }] }, { entity_id: 'manager' } ); @@ -146,7 +146,7 @@ module('Integration | Component | control group', function (hooks) { }); test('authorizer rendering: authorized and success', async function (assert) { - let { model, authData } = setup( + const { model, authData } = setup( { approved: true, canAuthorize: true, authorizations: [{ id: 'manager', name: 'manager' }] }, { entity_id: 'manager' } ); @@ -166,7 +166,7 @@ module('Integration | Component | control group', function (hooks) { }); test('third-party: success', async function (assert) { - let { model, authData } = setup( + const { model, authData } = setup( { approved: true, canAuthorize: true, authorizations: [{ id: 'foo', name: 'foo' }] }, { entity_id: 'manager' } ); diff --git a/ui/tests/integration/components/database-role-setting-form-test.js b/ui/tests/integration/components/database-role-setting-form-test.js index fb734d5ec3..139448fa2b 100644 --- a/ui/tests/integration/components/database-role-setting-form-test.js +++ b/ui/tests/integration/components/database-role-setting-form-test.js @@ -112,9 +112,9 @@ module('Integration | Component | database-role-setting-form', function (hooks) /> `); assert.dom('[data-test-component="empty-state"]').doesNotExist('Does not show empty states'); - for (let testCase of testCases) { - let staticFields = getFields(testCase.staticRoleFields); - let dynamicFields = getFields(testCase.dynamicRoleFields); + for (const testCase of testCases) { + const staticFields = getFields(testCase.staticRoleFields); + const dynamicFields = getFields(testCase.dynamicRoleFields); this.set('dbType', testCase.pluginType); this.set('roleType', 'static'); staticFields.show.forEach((attr) => { diff --git a/ui/tests/integration/components/date-dropdown-test.js b/ui/tests/integration/components/date-dropdown-test.js index 84bc300189..c960c48f4e 100644 --- a/ui/tests/integration/components/date-dropdown-test.js +++ b/ui/tests/integration/components/date-dropdown-test.js @@ -45,7 +45,7 @@ module('Integration | Component | date-dropdown', function (hooks) { test('it renders dropdown and selects month and year', async function (assert) { assert.expect(27); - let parentAction = (month, year) => { + const parentAction = (month, year) => { assert.strictEqual(month, 'January', 'sends correct month to parent callback'); assert.strictEqual(year, CURRENT_YEAR, 'sends correct year to parent callback'); }; @@ -65,9 +65,9 @@ module('Integration | Component | date-dropdown', function (hooks) { assert.true(submitButton.disabled, 'button is disabled when no month or year selected'); await click(monthDropdown); - let dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); + const dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); assert.strictEqual(dropdownListMonths.length, 12, 'dropdown has 12 months'); - for (let [index, month] of ARRAY_OF_MONTHS.entries()) { + for (const [index, month] of ARRAY_OF_MONTHS.entries()) { assert.dom(dropdownListMonths[index]).hasText(`${month}`, `dropdown includes ${month}`); } @@ -76,11 +76,11 @@ module('Integration | Component | date-dropdown', function (hooks) { assert.dom('.ember-basic-dropdown-content').doesNotExist('dropdown closes after selecting month'); await click(yearDropdown); - let dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); + const dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); assert.strictEqual(dropdownListYears.length, 5, 'dropdown has 5 years'); - for (let [index, year] of dropdownListYears.entries()) { - let comparisonYear = CURRENT_YEAR - index; + for (const [index, year] of dropdownListYears.entries()) { + const comparisonYear = CURRENT_YEAR - index; assert.dom(year).hasText(`${comparisonYear}`, `dropdown includes ${comparisonYear}`); } @@ -105,18 +105,18 @@ module('Integration | Component | date-dropdown', function (hooks) { for (let i = 0; i < 12; i++) { await click(monthDropdown); - let dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); + const dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); await click(dropdownListMonths[i]); await click(yearDropdown); - let dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); + const dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); if (i < CURRENT_MONTH) { - for (let year of dropdownListYears) { + for (const year of dropdownListYears) { assert.false(year.disabled, `${ARRAY_OF_MONTHS[i]} ${year.innerText} valid`); } } else { - for (let [yearIndex, year] of dropdownListYears.entries()) { + for (const [yearIndex, year] of dropdownListYears.entries()) { if (yearIndex === 0) { assert.true(year.disabled, `${ARRAY_OF_MONTHS[i]} ${year.innerText} disabled`); } else { @@ -141,14 +141,14 @@ module('Integration | Component | date-dropdown', function (hooks) { for (let i = 0; i < 5; i++) { await click(yearDropdown); - let dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); + const dropdownListYears = this.element.querySelectorAll('[data-test-year-list] button'); await click(dropdownListYears[i]); await click(monthDropdown); - let dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); + const dropdownListMonths = this.element.querySelectorAll('[data-test-month-list] button'); if (i === 0) { - for (let [monthIndex, month] of dropdownListMonths.entries()) { + for (const [monthIndex, month] of dropdownListMonths.entries()) { if (monthIndex < CURRENT_MONTH) { assert.false( month.disabled, @@ -162,7 +162,7 @@ module('Integration | Component | date-dropdown', function (hooks) { } } } else { - for (let [monthIndex, month] of dropdownListMonths.entries()) { + for (const [monthIndex, month] of dropdownListMonths.entries()) { assert.false( month.disabled, `${ARRAY_OF_MONTHS[monthIndex]} ${dropdownListYears[i].innerText.trim()} valid` diff --git a/ui/tests/integration/components/diff-version-selector-test.js b/ui/tests/integration/components/diff-version-selector-test.js index c461e60eeb..6145b3cf9c 100644 --- a/ui/tests/integration/components/diff-version-selector-test.js +++ b/ui/tests/integration/components/diff-version-selector-test.js @@ -25,7 +25,7 @@ module('Integration | Component | diff-version-selector', function (hooks) { }) ); await render(hbs``); - let leftSideVersion = document + const leftSideVersion = document .querySelector('[data-test-popup-menu-trigger="left-version"]') .innerText.trim(); assert.strictEqual(leftSideVersion, 'Version 2', 'left side toolbar defaults to currentVersion'); diff --git a/ui/tests/integration/components/edit-form-kmip-role-test.js b/ui/tests/integration/components/edit-form-kmip-role-test.js index 28290e7720..4092527c6e 100644 --- a/ui/tests/integration/components/edit-form-kmip-role-test.js +++ b/ui/tests/integration/components/edit-form-kmip-role-test.js @@ -18,7 +18,7 @@ const namespace = Service.extend({}); const fieldToCheckbox = (field) => ({ name: field, type: 'boolean' }); const createModel = (options) => { - let model = EmberObject.extend(COMPUTEDS, { + const model = EmberObject.extend(COMPUTEDS, { /* eslint-disable ember/avoid-leaking-state-in-ember-objects */ newFields: [ 'role', @@ -68,7 +68,7 @@ module('Integration | Component | edit form kmip role', function (hooks) { }); test('it renders: new model', async function (assert) { - let model = createModel({ isNew: true }); + const model = createModel({ isNew: true }); this.set('model', model); await render(hbs``, this.context); @@ -76,14 +76,14 @@ module('Integration | Component | edit form kmip role', function (hooks) { }); test('it renders: operationAll', async function (assert) { - let model = createModel({ operationAll: true }); + const model = createModel({ operationAll: true }); this.set('model', model); await render(hbs``, this.context); assert.dom('[data-test-input="operationAll"]').isChecked('sets operationAll'); }); test('it renders: operationNone', async function (assert) { - let model = createModel({ operationNone: true }); + const model = createModel({ operationNone: true }); this.set('model', model); await render(hbs``, this.context); @@ -91,7 +91,7 @@ module('Integration | Component | edit form kmip role', function (hooks) { }); test('it renders: choose operations', async function (assert) { - let model = createModel({ operationGet: true }); + const model = createModel({ operationGet: true }); this.set('model', model); await render(hbs``, this.context); @@ -99,7 +99,7 @@ module('Integration | Component | edit form kmip role', function (hooks) { assert.dom('[data-test-input="operationAll"]').isNotChecked('sets operationAll'); }); - let savingTests = [ + const savingTests = [ [ 'setting operationAll', { operationNone: true, operationGet: true }, @@ -150,19 +150,19 @@ module('Integration | Component | edit form kmip role', function (hooks) { 7, ], ]; - for (let testCase of savingTests) { - let [name, initialState, displayClicks, stateBeforeSave, stateAfterSave, assertionCount] = testCase; + for (const testCase of savingTests) { + const [name, initialState, displayClicks, stateBeforeSave, stateAfterSave, assertionCount] = testCase; test(name, async function (assert) { assert.expect(assertionCount); - let model = createModel(initialState); + const model = createModel(initialState); this.set('model', model); - let clickTargets = displayClicks.split(','); + const clickTargets = displayClicks.split(','); await render(hbs``, this.context); - for (let clickTarget of clickTargets) { + for (const clickTarget of clickTargets) { await click(`label[for=${clickTarget}]`); } - for (let beforeStateKey of Object.keys(stateBeforeSave)) { + for (const beforeStateKey of Object.keys(stateBeforeSave)) { assert.strictEqual( model.get(beforeStateKey), stateBeforeSave[beforeStateKey], @@ -174,7 +174,7 @@ module('Integration | Component | edit form kmip role', function (hooks) { later(() => cancelTimers(), 50); return settled().then(() => { - for (let afterStateKey of Object.keys(stateAfterSave)) { + for (const afterStateKey of Object.keys(stateAfterSave)) { assert.strictEqual( model.get(afterStateKey), stateAfterSave[afterStateKey], diff --git a/ui/tests/integration/components/edit-form-test.js b/ui/tests/integration/components/edit-form-test.js index d3baef4b7f..0dd87ac188 100644 --- a/ui/tests/integration/components/edit-form-test.js +++ b/ui/tests/integration/components/edit-form-test.js @@ -52,12 +52,12 @@ module('Integration | Component | edit form', function (hooks) { test('it calls flash message fns on save', async function (assert) { assert.expect(4); - let onSave = () => { + const onSave = () => { return resolve(); }; this.set('model', createModel()); this.set('onSave', onSave); - let saveSpy = sinon.spy(this, 'onSave'); + const saveSpy = sinon.spy(this, 'onSave'); await render(hbs`{{edit-form model=this.model onSave=this.onSave}}`); @@ -67,7 +67,7 @@ module('Integration | Component | edit form', function (hooks) { assert.ok(saveSpy.calledOnce, 'calls passed onSave'); assert.strictEqual(saveSpy.getCall(0).args[0].saveType, 'save'); assert.deepEqual(saveSpy.getCall(0).args[0].model, this.model, 'passes model to onSave'); - let flash = this.owner.lookup('service:flash-messages'); + const flash = this.owner.lookup('service:flash-messages'); assert.strictEqual(flash.success.callCount, 1, 'calls flash message success'); }); }); diff --git a/ui/tests/integration/components/form-field-test.js b/ui/tests/integration/components/form-field-test.js index 6c97ab5666..d2a10f6289 100644 --- a/ui/tests/integration/components/form-field-test.js +++ b/ui/tests/integration/components/form-field-test.js @@ -21,8 +21,8 @@ module('Integration | Component | form field', function (hooks) { }; const setup = async function (attr) { - let model = EmberObject.create({}); - let spy = sinon.spy(); + const model = EmberObject.create({}); + const spy = sinon.spy(); this.set('onChange', spy); this.set('model', model); this.set('attr', attr); @@ -31,7 +31,7 @@ module('Integration | Component | form field', function (hooks) { }; test('it renders', async function (assert) { - let model = EmberObject.create({}); + const model = EmberObject.create({}); this.attr = { name: 'foo' }; this.model = model; await render(hbs``); @@ -40,7 +40,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: string', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', 'string', { defaultValue: 'default' })); + const [model, spy] = await setup.call(this, createAttr('foo', 'string', { defaultValue: 'default' })); assert.strictEqual(component.fields.objectAt(0).labelText[0], 'Foo', 'renders a label'); assert.strictEqual(component.fields.objectAt(0).inputValue, 'default', 'renders default value'); assert.ok(component.hasInput, 'renders input for string'); @@ -51,7 +51,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: boolean', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', 'boolean', { defaultValue: false })); + const [model, spy] = await setup.call(this, createAttr('foo', 'boolean', { defaultValue: false })); assert.strictEqual(component.fields.objectAt(0).labelText[0], 'Foo', 'renders a label'); assert.notOk(component.fields.objectAt(0).inputChecked, 'renders default value'); assert.ok(component.hasCheckbox, 'renders a checkbox for boolean'); @@ -62,7 +62,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: number', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', 'number', { defaultValue: 5 })); + const [model, spy] = await setup.call(this, createAttr('foo', 'number', { defaultValue: 5 })); assert.strictEqual(component.fields.objectAt(0).labelText[0], 'Foo', 'renders a label'); assert.strictEqual(component.fields.objectAt(0).inputValue, '5', 'renders default value'); assert.ok(component.hasInput, 'renders input for number'); @@ -86,7 +86,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: editType textarea', async function (assert) { - let [model, spy] = await setup.call( + const [model, spy] = await setup.call( this, createAttr('foo', 'string', { defaultValue: 'goodbye', editType: 'textarea' }) ); @@ -110,7 +110,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: editType ttl', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', null, { editType: 'ttl' })); + const [model, spy] = await setup.call(this, createAttr('foo', null, { editType: 'ttl' })); assert.ok(component.hasTTLPicker, 'renders the ttl-picker component'); await component.fields.objectAt(0).toggleTtl(); await component.fields.objectAt(0).select('h').change(); @@ -121,7 +121,10 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: editType ttl without toggle', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', null, { editType: 'ttl', hideToggle: true })); + const [model, spy] = await setup.call( + this, + createAttr('foo', null, { editType: 'ttl', hideToggle: true }) + ); await component.fields.objectAt(0).select('h').change(); await component.fields.objectAt(0).ttlTime('3'); const expectedSeconds = `${3 * 3600}s`; @@ -130,7 +133,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: radio buttons for possible values', async function (assert) { - let [model, spy] = await setup.call( + const [model, spy] = await setup.call( this, createAttr('foo', null, { editType: 'radio', possibleValues: ['SHA1', 'SHA256'] }) ); @@ -142,7 +145,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: editType stringArray', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('foo', 'string', { editType: 'stringArray' })); + const [model, spy] = await setup.call(this, createAttr('foo', 'string', { editType: 'stringArray' })); assert.ok(component.hasStringList, 'renders the string-list component'); await component.fields.objectAt(0).textarea('array').change(); @@ -151,7 +154,7 @@ module('Integration | Component | form field', function (hooks) { }); test('it renders: sensitive', async function (assert) { - let [model, spy] = await setup.call(this, createAttr('password', 'string', { sensitive: true })); + const [model, spy] = await setup.call(this, createAttr('password', 'string', { sensitive: true })); assert.ok(component.hasMaskedInput, 'renders the masked-input component'); await component.fields.objectAt(0).textarea('secret'); assert.strictEqual(model.get('password'), 'secret'); diff --git a/ui/tests/integration/components/icon-test.js b/ui/tests/integration/components/icon-test.js index aa27db336d..6b70ab4bf7 100644 --- a/ui/tests/integration/components/icon-test.js +++ b/ui/tests/integration/components/icon-test.js @@ -24,9 +24,9 @@ module('Integration | Component | icon', function (hooks) { await render(hbs``); assert.dom('.hs-icon').hasClass('hs-icon-xl', 'adds the larger size class'); - let promise = waitForError(); + const promise = waitForError(); render(hbs``); - let err = await promise; + const err = await promise; assert.strictEqual( err.message, 'Assertion Failed: Icon component size argument must be either "16" or "24"', diff --git a/ui/tests/integration/components/identity/item-details-test.js b/ui/tests/integration/components/identity/item-details-test.js index f6cfee43dd..cef93efd7e 100644 --- a/ui/tests/integration/components/identity/item-details-test.js +++ b/ui/tests/integration/components/identity/item-details-test.js @@ -18,7 +18,7 @@ module('Integration | Component | identity/item details', function (hooks) { }); test('it renders the disabled warning', async function (assert) { - let model = EmberObject.create({ + const model = EmberObject.create({ save() { return resolve(); }, @@ -35,7 +35,7 @@ module('Integration | Component | identity/item details', function (hooks) { }); test('it does not render the button if canEdit is false', async function (assert) { - let model = EmberObject.create({ + const model = EmberObject.create({ disabled: true, }); @@ -46,7 +46,7 @@ module('Integration | Component | identity/item details', function (hooks) { }); test('it does not render the banner when item is enabled', async function (assert) { - let model = EmberObject.create(); + const model = EmberObject.create(); this.set('model', model); await render(hbs`{{identity/item-details model=this.model}}`); diff --git a/ui/tests/integration/components/info-table-item-array-test.js b/ui/tests/integration/components/info-table-item-array-test.js index e5e5ac29bc..ab2fc4bdb5 100644 --- a/ui/tests/integration/components/info-table-item-array-test.js +++ b/ui/tests/integration/components/info-table-item-array-test.js @@ -68,7 +68,7 @@ module('Integration | Component | InfoTableItemArray', function (hooks) { />`); assert.dom('[data-test-info-table-item-array]').exists(); - let noLinkString = document.querySelector('code').textContent.trim(); + const noLinkString = document.querySelector('code').textContent.trim(); assert.strictEqual( noLinkString.length, DISPLAY_ARRAY.toString().length, diff --git a/ui/tests/integration/components/info-table-row-test.js b/ui/tests/integration/components/info-table-row-test.js index 09c1913d0f..281a1f77e6 100644 --- a/ui/tests/integration/components/info-table-row-test.js +++ b/ui/tests/integration/components/info-table-row-test.js @@ -66,7 +66,7 @@ module('Integration | Component | InfoTableRow', function (hooks) { await triggerEvent('[data-test-value-div="test label"] .ember-basic-dropdown-trigger', 'mouseenter'); - let tooltip = document.querySelector('div.box').textContent.trim(); + const tooltip = document.querySelector('div.box').textContent.trim(); assert.strictEqual(tooltip, 'Tooltip text!', 'renders tooltip text'); }); @@ -147,7 +147,7 @@ module('Integration | Component | InfoTableRow', function (hooks) { this.set('value', ''); this.set('label', ''); this.set('default', ''); - let dashCount = document.querySelectorAll('.flight-icon').length; + const dashCount = document.querySelectorAll('.flight-icon').length; assert.strictEqual( dashCount, 2, @@ -163,7 +163,7 @@ module('Integration | Component | InfoTableRow', function (hooks) { Block content is here `); - let block = document.querySelector('[data-test-value-div]').textContent.trim(); + const block = document.querySelector('[data-test-value-div]').textContent.trim(); assert.strictEqual(block, 'Block content is here', 'renders block passed through'); }); @@ -254,7 +254,7 @@ module('Integration | Component | InfoTableRow', function (hooks) { }); test('Formats the value as date when formatDate present', async function (assert) { - let yearString = new Date().getFullYear().toString(); + const yearString = new Date().getFullYear().toString(); this.set('value', new Date()); await render(hbs` f.featureStatus === 'Active'); + const activeFeatures = component.featureRows.filter((f) => f.featureStatus === 'Active'); assert.strictEqual(activeFeatures.length, 2, 'Has two features listed as active'); }); @@ -49,7 +49,7 @@ module('Integration | Component | license info', function (hooks) { @autoloaded={{true}} />` ); - let row = component.detailRows.filterBy('rowName', 'License state')[0]; + const row = component.detailRows.filterBy('rowName', 'License state')[0]; assert.strictEqual(row.rowValue, 'Autoloaded', 'Shows autoloaded status'); }); @@ -65,7 +65,7 @@ module('Integration | Component | license info', function (hooks) { hbs`` ); - let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; + const row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; assert.strictEqual( row.featureStatus, 'Not Active', @@ -91,7 +91,7 @@ module('Integration | Component | license info', function (hooks) { />` ); - let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; + const row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; assert.strictEqual( row.featureStatus, 'Active — 4 standby nodes allotted', diff --git a/ui/tests/integration/components/masked-input-test.js b/ui/tests/integration/components/masked-input-test.js index 11f7bf5214..74507a12b0 100644 --- a/ui/tests/integration/components/masked-input-test.js +++ b/ui/tests/integration/components/masked-input-test.js @@ -73,11 +73,11 @@ module('Integration | Component | masked input', function (hooks) { test('it shortens all outputs when displayOnly and masked', async function (assert) { this.set('value', '123456789-123456789-123456789'); await render(hbs`{{masked-input value=this.value displayOnly=true}}`); - let maskedValue = document.querySelector('.masked-value').innerText; + const maskedValue = document.querySelector('.masked-value').innerText; assert.strictEqual(maskedValue.length, 11); await component.toggleMasked(); - let unMaskedValue = document.querySelector('.masked-value').innerText; + const unMaskedValue = document.querySelector('.masked-value').innerText; assert.strictEqual(unMaskedValue.length, this.value.length); }); @@ -94,7 +94,7 @@ module('Integration | Component | masked input', function (hooks) { await render(hbs`{{masked-input value=this.value}}`); await triggerKeyEvent('[data-test-textarea]', 'keydown', 9); await component.toggleMasked(); - let unMaskedValue = document.querySelector('.masked-value').value; + const unMaskedValue = document.querySelector('.masked-value').value; assert.strictEqual(unMaskedValue, this.value); }); }); diff --git a/ui/tests/integration/components/mfa-form-test.js b/ui/tests/integration/components/mfa-form-test.js index 415638b453..11010228f1 100644 --- a/ui/tests/integration/components/mfa-form-test.js +++ b/ui/tests/integration/components/mfa-form-test.js @@ -177,7 +177,7 @@ module('Integration | Component | mfa-form', function (hooks) { 'maximum TOTP validation attempts 4 exceeded the allowed attempts 3. Please try again in 15 seconds', }; const codes = ['used', 'limit']; - for (let code of codes) { + for (const code of codes) { this.owner.lookup('service:auth').reopen({ totpValidate() { throw { errors: [messages[code]] }; diff --git a/ui/tests/integration/components/mfa/method-form-test.js b/ui/tests/integration/components/mfa/method-form-test.js index 269e37e16c..160f9c8169 100644 --- a/ui/tests/integration/components/mfa/method-form-test.js +++ b/ui/tests/integration/components/mfa/method-form-test.js @@ -75,7 +75,7 @@ module('Integration | Component | mfa-method-form', function (hooks) { `); assert.dom('[data-test-input="issuer"]').hasValue('Vault', 'Issuer input is populated'); assert.dom('[data-test-ttl-value="Period"]').hasValue('30', 'Period input ttl is populated'); - let checkedAlgorithm = this.element.querySelector('input[name=algorithm]:checked'); + const checkedAlgorithm = this.element.querySelector('input[name=algorithm]:checked'); assert.dom(checkedAlgorithm).hasValue('SHA512', 'SHA512 radio input is selected'); }); }); diff --git a/ui/tests/integration/components/mount-accessor-select-test.js b/ui/tests/integration/components/mount-accessor-select-test.js index d6a64bbaab..da93cb928f 100644 --- a/ui/tests/integration/components/mount-accessor-select-test.js +++ b/ui/tests/integration/components/mount-accessor-select-test.js @@ -28,14 +28,14 @@ module('Integration | Component | mount-accessor-select', function (hooks) { test('it filters token', async function (assert) { await render(hbs``); await click('[data-test-mount-accessor-select]'); - let options = document.querySelector('[data-test-mount-accessor-select]').options; + const options = document.querySelector('[data-test-mount-accessor-select]').options; assert.strictEqual(options.length, 1, 'only the auth option, no token'); }); test('it shows token', async function (assert) { await render(hbs``); await click('[data-test-mount-accessor-select]'); - let options = document.querySelector('[data-test-mount-accessor-select]').options; + const options = document.querySelector('[data-test-mount-accessor-select]').options; assert.strictEqual(options.length, 2, 'both auth and token show'); }); @@ -50,14 +50,14 @@ module('Integration | Component | mount-accessor-select', function (hooks) { test('it selects the first option if no default', async function (assert) { await render(hbs``); - let defaultSelection = document.querySelector('[data-test-mount-accessor-select]').options[0].innerHTML; + const defaultSelection = document.querySelector('[data-test-mount-accessor-select]').options[0].innerHTML; // remove all non letters assert.strictEqual(defaultSelection.replace(/\W/g, ''), 'userpassuserpass'); }); test('it shows Select one if yes default', async function (assert) { await render(hbs``); - let defaultSelection = document.querySelector('[data-test-mount-accessor-select]').options[0].innerHTML; + const defaultSelection = document.querySelector('[data-test-mount-accessor-select]').options[0].innerHTML; // remove all non letters assert.strictEqual(defaultSelection.replace(/\W/g, ''), 'Selectone'); }); diff --git a/ui/tests/integration/components/mount-backend-form-test.js b/ui/tests/integration/components/mount-backend-form-test.js index dfa9b20823..3b227971ee 100644 --- a/ui/tests/integration/components/mount-backend-form-test.js +++ b/ui/tests/integration/components/mount-backend-form-test.js @@ -69,7 +69,7 @@ module('Integration | Component | mount backend form', function (hooks) { later(() => cancelTimers(), 50); await settled(); - let enableRequest = this.server.handledRequests.findBy('url', '/v1/sys/auth/foo'); + const enableRequest = this.server.handledRequests.findBy('url', '/v1/sys/auth/foo'); assert.ok(enableRequest, 'it calls enable on an auth method'); assert.ok(spy.calledOnce, 'calls the passed success method'); }); diff --git a/ui/tests/integration/components/oidc/client-form-test.js b/ui/tests/integration/components/oidc/client-form-test.js index e6b05de71c..1892718409 100644 --- a/ui/tests/integration/components/oidc/client-form-test.js +++ b/ui/tests/integration/components/oidc/client-form-test.js @@ -91,7 +91,7 @@ module('Integration | Component | oidc/client-form', function (hooks) { await click('[data-test-selected-list-button="delete"]'); await click(SELECTORS.clientSaveButton); - let validationErrors = findAll(SELECTORS.inlineAlert); + const validationErrors = findAll(SELECTORS.inlineAlert); assert .dom(validationErrors[0]) .hasText('Name is required. Name cannot contain whitespace.', 'Validation messages are shown for name'); diff --git a/ui/tests/integration/components/oidc/key-form-test.js b/ui/tests/integration/components/oidc/key-form-test.js index 3016e36233..14a9f3da35 100644 --- a/ui/tests/integration/components/oidc/key-form-test.js +++ b/ui/tests/integration/components/oidc/key-form-test.js @@ -54,7 +54,7 @@ module('Integration | Component | oidc/key-form', function (hooks) { await fillIn('[data-test-input="name"]', ' '); await click(SELECTORS.keySaveButton); - let validationErrors = findAll(SELECTORS.inlineAlert); + const validationErrors = findAll(SELECTORS.inlineAlert); assert .dom(validationErrors[0]) .hasText('Name is required. Name cannot contain whitespace.', 'Validation messages are shown for name'); diff --git a/ui/tests/integration/components/oidc/provider-form-test.js b/ui/tests/integration/components/oidc/provider-form-test.js index 92492edc2f..0820efb8b1 100644 --- a/ui/tests/integration/components/oidc/provider-form-test.js +++ b/ui/tests/integration/components/oidc/provider-form-test.js @@ -77,7 +77,7 @@ module('Integration | Component | oidc/provider-form', function (hooks) { await fillIn('[data-test-input="name"]', ' '); await click(SELECTORS.providerSaveButton); - let validationErrors = findAll(SELECTORS.inlineAlert); + const validationErrors = findAll(SELECTORS.inlineAlert); assert .dom(validationErrors[0]) .hasText('Name is required. Name cannot contain whitespace.', 'Validation messages are shown for name'); diff --git a/ui/tests/integration/components/oidc/scope-form-test.js b/ui/tests/integration/components/oidc/scope-form-test.js index fe84a259b8..b26f8815e0 100644 --- a/ui/tests/integration/components/oidc/scope-form-test.js +++ b/ui/tests/integration/components/oidc/scope-form-test.js @@ -40,7 +40,7 @@ module('Integration | Component | oidc/scope-form', function (hooks) { // check validation errors await click(SELECTORS.scopeSaveButton); - let validationErrors = findAll(SELECTORS.inlineAlert); + const validationErrors = findAll(SELECTORS.inlineAlert); assert.dom(validationErrors[0]).hasText('Name is required.', 'Validation messages are shown for name'); assert.dom(validationErrors[1]).hasText('There is an error with this form.', 'Renders form error count'); diff --git a/ui/tests/integration/components/path-filter-config-list-test.js b/ui/tests/integration/components/path-filter-config-list-test.js index a15b17a2e3..5a7f7371bb 100644 --- a/ui/tests/integration/components/path-filter-config-list-test.js +++ b/ui/tests/integration/components/path-filter-config-list-test.js @@ -35,7 +35,7 @@ module('Integration | Component | path filter config list', function (hooks) { hooks.beforeEach(function () { this.context = { owner: this.engine }; // this.engine set by setupEngine - let ajaxStub = sinon.stub().usingPromise(Promise); + const ajaxStub = sinon.stub().usingPromise(Promise); ajaxStub.withArgs('/v1/sys/internal/ui/mounts', 'GET').resolves(MOUNTS_RESPONSE); ajaxStub .withArgs('/v1/sys/internal/ui/mounts', 'GET', { namespace: 'ns1' }) diff --git a/ui/tests/integration/components/pgp-list-test.js b/ui/tests/integration/components/pgp-list-test.js index d6af45042d..8870b5a0f2 100644 --- a/ui/tests/integration/components/pgp-list-test.js +++ b/ui/tests/integration/components/pgp-list-test.js @@ -31,7 +31,7 @@ module('Integration | Component | pgp list', function (hooks) { test('onDataUpdate is called properly', async function (assert) { this.set('spy', sinon.spy()); - let event = fileEvent(); + const event = fileEvent(); await render(hbs``); triggerEvent('[data-test-pgp-file-input]', ...event); @@ -40,7 +40,7 @@ module('Integration | Component | pgp list', function (hooks) { await waitUntil(() => { return !!this.spy.calledOnce; }); - let expected = [btoa(data)]; + const expected = [btoa(data)]; assert.deepEqual( this.spy.getCall(0).args[0], expected, @@ -59,7 +59,7 @@ module('Integration | Component | pgp list', function (hooks) { await waitUntil(() => { return !!this.spy.calledOnce; }); - let expected = [btoa(data), '', '']; + const expected = [btoa(data), '', '']; assert.deepEqual( this.spy.getCall(0).args[0], expected, @@ -71,7 +71,7 @@ module('Integration | Component | pgp list', function (hooks) { await waitUntil(() => { return !!this.spy.calledTwice; }); - let expected2 = [btoa(data), '', btoa(data)]; + const expected2 = [btoa(data), '', btoa(data)]; assert.deepEqual( this.spy.getCall(1).args[0], expected2, @@ -81,7 +81,7 @@ module('Integration | Component | pgp list', function (hooks) { // this will trim off the last input which was filled, so we should only have one file in the array // now this.set('listLength', 2); - let expected3 = [btoa(data), '']; + const expected3 = [btoa(data), '']; assert.deepEqual( this.spy.getCall(2).args[0], expected3, @@ -100,7 +100,7 @@ module('Integration | Component | pgp list', function (hooks) { await waitUntil(() => { return !!this.spy.calledOnce; }); - let expected = [btoa(data), '', '']; + const expected = [btoa(data), '', '']; assert.deepEqual( this.spy.getCall(0).args[0], expected, @@ -112,7 +112,7 @@ module('Integration | Component | pgp list', function (hooks) { await waitUntil(() => { return !!this.spy.calledTwice; }); - let expected2 = [btoa(data), '', btoa(data)]; + const expected2 = [btoa(data), '', btoa(data)]; assert.deepEqual( this.spy.getCall(1).args[0], expected2, @@ -121,7 +121,7 @@ module('Integration | Component | pgp list', function (hooks) { // this will add a couple of inputs but should keep the existing 3 this.set('listLength', 5); - let expected3 = [btoa(data), '', btoa(data), '', '']; + const expected3 = [btoa(data), '', btoa(data), '', '']; assert.deepEqual( this.spy.getCall(2).args[0], expected3, diff --git a/ui/tests/integration/components/pki/config-pki-test.js b/ui/tests/integration/components/pki/config-pki-test.js index 62cf6fd75b..1ed31298c5 100644 --- a/ui/tests/integration/components/pki/config-pki-test.js +++ b/ui/tests/integration/components/pki/config-pki-test.js @@ -132,7 +132,7 @@ module('Integration | Component | config pki', function (hooks) { test('it correctly sets toggle when initial CRL config is disable=true', async function (assert) { assert.expect(3); // change default config attrs - let configDisabled = this.config; + const configDisabled = this.config; configDisabled.expiry = '1m'; configDisabled.disable = true; await setupAndRender(this, configDisabled, 'crl'); diff --git a/ui/tests/integration/components/pki/pki-key-usage-test.js b/ui/tests/integration/components/pki/pki-key-usage-test.js index b1c7ddc816..1a332c7b9e 100644 --- a/ui/tests/integration/components/pki/pki-key-usage-test.js +++ b/ui/tests/integration/components/pki/pki-key-usage-test.js @@ -37,7 +37,7 @@ module('Integration | Component | pki-key-usage', function (hooks) { assert.dom(SELECTORS.extKeyUsageOids).exists('Extended Key usage oids renders'); // check is flexbox by checking the height of the box - let groupBoxHeight = document.querySelector('[data-test-surrounding-div="Key usage"]').clientHeight; + const groupBoxHeight = document.querySelector('[data-test-surrounding-div="Key usage"]').clientHeight; assert.strictEqual( groupBoxHeight, 518, diff --git a/ui/tests/integration/components/pki/radio-select-ttl-or-string-test.js b/ui/tests/integration/components/pki/radio-select-ttl-or-string-test.js index 8495fcbfc2..2e0697c4a6 100644 --- a/ui/tests/integration/components/pki/radio-select-ttl-or-string-test.js +++ b/ui/tests/integration/components/pki/radio-select-ttl-or-string-test.js @@ -34,7 +34,7 @@ module('Integration | Component | radio-select-ttl-or-string', function (hooks) { owner: this.engine } ); assert.dom('[data-test-input="ttl"]').exists('shows the TTL component'); - let inputValue = document.querySelector('[data-test-ttl-value="TTL"]').value; + const inputValue = document.querySelector('[data-test-ttl-value="TTL"]').value; assert.strictEqual(inputValue, '', 'default TTL is empty'); assert.dom('[data-test-radio-button="ttl"]').isChecked('ttl is selected by default'); }); diff --git a/ui/tests/integration/components/radial-progress-test.js b/ui/tests/integration/components/radial-progress-test.js index 9f4852aedb..e6a5b3140b 100644 --- a/ui/tests/integration/components/radial-progress-test.js +++ b/ui/tests/integration/components/radial-progress-test.js @@ -13,7 +13,7 @@ module('Integration | Component | radial progress', function (hooks) { test('it renders', async function (assert) { // We have to manually round the circumference, strokeDash, and strokeDashOffset because // ie11 truncates decimals differently than other browsers. - let circumference = ((19 / 2) * Math.PI * 2).toFixed(2); + const circumference = ((19 / 2) * Math.PI * 2).toFixed(2); await render(hbs`{{radial-progress progressDecimal=0.5}}`); assert.strictEqual(component.viewBox, '0 0 20 20'); diff --git a/ui/tests/integration/components/raft-join-test.js b/ui/tests/integration/components/raft-join-test.js index cf0ab01ad8..fd85ebb241 100644 --- a/ui/tests/integration/components/raft-join-test.js +++ b/ui/tests/integration/components/raft-join-test.js @@ -26,7 +26,7 @@ module('Integration | Component | raft-join', function (hooks) { }); test('it calls onDismiss when a user chooses to init', async function (assert) { - let spy = sinon.spy(); + const spy = sinon.spy(); this.set('onDismiss', spy); await render(hbs``); diff --git a/ui/tests/integration/components/regex-validator-test.js b/ui/tests/integration/components/regex-validator-test.js index 5cfe419b3e..0256b923f5 100644 --- a/ui/tests/integration/components/regex-validator-test.js +++ b/ui/tests/integration/components/regex-validator-test.js @@ -9,10 +9,10 @@ module('Integration | Component | regex-validator', function (hooks) { setupRenderingTest(hooks); test('it renders input and validation messages', async function (assert) { - let attr = EmberObject.create({ + const attr = EmberObject.create({ name: 'example', }); - let spy = sinon.spy(); + const spy = sinon.spy(); this.set('onChange', spy); this.set('attr', attr); this.set('value', '(\\d{4})'); diff --git a/ui/tests/integration/components/replication-actions-test.js b/ui/tests/integration/components/replication-actions-test.js index aa53f4bb39..87ac539e89 100644 --- a/ui/tests/integration/components/replication-actions-test.js +++ b/ui/tests/integration/components/replication-actions-test.js @@ -38,7 +38,7 @@ module('Integration | Component | replication actions', function (hooks) { }); }); const confirmInput = (confirmText) => fillIn('[data-test-confirmation-modal-input]', confirmText); - let testCases = [ + const testCases = [ [ 'dr', 'primary', @@ -127,7 +127,7 @@ module('Integration | Component | replication actions', function (hooks) { ], ]; - for (let [ + for (const [ replicationMode, clusterMode, action, @@ -176,7 +176,7 @@ module('Integration | Component | replication actions', function (hooks) { ` ); - let selector = oldVersion ? 'h4' : `[data-test-${action}-replication] h4`; + const selector = oldVersion ? 'h4' : `[data-test-${action}-replication] h4`; assert .dom(selector) .hasText(headerText, `${testKey}: renders the correct component header (${oldVersion})`); diff --git a/ui/tests/integration/components/search-select-test.js b/ui/tests/integration/components/search-select-test.js index c182421929..685093159b 100644 --- a/ui/tests/integration/components/search-select-test.js +++ b/ui/tests/integration/components/search-select-test.js @@ -67,7 +67,7 @@ module('Integration | Component | search select', function (hooks) { hooks.beforeEach(function () { const mockFunctionFromParent = (selection, dropdownOptions) => { - let modelExists = + const modelExists = !!dropdownOptions.findBy('id', selection) || !!dropdownOptions.findBy('uuid', selection) || isWildcardString([selection]); @@ -491,7 +491,7 @@ module('Integration | Component | search select', function (hooks) { const models = ['server/error']; this.set('models', models); this.set('onChange', sinon.spy()); - let promise = waitForError(); + const promise = waitForError(); await render(hbs` `); - let err = await promise; + const err = await promise; assert.ok(err.message.includes('internal server error'), 'it throws an internal server error'); }); diff --git a/ui/tests/integration/components/secret-edit-test.js b/ui/tests/integration/components/secret-edit-test.js index bd2294b616..ad34894c25 100644 --- a/ui/tests/integration/components/secret-edit-test.js +++ b/ui/tests/integration/components/secret-edit-test.js @@ -60,7 +60,7 @@ module('Integration | Component | secret edit', function (hooks) { await render(hbs`{{secret-edit mode=this.mode model=this.model preferAdvancedEdit=true }}`); - let instance = document.querySelector('.CodeMirror').CodeMirror; + const instance = document.querySelector('.CodeMirror').CodeMirror; instance.setValue(JSON.stringify([{ foo: 'bar' }])); await settled(); assert.dom('[data-test-error]').includesText('Vault expects data to be formatted as an JSON object'); @@ -96,7 +96,7 @@ module('Integration | Component | secret edit', function (hooks) { await render(hbs`{{secret-edit mode=this.mode model=this.model preferAdvancedEdit=true }}`); - let instance = document.querySelector('.CodeMirror').CodeMirror; + const instance = document.querySelector('.CodeMirror').CodeMirror; instance.setValue(JSON.stringify([{ foo: 'bar' }])); await settled(); assert.dom('[data-test-error]').includesText('Vault expects data to be formatted as an JSON object'); diff --git a/ui/tests/integration/components/secret-list-header-test.js b/ui/tests/integration/components/secret-list-header-test.js index 7d172ec2fb..6aba9865a4 100644 --- a/ui/tests/integration/components/secret-list-header-test.js +++ b/ui/tests/integration/components/secret-list-header-test.js @@ -16,7 +16,7 @@ module('Integration | Component | secret-list-header', function (hooks) { this.server.post('/sys/capabilities-self', () => {}); - for (let type of backends) { + for (const type of backends) { const data = this.server.create('secret-engine', 2, { type }); this.model = mirageToModels(data); await render(hbs` diff --git a/ui/tests/integration/components/selectable-card-test.js b/ui/tests/integration/components/selectable-card-test.js index 41810a00cb..014ea935b2 100644 --- a/ui/tests/integration/components/selectable-card-test.js +++ b/ui/tests/integration/components/selectable-card-test.js @@ -16,14 +16,14 @@ module('Integration | Component selectable-card', function (hooks) { test('it shows the card total', async function (assert) { await render(hbs``); - let titleNumber = this.element.querySelector('.title-number').innerText; + const titleNumber = this.element.querySelector('.title-number').innerText; assert.strictEqual(titleNumber, '15'); }); test('it returns card title, ', async function (assert) { await render(hbs``); - let titleText = this.element.querySelector('.title').innerText; + const titleText = this.element.querySelector('.title').innerText; assert.strictEqual(titleText, 'Connections'); }); }); diff --git a/ui/tests/integration/components/shamir-flow-test.js b/ui/tests/integration/components/shamir-flow-test.js index 18939d49db..5e18ae67dc 100644 --- a/ui/tests/integration/components/shamir-flow-test.js +++ b/ui/tests/integration/components/shamir-flow-test.js @@ -6,13 +6,13 @@ import { setupRenderingTest } from 'ember-qunit'; import { render, click } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; -let response = { +const response = { progress: 1, required: 3, complete: false, }; -let adapter = { +const adapter = { foo() { return resolve(response); }, diff --git a/ui/tests/integration/components/stat-text-test.js b/ui/tests/integration/components/stat-text-test.js index 6462f7dff9..f850fbf448 100644 --- a/ui/tests/integration/components/stat-text-test.js +++ b/ui/tests/integration/components/stat-text-test.js @@ -28,7 +28,7 @@ module('Integration | Component | StatText', function (hooks) { this.set('value', 604099); await settled(); - let formattedNumber = '604,099'; + const formattedNumber = '604,099'; assert.dom('.stat-value').hasText(formattedNumber, 'renders correctly formatted integer value'); }); }); diff --git a/ui/tests/integration/components/string-list-test.js b/ui/tests/integration/components/string-list-test.js index b44bec2f4e..e02b2a46dd 100644 --- a/ui/tests/integration/components/string-list-test.js +++ b/ui/tests/integration/components/string-list-test.js @@ -136,7 +136,7 @@ module('Integration | Component | string list', function (hooks) { test('it replaces helpText if name is tokenBoundCidrs', async function (assert) { assert.expect(1); await render(hbs``); - let tooltipTrigger = document.querySelector('[data-test-tool-tip-trigger]'); + const tooltipTrigger = document.querySelector('[data-test-tool-tip-trigger]'); await triggerEvent(tooltipTrigger, 'mouseenter'); assert .dom('[data-test-info-tooltip-content]') diff --git a/ui/tests/integration/components/toggle-test.js b/ui/tests/integration/components/toggle-test.js index b65b557f67..2dc7dadca5 100644 --- a/ui/tests/integration/components/toggle-test.js +++ b/ui/tests/integration/components/toggle-test.js @@ -4,7 +4,7 @@ import { render, findAll } from '@ember/test-helpers'; import sinon from 'sinon'; import hbs from 'htmlbars-inline-precompile'; -let handler = (data, e) => { +const handler = (data, e) => { if (e && e.preventDefault) e.preventDefault(); return; }; diff --git a/ui/tests/integration/components/transform-list-item-test.js b/ui/tests/integration/components/transform-list-item-test.js index a23a00137e..917106b4ba 100644 --- a/ui/tests/integration/components/transform-list-item-test.js +++ b/ui/tests/integration/components/transform-list-item-test.js @@ -8,7 +8,7 @@ module('Integration | Component | transform-list-item', function (hooks) { setupRenderingTest(hooks); test('it renders un-clickable item if no read capability', async function (assert) { - let item = EmberObject.create({ + const item = EmberObject.create({ id: 'foo', updatePath: { canRead: false, @@ -30,7 +30,7 @@ module('Integration | Component | transform-list-item', function (hooks) { }); test('it is clickable with details menu item if read capability', async function (assert) { - let item = EmberObject.create({ + const item = EmberObject.create({ id: 'foo', updatePath: { canRead: true, @@ -53,7 +53,7 @@ module('Integration | Component | transform-list-item', function (hooks) { }); test('it has details and edit menu item if read & edit capabilities', async function (assert) { - let item = EmberObject.create({ + const item = EmberObject.create({ id: 'foo', updatePath: { canRead: true, @@ -76,7 +76,7 @@ module('Integration | Component | transform-list-item', function (hooks) { }); test('it is not clickable if built-in template with all capabilities', async function (assert) { - let item = EmberObject.create({ + const item = EmberObject.create({ id: 'builtin/foo', updatePath: { canRead: true, @@ -98,7 +98,7 @@ module('Integration | Component | transform-list-item', function (hooks) { }); test('it is not clickable if built-in alphabet', async function (assert) { - let item = EmberObject.create({ + const item = EmberObject.create({ id: 'builtin/foo', updatePath: { canRead: true, diff --git a/ui/tests/integration/components/transit-key-actions-test.js b/ui/tests/integration/components/transit-key-actions-test.js index ea32a07709..3d6c5ca474 100644 --- a/ui/tests/integration/components/transit-key-actions-test.js +++ b/ui/tests/integration/components/transit-key-actions-test.js @@ -44,12 +44,12 @@ module('Integration | Component | transit key actions', function (hooks) { }); test('it requires `key`', async function (assert) { - let promise = waitForError(); + const promise = waitForError(); render(hbs` {{transit-key-actions}} `); - let err = await promise; + const err = await promise; assert.ok(err.message.includes('`key` is required for'), 'asserts without key'); }); @@ -115,7 +115,7 @@ module('Integration | Component | transit key actions', function (hooks) { }); async function doEncrypt(assert, actions = [], keyattrs = {}) { - let keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat(actions) }; + const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat(actions) }; const key = assign({}, keyDefaults, keyattrs); this.set('key', key); @@ -168,8 +168,8 @@ module('Integration | Component | transit key actions', function (hooks) { test('it encrypts', doEncrypt); test('it shows key version selection', async function (assert) { - let keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) }; - let keyattrs = { keysForEncryption: [3, 2, 1], latestVersion: 3 }; + const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) }; + const keyattrs = { keysForEncryption: [3, 2, 1], latestVersion: 3 }; const key = assign({}, keyDefaults, keyattrs); this.set('key', key); this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' }); @@ -199,8 +199,8 @@ module('Integration | Component | transit key actions', function (hooks) { }); test('it hides key version selection', async function (assert) { - let keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) }; - let keyattrs = { keysForEncryption: [1] }; + const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) }; + const keyattrs = { keysForEncryption: [1] }; const key = assign({}, keyDefaults, keyattrs); this.set('key', key); this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' }); diff --git a/ui/tests/integration/components/ttl-form-test.js b/ui/tests/integration/components/ttl-form-test.js index 0a57959947..91bd9a7a62 100644 --- a/ui/tests/integration/components/ttl-form-test.js +++ b/ui/tests/integration/components/ttl-form-test.js @@ -34,7 +34,7 @@ module('Integration | Component | ttl-form', function (hooks) { }); test('it correctly shows initial unit', async function (assert) { - let changeSpy = sinon.spy(); + const changeSpy = sinon.spy(); this.set('onChange', changeSpy); await render(hbs` `); - let callCount = this.changeSpy.callCount; + const callCount = this.changeSpy.callCount; await fillIn('[data-test-ttl-value]', 'foo'); assert.strictEqual(this.changeSpy.callCount, callCount, "it didn't call onChange again"); assert.dom('[data-test-ttl-error]').includesText('Error', 'renders the error box'); diff --git a/ui/tests/integration/components/wrap-ttl-test.js b/ui/tests/integration/components/wrap-ttl-test.js index e58fa840fc..6bcb6dfd2f 100644 --- a/ui/tests/integration/components/wrap-ttl-test.js +++ b/ui/tests/integration/components/wrap-ttl-test.js @@ -15,9 +15,9 @@ module('Integration | Component | wrap ttl', function (hooks) { }); test('it requires `onChange`', async function (assert) { - let promise = waitForError(); + const promise = waitForError(); render(hbs`{{wrap-ttl}}`); - let err = await promise; + const err = await promise; assert.ok(err.message.includes('`onChange` handler is a required attr in'), 'asserts without onChange'); }); diff --git a/ui/tests/integration/helpers/date-format-test.js b/ui/tests/integration/helpers/date-format-test.js index 2f90dafe82..c0ca265cc1 100644 --- a/ui/tests/integration/helpers/date-format-test.js +++ b/ui/tests/integration/helpers/date-format-test.js @@ -8,7 +8,7 @@ module('Integration | Helper | date-format', function (hooks) { setupRenderingTest(hooks); test('it is able to format a date object', async function (assert) { - let today = new Date(); + const today = new Date(); this.set('today', today); await render(hbs`

Date: {{date-format this.today "yyyy"}}

`); @@ -18,16 +18,16 @@ module('Integration | Helper | date-format', function (hooks) { }); test('it supports date timestamps', async function (assert) { - let today = new Date().getTime(); + const today = new Date().getTime(); this.set('today', today); await render(hbs`

{{date-format this.today 'hh:mm:ss'}}

`); - let formattedDate = document.querySelector('.date-format').innerText; + const formattedDate = document.querySelector('.date-format').innerText; assert.ok(formattedDate.match(/^\d{2}:\d{2}:\d{2}$/)); }); test('it supports date strings', async function (assert) { - let todayString = new Date().getFullYear().toString(); + const todayString = new Date().getFullYear().toString(); this.set('todayString', todayString); await render(hbs`

Date: {{date-format this.todayString "yyyy"}}

`); @@ -37,7 +37,7 @@ module('Integration | Helper | date-format', function (hooks) { }); test('it supports ten digit dates', async function (assert) { - let tenDigitDate = 1621785298; + const tenDigitDate = 1621785298; this.set('tenDigitDate', tenDigitDate); await render(hbs`

Date: {{date-format this.tenDigitDate "MM/dd/yyyy"}}

`); @@ -45,7 +45,7 @@ module('Integration | Helper | date-format', function (hooks) { }); test('it supports already formatted dates', async function (assert) { - let formattedDate = new Date(); + const formattedDate = new Date(); this.set('formattedDate', formattedDate); await render( @@ -55,7 +55,7 @@ module('Integration | Helper | date-format', function (hooks) { }); test('displays correct date when timestamp is in ISO 8601 format', async function (assert) { - let timestampDate = '2021-09-01T00:00:00Z'; + const timestampDate = '2021-09-01T00:00:00Z'; this.set('timestampDate', timestampDate); await render( diff --git a/ui/tests/integration/helpers/date-from-now-test.js b/ui/tests/integration/helpers/date-from-now-test.js index ac83698a14..36c55b42fa 100644 --- a/ui/tests/integration/helpers/date-from-now-test.js +++ b/ui/tests/integration/helpers/date-from-now-test.js @@ -9,34 +9,34 @@ module('Integration | Helper | date-from-now', function (hooks) { setupRenderingTest(hooks); test('it works', function (assert) { - let result = dateFromNow([1481022124443]); + const result = dateFromNow([1481022124443]); assert.strictEqual(typeof result, 'string', 'it is a string'); }); test('you can include a suffix', function (assert) { - let result = dateFromNow([1481022124443], { addSuffix: true }); + const result = dateFromNow([1481022124443], { addSuffix: true }); assert.ok(result.includes(' ago')); }); test('you can pass in UTC timestamp', function (assert) { - let result = dateFromNow(['Fri, 11 Oct 2019 18:56:08 GMT'], { addSuffix: true }); + const result = dateFromNow(['Fri, 11 Oct 2019 18:56:08 GMT'], { addSuffix: true }); assert.ok(result.includes(' ago')); }); test('you can pass in ISO timestamp', function (assert) { - let result = dateFromNow(['2019-10-11T18:56:08.984Z'], { addSuffix: true }); + const result = dateFromNow(['2019-10-11T18:56:08.984Z'], { addSuffix: true }); assert.ok(result.includes(' ago')); }); test('you can include a suffix using date class', function (assert) { - let now = Date.now(); - let pastDate = subMinutes(now, 30); - let result = dateFromNow([pastDate], { addSuffix: true }); + const now = Date.now(); + const pastDate = subMinutes(now, 30); + const result = dateFromNow([pastDate], { addSuffix: true }); assert.ok(result.includes(' ago')); }); test('you can include a suffix using ISO 8601 format', function (assert) { - let result = dateFromNow(['2021-02-05T20:43:09+00:00'], { addSuffix: true }); + const result = dateFromNow(['2021-02-05T20:43:09+00:00'], { addSuffix: true }); assert.ok(result.includes(' ago')); }); diff --git a/ui/tests/integration/helpers/has-feature-test.js b/ui/tests/integration/helpers/has-feature-test.js index f19be518f2..39678fe5d0 100644 --- a/ui/tests/integration/helpers/has-feature-test.js +++ b/ui/tests/integration/helpers/has-feature-test.js @@ -18,9 +18,9 @@ module('helper:has-feature', function (hooks) { }); test('it asserts on unknown features', async function (assert) { - let promise = waitForError(); + const promise = waitForError(); render(hbs`{{has-feature 'New Feature'}}`); - let err = await promise; + const err = await promise; assert.ok( err.message.includes('New Feature is not one of the available values for Vault Enterprise features.'), 'asserts when an unknown feature is passed as an arg' diff --git a/ui/tests/integration/services/auth-test.js b/ui/tests/integration/services/auth-test.js index 26616699f5..a7d2456991 100644 --- a/ui/tests/integration/services/auth-test.js +++ b/ui/tests/integration/services/auth-test.js @@ -27,7 +27,7 @@ function storage() { }; } -let ROOT_TOKEN_RESPONSE = { +const ROOT_TOKEN_RESPONSE = { request_id: 'e6674d7f-c96f-d51f-4463-cc95f0ad307e', lease_id: '', renewable: false, @@ -51,7 +51,7 @@ let ROOT_TOKEN_RESPONSE = { auth: null, }; -let TOKEN_NON_ROOT_RESPONSE = function () { +const TOKEN_NON_ROOT_RESPONSE = function () { return { request_id: '3ca32cd9-fd40-891d-02d5-ea23138e8642', lease_id: '', @@ -78,7 +78,7 @@ let TOKEN_NON_ROOT_RESPONSE = function () { }; }; -let USERPASS_RESPONSE = { +const USERPASS_RESPONSE = { request_id: '7e5e8d3d-599e-6ef7-7570-f7057fc7c53d', lease_id: '', renewable: false, @@ -98,7 +98,7 @@ let USERPASS_RESPONSE = { }, }; -let GITHUB_RESPONSE = { +const GITHUB_RESPONSE = { request_id: '4913f9cd-a95f-d1f9-5746-4c3af4e15660', lease_id: '', renewable: false, @@ -128,20 +128,20 @@ module('Integration | Service | auth', function (hooks) { this.memStore = storage(); this.server = new Pretender(function () { this.get('/v1/auth/token/lookup-self', function (request) { - let resp = copy(ROOT_TOKEN_RESPONSE, true); + const resp = copy(ROOT_TOKEN_RESPONSE, true); resp.id = request.requestHeaders['X-Vault-Token']; resp.data.id = request.requestHeaders['X-Vault-Token']; return [200, {}, resp]; }); this.post('/v1/auth/userpass/login/:username', function (request) { const { username } = request.params; - let resp = copy(USERPASS_RESPONSE, true); + const resp = copy(USERPASS_RESPONSE, true); resp.auth.metadata.username = username; return [200, {}, resp]; }); this.post('/v1/auth/github/login', function () { - let resp = copy(GITHUB_RESPONSE, true); + const resp = copy(GITHUB_RESPONSE, true); return [200, {}, resp]; }); }); @@ -162,9 +162,9 @@ module('Integration | Service | auth', function (hooks) { test('token authentication: root token', function (assert) { assert.expect(6); - let done = assert.async(); - let self = this; - let service = this.owner.factoryFor('service:auth').create({ + const done = assert.async(); + const self = this; + const service = this.owner.factoryFor('service:auth').create({ storage(tokenName) { if ( tokenName && @@ -207,8 +207,8 @@ module('Integration | Service | auth', function (hooks) { }); test('token authentication: root token in ember development environment', async function (assert) { - let self = this; - let service = this.owner.factoryFor('service:auth').create({ + const self = this; + const service = this.owner.factoryFor('service:auth').create({ storage(tokenName) { if ( tokenName && @@ -246,8 +246,8 @@ module('Integration | Service | auth', function (hooks) { test('github authentication', function (assert) { assert.expect(6); - let done = assert.async(); - let service = this.owner.factoryFor('service:auth').create({ + const done = assert.async(); + const service = this.owner.factoryFor('service:auth').create({ storage: (type) => (type === 'memory' ? this.memStore : this.store), }); @@ -275,8 +275,8 @@ module('Integration | Service | auth', function (hooks) { test('userpass authentication', function (assert) { assert.expect(4); - let done = assert.async(); - let service = this.owner.factoryFor('service:auth').create({ storage: () => this.store }); + const done = assert.async(); + const service = this.owner.factoryFor('service:auth').create({ storage: () => this.store }); run(() => { service .authenticate({ @@ -311,15 +311,15 @@ module('Integration | Service | auth', function (hooks) { const tokenResp = TOKEN_NON_ROOT_RESPONSE(); this.server.map(function () { this.get('/v1/auth/token/lookup-self', function (request) { - let resp = copy(tokenResp, true); + const resp = copy(tokenResp, true); resp.id = request.requestHeaders['X-Vault-Token']; resp.data.id = request.requestHeaders['X-Vault-Token']; return [200, {}, resp]; }); }); - let done = assert.async(); - let service = this.owner.factoryFor('service:auth').create({ storage: () => this.store }); + const done = assert.async(); + const service = this.owner.factoryFor('service:auth').create({ storage: () => this.store }); run(() => { service.authenticate({ clusterId: '1', backend: 'token', data: { token: 'test' } }).then(() => { const clusterTokenName = service.get('currentTokenName'); diff --git a/ui/tests/integration/utils/client-count-utils-test.js b/ui/tests/integration/utils/client-count-utils-test.js index e02550d8b3..329e173550 100644 --- a/ui/tests/integration/utils/client-count-utils-test.js +++ b/ui/tests/integration/utils/client-count-utils-test.js @@ -617,8 +617,8 @@ module('Integration | Util | client count utils', function (hooks) { ); }; const assertClientCounts = (object, originalObject) => { - let newObjectKeys = ['clients', 'entity_clients', 'non_entity_clients']; - let originalKeys = Object.keys(originalObject.counts).includes('entity_clients') + const newObjectKeys = ['clients', 'entity_clients', 'non_entity_clients']; + const originalKeys = Object.keys(originalObject.counts).includes('entity_clients') ? newObjectKeys : ['clients', 'distinct_entities', 'non_entity_tokens']; @@ -654,7 +654,7 @@ module('Integration | Util | client count utils', function (hooks) { }); // method fails gracefully - let expected = [ + const expected = [ { counts: null, month: '6/21', @@ -709,12 +709,12 @@ module('Integration | Util | client count utils', function (hooks) { assert.notEqual(formattedNamespaces, MONTHS, 'does not modify original array'); formattedNamespaces.forEach((namespace) => { - let origNamespace = BY_NAMESPACE.find((ns) => ns.namespace_path === namespace.label); + const origNamespace = BY_NAMESPACE.find((ns) => ns.namespace_path === namespace.label); keyNameAssertions(namespace, 'formatted namespace'); keyValueAssertions(namespace, 'namespace_path', origNamespace); namespace.mounts.forEach((mount) => { - let origMount = origNamespace.mounts.find((m) => m.mount_path === mount.label); + const origMount = origNamespace.mounts.find((m) => m.mount_path === mount.label); keyNameAssertions(mount, 'formatted mount'); keyValueAssertions(mount, 'mount_path', origMount); }); @@ -733,7 +733,7 @@ module('Integration | Util | client count utils', function (hooks) { mounts: [], }; - let formattedNsWithoutMounts = formatByNamespace([nsWithoutMounts])[0]; + const formattedNsWithoutMounts = formatByNamespace([nsWithoutMounts])[0]; keyNameAssertions(formattedNsWithoutMounts, 'namespace without mounts'); keyValueAssertions(formattedNsWithoutMounts, 'namespace_path', nsWithoutMounts); assert.strictEqual(formattedNsWithoutMounts.mounts.length, 0, 'formatted namespace has no mounts'); @@ -760,7 +760,7 @@ module('Integration | Util | client count utils', function (hooks) { ); }; - let transformedMonths = [...MONTHS]; + const transformedMonths = [...MONTHS]; transformedMonths.forEach((month) => { month.counts = homogenizeClientNaming(month.counts); keyNameAssertions(month.counts, 'month counts'); @@ -863,7 +863,7 @@ module('Integration | Util | client count utils', function (hooks) { assert.expect(30); const assertClientCounts = (object, originalObject) => { - let valuesToCheck = ['clients', 'entity_clients', 'non_entity_clients']; + const valuesToCheck = ['clients', 'entity_clients', 'non_entity_clients']; valuesToCheck.forEach((key) => { assert.strictEqual(object[key], originalObject[key], `${key} equal original counts`); @@ -889,27 +889,27 @@ module('Integration | Util | client count utils', function (hooks) { 'it does not modify original array' ); - let namespaceKeys = Object.keys(byNamespaceKeyObject); + const namespaceKeys = Object.keys(byNamespaceKeyObject); namespaceKeys.forEach((nsKey) => { const newNsObject = byNamespaceKeyObject[nsKey]; - let originalNsData = totalClientsByNamespace.find((ns) => ns.label === nsKey); + const originalNsData = totalClientsByNamespace.find((ns) => ns.label === nsKey); assertClientCounts(newNsObject, originalNsData); - let mountKeys = Object.keys(newNsObject.mounts_by_key); + const mountKeys = Object.keys(newNsObject.mounts_by_key); mountKeys.forEach((mKey) => { - let mountData = originalNsData.mounts.find((m) => m.label === mKey); + const mountData = originalNsData.mounts.find((m) => m.label === mKey); assertClientCounts(newNsObject.mounts_by_key[mKey], mountData); }); }); namespaceKeys.forEach((nsKey) => { const newNsObject = byNamespaceKeyObject[nsKey]; - let originalNsData = newClientsByNamespace.find((ns) => ns.label === nsKey); + const originalNsData = newClientsByNamespace.find((ns) => ns.label === nsKey); if (!originalNsData) return; assertClientCounts(newNsObject.new_clients, originalNsData); - let mountKeys = Object.keys(newNsObject.mounts_by_key); + const mountKeys = Object.keys(newNsObject.mounts_by_key); mountKeys.forEach((mKey) => { - let mountData = originalNsData.mounts.find((m) => m.label === mKey); + const mountData = originalNsData.mounts.find((m) => m.label === mKey); assertClientCounts(newNsObject.mounts_by_key[mKey].new_clients, mountData); }); }); diff --git a/ui/tests/integration/utils/date-formatters-test.js b/ui/tests/integration/utils/date-formatters-test.js index f366dfb567..1aa741be21 100644 --- a/ui/tests/integration/utils/date-formatters-test.js +++ b/ui/tests/integration/utils/date-formatters-test.js @@ -19,20 +19,20 @@ module('Integration | Util | date formatters utils', function (hooks) { assert.expect(6); assert.strictEqual(parseAPITimestamp(UNIX_TIME), undefined, 'it returns if timestamp is not a string'); - let parsedTimestamp = parseAPITimestamp(API_TIMESTAMP); + const parsedTimestamp = parseAPITimestamp(API_TIMESTAMP); assert.true(parsedTimestamp instanceof Date, 'parsed timestamp is a date object'); assert.true(isSameYear(parsedTimestamp, DATE), 'parsed timestamp is correct year'); assert.true(isSameMonth(parsedTimestamp, DATE), 'parsed timestamp is correct month'); assert.true(isSameDay(parsedTimestamp, DATE), 'parsed timestamp is correct day'); - let formattedTimestamp = parseAPITimestamp(API_TIMESTAMP, 'MM yyyy'); + const formattedTimestamp = parseAPITimestamp(API_TIMESTAMP, 'MM yyyy'); assert.strictEqual(formattedTimestamp, format(DATE, 'MM yyyy'), 'it formats the date'); }); test('parseRFC3339: convert timestamp to array for widget', async function (assert) { assert.expect(4); - let arrayArg = ['2021', 2]; + const arrayArg = ['2021', 2]; assert.strictEqual(parseRFC3339(arrayArg), arrayArg, 'it returns arg if already an array'); assert.strictEqual( parseRFC3339(UNIX_TIME), @@ -40,7 +40,7 @@ module('Integration | Util | date formatters utils', function (hooks) { 'it returns null parsing a timestamp of the wrong format' ); - let parsedTimestamp = parseRFC3339(API_TIMESTAMP); + const parsedTimestamp = parseRFC3339(API_TIMESTAMP); assert.strictEqual(parsedTimestamp[0], format(DATE, 'yyyy'), 'first element is a string of the year'); assert.strictEqual( ARRAY_OF_MONTHS[parsedTimestamp[1]], @@ -51,7 +51,7 @@ module('Integration | Util | date formatters utils', function (hooks) { test('formatChartDate: expand chart date to full month and year', async function (assert) { assert.expect(1); - let chartDate = '03/21'; + const chartDate = '03/21'; assert.strictEqual(formatChartDate(chartDate), 'March 2021', 'it re-formats the date'); }); }); diff --git a/ui/tests/pages/components/console/ui-panel.js b/ui/tests/pages/components/console/ui-panel.js index 9333ef4dda..e746080ba6 100644 --- a/ui/tests/pages/components/console/ui-panel.js +++ b/ui/tests/pages/components/console/ui-panel.js @@ -13,22 +13,22 @@ export default { text: text(), }), lastLogOutput: getter(function () { - let count = this.logOutputItems.length; - let outputItemText = this.logOutputItems.objectAt(count - 1).text; + const count = this.logOutputItems.length; + const outputItemText = this.logOutputItems.objectAt(count - 1).text; return outputItemText; }), logTextItems: collection('[data-test-component="console/log-text"]', { text: text(), }), lastTextOutput: getter(function () { - let count = this.logTextItems.length; + const count = this.logTextItems.length; return this.logTextItems.objectAt(count - 1).text; }), logJSONItems: collection('[data-test-component="console/log-json"]', { text: text(), }), lastJSONOutput: getter(function () { - let count = this.logJSONItems.length; + const count = this.logJSONItems.length; return this.logJSONItems.objectAt(count - 1).text; }), up: triggerable('keyup', '[data-test-component="console/command-input"] input', { @@ -42,8 +42,8 @@ export default { }), hasInput: isPresent('[data-test-component="console/command-input"] input'), runCommands: async function (commands) { - let toExecute = Array.isArray(commands) ? commands : [commands]; - for (let command of toExecute) { + const toExecute = Array.isArray(commands) ? commands : [commands]; + for (const command of toExecute) { await this.consoleInput(command); await this.enter(); await settled(); diff --git a/ui/tests/pages/components/flash-message.js b/ui/tests/pages/components/flash-message.js index 74f716ffb9..6bf5b4c86a 100644 --- a/ui/tests/pages/components/flash-message.js +++ b/ui/tests/pages/components/flash-message.js @@ -21,7 +21,7 @@ export default { return this.latestItem.click(); }, async clickAll() { - for (let message of this.messages) { + for (const message of this.messages) { message.click(); } await settled(); diff --git a/ui/tests/unit/adapters/aws-credential-test.js b/ui/tests/unit/adapters/aws-credential-test.js index c2f0ecb12e..93e8b925ed 100644 --- a/ui/tests/unit/adapters/aws-credential-test.js +++ b/ui/tests/unit/adapters/aws-credential-test.js @@ -22,7 +22,7 @@ module('Unit | Adapter | aws credential', function (hooks) { }, }; - let makeSnapshot = (obj) => { + const makeSnapshot = (obj) => { obj.role = { backend: 'aws', name: 'foo', @@ -69,9 +69,9 @@ module('Unit | Adapter | aws credential', function (hooks) { cases.forEach(([description, args, expectedMethod, expectedRequestBody]) => { test(`aws-credential: ${description}`, function (assert) { assert.expect(3); - let adapter = this.owner.lookup('adapter:aws-credential'); + const adapter = this.owner.lookup('adapter:aws-credential'); adapter.createRecord(...args); - let { method, url, requestBody } = this.server.handledRequests[0]; + const { method, url, requestBody } = this.server.handledRequests[0]; assert.strictEqual(url, '/v1/aws/creds/foo', `calls the correct url`); assert.strictEqual( method, diff --git a/ui/tests/unit/adapters/capabilities-test.js b/ui/tests/unit/adapters/capabilities-test.js index 8261e2f28b..27797a084b 100644 --- a/ui/tests/unit/adapters/capabilities-test.js +++ b/ui/tests/unit/adapters/capabilities-test.js @@ -7,7 +7,7 @@ module('Unit | Adapter | capabilities', function (hooks) { test('calls the correct url', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:capabilities').create({ + const adapter = this.owner.factoryFor('adapter:capabilities').create({ ajax: (...args) => { [url, method, options] = args; return resolve(); diff --git a/ui/tests/unit/adapters/cluster-test.js b/ui/tests/unit/adapters/cluster-test.js index a3386cdb32..e754313d45 100644 --- a/ui/tests/unit/adapters/cluster-test.js +++ b/ui/tests/unit/adapters/cluster-test.js @@ -7,7 +7,7 @@ module('Unit | Adapter | cluster', function (hooks) { test('cluster api urls', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:cluster').create({ + const adapter = this.owner.factoryFor('adapter:cluster').create({ ajax: (...args) => { [url, method, options] = args; return resolve(); @@ -140,7 +140,7 @@ module('Unit | Adapter | cluster', function (hooks) { test('cluster replication api urls', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:cluster').create({ + const adapter = this.owner.factoryFor('adapter:cluster').create({ ajax: (...args) => { [url, method, options] = args; return resolve(); diff --git a/ui/tests/unit/adapters/console-test.js b/ui/tests/unit/adapters/console-test.js index 955ef526b4..e19b522c0d 100644 --- a/ui/tests/unit/adapters/console-test.js +++ b/ui/tests/unit/adapters/console-test.js @@ -5,9 +5,9 @@ module('Unit | Adapter | console', function (hooks) { setupTest(hooks); test('it builds the correct URL', function (assert) { - let adapter = this.owner.lookup('adapter:console'); - let sysPath = 'sys/health'; - let awsPath = 'aws/roles/my-other-role'; + const adapter = this.owner.lookup('adapter:console'); + const sysPath = 'sys/health'; + const awsPath = 'aws/roles/my-other-role'; assert.strictEqual(adapter.buildURL(sysPath), '/v1/sys/health'); assert.strictEqual(adapter.buildURL(awsPath), '/v1/aws/roles/my-other-role'); }); diff --git a/ui/tests/unit/adapters/identity/entity-alias-test.js b/ui/tests/unit/adapters/identity/entity-alias-test.js index e27c50fed7..513bc107c1 100644 --- a/ui/tests/unit/adapters/identity/entity-alias-test.js +++ b/ui/tests/unit/adapters/identity/entity-alias-test.js @@ -19,9 +19,9 @@ module('Unit | Adapter | identity/entity-alias', function (hooks) { cases.forEach((testCase) => { test(`entity-alias#${testCase.adapterMethod}`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:identity/entity-alias'); + const adapter = this.owner.lookup('adapter:identity/entity-alias'); adapter[testCase.adapterMethod](...testCase.args); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual( url, testCase.url, diff --git a/ui/tests/unit/adapters/identity/entity-merge-test.js b/ui/tests/unit/adapters/identity/entity-merge-test.js index 882b1da5ff..3cc9033c2d 100644 --- a/ui/tests/unit/adapters/identity/entity-merge-test.js +++ b/ui/tests/unit/adapters/identity/entity-merge-test.js @@ -20,9 +20,9 @@ module('Unit | Adapter | identity/entity-merge', function (hooks) { test(`entity-merge#createRecord`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:identity/entity-merge'); + const adapter = this.owner.lookup('adapter:identity/entity-merge'); adapter.createRecord(storeMVP, { modelName: 'identity/entity-merge' }, { attr: (x) => x }); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual(url, `/v1/identity/entity/merge`, ` calls the correct url`); assert.strictEqual(method, 'POST', `uses the correct http verb: POST`); }); diff --git a/ui/tests/unit/adapters/identity/entity-test.js b/ui/tests/unit/adapters/identity/entity-test.js index 82e1af01a1..106315b2e5 100644 --- a/ui/tests/unit/adapters/identity/entity-test.js +++ b/ui/tests/unit/adapters/identity/entity-test.js @@ -19,9 +19,9 @@ module('Unit | Adapter | identity/entity', function (hooks) { cases.forEach((testCase) => { test(`entity#${testCase.adapterMethod}`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:identity/entity'); + const adapter = this.owner.lookup('adapter:identity/entity'); adapter[testCase.adapterMethod](...testCase.args); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual( url, testCase.url, diff --git a/ui/tests/unit/adapters/identity/group-alias-test.js b/ui/tests/unit/adapters/identity/group-alias-test.js index 7f1843f6dd..50d80141a1 100644 --- a/ui/tests/unit/adapters/identity/group-alias-test.js +++ b/ui/tests/unit/adapters/identity/group-alias-test.js @@ -19,9 +19,9 @@ module('Unit | Adapter | identity/group-alias', function (hooks) { cases.forEach((testCase) => { test(`group-alias#${testCase.adapterMethod}`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:identity/group-alias'); + const adapter = this.owner.lookup('adapter:identity/group-alias'); adapter[testCase.adapterMethod](...testCase.args); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual( url, testCase.url, diff --git a/ui/tests/unit/adapters/identity/group-test.js b/ui/tests/unit/adapters/identity/group-test.js index f454aa963d..97d996702c 100644 --- a/ui/tests/unit/adapters/identity/group-test.js +++ b/ui/tests/unit/adapters/identity/group-test.js @@ -19,9 +19,9 @@ module('Unit | Adapter | identity/group', function (hooks) { cases.forEach((testCase) => { test(`group#${testCase.adapterMethod}`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:identity/group'); + const adapter = this.owner.lookup('adapter:identity/group'); adapter[testCase.adapterMethod](...testCase.args); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual( url, testCase.url, diff --git a/ui/tests/unit/adapters/kmip/role-test.js b/ui/tests/unit/adapters/kmip/role-test.js index af196508b3..81d8628535 100644 --- a/ui/tests/unit/adapters/kmip/role-test.js +++ b/ui/tests/unit/adapters/kmip/role-test.js @@ -4,7 +4,7 @@ import { setupTest } from 'ember-qunit'; module('Unit | Adapter | kmip/role', function (hooks) { setupTest(hooks); - let serializeTests = [ + const serializeTests = [ [ 'operation_all is the only operation item present after serialization', { @@ -72,11 +72,11 @@ module('Unit | Adapter | kmip/role', function (hooks) { }, ], ]; - for (let testCase of serializeTests) { - let [name, snapshotStub, expected] = testCase; + for (const testCase of serializeTests) { + const [name, snapshotStub, expected] = testCase; test(`adapter serialize: ${name}`, function (assert) { - let adapter = this.owner.lookup('adapter:kmip/role'); - let result = adapter.serialize(snapshotStub); + const adapter = this.owner.lookup('adapter:kmip/role'); + const result = adapter.serialize(snapshotStub); assert.deepEqual(result, expected, 'output matches expected'); }); } diff --git a/ui/tests/unit/adapters/oidc/test-helper.js b/ui/tests/unit/adapters/oidc/test-helper.js index f8ba69cc0f..a267cfcb75 100644 --- a/ui/tests/unit/adapters/oidc/test-helper.js +++ b/ui/tests/unit/adapters/oidc/test-helper.js @@ -118,7 +118,7 @@ export default (test) => { 'throws assertion when filterFor is not an array' ); } else { - let testQuery = ['b123', 'c123']; + const testQuery = ['b123', 'c123']; await this.store .query(this.modelName, { paramKey: 'model_id', filterFor: testQuery }) .then((resp) => assert.ok(resp.isLoaded, 'does not error when key_info does not exist')); diff --git a/ui/tests/unit/adapters/secret-engine-test.js b/ui/tests/unit/adapters/secret-engine-test.js index d970ea79ce..199dd06000 100644 --- a/ui/tests/unit/adapters/secret-engine-test.js +++ b/ui/tests/unit/adapters/secret-engine-test.js @@ -51,9 +51,9 @@ module('Unit | Adapter | secret engine', function (hooks) { cases.forEach((testCase) => { test(`secret-engine: ${testCase.description}`, function (assert) { assert.expect(2); - let adapter = this.owner.lookup('adapter:secret-engine'); + const adapter = this.owner.lookup('adapter:secret-engine'); adapter[testCase.adapterMethod](...testCase.args); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual( url, testCase.url, diff --git a/ui/tests/unit/adapters/secret-test.js b/ui/tests/unit/adapters/secret-test.js index 0ecee23de1..56f251af2d 100644 --- a/ui/tests/unit/adapters/secret-test.js +++ b/ui/tests/unit/adapters/secret-test.js @@ -7,7 +7,7 @@ module('Unit | Adapter | secret', function (hooks) { test('secret api urls', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:secret').create({ + const adapter = this.owner.factoryFor('adapter:secret').create({ ajax: (...args) => { [url, method, options] = args; return resolve({}); diff --git a/ui/tests/unit/adapters/secret-v2-test.js b/ui/tests/unit/adapters/secret-v2-test.js index db218eb4bb..ab5e066783 100644 --- a/ui/tests/unit/adapters/secret-v2-test.js +++ b/ui/tests/unit/adapters/secret-v2-test.js @@ -56,9 +56,9 @@ module('Unit | Adapter | secret-v2', function (hooks) { ], ].forEach(([adapterMethod, store, type, queryOrSnapshot, expectedHttpVerb, expectedURL]) => { test(`secret-v2: ${adapterMethod}`, function (assert) { - let adapter = this.owner.lookup('adapter:secret-v2'); + const adapter = this.owner.lookup('adapter:secret-v2'); adapter[adapterMethod](store, type, queryOrSnapshot); - let { url, method } = this.server.handledRequests[0]; + const { url, method } = this.server.handledRequests[0]; assert.strictEqual(url, expectedURL, `${adapterMethod} calls the correct url: ${expectedURL}`); assert.strictEqual( method, diff --git a/ui/tests/unit/adapters/secret-v2-version-test.js b/ui/tests/unit/adapters/secret-v2-version-test.js index fcf2644697..479ebb5a2b 100644 --- a/ui/tests/unit/adapters/secret-v2-version-test.js +++ b/ui/tests/unit/adapters/secret-v2-version-test.js @@ -14,7 +14,7 @@ module('Unit | Adapter | secret-v2-version', function (hooks) { this.server.shutdown(); }); - let fakeStore = { + const fakeStore = { peekRecord() { return { rollbackAttributes() {}, @@ -80,9 +80,9 @@ module('Unit | Adapter | secret-v2-version', function (hooks) { ([testName, adapterMethod, args, expectedHttpVerb, expectedURL, exptectedRequestBody, assertCount]) => { test(`${testName}`, function (assert) { assert.expect(assertCount); - let adapter = this.owner.lookup('adapter:secret-v2-version'); + const adapter = this.owner.lookup('adapter:secret-v2-version'); adapter[adapterMethod](...args); - let { url, method, requestBody } = this.server.handledRequests[0]; + const { url, method, requestBody } = this.server.handledRequests[0]; assert.strictEqual(url, expectedURL, `${adapterMethod} calls the correct url: ${expectedURL}`); assert.strictEqual( method, diff --git a/ui/tests/unit/adapters/tools-test.js b/ui/tests/unit/adapters/tools-test.js index c4bc44dbbc..709090aa22 100644 --- a/ui/tests/unit/adapters/tools-test.js +++ b/ui/tests/unit/adapters/tools-test.js @@ -7,7 +7,7 @@ module('Unit | Adapter | tools', function (hooks) { test('wrapping api urls', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:tools').create({ + const adapter = this.owner.factoryFor('adapter:tools').create({ ajax: (...args) => { [url, method, options] = args; return resolve(); @@ -40,7 +40,7 @@ module('Unit | Adapter | tools', function (hooks) { test('tools api urls', function (assert) { let url, method; - let adapter = this.owner.factoryFor('adapter:tools').create({ + const adapter = this.owner.factoryFor('adapter:tools').create({ ajax: (...args) => { [url, method] = args; return resolve(); diff --git a/ui/tests/unit/adapters/transit-key-test.js b/ui/tests/unit/adapters/transit-key-test.js index ea2d304875..2599b99566 100644 --- a/ui/tests/unit/adapters/transit-key-test.js +++ b/ui/tests/unit/adapters/transit-key-test.js @@ -7,7 +7,7 @@ module('Unit | Adapter | transit key', function (hooks) { test('transit api urls', function (assert) { let url, method, options; - let adapter = this.owner.factoryFor('adapter:transit-key').create({ + const adapter = this.owner.factoryFor('adapter:transit-key').create({ ajax: (...args) => { [url, method, options] = args; return resolve({}); diff --git a/ui/tests/unit/components/identity/edit-form-test.js b/ui/tests/unit/components/identity/edit-form-test.js index c48bf72304..a9762fe9c0 100644 --- a/ui/tests/unit/components/identity/edit-form-test.js +++ b/ui/tests/unit/components/identity/edit-form-test.js @@ -6,7 +6,7 @@ import sinon from 'sinon'; module('Unit | Component | identity/edit-form', function (hooks) { setupTest(hooks); - let testCases = [ + const testCases = [ { identityType: 'entity', mode: 'create', @@ -54,12 +54,12 @@ module('Unit | Component | identity/edit-form', function (hooks) { }, ]; testCases.forEach(function (testCase) { - let model = EmberObject.create({ + const model = EmberObject.create({ identityType: testCase.identityType, rollbackAttributes: sinon.spy(), }); test(`it computes cancelLink properly: ${testCase.identityType} ${testCase.mode}`, function (assert) { - let component = this.owner.lookup('component:identity/edit-form'); + const component = this.owner.lookup('component:identity/edit-form'); component.set('mode', testCase.mode); component.set('model', model); diff --git a/ui/tests/unit/helpers/filter-wildcard-test.js b/ui/tests/unit/helpers/filter-wildcard-test.js index c76fdbdd9e..6767c5f347 100644 --- a/ui/tests/unit/helpers/filter-wildcard-test.js +++ b/ui/tests/unit/helpers/filter-wildcard-test.js @@ -3,23 +3,23 @@ import { module, test } from 'qunit'; module('Unit | Helpers | filter-wildcard', function () { test('it returns a count if array contains a wildcard', function (assert) { - let string = { id: 'foo*' }; - let array = ['foobar', 'foozar', 'boo', 'oof']; - let result = filterWildcard([string, array]); + const string = { id: 'foo*' }; + const array = ['foobar', 'foozar', 'boo', 'oof']; + const result = filterWildcard([string, array]); assert.strictEqual(result, 2); }); test('it returns zero if no wildcard is string', function (assert) { - let string = { id: 'foo#' }; - let array = ['foobar', 'foozar', 'boo', 'oof']; - let result = filterWildcard([string, array]); + const string = { id: 'foo#' }; + const array = ['foobar', 'foozar', 'boo', 'oof']; + const result = filterWildcard([string, array]); assert.strictEqual(result, 0); }); test('it escapes function and does not error if no id is in string', function (assert) { - let string = '*bar*'; - let array = ['foobar', 'foozar', 'boobarboo', 'oof']; - let result = filterWildcard([string, array]); + const string = '*bar*'; + const array = ['foobar', 'foozar', 'boobarboo', 'oof']; + const result = filterWildcard([string, array]); assert.strictEqual(result, 2); }); }); diff --git a/ui/tests/unit/helpers/is-wildcard-string-test.js b/ui/tests/unit/helpers/is-wildcard-string-test.js index 5c0c5152fb..bbb0ba426a 100644 --- a/ui/tests/unit/helpers/is-wildcard-string-test.js +++ b/ui/tests/unit/helpers/is-wildcard-string-test.js @@ -3,38 +3,38 @@ import { module, test } from 'qunit'; module('Unit | Helpers | is-wildcard-string', function () { test('it returns true if regular string with wildcard', function (assert) { - let string = 'foom#*eep'; - let result = isWildcardString([string]); + const string = 'foom#*eep'; + const result = isWildcardString([string]); assert.true(result); }); test('it returns false if no wildcard', function (assert) { - let string = 'foo.bar'; - let result = isWildcardString([string]); + const string = 'foo.bar'; + const result = isWildcardString([string]); assert.false(result); }); test('it returns true if string with id as in searchSelect selected has wildcard', function (assert) { - let string = { id: 'foo.bar*baz' }; - let result = isWildcardString([string]); + const string = { id: 'foo.bar*baz' }; + const result = isWildcardString([string]); assert.true(result); }); test('it returns true if string object has name and no id', function (assert) { - let string = { name: 'foo.bar*baz' }; - let result = isWildcardString([string]); + const string = { name: 'foo.bar*baz' }; + const result = isWildcardString([string]); assert.true(result); }); test('it returns true if string object has name and id with at least one wildcard', function (assert) { - let string = { id: '7*', name: 'seven' }; - let result = isWildcardString([string]); + const string = { id: '7*', name: 'seven' }; + const result = isWildcardString([string]); assert.true(result); }); test('it returns true if string object has name and id with wildcard in name not id', function (assert) { - let string = { id: '7', name: 'sev*n' }; - let result = isWildcardString([string]); + const string = { id: '7', name: 'sev*n' }; + const result = isWildcardString([string]); assert.true(result); }); }); diff --git a/ui/tests/unit/lib/attach-capabilities-test.js b/ui/tests/unit/lib/attach-capabilities-test.js index c4d65d5706..0bf4f37425 100644 --- a/ui/tests/unit/lib/attach-capabilities-test.js +++ b/ui/tests/unit/lib/attach-capabilities-test.js @@ -4,9 +4,9 @@ import { setupTest } from 'ember-qunit'; import attachCapabilities from 'vault/lib/attach-capabilities'; import apiPath from 'vault/utils/api-path'; -let MODEL_TYPE = 'test-form-model'; +const MODEL_TYPE = 'test-form-model'; -let makeModelClass = () => { +const makeModelClass = () => { return Model.extend(); }; @@ -47,7 +47,7 @@ module('Unit | lib | attach capabilities', function (hooks) { updatePath: apiPath`update/${'id'}`, deletePath: apiPath`delete/${'id'}`, }); - let jsonAPIDocSingle = { + const jsonAPIDocSingle = { data: { id: 'test', type: MODEL_TYPE, @@ -57,7 +57,7 @@ module('Unit | lib | attach capabilities', function (hooks) { included: [], }; - let expected = { + const expected = { data: { id: 'test', type: MODEL_TYPE, @@ -96,7 +96,7 @@ module('Unit | lib | attach capabilities', function (hooks) { updatePath: apiPath`update/${'id'}`, deletePath: apiPath`delete/${'id'}`, }); - let jsonAPIDocSingle = { + const jsonAPIDocSingle = { data: [ { id: 'test', @@ -114,7 +114,7 @@ module('Unit | lib | attach capabilities', function (hooks) { included: [], }; - let expected = { + const expected = { data: [ { id: 'test', diff --git a/ui/tests/unit/lib/console-helpers-test.js b/ui/tests/unit/lib/console-helpers-test.js index ff9c8b7e9c..f8d6487892 100644 --- a/ui/tests/unit/lib/console-helpers-test.js +++ b/ui/tests/unit/lib/console-helpers-test.js @@ -104,14 +104,14 @@ module('Unit | Lib | console helpers', function () { testCommands.forEach(function (testCase) { test(`#parseCommand: ${testCase.name}`, function (assert) { - let result = parseCommand(testCase.command); + const result = parseCommand(testCase.command); assert.deepEqual(result, testCase.expected); }); }); test('#parseCommand: invalid commands', function (assert) { - let command = 'vault kv get foo'; - let result = parseCommand(command); + const command = 'vault kv get foo'; + const result = parseCommand(command); assert.false(result, 'parseCommand returns false by default'); assert.throws( @@ -218,13 +218,13 @@ module('Unit | Lib | console helpers', function () { testExtractCases.forEach(function (testCase) { test(`#extractDataAndFlags: ${testCase.name}`, function (assert) { - let { data, flags } = extractDataAndFlags(testCase.method, ...testCase.input); + const { data, flags } = extractDataAndFlags(testCase.method, ...testCase.input); assert.deepEqual(data, testCase.expected.data, 'has expected data'); assert.deepEqual(flags, testCase.expected.flags, 'has expected flags'); }); }); - let testResponseCases = [ + const testResponseCases = [ { name: 'write response, no content', args: [null, 'foo/bar', 'write', {}], @@ -396,12 +396,12 @@ module('Unit | Lib | console helpers', function () { testResponseCases.forEach(function (testCase) { test(`#logFromResponse: ${testCase.name}`, function (assert) { - let data = logFromResponse(...testCase.args); + const data = logFromResponse(...testCase.args); assert.deepEqual(data, testCase.expectedData); }); }); - let testErrorCases = [ + const testErrorCases = [ { name: 'AdapterError write', args: [{ httpStatus: 404, path: 'v1/sys/foo', errors: [{}] }, 'sys/foo', 'write'], @@ -441,7 +441,7 @@ module('Unit | Lib | console helpers', function () { testErrorCases.forEach(function (testCase) { test(`#logFromError: ${testCase.name}`, function (assert) { - let data = logFromError(...testCase.args); + const data = logFromError(...testCase.args); assert.deepEqual( data, { type: 'error', content: testCase.expectedContent }, @@ -465,7 +465,7 @@ module('Unit | Lib | console helpers', function () { testCommandCases.forEach(function (testCase) { test(`#logErrorFromInput: ${testCase.name}`, function (assert) { - let data = logErrorFromInput(...testCase.args); + const data = logErrorFromInput(...testCase.args); assert.deepEqual( data, diff --git a/ui/tests/unit/lib/kv-object-test.js b/ui/tests/unit/lib/kv-object-test.js index 6764209aee..1d567fb4ed 100644 --- a/ui/tests/unit/lib/kv-object-test.js +++ b/ui/tests/unit/lib/kv-object-test.js @@ -2,7 +2,7 @@ import { module, test } from 'qunit'; import KVObject from 'vault/lib/kv-object'; module('Unit | Lib | kv object', function () { - let fromJSONTests = [ + const fromJSONTests = [ [ 'types', { string: 'string', false: false, zero: 0, number: 1, null: null, true: true, object: { one: 'two' } }, @@ -31,13 +31,13 @@ module('Unit | Lib | kv object', function () { fromJSONTests.forEach(function ([name, input, content]) { test(`fromJSON: ${name}`, function (assert) { - let data = KVObject.create({ content: [] }).fromJSON(input); + const data = KVObject.create({ content: [] }).fromJSON(input); assert.deepEqual(data.get('content'), content, 'has expected content'); }); }); test(`fromJSON: non-object input`, function (assert) { - let input = [{ foo: 'bar' }]; + const input = [{ foo: 'bar' }]; assert.throws( () => { KVObject.create({ content: [] }).fromJSON(input); @@ -49,13 +49,13 @@ module('Unit | Lib | kv object', function () { fromJSONTests.forEach(function ([name, input, content]) { test(`fromJSONString: ${name}`, function (assert) { - let inputString = JSON.stringify(input, null, 2); - let data = KVObject.create({ content: [] }).fromJSONString(inputString); + const inputString = JSON.stringify(input, null, 2); + const data = KVObject.create({ content: [] }).fromJSONString(inputString); assert.deepEqual(data.get('content'), content, 'has expected content'); }); }); - let toJSONTests = [ + const toJSONTests = [ [ 'types', false, @@ -68,22 +68,22 @@ module('Unit | Lib | kv object', function () { toJSONTests.forEach(function ([name, includeBlanks, input, output]) { test(`toJSON: ${name}`, function (assert) { - let data = KVObject.create({ content: [] }).fromJSON(input); - let result = data.toJSON(includeBlanks); + const data = KVObject.create({ content: [] }).fromJSON(input); + const result = data.toJSON(includeBlanks); assert.deepEqual(result, output, 'has expected output'); }); }); toJSONTests.forEach(function ([name, includeBlanks, input, output]) { test(`toJSONString: ${name}`, function (assert) { - let expected = JSON.stringify(output, null, 2); - let data = KVObject.create({ content: [] }).fromJSON(input); - let result = data.toJSONString(includeBlanks); + const expected = JSON.stringify(output, null, 2); + const data = KVObject.create({ content: [] }).fromJSON(input); + const result = data.toJSONString(includeBlanks); assert.strictEqual(result, expected, 'has expected output string'); }); }); - let isAdvancedTests = [ + const isAdvancedTests = [ [ 'advanced', { string: 'string', false: false, zero: 0, number: 1, null: null, true: true, object: { one: 'two' } }, @@ -94,7 +94,7 @@ module('Unit | Lib | kv object', function () { isAdvancedTests.forEach(function ([name, input, expected]) { test(`isAdvanced: ${name}`, function (assert) { - let data = KVObject.create({ content: [] }).fromJSON(input); + const data = KVObject.create({ content: [] }).fromJSON(input); assert.strictEqual(data.isAdvanced(), expected, 'calculates isAdvanced correctly'); }); diff --git a/ui/tests/unit/lib/path-to-tree-test.js b/ui/tests/unit/lib/path-to-tree-test.js index 17f02411ce..11966cdbe7 100644 --- a/ui/tests/unit/lib/path-to-tree-test.js +++ b/ui/tests/unit/lib/path-to-tree-test.js @@ -2,7 +2,7 @@ import { module, test } from 'qunit'; import pathToTree from 'vault/lib/path-to-tree'; module('Unit | Lib | path to tree', function () { - let tests = [ + const tests = [ [ 'basic', ['one', 'one/two', 'one/two/three/four/five'], @@ -101,7 +101,7 @@ module('Unit | Lib | path to tree', function () { tests.forEach(function ([name, input, expected]) { test(`pathToTree: ${name}`, function (assert) { - let output = pathToTree(input); + const output = pathToTree(input); assert.deepEqual(output, expected, 'has expected data'); }); }); diff --git a/ui/tests/unit/machines/auth-machine-test.js b/ui/tests/unit/machines/auth-machine-test.js index 862581ffc3..0fc1909622 100644 --- a/ui/tests/unit/machines/auth-machine-test.js +++ b/ui/tests/unit/machines/auth-machine-test.js @@ -77,7 +77,7 @@ module('Unit | Machine | auth-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = authMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = authMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.strictEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/machines/policies-machine-test.js b/ui/tests/unit/machines/policies-machine-test.js index 644dc209f6..2e48316934 100644 --- a/ui/tests/unit/machines/policies-machine-test.js +++ b/ui/tests/unit/machines/policies-machine-test.js @@ -52,7 +52,7 @@ module('Unit | Machine | policies-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = policiesMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = policiesMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.strictEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/machines/replication-machine-test.js b/ui/tests/unit/machines/replication-machine-test.js index ca947698bc..68bf007ccf 100644 --- a/ui/tests/unit/machines/replication-machine-test.js +++ b/ui/tests/unit/machines/replication-machine-test.js @@ -28,7 +28,7 @@ module('Unit | Machine | replication-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = replicationMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = replicationMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.strictEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/machines/secrets-machine-test.js b/ui/tests/unit/machines/secrets-machine-test.js index fcc84f50cb..b549242a08 100644 --- a/ui/tests/unit/machines/secrets-machine-test.js +++ b/ui/tests/unit/machines/secrets-machine-test.js @@ -1062,7 +1062,7 @@ module('Unit | Machine | secrets-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = secretsMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = secretsMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.strictEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/machines/tools-machine-test.js b/ui/tests/unit/machines/tools-machine-test.js index b34cc8e6ab..84dd3c0d92 100644 --- a/ui/tests/unit/machines/tools-machine-test.js +++ b/ui/tests/unit/machines/tools-machine-test.js @@ -81,7 +81,7 @@ module('Unit | Machine | tools-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = toolsMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = toolsMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.strictEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/machines/tutorial-machine-test.js b/ui/tests/unit/machines/tutorial-machine-test.js index 8647cb77b3..dee8296c62 100644 --- a/ui/tests/unit/machines/tutorial-machine-test.js +++ b/ui/tests/unit/machines/tutorial-machine-test.js @@ -238,7 +238,7 @@ module('Unit | Machine | tutorial-machine', function () { testCases.forEach((testCase) => { test(`transition: ${testCase.event} for currentState ${testCase.currentState} and componentState ${testCase.params}`, function (assert) { - let result = tutorialMachine.transition(testCase.currentState, testCase.event, testCase.params); + const result = tutorialMachine.transition(testCase.currentState, testCase.event, testCase.params); assert.deepEqual(result.value, testCase.expectedResults.value); assert.deepEqual(result.actions, testCase.expectedResults.actions); }); diff --git a/ui/tests/unit/mixins/cluster-route-test.js b/ui/tests/unit/mixins/cluster-route-test.js index be822e2fa6..28df39d9aa 100644 --- a/ui/tests/unit/mixins/cluster-route-test.js +++ b/ui/tests/unit/mixins/cluster-route-test.js @@ -18,7 +18,7 @@ module('Unit | Mixin | cluster route', function () { clusterModel = {}, methods = { router: {}, hasKeyData: () => false, authToken: () => null, transitionTo: () => {} } ) { - let ClusterRouteObject = EmberObject.extend( + const ClusterRouteObject = EmberObject.extend( ClusterRouteMixin, assign(methods, { clusterModel: () => clusterModel }) ); @@ -73,7 +73,7 @@ module('Unit | Mixin | cluster route', function () { }); test('#targetRouteName happy path forwards to CLUSTER route', function (assert) { - let subject = createClusterRoute( + const subject = createClusterRoute( { needsInit: false, sealed: false, dr: { isSecondary: false } }, { hasKeyData: () => false, authToken: () => 'a token' } ); @@ -99,7 +99,7 @@ module('Unit | Mixin | cluster route', function () { }); test('#targetRouteName happy path when not authed forwards to AUTH', function (assert) { - let subject = createClusterRoute( + const subject = createClusterRoute( { needsInit: false, sealed: false, dr: { isSecondary: false } }, { hasKeyData: () => false, authToken: () => null } ); @@ -125,10 +125,10 @@ module('Unit | Mixin | cluster route', function () { }); test('#transitionToTargetRoute', function (assert) { - let redirectRouteURL = '/vault/secrets/secret/create'; - let subject = createClusterRoute({ needsInit: false, sealed: false }); + const redirectRouteURL = '/vault/secrets/secret/create'; + const subject = createClusterRoute({ needsInit: false, sealed: false }); subject.router.currentURL = redirectRouteURL; - let spy = sinon.spy(subject, 'transitionTo'); + const spy = sinon.spy(subject, 'transitionTo'); subject.transitionToTargetRoute(); assert.ok( spy.calledWithExactly(AUTH, { queryParams: { redirect_to: redirectRouteURL } }), @@ -139,8 +139,8 @@ module('Unit | Mixin | cluster route', function () { }); test('#transitionToTargetRoute with auth as a target', function (assert) { - let subject = createClusterRoute({ needsInit: false, sealed: false }); - let spy = sinon.spy(subject, 'transitionTo'); + const subject = createClusterRoute({ needsInit: false, sealed: false }); + const spy = sinon.spy(subject, 'transitionTo'); // in this case it's already transitioning to the AUTH route so we don't need to call transitionTo again subject.transitionToTargetRoute({ targetName: AUTH }); assert.ok(spy.notCalled, 'transitionTo is not called'); @@ -148,8 +148,8 @@ module('Unit | Mixin | cluster route', function () { }); test('#transitionToTargetRoute with auth target, coming from cluster route', function (assert) { - let subject = createClusterRoute({ needsInit: false, sealed: false }); - let spy = sinon.spy(subject, 'transitionTo'); + const subject = createClusterRoute({ needsInit: false, sealed: false }); + const spy = sinon.spy(subject, 'transitionTo'); subject.transitionToTargetRoute({ targetName: CLUSTER_INDEX }); assert.ok(spy.calledWithExactly(AUTH), 'calls transitionTo without redirect_to'); spy.restore(); diff --git a/ui/tests/unit/models/capabilities-test.js b/ui/tests/unit/models/capabilities-test.js index f34f396855..56b6f1e81c 100644 --- a/ui/tests/unit/models/capabilities-test.js +++ b/ui/tests/unit/models/capabilities-test.js @@ -8,12 +8,12 @@ module('Unit | Model | capabilities', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let model = run(() => this.owner.lookup('service:store').createRecord('capabilities')); + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities')); assert.ok(!!model); }); test('it reads capabilities', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: 'foo', capabilities: ['list', 'read'], @@ -27,7 +27,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it allows everything if root is present', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: 'foo', capabilities: ['root', 'deny', 'read'], @@ -41,7 +41,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it denies everything if deny is present', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: 'foo', capabilities: ['sudo', 'deny', 'read'], @@ -55,7 +55,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it requires sudo on sudo paths', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: SUDO_PATHS[0], capabilities: ['sudo', 'read'], @@ -69,7 +69,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it requires sudo on sudo paths prefixes', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: SUDO_PATH_PREFIXES[0] + '/foo', capabilities: ['sudo', 'read'], @@ -83,7 +83,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it does not require sudo on sys/leases/revoke if update capability is present and path is not fully a sudo prefix', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: 'sys/leases/revoke', capabilities: ['update', 'read'], @@ -97,7 +97,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it requires sudo on prefix path even if capability is present', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: SUDO_PATH_PREFIXES[0] + '/aws', capabilities: ['update', 'read'], @@ -111,7 +111,7 @@ module('Unit | Model | capabilities', function (hooks) { }); test('it does not require sudo on prefix path if both update and sudo capabilities are present', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('capabilities', { path: SUDO_PATH_PREFIXES[0] + '/aws', capabilities: ['sudo', 'update', 'read'], diff --git a/ui/tests/unit/models/role-jwt-test.js b/ui/tests/unit/models/role-jwt-test.js index 4ce3b14fad..eedf305435 100644 --- a/ui/tests/unit/models/role-jwt-test.js +++ b/ui/tests/unit/models/role-jwt-test.js @@ -7,14 +7,14 @@ module('Unit | Model | role-jwt', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let model = this.owner.lookup('service:store').createRecord('role-jwt'); + const model = this.owner.lookup('service:store').createRecord('role-jwt'); assert.ok(!!model); assert.strictEqual(model.providerName, null, 'no providerName'); assert.strictEqual(model.providerButtonComponent, null, 'no providerButtonComponent'); }); test('it computes providerName when known provider url match fails', function (assert) { - let model = this.owner.lookup('service:store').createRecord('role-jwt', { + const model = this.owner.lookup('service:store').createRecord('role-jwt', { authUrl: 'http://example.com', }); @@ -25,11 +25,11 @@ module('Unit | Model | role-jwt', function (hooks) { test('it provides a providerName for listed known providers', function (assert) { assert.expect(12); Object.keys(DOMAIN_STRINGS).forEach((domainPart) => { - let model = this.owner.lookup('service:store').createRecord('role-jwt', { + const model = this.owner.lookup('service:store').createRecord('role-jwt', { authUrl: `http://provider-${domainPart}.com`, }); - let expectedName = DOMAIN_STRINGS[domainPart]; + const expectedName = DOMAIN_STRINGS[domainPart]; assert.strictEqual(model.providerName, expectedName, `computes providerName: ${expectedName}`); if (PROVIDER_WITH_LOGO.includes(expectedName)) { assert.strictEqual( diff --git a/ui/tests/unit/models/transit-key-test.js b/ui/tests/unit/models/transit-key-test.js index 27dd40f803..68b455df79 100644 --- a/ui/tests/unit/models/transit-key-test.js +++ b/ui/tests/unit/models/transit-key-test.js @@ -6,12 +6,12 @@ module('Unit | Model | transit key', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let model = run(() => this.owner.lookup('service:store').createRecord('transit-key')); + const model = run(() => this.owner.lookup('service:store').createRecord('transit-key')); assert.ok(!!model); }); test('supported actions', function (assert) { - let model = run(() => + const model = run(() => this.owner.lookup('service:store').createRecord('transit-key', { supportsEncryption: true, supportsDecryption: true, @@ -19,14 +19,14 @@ module('Unit | Model | transit key', function (hooks) { }) ); - let supportedActions = model.get('supportedActions').map((k) => k.name); + const supportedActions = model.get('supportedActions').map((k) => k.name); assert.deepEqual(['encrypt', 'decrypt', 'datakey', 'rewrap', 'hmac', 'verify'], supportedActions); }); test('encryption key versions', function (assert) { assert.expect(2); - let done = assert.async(); - let model = run(() => + const done = assert.async(); + const model = run(() => this.owner.lookup('service:store').createRecord('transit-key', { keys: { 1: 123, 2: 456, 3: 789, 4: 101112, 5: 131415 }, minDecryptionVersion: 1, @@ -47,8 +47,8 @@ module('Unit | Model | transit key', function (hooks) { test('keys for encryption', function (assert) { assert.expect(2); - let done = assert.async(); - let model = run(() => + const done = assert.async(); + const model = run(() => this.owner.lookup('service:store').createRecord('transit-key', { keys: { 1: 123, 2: 456, 3: 789, 4: 101112, 5: 131415 }, minDecryptionVersion: 1, diff --git a/ui/tests/unit/serializers/policy-test.js b/ui/tests/unit/serializers/policy-test.js index d79d9ed0c4..c5457176d6 100644 --- a/ui/tests/unit/serializers/policy-test.js +++ b/ui/tests/unit/serializers/policy-test.js @@ -47,9 +47,9 @@ module('Unit | Serializer | policy', function (hooks) { }; test('it transforms a list request payload', function (assert) { - let serializer = this.owner.lookup('serializer:policy'); + const serializer = this.owner.lookup('serializer:policy'); - let transformedPayload = serializer.normalizePolicies(POLICY_LIST_RESPONSE); + const transformedPayload = serializer.normalizePolicies(POLICY_LIST_RESPONSE); assert.deepEqual( transformedPayload, @@ -59,9 +59,9 @@ module('Unit | Serializer | policy', function (hooks) { }); test('it transforms another list request payload', function (assert) { - let serializer = this.owner.lookup('serializer:policy'); + const serializer = this.owner.lookup('serializer:policy'); - let transformedPayload = serializer.normalizePolicies(POLICY_SHOW_RESPONSE); + const transformedPayload = serializer.normalizePolicies(POLICY_SHOW_RESPONSE); assert.deepEqual( transformedPayload, diff --git a/ui/tests/unit/serializers/transit-key-test.js b/ui/tests/unit/serializers/transit-key-test.js index 00eeda6022..002ec87421 100644 --- a/ui/tests/unit/serializers/transit-key-test.js +++ b/ui/tests/unit/serializers/transit-key-test.js @@ -64,13 +64,13 @@ const AES = { module('Unit | Serializer | transit-key', function (hooks) { setupTest(hooks); test('it expands the timestamp for aes and chacha-poly keys', function (assert) { - let serializer = this.owner.lookup('serializer:transit-key'); - let aesExpected = AES.data.keys[1] * 1000; - let chachaExpected = CHACHA.data.keys[1] * 1000; - let aesData = serializer.normalizeSecrets({ ...AES }); + const serializer = this.owner.lookup('serializer:transit-key'); + const aesExpected = AES.data.keys[1] * 1000; + const chachaExpected = CHACHA.data.keys[1] * 1000; + const aesData = serializer.normalizeSecrets({ ...AES }); assert.strictEqual(aesData.firstObject.keys[1], aesExpected, 'converts seconds to millis for aes keys'); - let chachaData = serializer.normalizeSecrets({ ...CHACHA }); + const chachaData = serializer.normalizeSecrets({ ...CHACHA }); assert.strictEqual( chachaData.firstObject.keys[1], chachaExpected, @@ -79,8 +79,8 @@ module('Unit | Serializer | transit-key', function (hooks) { }); test('it includes backend from the payload on the normalized data', function (assert) { - let serializer = this.owner.lookup('serializer:transit-key'); - let data = serializer.normalizeSecrets({ ...AES }); + const serializer = this.owner.lookup('serializer:transit-key'); + const data = serializer.normalizeSecrets({ ...AES }); assert.strictEqual( data.firstObject.backend, 'its-a-transit', diff --git a/ui/tests/unit/services/auth-test.js b/ui/tests/unit/services/auth-test.js index aec0a771bb..a37377be80 100644 --- a/ui/tests/unit/services/auth-test.js +++ b/ui/tests/unit/services/auth-test.js @@ -9,14 +9,14 @@ module('Unit | Service | auth', function (hooks) { ['#calculateExpiration w/lease_duration', { ttl: 15 }, 15], ].forEach(([testName, response, ttlValue]) => { test(testName, function (assert) { - let now = Date.now(); - let service = this.owner.factoryFor('service:auth').create({ + const now = Date.now(); + const service = this.owner.factoryFor('service:auth').create({ now() { return now; }, }); - let resp = service.calculateExpiration(response); + const resp = service.calculateExpiration(response); assert.strictEqual(resp.ttl, ttlValue, 'returns the ttl'); assert.strictEqual( diff --git a/ui/tests/unit/services/console-test.js b/ui/tests/unit/services/console-test.js index b080a9cbf5..b3a1d3eeba 100644 --- a/ui/tests/unit/services/console-test.js +++ b/ui/tests/unit/services/console-test.js @@ -22,7 +22,7 @@ module('Unit | Service | console', function (hooks) { assert.strictEqual(ensureTrailingSlash('baz/'), 'baz/', 'keeps trailing slash if there is one'); }); - let testCases = [ + const testCases = [ { method: 'read', args: ['/sys/health', {}], @@ -77,8 +77,8 @@ module('Unit | Service | console', function (hooks) { test('it reads, writes, lists, deletes', function (assert) { assert.expect(18); - let ajax = sinon.stub(); - let uiConsole = this.owner.factoryFor('service:console').create({ + const ajax = sinon.stub(); + const uiConsole = this.owner.factoryFor('service:console').create({ adapter() { return { buildURL(url) { @@ -91,7 +91,7 @@ module('Unit | Service | console', function (hooks) { testCases.forEach((testCase) => { uiConsole[testCase.method](...testCase.args); - let [url, verb, options] = ajax.lastCall.args; + const [url, verb, options] = ajax.lastCall.args; assert.strictEqual(url, testCase.expectedURL, `${testCase.method}: uses trimmed passed url`); assert.strictEqual(verb, testCase.expectedVerb, `${testCase.method}: uses the correct verb`); assert.deepEqual(options, testCase.expectedOptions, `${testCase.method}: uses the correct options`); diff --git a/ui/tests/unit/services/control-group-test.js b/ui/tests/unit/services/control-group-test.js index 874eea8b56..13333b137f 100644 --- a/ui/tests/unit/services/control-group-test.js +++ b/ui/tests/unit/services/control-group-test.js @@ -6,7 +6,7 @@ import sinon from 'sinon'; import { storageKey, CONTROL_GROUP_PREFIX, TOKEN_SEPARATOR } from 'vault/services/control-group'; -let versionStub = Service.extend(); +const versionStub = Service.extend(); function storage() { return { @@ -46,9 +46,9 @@ module('Unit | Service | control group', function (hooks) { hooks.afterEach(function () {}); - let isOSS = (context) => set(context, 'version.isOSS', true); - let isEnt = (context) => set(context, 'version.isOSS', false); - let resolvesArgs = (assert, result, expectedArgs) => { + const isOSS = (context) => set(context, 'version.isOSS', true); + const isEnt = (context) => set(context, 'version.isOSS', false); + const resolvesArgs = (assert, result, expectedArgs) => { return result.then((...args) => { return assert.deepEqual(args, expectedArgs, 'resolves with the passed args'); }); @@ -107,8 +107,8 @@ module('Unit | Service | control group', function (hooks) { if (setup) { setup(this); } - let service = this.owner.lookup('service:control-group'); - let result = service.checkForControlGroup(...args); + const service = this.owner.lookup('service:control-group'); + const result = service.checkForControlGroup(...args); return expectation(assert, result); }); }); @@ -134,17 +134,17 @@ module('Unit | Service | control group', function (hooks) { }); test(`logFromError: returns correct content string`, function (assert) { - let error = { + const error = { accessor: '12345', token: 'token', creation_path: 'kv/', creation_time: new Date().toISOString(), ttl: 400, }; - let service = this.owner.factoryFor('service:control-group').create({ + const service = this.owner.factoryFor('service:control-group').create({ storeControlGroupToken: sinon.spy(), }); - let contentString = service.logFromError(error); + const contentString = service.logFromError(error); assert.ok( this.router.urlFor.calledWith('vault.cluster.access.control-group-accessor', '12345'), 'calls urlFor with accessor' @@ -156,19 +156,19 @@ module('Unit | Service | control group', function (hooks) { }); test('storageKey', function (assert) { - let accessor = '12345'; - let path = 'kv/foo/bar'; - let expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; + const accessor = '12345'; + const path = 'kv/foo/bar'; + const expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; assert.strictEqual(storageKey(accessor, path), expectedKey, 'uses expected key'); }); test('keyFromAccessor', function (assert) { - let store = storage(); - let accessor = '12345'; - let path = 'kv/foo/bar'; - let data = { foo: 'bar' }; - let expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; - let subject = this.owner.factoryFor('service:control-group').create({ + const store = storage(); + const accessor = '12345'; + const path = 'kv/foo/bar'; + const data = { foo: 'bar' }; + const expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; + const subject = this.owner.factoryFor('service:control-group').create({ storage() { return store; }, @@ -182,50 +182,50 @@ module('Unit | Service | control group', function (hooks) { }); test('storeControlGroupToken', function (assert) { - let store = storage(); - let subject = this.owner.factoryFor('service:control-group').create({ + const store = storage(); + const subject = this.owner.factoryFor('service:control-group').create({ storage() { return store; }, }); - let info = { + const info = { accessor: '12345', creation_path: 'foo/', creation_time: new Date().toISOString(), ttl: 300, }; - let key = `${CONTROL_GROUP_PREFIX}${info.accessor}${TOKEN_SEPARATOR}${info.creation_path}`; + const key = `${CONTROL_GROUP_PREFIX}${info.accessor}${TOKEN_SEPARATOR}${info.creation_path}`; subject.storeControlGroupToken(info); assert.deepEqual(store.items[key], JSON.stringify(info), 'stores the whole info object'); }); test('deleteControlGroupToken', function (assert) { - let store = storage(); - let subject = this.owner.factoryFor('service:control-group').create({ + const store = storage(); + const subject = this.owner.factoryFor('service:control-group').create({ storage() { return store; }, }); - let accessor = 'foo'; - let path = 'kv/one'; + const accessor = 'foo'; + const path = 'kv/one'; - let expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; + const expectedKey = `${CONTROL_GROUP_PREFIX}${accessor}${TOKEN_SEPARATOR}${path}`; store.setItem(expectedKey, { one: '2' }); subject.deleteControlGroupToken(accessor); assert.strictEqual(Object.keys(store.items).length, 0, 'there are no keys stored in storage'); }); test('deleteTokens', function (assert) { - let store = storage(); - let subject = this.owner.factoryFor('service:control-group').create({ + const store = storage(); + const subject = this.owner.factoryFor('service:control-group').create({ storage() { return store; }, }); - let keyOne = `${CONTROL_GROUP_PREFIX}foo`; - let keyTwo = `${CONTROL_GROUP_PREFIX}bar`; + const keyOne = `${CONTROL_GROUP_PREFIX}foo`; + const keyTwo = `${CONTROL_GROUP_PREFIX}bar`; store.setItem(keyOne, { one: '2' }); store.setItem(keyTwo, { two: '2' }); store.setItem('value', 'one'); @@ -236,14 +236,14 @@ module('Unit | Service | control group', function (hooks) { }); test('wrapInfoForAccessor', function (assert) { - let store = storage(); - let subject = this.owner.factoryFor('service:control-group').create({ + const store = storage(); + const subject = this.owner.factoryFor('service:control-group').create({ storage() { return store; }, }); - let keyOne = `${CONTROL_GROUP_PREFIX}foo`; + const keyOne = `${CONTROL_GROUP_PREFIX}foo`; store.setItem(keyOne, { one: '2' }); assert.deepEqual(subject.wrapInfoForAccessor('foo'), { one: '2' }); }); diff --git a/ui/tests/unit/services/feature-flag-test.js b/ui/tests/unit/services/feature-flag-test.js index 3ff9acf363..3ca5b690e4 100644 --- a/ui/tests/unit/services/feature-flag-test.js +++ b/ui/tests/unit/services/feature-flag-test.js @@ -5,12 +5,12 @@ module('Unit | Service | feature-flag', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let service = this.owner.lookup('service:feature-flag'); + const service = this.owner.lookup('service:feature-flag'); assert.ok(service); }); test('it returns the namespace root when flag is present', function (assert) { - let service = this.owner.lookup('service:feature-flag'); + const service = this.owner.lookup('service:feature-flag'); assert.strictEqual(service.managedNamespaceRoot, null, 'Managed namespace root is null by default'); service.setFeatureFlags(['VAULT_CLOUD_ADMIN_NAMESPACE']); assert.strictEqual(service.managedNamespaceRoot, 'admin', 'Managed namespace is admin when flag present'); diff --git a/ui/tests/unit/services/permissions-test.js b/ui/tests/unit/services/permissions-test.js index 7c8a327cf1..1cbb197a9b 100644 --- a/ui/tests/unit/services/permissions-test.js +++ b/ui/tests/unit/services/permissions-test.js @@ -42,69 +42,69 @@ module('Unit | Service | permissions', function (hooks) { }); test('sets paths properly', async function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); await service.getPaths.perform(); assert.deepEqual(service.get('exactPaths'), PERMISSIONS_RESPONSE.data.exact_paths); assert.deepEqual(service.get('globPaths'), PERMISSIONS_RESPONSE.data.glob_paths); }); test('returns true if a policy includes access to an exact path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('exactPaths', PERMISSIONS_RESPONSE.data.exact_paths); assert.true(service.hasPermission('foo')); }); test('returns true if a paths prefix is included in the policys exact paths', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('exactPaths', PERMISSIONS_RESPONSE.data.exact_paths); assert.true(service.hasPermission('bar')); }); test('it returns true if a policy includes access to a glob path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('globPaths', PERMISSIONS_RESPONSE.data.glob_paths); assert.true(service.hasPermission('baz/biz/hi')); }); test('it returns true if a policy includes access to the * glob path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); const splatPath = { '': {} }; service.set('globPaths', splatPath); assert.true(service.hasPermission('hi')); }); test('it returns false if the matched path includes the deny capability', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('globPaths', PERMISSIONS_RESPONSE.data.glob_paths); assert.false(service.hasPermission('boo')); }); test('it returns true if passed path does not end in a slash but globPath does', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('globPaths', PERMISSIONS_RESPONSE.data.glob_paths); assert.true(service.hasPermission('ends/in/slash'), 'matches without slash'); assert.true(service.hasPermission('ends/in/slash/'), 'matches with slash'); }); test('it returns false if a policy does not includes access to a path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); assert.false(service.hasPermission('danger')); }); test('sets the root token', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.setPaths({ data: { root: true } }); assert.true(service.canViewAll); }); test('returns true with the root token', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('canViewAll', true); assert.true(service.hasPermission('hi')); }); test('it returns true if a policy has the specified capabilities on a path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('exactPaths', PERMISSIONS_RESPONSE.data.exact_paths); service.set('globPaths', PERMISSIONS_RESPONSE.data.glob_paths); assert.true(service.hasPermission('bar/bee', ['create', 'list'])); @@ -112,7 +112,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('it returns false if a policy does not have the specified capabilities on a path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); service.set('exactPaths', PERMISSIONS_RESPONSE.data.exact_paths); service.set('globPaths', PERMISSIONS_RESPONSE.data.glob_paths); assert.false(service.hasPermission('bar/bee', ['create', 'delete'])); @@ -120,7 +120,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('defaults to show all items when policy cannot be found', async function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); this.server.get('/v1/sys/internal/ui/resultant-acl', () => { return [403, { 'Content-Type': 'application/json' }]; }); @@ -129,7 +129,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('returns the first allowed nav route for policies', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); const policyPaths = { 'sys/policies/acl': { capabilities: ['deny'], @@ -143,7 +143,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('returns the first allowed nav route for access', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); const accessPaths = { 'sys/auth': { capabilities: ['deny'], @@ -158,7 +158,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('hasNavPermission returns true if a policy includes the required capabilities for at least one path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); const accessPaths = { 'sys/auth': { capabilities: ['deny'], @@ -172,7 +172,7 @@ module('Unit | Service | permissions', function (hooks) { }); test('hasNavPermission returns false if a policy does not include the required capabilities for at least one path', function (assert) { - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); const accessPaths = { 'sys/auth': { capabilities: ['deny'], @@ -190,7 +190,7 @@ module('Unit | Service | permissions', function (hooks) { path: 'marketing', }); this.owner.register('service:namespace', namespaceService); - let service = this.owner.lookup('service:permissions'); + const service = this.owner.lookup('service:permissions'); assert.strictEqual(service.pathNameWithNamespace('sys/auth'), 'marketing/sys/auth'); }); }); diff --git a/ui/tests/unit/services/store-test.js b/ui/tests/unit/services/store-test.js index 82a5636492..8022f955d0 100644 --- a/ui/tests/unit/services/store-test.js +++ b/ui/tests/unit/services/store-test.js @@ -92,7 +92,7 @@ module('Unit | Service | store', function (hooks) { }); test('store.fetchPage', function (assert) { - let done = assert.async(4); + const done = assert.async(4); const keys = ['zero', 'one', 'two', 'three', 'four', 'five', 'six']; const data = { data: { @@ -191,7 +191,7 @@ module('Unit | Service | store', function (hooks) { }); test('store.lazyPaginatedQuery', function (assert) { - let response = { + const response = { data: ['foo'], }; let queryArgs; diff --git a/ui/tests/unit/services/version-test.js b/ui/tests/unit/services/version-test.js index d0b49bef2e..177bfe8d2a 100644 --- a/ui/tests/unit/services/version-test.js +++ b/ui/tests/unit/services/version-test.js @@ -5,35 +5,35 @@ module('Unit | Service | version', function (hooks) { setupTest(hooks); test('setting version computes isOSS properly', function (assert) { - let service = this.owner.lookup('service:version'); + const service = this.owner.lookup('service:version'); service.set('version', '0.9.5'); assert.true(service.get('isOSS')); assert.false(service.get('isEnterprise')); }); test('setting version computes isEnterprise properly', function (assert) { - let service = this.owner.lookup('service:version'); + const service = this.owner.lookup('service:version'); service.set('version', '0.9.5+prem'); assert.false(service.get('isOSS')); assert.true(service.get('isEnterprise')); }); test('setting version with hsm ending computes isEnterprise properly', function (assert) { - let service = this.owner.lookup('service:version'); + const service = this.owner.lookup('service:version'); service.set('version', '0.9.5+prem.hsm'); assert.false(service.get('isOSS')); assert.true(service.get('isEnterprise')); }); test('hasPerfReplication', function (assert) { - let service = this.owner.lookup('service:version'); + const service = this.owner.lookup('service:version'); assert.false(service.get('hasPerfReplication')); service.set('_features', ['Performance Replication']); assert.true(service.get('hasPerfReplication')); }); test('hasDRReplication', function (assert) { - let service = this.owner.lookup('service:version'); + const service = this.owner.lookup('service:version'); assert.false(service.get('hasDRReplication')); service.set('_features', ['DR Replication']); assert.true(service.get('hasDRReplication')); diff --git a/ui/tests/unit/services/wizard-test.js b/ui/tests/unit/services/wizard-test.js index c8c5a22290..27932df97e 100644 --- a/ui/tests/unit/services/wizard-test.js +++ b/ui/tests/unit/services/wizard-test.js @@ -45,7 +45,7 @@ module('Unit | Service | wizard', function (hooks) { }; } - let testCases = [ + const testCases = [ { method: 'getExtState', args: [STORAGE_KEYS.TUTORIAL_STATE], @@ -323,10 +323,10 @@ module('Unit | Service | wizard', function (hooks) { ]; testCases.forEach((testCase) => { - let store = storage(); + const store = storage(); test(`${testCase.method}`, function (assert) { assert.expect(testCase.assertCount); - let wizard = this.owner.factoryFor('service:wizard').create({ + const wizard = this.owner.factoryFor('service:wizard').create({ storage() { return store; }, @@ -342,7 +342,7 @@ module('Unit | Service | wizard', function (hooks) { testCase.storage.forEach((item) => wizard.storage().setItem(item.key, item.value)); } - let result = wizard[testCase.method](...testCase.args); + const result = wizard[testCase.method](...testCase.args); if (testCase.expectedResults.props) { testCase.expectedResults.props.forEach((property) => { assert.deepEqual( diff --git a/ui/tests/unit/utils/api-path-test.js b/ui/tests/unit/utils/api-path-test.js index 9d7dcd4d2d..c8d65bdddc 100644 --- a/ui/tests/unit/utils/api-path-test.js +++ b/ui/tests/unit/utils/api-path-test.js @@ -3,19 +3,19 @@ import { module, test } from 'qunit'; module('Unit | Util | api path', function () { test('it returns a function', function (assert) { - let ret = apiPath`foo`; + const ret = apiPath`foo`; assert.strictEqual(typeof ret, 'function'); }); test('it iterpolates strings from passed context object', function (assert) { - let ret = apiPath`foo/${'one'}/${'two'}`; - let result = ret({ one: 1, two: 2 }); + const ret = apiPath`foo/${'one'}/${'two'}`; + const result = ret({ one: 1, two: 2 }); assert.strictEqual(result, 'foo/1/2', 'returns the expected string'); }); test('it throws when the key is not found in the context', function (assert) { - let ret = apiPath`foo/${'one'}/${'two'}`; + const ret = apiPath`foo/${'one'}/${'two'}`; assert.throws(() => { ret({ one: 1 }); }, /Error: Assertion Failed: Expected 2 keys in apiPath context, only recieved one/); diff --git a/ui/tests/unit/utils/common-prefix-test.js b/ui/tests/unit/utils/common-prefix-test.js index 216f0b6f83..345cdc1de4 100644 --- a/ui/tests/unit/utils/common-prefix-test.js +++ b/ui/tests/unit/utils/common-prefix-test.js @@ -10,23 +10,23 @@ module('Unit | Util | common prefix', function () { }); test('it returns empty string if there are no common prefixes', function (assert) { - let secrets = ['asecret', 'secret2', 'secret3'].map((s) => ({ id: s })); - let returned = commonPrefix(secrets); + const secrets = ['asecret', 'secret2', 'secret3'].map((s) => ({ id: s })); + const returned = commonPrefix(secrets); assert.strictEqual(returned, '', 'returns an empty string'); }); test('it returns the longest prefix', function (assert) { - let secrets = ['secret1', 'secret2', 'secret3'].map((s) => ({ id: s })); + const secrets = ['secret1', 'secret2', 'secret3'].map((s) => ({ id: s })); let returned = commonPrefix(secrets); assert.strictEqual(returned, 'secret', 'finds secret prefix'); - let greetings = ['hello-there', 'hello-hi', 'hello-howdy'].map((s) => ({ id: s })); + const greetings = ['hello-there', 'hello-hi', 'hello-howdy'].map((s) => ({ id: s })); returned = commonPrefix(greetings); assert.strictEqual(returned, 'hello-', 'finds hello- prefix'); }); test('it can compare an attribute that is not "id" to calculate the longest prefix', function (assert) { - let secrets = ['secret1', 'secret2', 'secret3'].map((s) => ({ name: s })); - let returned = commonPrefix(secrets, 'name'); + const secrets = ['secret1', 'secret2', 'secret3'].map((s) => ({ name: s })); + const returned = commonPrefix(secrets, 'name'); assert.strictEqual(returned, 'secret', 'finds secret prefix from name attribute'); }); }); diff --git a/ui/tests/unit/utils/openapi-to-attrs-test.js b/ui/tests/unit/utils/openapi-to-attrs-test.js index dc3c55b60c..2163cea167 100644 --- a/ui/tests/unit/utils/openapi-to-attrs-test.js +++ b/ui/tests/unit/utils/openapi-to-attrs-test.js @@ -143,7 +143,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { test('it creates objects from OpenAPI schema props', function (assert) { assert.expect(6); const generatedProps = expandOpenApiProps(OPENAPI_RESPONSE_PROPS); - for (let propName in EXPANDED_PROPS) { + for (const propName in EXPANDED_PROPS) { assert.deepEqual(EXPANDED_PROPS[propName], generatedProps[propName], `correctly expands ${propName}`); } }); @@ -151,14 +151,14 @@ module('Unit | Util | OpenAPI Data Utilities', function () { test('it combines OpenAPI props with existing model attrs', function (assert) { assert.expect(3); const combined = combineAttributes(EXISTING_MODEL_ATTRS, EXPANDED_PROPS); - for (let propName in EXISTING_MODEL_ATTRS) { + for (const propName in EXISTING_MODEL_ATTRS) { assert.deepEqual(COMBINED_ATTRS[propName], combined[propName]); } }); test('it adds new fields from OpenAPI to fieldGroups except for exclusions', function (assert) { assert.expect(3); - let modelFieldGroups = [ + const modelFieldGroups = [ { default: ['name', 'awesomePeople'] }, { Options: ['ttl'], @@ -172,7 +172,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { }, ]; const newFieldGroups = combineFieldGroups(modelFieldGroups, NEW_FIELDS, excludedFields); - for (let groupName in modelFieldGroups) { + for (const groupName in modelFieldGroups) { assert.deepEqual( newFieldGroups[groupName], expectedGroups[groupName], @@ -182,7 +182,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { }); test('it adds all new fields from OpenAPI to fieldGroups when excludedFields is empty', function (assert) { assert.expect(3); - let modelFieldGroups = [ + const modelFieldGroups = [ { default: ['name', 'awesomePeople'] }, { Options: ['ttl'], @@ -196,7 +196,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { }, ]; const nonExcludedFieldGroups = combineFieldGroups(modelFieldGroups, NEW_FIELDS, excludedFields); - for (let groupName in modelFieldGroups) { + for (const groupName in modelFieldGroups) { assert.deepEqual( nonExcludedFieldGroups[groupName], expectedGroups[groupName], @@ -206,7 +206,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { }); test('it keeps fields the same when there are no brand new fields from OpenAPI', function (assert) { assert.expect(3); - let modelFieldGroups = [ + const modelFieldGroups = [ { default: ['name', 'awesomePeople', 'two', 'one', 'three'] }, { Options: ['ttl'], @@ -220,7 +220,7 @@ module('Unit | Util | OpenAPI Data Utilities', function () { }, ]; const fieldGroups = combineFieldGroups(modelFieldGroups, NEW_FIELDS, excludedFields); - for (let groupName in modelFieldGroups) { + for (const groupName in modelFieldGroups) { assert.deepEqual(fieldGroups[groupName], expectedGroups[groupName], 'it incorporates all new fields'); } });