Eslint prefer-const (#17864)

* adds prefer-const to eslint config and runs fixer

* reverts unintended change
This commit is contained in:
Jordan Reimer 2022-11-09 16:15:31 -07:00 committed by GitHub
parent 987e499a9e
commit 52fe56ec87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
464 changed files with 1701 additions and 1714 deletions

View File

@ -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

View File

@ -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 || {},

View File

@ -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,
})

View File

@ -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;

View File

@ -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;
});

View File

@ -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;
});

View File

@ -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') {

View File

@ -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`;
},
});

View File

@ -16,7 +16,7 @@ export default ApplicationAdapter.extend({
return url;
},
optionsForQuery(id) {
let data = {};
const data = {};
if (!id) {
data['list'] = true;
}

View File

@ -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();

View File

@ -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);

View File

@ -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);
},

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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);
},
});

View File

@ -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);

View File

@ -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];
}

View File

@ -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 {

View File

@ -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,

View File

@ -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);

View File

@ -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 });
}
}

View File

@ -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'

View File

@ -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 };
});

View File

@ -14,7 +14,7 @@ export default Adapter.extend({
return url;
},
optionsForQuery(id) {
let data = {};
const data = {};
if (!id) {
data['list'] = true;
}

View File

@ -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;
});

View File

@ -5,7 +5,7 @@ export default class PkiIssuerEngineAdapter extends ApplicationAdapter {
namespace = 'v1';
optionsForQuery(id) {
let data = {};
const data = {};
if (!id) {
data['list'] = true;
}

View File

@ -5,7 +5,7 @@ export default class PkiKeyEngineAdapter extends ApplicationAdapter {
namespace = 'v1';
optionsForQuery(id) {
let data = {};
const data = {};
if (!id) {
data['list'] = true;
}

View File

@ -14,7 +14,7 @@ export default class PkiRoleEngineAdapter extends ApplicationAdapter {
}
_optionsForQuery(id) {
let data = {};
const data = {};
if (!id) {
data['list'] = true;
}

View File

@ -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;
}

View File

@ -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;
},

View File

@ -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;
});

View File

@ -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;
}

View File

@ -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,
})}`;

View File

@ -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,

View File

@ -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 });
},

View File

@ -43,7 +43,7 @@ export default ApplicationAdapter.extend({
},
optionsForQuery(id, action, wrapTTL) {
let data = {};
const data = {};
if (action === 'query') {
data.list = true;
}

View File

@ -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 } });
},
});

View File

@ -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,

View File

@ -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)}`;
}

View File

@ -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;
}

View File

@ -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'

View File

@ -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,
},

View File

@ -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 `<state_id>,ns=<namespace>`. 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}`

View File

@ -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);

View File

@ -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';
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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.';
}

View File

@ -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,
});

View File

@ -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})`);

View File

@ -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;
});
}

View File

@ -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
});
}

View File

@ -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, {

View File

@ -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) {

View File

@ -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(),
});

View File

@ -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';
}

View File

@ -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(() => {

View File

@ -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 dont 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(() => {

View File

@ -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);
});

View File

@ -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;

View File

@ -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);

View File

@ -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()

View File

@ -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();
}

View File

@ -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];
}

View File

@ -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();

View File

@ -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 });

View File

@ -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());

View File

@ -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}`;
},

View File

@ -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();
},

View File

@ -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();

View File

@ -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();
},

View File

@ -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,

View File

@ -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);

View File

@ -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) =>

View File

@ -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,

View File

@ -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);

View File

@ -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;
});

View File

@ -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 +

View File

@ -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];
}),

View File

@ -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;
}

View File

@ -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 {

View File

@ -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;
}

View File

@ -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));
},

View File

@ -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 () {

View File

@ -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);

View File

@ -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);
}
}),

View File

@ -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);
}
})

View File

@ -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);
},
},

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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++;
}

View File

@ -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;
}

View File

@ -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(() => {

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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',

View File

@ -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.';

View File

@ -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 = '<choose a role>';
let value = 'value=<enter your value here>';
const value = 'value=<enter your value here>';
let tweak = '';
// determine the role

Some files were not shown because too many files have changed in this diff Show More