mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	Eslint prefer-const (#17864)
* adds prefer-const to eslint config and runs fixer * reverts unintended change
This commit is contained in:
		| @@ -24,6 +24,7 @@ module.exports = { | |||||||
|   }, |   }, | ||||||
|   rules: { |   rules: { | ||||||
|     'no-console': 'error', |     'no-console': 'error', | ||||||
|  |     'prefer-const': ['error', { destructuring: 'all' }], | ||||||
|     'ember/no-mixins': 'warn', |     'ember/no-mixins': 'warn', | ||||||
|     'ember/no-new-mixins': 'off', // should be warn but then every line of the mixin is green |     '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 |     // need to be fully glimmerized before these rules can be turned on | ||||||
|   | |||||||
| @@ -32,15 +32,16 @@ export default RESTAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   addHeaders(url, options) { |   addHeaders(url, options) { | ||||||
|     let token = options.clientToken || this.auth.currentToken; |     const token = options.clientToken || this.auth.currentToken; | ||||||
|     let headers = {}; |     const headers = {}; | ||||||
|     if (token && !options.unauthenticated) { |     if (token && !options.unauthenticated) { | ||||||
|       headers['X-Vault-Token'] = token; |       headers['X-Vault-Token'] = token; | ||||||
|     } |     } | ||||||
|     if (options.wrapTTL) { |     if (options.wrapTTL) { | ||||||
|       headers['X-Vault-Wrap-TTL'] = options.wrapTTL; |       headers['X-Vault-Wrap-TTL'] = options.wrapTTL; | ||||||
|     } |     } | ||||||
|     let namespace = typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; |     const namespace = | ||||||
|  |       typeof options.namespace === 'undefined' ? this.namespaceService.path : options.namespace; | ||||||
|     if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) { |     if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) { | ||||||
|       headers['X-Vault-Namespace'] = namespace; |       headers['X-Vault-Namespace'] = namespace; | ||||||
|     } |     } | ||||||
| @@ -61,8 +62,8 @@ export default RESTAdapter.extend({ | |||||||
|     let url = intendedUrl; |     let url = intendedUrl; | ||||||
|     let type = method; |     let type = method; | ||||||
|     let options = passedOptions; |     let options = passedOptions; | ||||||
|     let controlGroup = this.controlGroup; |     const controlGroup = this.controlGroup; | ||||||
|     let controlGroupToken = controlGroup.tokenForUrl(url); |     const controlGroupToken = controlGroup.tokenForUrl(url); | ||||||
|     // if we have a Control Group token that matches the intendedUrl, |     // if we have a Control Group token that matches the intendedUrl, | ||||||
|     // then we want to unwrap it and return the unwrapped response as |     // then we want to unwrap it and return the unwrapped response as | ||||||
|     // if it were the initial request |     // 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) => { |     return this._super(url, type, opts).then((...args) => { | ||||||
|       if (controlGroupToken) { |       if (controlGroupToken) { | ||||||
| @@ -85,7 +86,7 @@ export default RESTAdapter.extend({ | |||||||
|       } |       } | ||||||
|       const [resp] = args; |       const [resp] = args; | ||||||
|       if (resp && resp.warnings) { |       if (resp && resp.warnings) { | ||||||
|         let flash = this.flashMessages; |         const flash = this.flashMessages; | ||||||
|         resp.warnings.forEach((message) => { |         resp.warnings.forEach((message) => { | ||||||
|           flash.info(message); |           flash.info(message); | ||||||
|         }); |         }); | ||||||
| @@ -96,7 +97,7 @@ export default RESTAdapter.extend({ | |||||||
|  |  | ||||||
|   // for use on endpoints that don't return JSON responses |   // for use on endpoints that don't return JSON responses | ||||||
|   rawRequest(url, type, options = {}) { |   rawRequest(url, type, options = {}) { | ||||||
|     let opts = this._preRequest(url, options); |     const opts = this._preRequest(url, options); | ||||||
|     return fetch(url, { |     return fetch(url, { | ||||||
|       method: type || 'GET', |       method: type || 'GET', | ||||||
|       headers: opts.headers || {}, |       headers: opts.headers || {}, | ||||||
|   | |||||||
| @@ -16,9 +16,9 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   findAll(store, type, sinceToken, snapshotRecordArray) { |   findAll(store, type, sinceToken, snapshotRecordArray) { | ||||||
|     let isUnauthenticated = snapshotRecordArray?.adapterOptions?.unauthenticated; |     const isUnauthenticated = snapshotRecordArray?.adapterOptions?.unauthenticated; | ||||||
|     if (isUnauthenticated) { |     if (isUnauthenticated) { | ||||||
|       let url = `/${this.urlPrefix()}/internal/ui/mounts`; |       const url = `/${this.urlPrefix()}/internal/ui/mounts`; | ||||||
|       return this.ajax(url, 'GET', { |       return this.ajax(url, 'GET', { | ||||||
|         unauthenticated: true, |         unauthenticated: true, | ||||||
|       }) |       }) | ||||||
|   | |||||||
| @@ -2,12 +2,12 @@ import ApplicationAdapter from './application'; | |||||||
|  |  | ||||||
| export default ApplicationAdapter.extend({ | export default ApplicationAdapter.extend({ | ||||||
|   createRecord(store, type, snapshot) { |   createRecord(store, type, snapshot) { | ||||||
|     let ttl = snapshot.attr('ttl'); |     const ttl = snapshot.attr('ttl'); | ||||||
|     let roleArn = snapshot.attr('roleArn'); |     const roleArn = snapshot.attr('roleArn'); | ||||||
|     let roleType = snapshot.attr('credentialType'); |     const roleType = snapshot.attr('credentialType'); | ||||||
|     let method = 'POST'; |     let method = 'POST'; | ||||||
|     let options; |     let options; | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (roleType === 'iam_user') { |     if (roleType === 'iam_user') { | ||||||
|       method = 'GET'; |       method = 'GET'; | ||||||
|     } else { |     } else { | ||||||
| @@ -19,8 +19,8 @@ export default ApplicationAdapter.extend({ | |||||||
|       } |       } | ||||||
|       options = data.ttl || data.role_arn ? { data } : {}; |       options = data.ttl || data.role_arn ? { data } : {}; | ||||||
|     } |     } | ||||||
|     let role = snapshot.attr('role'); |     const role = snapshot.attr('role'); | ||||||
|     let url = `/v1/${role.backend}/creds/${role.name}`; |     const url = `/v1/${role.backend}/creds/${role.name}`; | ||||||
|  |  | ||||||
|     return this.ajax(url, method, options).then((response) => { |     return this.ajax(url, method, options).then((response) => { | ||||||
|       response.id = snapshot.id; |       response.id = snapshot.id; | ||||||
|   | |||||||
| @@ -8,14 +8,14 @@ export default Application.extend({ | |||||||
|     let { start_time, end_time } = query; |     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 |     // 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)) { |     if (Array.isArray(start_time)) { | ||||||
|       let startYear = Number(start_time[0]); |       const startYear = Number(start_time[0]); | ||||||
|       let startMonth = Number(start_time[1]); |       const startMonth = Number(start_time[1]); | ||||||
|       start_time = formatRFC3339(new Date(startYear, startMonth, 10)); |       start_time = formatRFC3339(new Date(startYear, startMonth, 10)); | ||||||
|     } |     } | ||||||
|     if (end_time) { |     if (end_time) { | ||||||
|       if (Array.isArray(end_time)) { |       if (Array.isArray(end_time)) { | ||||||
|         let endYear = Number(end_time[0]); |         const endYear = Number(end_time[0]); | ||||||
|         let endMonth = Number(end_time[1]); |         const endMonth = Number(end_time[1]); | ||||||
|         end_time = formatRFC3339(new Date(endYear, endMonth, 20)); |         end_time = formatRFC3339(new Date(endYear, endMonth, 20)); | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @@ -30,12 +30,12 @@ export default Application.extend({ | |||||||
|   // end_time: (2) ['2022', 0] |   // end_time: (2) ['2022', 0] | ||||||
|   // start_time: (2) ['2021', 2] |   // start_time: (2) ['2021', 2] | ||||||
|   queryRecord(store, type, query) { |   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. |     // 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) { |     if (queryParams) { | ||||||
|       return this.ajax(url, 'GET', { data: queryParams }).then((resp) => { |       return this.ajax(url, 'GET', { data: queryParams }).then((resp) => { | ||||||
|         let response = resp || {}; |         const response = resp || {}; | ||||||
|         response.id = response.request_id || 'no-data'; |         response.id = response.request_id || 'no-data'; | ||||||
|         return response; |         return response; | ||||||
|       }); |       }); | ||||||
|   | |||||||
| @@ -2,10 +2,10 @@ import ApplicationAdapter from '../application'; | |||||||
|  |  | ||||||
| export default class MonthlyAdapter extends ApplicationAdapter { | export default class MonthlyAdapter extends ApplicationAdapter { | ||||||
|   queryRecord() { |   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. |     // Query has startTime defined. The API will return the endTime if none is provided. | ||||||
|     return this.ajax(url, 'GET').then((resp) => { |     return this.ajax(url, 'GET').then((resp) => { | ||||||
|       let response = resp || {}; |       const response = resp || {}; | ||||||
|       response.id = response.request_id || 'no-data'; |       response.id = response.request_id || 'no-data'; | ||||||
|       return response; |       return response; | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   findRecord(store, type, id, snapshot) { |   findRecord(store, type, id, snapshot) { | ||||||
|     let fetches = { |     const fetches = { | ||||||
|       health: this.health(), |       health: this.health(), | ||||||
|       sealStatus: this.sealStatus().catch((e) => e), |       sealStatus: this.sealStatus().catch((e) => e), | ||||||
|     }; |     }; | ||||||
| @@ -110,7 +110,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const { role, jwt, token, password, username, path, nonce } = data; |     const { role, jwt, token, password, username, path, nonce } = data; | ||||||
|     const url = this.urlForAuth(backend, username, path); |     const url = this.urlForAuth(backend, username, path); | ||||||
|     const verb = backend === 'token' ? 'GET' : 'POST'; |     const verb = backend === 'token' ? 'GET' : 'POST'; | ||||||
|     let options = { |     const options = { | ||||||
|       unauthenticated: true, |       unauthenticated: true, | ||||||
|     }; |     }; | ||||||
|     if (backend === 'token') { |     if (backend === 'token') { | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   findRecord(store, type, id) { |   findRecord(store, type, id) { | ||||||
|     let baseUrl = this.buildURL(type.modelName); |     const baseUrl = this.buildURL(type.modelName); | ||||||
|     return this.ajax(`${baseUrl}/request`, 'POST', { |     return this.ajax(`${baseUrl}/request`, 'POST', { | ||||||
|       data: { |       data: { | ||||||
|         accessor: id, |         accessor: id, | ||||||
| @@ -18,7 +18,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   urlForUpdateRecord(id, modelName) { |   urlForUpdateRecord(id, modelName) { | ||||||
|     let base = this.buildURL(modelName); |     const base = this.buildURL(modelName); | ||||||
|     return `${base}/authorize`; |     return `${base}/authorize`; | ||||||
|   }, |   }, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     return url; |     return url; | ||||||
|   }, |   }, | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
| @@ -83,9 +83,9 @@ export default ApplicationAdapter.extend({ | |||||||
|         } |         } | ||||||
|         // Names are distinct across both types of role, |         // Names are distinct across both types of role, | ||||||
|         // so only one request should ever come back with value |         // so only one request should ever come back with value | ||||||
|         let type = staticResp.value ? 'static' : 'dynamic'; |         const type = staticResp.value ? 'static' : 'dynamic'; | ||||||
|         let successful = staticResp.value || dynamicResp.value; |         const successful = staticResp.value || dynamicResp.value; | ||||||
|         let resp = { |         const resp = { | ||||||
|           data: {}, |           data: {}, | ||||||
|           backend, |           backend, | ||||||
|           id, |           id, | ||||||
| @@ -105,7 +105,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const dynamicReq = this.dynamicRoles(backend); |     const dynamicReq = this.dynamicRoles(backend); | ||||||
|  |  | ||||||
|     return allSettled([staticReq, dynamicReq]).then(([staticResp, dynamicResp]) => { |     return allSettled([staticReq, dynamicReq]).then(([staticResp, dynamicResp]) => { | ||||||
|       let resp = { |       const resp = { | ||||||
|         backend, |         backend, | ||||||
|         data: { keys: [] }, |         data: { keys: [] }, | ||||||
|       }; |       }; | ||||||
| @@ -139,7 +139,7 @@ export default ApplicationAdapter.extend({ | |||||||
|  |  | ||||||
|   async _updateAllowedRoles(store, { role, backend, db, type = 'add' }) { |   async _updateAllowedRoles(store, { role, backend, db, type = 'add' }) { | ||||||
|     const connection = await store.queryRecord('database/connection', { backend, id: db }); |     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]); |     const allowedRoles = type === 'add' ? addToArray([roles, role]) : removeFromArray([roles, role]); | ||||||
|     connection.allowed_roles = allowedRoles; |     connection.allowed_roles = allowedRoles; | ||||||
|     return connection.save(); |     return connection.save(); | ||||||
|   | |||||||
| @@ -11,14 +11,14 @@ export default ApplicationAdapter.extend({ | |||||||
|  |  | ||||||
|   getDynamicApiPath: task(function* (id) { |   getDynamicApiPath: task(function* (id) { | ||||||
|     // TODO: remove yield at some point. |     // 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; |     this.dynamicApiPath = result.apiPath; | ||||||
|     return; |     return; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   fetchByQuery: task(function* (store, query, isList) { |   fetchByQuery: task(function* (store, query, isList) { | ||||||
|     const { id } = query; |     const { id } = query; | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (isList) { |     if (isList) { | ||||||
|       data.list = true; |       data.list = true; | ||||||
|       yield this.getDynamicApiPath.perform(id); |       yield this.getDynamicApiPath.perform(id); | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import IdentityAdapter from './base'; | |||||||
| export default IdentityAdapter.extend({ | export default IdentityAdapter.extend({ | ||||||
|   buildURL() { |   buildURL() { | ||||||
|     // first arg is modelName which we're hardcoding in the call to _super. |     // 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); |     return this._super('identity/entity/merge', ...args); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,11 +2,11 @@ import IdentityAdapter from './base'; | |||||||
|  |  | ||||||
| export default IdentityAdapter.extend({ | export default IdentityAdapter.extend({ | ||||||
|   lookup(store, data) { |   lookup(store, data) { | ||||||
|     let url = `/${this.urlPrefix()}/identity/lookup/entity`; |     const url = `/${this.urlPrefix()}/identity/lookup/entity`; | ||||||
|     return this.ajax(url, 'POST', { data }).then((response) => { |     return this.ajax(url, 'POST', { data }).then((response) => { | ||||||
|       // unsuccessful lookup is a 204 |       // unsuccessful lookup is a 204 | ||||||
|       if (!response) return; |       if (!response) return; | ||||||
|       let modelName = 'identity/entity'; |       const modelName = 'identity/entity'; | ||||||
|       store.push( |       store.push( | ||||||
|         store |         store | ||||||
|           .serializerFor(modelName) |           .serializerFor(modelName) | ||||||
|   | |||||||
| @@ -2,11 +2,11 @@ import IdentityAdapter from './base'; | |||||||
|  |  | ||||||
| export default IdentityAdapter.extend({ | export default IdentityAdapter.extend({ | ||||||
|   lookup(store, data) { |   lookup(store, data) { | ||||||
|     let url = `/${this.urlPrefix()}/identity/lookup/group`; |     const url = `/${this.urlPrefix()}/identity/lookup/group`; | ||||||
|     return this.ajax(url, 'POST', { data }).then((response) => { |     return this.ajax(url, 'POST', { data }).then((response) => { | ||||||
|       // unsuccessful lookup is a 204 |       // unsuccessful lookup is a 204 | ||||||
|       if (!response) return; |       if (!response) return; | ||||||
|       let modelName = 'identity/group'; |       const modelName = 'identity/group'; | ||||||
|       store.push( |       store.push( | ||||||
|         store |         store | ||||||
|           .serializerFor(modelName) |           .serializerFor(modelName) | ||||||
|   | |||||||
| @@ -47,13 +47,13 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter { | |||||||
|  |  | ||||||
|   _updateKey(backend, name, serialized) { |   _updateKey(backend, name, serialized) { | ||||||
|     // Only these two attributes are allowed to be updated |     // 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 }); |     return this.ajax(this.url(backend, name), 'PUT', { data }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   _createKey(backend, name, serialized) { |   _createKey(backend, name, serialized) { | ||||||
|     // Only type is allowed on create |     // 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 }); |     return this.ajax(this.url(backend, name), 'POST', { data }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -159,7 +159,7 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async rotateKey(backend, id) { |   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'); |     const result = await this.ajax(this.url(backend, id, 'ROTATE'), 'PUT'); | ||||||
|     await keyModel.reload(); |     await keyModel.reload(); | ||||||
|     return result; |     return result; | ||||||
|   | |||||||
| @@ -8,8 +8,8 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   _url(modelType, meta = {}, id) { |   _url(modelType, meta = {}, id) { | ||||||
|     let { backend, scope, role } = meta; |     const { backend, scope, role } = meta; | ||||||
|     let type = this.pathForType(modelType); |     const type = this.pathForType(modelType); | ||||||
|     let base; |     let base; | ||||||
|     switch (type) { |     switch (type) { | ||||||
|       case 'scope': |       case 'scope': | ||||||
| @@ -33,7 +33,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   urlForQuery(query, modelType) { |   urlForQuery(query, modelType) { | ||||||
|     let base = this._url(modelType, query); |     const base = this._url(modelType, query); | ||||||
|     return base + '?list=true'; |     return base + '?list=true'; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -47,7 +47,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   queryRecord(store, type, query) { |   queryRecord(store, type, query) { | ||||||
|     let id = query.id; |     const id = query.id; | ||||||
|     delete query.id; |     delete query.id; | ||||||
|     return this.ajax(this._url(type.modelName, query, id), 'GET').then((resp) => { |     return this.ajax(this._url(type.modelName, query, id), 'GET').then((resp) => { | ||||||
|       resp.id = id; |       resp.id = id; | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import BaseAdapter from './base'; | |||||||
|  |  | ||||||
| export default BaseAdapter.extend({ | export default BaseAdapter.extend({ | ||||||
|   urlForFindRecord(id, modelName, snapshot) { |   urlForFindRecord(id, modelName, snapshot) { | ||||||
|     let name = this.pathForType(modelName); |     const name = this.pathForType(modelName); | ||||||
|     return this.buildURL(id, name, snapshot); |     return this.buildURL(id, name, snapshot); | ||||||
|   }, |   }, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import BaseAdapter from './base'; | |||||||
|  |  | ||||||
| export default BaseAdapter.extend({ | export default BaseAdapter.extend({ | ||||||
|   _url(id, modelName, snapshot) { |   _url(id, modelName, snapshot) { | ||||||
|     let name = this.pathForType(modelName); |     const name = this.pathForType(modelName); | ||||||
|     // id here will be the mount path, |     // id here will be the mount path, | ||||||
|     // modelName will be config so we want to transpose the first two call args |     // modelName will be config so we want to transpose the first two call args | ||||||
|     return this.buildURL(id, name, snapshot); |     return this.buildURL(id, name, snapshot); | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ import { getProperties } from '@ember/object'; | |||||||
|  |  | ||||||
| export default BaseAdapter.extend({ | export default BaseAdapter.extend({ | ||||||
|   createRecord(store, type, snapshot) { |   createRecord(store, type, snapshot) { | ||||||
|     let name = snapshot.id || snapshot.attr('name'); |     const name = snapshot.id || snapshot.attr('name'); | ||||||
|     let url = this._url( |     const url = this._url( | ||||||
|       type.modelName, |       type.modelName, | ||||||
|       { |       { | ||||||
|         backend: snapshot.record.backend, |         backend: snapshot.record.backend, | ||||||
| @@ -24,8 +24,8 @@ export default BaseAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   deleteRecord(store, type, snapshot) { |   deleteRecord(store, type, snapshot) { | ||||||
|     let name = snapshot.id || snapshot.attr('name'); |     const name = snapshot.id || snapshot.attr('name'); | ||||||
|     let url = this._url( |     const url = this._url( | ||||||
|       type.modelName, |       type.modelName, | ||||||
|       { |       { | ||||||
|         backend: snapshot.record.backend, |         backend: snapshot.record.backend, | ||||||
| @@ -39,10 +39,10 @@ export default BaseAdapter.extend({ | |||||||
|   serialize(snapshot) { |   serialize(snapshot) { | ||||||
|     // the endpoint here won't allow sending `operation_all` and `operation_none` at the same time or with |     // 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 |     // other operation_ values, so we manually check for them and send an abbreviated object | ||||||
|     let json = snapshot.serialize(); |     const json = snapshot.serialize(); | ||||||
|     let keys = snapshot.record.nonOperationFields.map(decamelize); |     const keys = snapshot.record.nonOperationFields.map(decamelize); | ||||||
|     let nonOperationFields = getProperties(json, keys); |     const nonOperationFields = getProperties(json, keys); | ||||||
|     for (let field in nonOperationFields) { |     for (const field in nonOperationFields) { | ||||||
|       if (nonOperationFields[field] == null) { |       if (nonOperationFields[field] == null) { | ||||||
|         delete nonOperationFields[field]; |         delete nonOperationFields[field]; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import BaseAdapter from './base'; | |||||||
|  |  | ||||||
| export default BaseAdapter.extend({ | export default BaseAdapter.extend({ | ||||||
|   createRecord(store, type, snapshot) { |   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 this.ajax(this._url(type.modelName, { backend: snapshot.record.backend }, name), 'POST').then( | ||||||
|       () => { |       () => { | ||||||
|         return { |         return { | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   renew(lease_id, increment) { |   renew(lease_id, increment) { | ||||||
|     let url = this.buildURL() + '/leases/renew'; |     const url = this.buildURL() + '/leases/renew'; | ||||||
|     return this.ajax(url, 'PUT', { |     return this.ajax(url, 'PUT', { | ||||||
|       data: { |       data: { | ||||||
|         lease_id, |         lease_id, | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ export default class MfaMethodAdapter extends ApplicationAdapter { | |||||||
|  |  | ||||||
|   buildURL(modelName, id, snapshot, requestType) { |   buildURL(modelName, id, snapshot, requestType) { | ||||||
|     if (requestType === 'POST') { |     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 id ? `${url}/${id}` : url; | ||||||
|     } |     } | ||||||
|     return super.buildURL(...arguments); |     return super.buildURL(...arguments); | ||||||
|   | |||||||
| @@ -2,12 +2,12 @@ import ApplicationAdapter from './application'; | |||||||
|  |  | ||||||
| export default class MfaSetupAdapter extends ApplicationAdapter { | export default class MfaSetupAdapter extends ApplicationAdapter { | ||||||
|   adminGenerate(data) { |   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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   adminDestroy(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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -18,8 +18,8 @@ export default class NamedPathAdapter extends ApplicationAdapter { | |||||||
|  |  | ||||||
|   // create does not return response similar to PUT request |   // create does not return response similar to PUT request | ||||||
|   createRecord() { |   createRecord() { | ||||||
|     let [store, { modelName }, snapshot] = arguments; |     const [store, { modelName }, snapshot] = arguments; | ||||||
|     let name = snapshot.attr('name'); |     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 |     // 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)) { |     if (store.hasRecordForId(modelName, name)) { | ||||||
|       throw new Error(`A record already exists with the name: ${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' |     // * '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 |     // * '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 |     // * '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 }); |     const response = await this.ajax(url, 'GET', { data: queryParams }); | ||||||
|  |  | ||||||
|     // filter LIST response only if key_info exists and query includes both 'paramKey' & 'filterFor' |     // filter LIST response only if key_info exists and query includes both 'paramKey' & 'filterFor' | ||||||
|   | |||||||
| @@ -12,12 +12,12 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   urlForCreateRecord(modelName, snapshot) { |   urlForCreateRecord(modelName, snapshot) { | ||||||
|     let id = snapshot.attr('path'); |     const id = snapshot.attr('path'); | ||||||
|     return this.buildURL(modelName, id); |     return this.buildURL(modelName, id); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   createRecord(store, type, snapshot) { |   createRecord(store, type, snapshot) { | ||||||
|     let id = snapshot.attr('path'); |     const id = snapshot.attr('path'); | ||||||
|     return this._super(...arguments).then(() => { |     return this._super(...arguments).then(() => { | ||||||
|       return { id }; |       return { id }; | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ export default Adapter.extend({ | |||||||
|     return url; |     return url; | ||||||
|   }, |   }, | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ export default ApplicationAdapter.extend({ | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     const data = snapshot.adapterOptions.fields.reduce((data, field) => { |     const data = snapshot.adapterOptions.fields.reduce((data, field) => { | ||||||
|       let attr = snapshot.attr(field); |       const attr = snapshot.attr(field); | ||||||
|       if (attr) { |       if (attr) { | ||||||
|         serializer.serializeAttribute(snapshot, data, field, attr); |         serializer.serializeAttribute(snapshot, data, field, attr); | ||||||
|       } else { |       } else { | ||||||
| @@ -32,7 +32,7 @@ export default ApplicationAdapter.extend({ | |||||||
|       return data; |       return data; | ||||||
|     }, {}); |     }, {}); | ||||||
|     return this.ajax(url, 'POST', { data }).then((resp) => { |     return this.ajax(url, 'POST', { data }).then((resp) => { | ||||||
|       let response = resp || {}; |       const response = resp || {}; | ||||||
|       response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`; |       response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`; | ||||||
|       return response; |       return response; | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ export default class PkiIssuerEngineAdapter extends ApplicationAdapter { | |||||||
|   namespace = 'v1'; |   namespace = 'v1'; | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ export default class PkiKeyEngineAdapter extends ApplicationAdapter { | |||||||
|   namespace = 'v1'; |   namespace = 'v1'; | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ export default class PkiRoleEngineAdapter extends ApplicationAdapter { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   _optionsForQuery(id) { |   _optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot, requestType); |     const data = serializer.serialize(snapshot, requestType); | ||||||
|     const { id } = snapshot; |     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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
| @@ -40,7 +40,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import ApplicationAdapter from './application'; | |||||||
| export default ApplicationAdapter.extend({ | export default ApplicationAdapter.extend({ | ||||||
|   namespace: 'v1/sys', |   namespace: 'v1/sys', | ||||||
|   pathForType(type) { |   pathForType(type) { | ||||||
|     let path = type.replace('policy', 'policies'); |     const path = type.replace('policy', 'policies'); | ||||||
|     return path; |     return path; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   fetchStatus(mode) { |   fetchStatus(mode) { | ||||||
|     let url = this.getStatusUrl(mode); |     const url = this.getStatusUrl(mode); | ||||||
|     return this.ajax(url, 'GET', { unauthenticated: true }).then((resp) => { |     return this.ajax(url, 'GET', { unauthenticated: true }).then((resp) => { | ||||||
|       return resp.data; |       return resp.data; | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot, requestType); |     const data = serializer.serialize(snapshot, requestType); | ||||||
|     const { id } = snapshot; |     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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
| @@ -40,7 +40,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -9,8 +9,8 @@ export default ApplicationAdapter.extend({ | |||||||
|     let [path, role] = JSON.parse(id); |     let [path, role] = JSON.parse(id); | ||||||
|     path = encodePath(path); |     path = encodePath(path); | ||||||
|  |  | ||||||
|     let namespace = snapshot?.adapterOptions.namespace; |     const namespace = snapshot?.adapterOptions.namespace; | ||||||
|     let url = `/v1/auth/${path}/oidc/auth_url`; |     const url = `/v1/auth/${path}/oidc/auth_url`; | ||||||
|     let redirect_uri = `${window.location.origin}${this.router.urlFor('vault.cluster.oidc-callback', { |     let redirect_uri = `${window.location.origin}${this.router.urlFor('vault.cluster.oidc-callback', { | ||||||
|       auth_path: path, |       auth_path: path, | ||||||
|     })}`; |     })}`; | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot, requestType); |     const data = serializer.serialize(snapshot, requestType); | ||||||
|     const { id } = snapshot; |     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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
| @@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
| @@ -61,7 +61,7 @@ export default ApplicationAdapter.extend({ | |||||||
|       if (!results[0].value) { |       if (!results[0].value) { | ||||||
|         throw results[0].reason; |         throw results[0].reason; | ||||||
|       } |       } | ||||||
|       let resp = { |       const resp = { | ||||||
|         id, |         id, | ||||||
|         name: id, |         name: id, | ||||||
|         backend, |         backend, | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     data.config.id = path; // config relationship needs an id so use path for now |     data.config.id = path; // config relationship needs an id so use path for now | ||||||
|     if (data.type === 'kv' && data.options.version === 2) { |     if (data.type === 'kv' && data.options.version === 2) { | ||||||
|       // data has both data for sys mount and the config, we need to separate them |       // 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; |       let configData; | ||||||
|       [configData, data] = splitObjects; |       [configData, data] = splitObjects; | ||||||
|  |  | ||||||
| @@ -116,13 +116,13 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   saveAWSRoot(store, type, snapshot) { |   saveAWSRoot(store, type, snapshot) { | ||||||
|     let { data } = snapshot.adapterOptions; |     const { data } = snapshot.adapterOptions; | ||||||
|     const path = encodePath(snapshot.id); |     const path = encodePath(snapshot.id); | ||||||
|     return this.ajax(`/v1/${path}/config/root`, 'POST', { data }); |     return this.ajax(`/v1/${path}/config/root`, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   saveAWSLease(store, type, snapshot) { |   saveAWSLease(store, type, snapshot) { | ||||||
|     let { data } = snapshot.adapterOptions; |     const { data } = snapshot.adapterOptions; | ||||||
|     const path = encodePath(snapshot.id); |     const path = encodePath(snapshot.id); | ||||||
|     return this.ajax(`/v1/${path}/config/lease`, 'POST', { data }); |     return this.ajax(`/v1/${path}/config/lease`, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id, action, wrapTTL) { |   optionsForQuery(id, action, wrapTTL) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (action === 'query') { |     if (action === 'query') { | ||||||
|       data.list = true; |       data.list = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -12,8 +12,8 @@ export default ApplicationAdapter.extend({ | |||||||
|     return '/v1/sys/storage/raft/remove-peer'; |     return '/v1/sys/storage/raft/remove-peer'; | ||||||
|   }, |   }, | ||||||
|   deleteRecord(store, type, snapshot) { |   deleteRecord(store, type, snapshot) { | ||||||
|     let server_id = snapshot.attr('nodeId'); |     const server_id = snapshot.attr('nodeId'); | ||||||
|     let url = '/v1/sys/storage/raft/remove-peer'; |     const url = '/v1/sys/storage/raft/remove-peer'; | ||||||
|     return this.ajax(url, 'POST', { data: { server_id } }); |     return this.ajax(url, 'POST', { data: { server_id } }); | ||||||
|   }, |   }, | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot); |     const data = serializer.serialize(snapshot); | ||||||
|     const { id } = 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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
| @@ -41,7 +41,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
| @@ -57,7 +57,7 @@ export default ApplicationAdapter.extend({ | |||||||
|       if (!results[0].value) { |       if (!results[0].value) { | ||||||
|         throw results[0].reason; |         throw results[0].reason; | ||||||
|       } |       } | ||||||
|       let resp = { |       const resp = { | ||||||
|         id, |         id, | ||||||
|         name: id, |         name: id, | ||||||
|         backend, |         backend, | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default ApplicationAdapter.extend({ | |||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot); |     const data = serializer.serialize(snapshot); | ||||||
|     const { id } = 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 }); |     return this.ajax(url, 'POST', { data }); | ||||||
|   }, |   }, | ||||||
| @@ -31,8 +31,8 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   url(backend, modelType, id) { |   url(backend, modelType, id) { | ||||||
|     let type = this.pathForType(modelType); |     const type = this.pathForType(modelType); | ||||||
|     let url = `/${this.namespace}/${encodePath(backend)}/${encodePath(type)}`; |     const url = `/${this.namespace}/${encodePath(backend)}/${encodePath(type)}`; | ||||||
|     if (id) { |     if (id) { | ||||||
|       return `${url}/${encodePath(id)}`; |       return `${url}/${encodePath(id)}`; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -8,14 +8,14 @@ export default ApplicationAdapter.extend({ | |||||||
|   createOrUpdate(store, type, snapshot, requestType) { |   createOrUpdate(store, type, snapshot, requestType) { | ||||||
|     const serializer = store.serializerFor(type.modelName); |     const serializer = store.serializerFor(type.modelName); | ||||||
|     const data = serializer.serialize(snapshot, requestType); |     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); |     let url = this.urlForSecret(snapshot.record.get('backend'), name); | ||||||
|     if (requestType === 'update') { |     if (requestType === 'update') { | ||||||
|       url = url + '/config'; |       url = url + '/config'; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return this.ajax(url, 'POST', { data }).then((resp) => { |     return this.ajax(url, 'POST', { data }).then((resp) => { | ||||||
|       let response = resp || {}; |       const response = resp || {}; | ||||||
|       response.id = name; |       response.id = name; | ||||||
|       return response; |       return response; | ||||||
|     }); |     }); | ||||||
| @@ -59,7 +59,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   urlForAction(action, backend, id, param) { |   urlForAction(action, backend, id, param) { | ||||||
|     let urlBase = `${this.buildURL()}/${encodePath(backend)}/${action}`; |     const urlBase = `${this.buildURL()}/${encodePath(backend)}/${action}`; | ||||||
|     // these aren't key-specific |     // these aren't key-specific | ||||||
|     if (action === 'hash' || action === 'random') { |     if (action === 'hash' || action === 'random') { | ||||||
|       return urlBase; |       return urlBase; | ||||||
| @@ -69,7 +69,7 @@ export default ApplicationAdapter.extend({ | |||||||
|       return `${urlBase}/${param}/${encodePath(id)}`; |       return `${urlBase}/${param}/${encodePath(id)}`; | ||||||
|     } |     } | ||||||
|     if (action === 'export' && param) { |     if (action === 'export' && param) { | ||||||
|       let [type, version] = param; |       const [type, version] = param; | ||||||
|       const exportBase = `${urlBase}/${type}-key/${encodePath(id)}`; |       const exportBase = `${urlBase}/${type}-key/${encodePath(id)}`; | ||||||
|       return version ? `${exportBase}/${version}` : exportBase; |       return version ? `${exportBase}/${version}` : exportBase; | ||||||
|     } |     } | ||||||
| @@ -77,7 +77,7 @@ export default ApplicationAdapter.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   optionsForQuery(id) { |   optionsForQuery(id) { | ||||||
|     let data = {}; |     const data = {}; | ||||||
|     if (!id) { |     if (!id) { | ||||||
|       data['list'] = true; |       data['list'] = true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ export default AuthConfigComponent.extend({ | |||||||
|  |  | ||||||
|   saveModel: task( |   saveModel: task( | ||||||
|     waitFor(function* () { |     waitFor(function* () { | ||||||
|       let data = this.model.config.serialize(); |       const data = this.model.config.serialize(); | ||||||
|       data.description = this.model.description; |       data.description = this.model.description; | ||||||
|  |  | ||||||
|       // token_type should not be tuneable for the token auth method, default is 'default-service' |       // token_type should not be tuneable for the token auth method, default is 'default-service' | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ export default Component.extend(DEFAULTS, { | |||||||
|  |  | ||||||
|   didReceiveAttrs() { |   didReceiveAttrs() { | ||||||
|     this._super(...arguments); |     this._super(...arguments); | ||||||
|     let { |     const { | ||||||
|       wrappedToken: token, |       wrappedToken: token, | ||||||
|       oldWrappedToken: oldToken, |       oldWrappedToken: oldToken, | ||||||
|       oldNamespace: oldNS, |       oldNamespace: oldNS, | ||||||
| @@ -94,13 +94,13 @@ export default Component.extend(DEFAULTS, { | |||||||
|   didRender() { |   didRender() { | ||||||
|     this._super(...arguments); |     this._super(...arguments); | ||||||
|     // on very narrow viewports the active tab may be overflowed, so we scroll it into view here |     // 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) { |     if (activeEle) { | ||||||
|       activeEle.scrollIntoView(); |       activeEle.scrollIntoView(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     next(() => { |     next(() => { | ||||||
|       let firstMethod = this.firstMethod(); |       const firstMethod = this.firstMethod(); | ||||||
|       // set `with` to the first method |       // set `with` to the first method | ||||||
|       if ( |       if ( | ||||||
|         !this.wrappedToken && |         !this.wrappedToken && | ||||||
| @@ -113,7 +113,7 @@ export default Component.extend(DEFAULTS, { | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   firstMethod() { |   firstMethod() { | ||||||
|     let firstMethod = this.methodsToShow.firstObject; |     const firstMethod = this.methodsToShow.firstObject; | ||||||
|     if (!firstMethod) return; |     if (!firstMethod) return; | ||||||
|     // prefer backends with a path over those with a type |     // prefer backends with a path over those with a type | ||||||
|     return firstMethod.path || firstMethod.type; |     return firstMethod.path || firstMethod.type; | ||||||
| @@ -154,7 +154,7 @@ export default Component.extend(DEFAULTS, { | |||||||
|     } |     } | ||||||
|     let type = this.selectedAuthBackend.type || 'token'; |     let type = this.selectedAuthBackend.type || 'token'; | ||||||
|     type = type.toLowerCase(); |     type = type.toLowerCase(); | ||||||
|     let templateName = dasherize(type); |     const templateName = dasherize(type); | ||||||
|     return templateName; |     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.`, |   cspErrorText: `This is a standby Vault node but can't communicate with the active node via request forwarding. Sign in at the active node to use the Vault UI.`, | ||||||
|  |  | ||||||
|   allSupportedMethods: computed('methodsToShow', 'hasMethodsWithPath', function () { |   allSupportedMethods: computed('methodsToShow', 'hasMethodsWithPath', function () { | ||||||
|     let hasMethodsWithPath = this.hasMethodsWithPath; |     const hasMethodsWithPath = this.hasMethodsWithPath; | ||||||
|     let methodsToShow = this.methodsToShow; |     const methodsToShow = this.methodsToShow; | ||||||
|     return hasMethodsWithPath ? methodsToShow.concat(BACKENDS) : methodsToShow; |     return hasMethodsWithPath ? methodsToShow.concat(BACKENDS) : methodsToShow; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
| @@ -172,8 +172,8 @@ export default Component.extend(DEFAULTS, { | |||||||
|     return this.methodsToShow.isAny('path'); |     return this.methodsToShow.isAny('path'); | ||||||
|   }), |   }), | ||||||
|   methodsToShow: computed('methods', function () { |   methodsToShow: computed('methods', function () { | ||||||
|     let methods = this.methods || []; |     const methods = this.methods || []; | ||||||
|     let shownMethods = methods.filter((m) => |     const shownMethods = methods.filter((m) => | ||||||
|       BACKENDS.find((b) => b.type.toLowerCase() === m.type.toLowerCase()) |       BACKENDS.find((b) => b.type.toLowerCase() === m.type.toLowerCase()) | ||||||
|     ); |     ); | ||||||
|     return shownMethods.length ? shownMethods : BACKENDS; |     return shownMethods.length ? shownMethods : BACKENDS; | ||||||
| @@ -183,9 +183,9 @@ export default Component.extend(DEFAULTS, { | |||||||
|     waitFor(function* (token) { |     waitFor(function* (token) { | ||||||
|       // will be using the Token Auth Method, so set it here |       // will be using the Token Auth Method, so set it here | ||||||
|       this.set('selectedAuth', 'token'); |       this.set('selectedAuth', 'token'); | ||||||
|       let adapter = this.store.adapterFor('tools'); |       const adapter = this.store.adapterFor('tools'); | ||||||
|       try { |       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.set('token', response.auth.client_token); | ||||||
|         this.send('doSubmit'); |         this.send('doSubmit'); | ||||||
|       } catch (e) { |       } catch (e) { | ||||||
| @@ -196,9 +196,9 @@ export default Component.extend(DEFAULTS, { | |||||||
|  |  | ||||||
|   fetchMethods: task( |   fetchMethods: task( | ||||||
|     waitFor(function* () { |     waitFor(function* () { | ||||||
|       let store = this.store; |       const store = this.store; | ||||||
|       try { |       try { | ||||||
|         let methods = yield store.findAll('auth-method', { |         const methods = yield store.findAll('auth-method', { | ||||||
|           adapterOptions: { |           adapterOptions: { | ||||||
|             unauthenticated: true, |             unauthenticated: true, | ||||||
|           }, |           }, | ||||||
|   | |||||||
| @@ -58,8 +58,8 @@ export default Component.extend({ | |||||||
|         // debounce |         // debounce | ||||||
|         yield timeout(Ember.testing ? 0 : WAIT_TIME); |         yield timeout(Ember.testing ? 0 : WAIT_TIME); | ||||||
|       } |       } | ||||||
|       let path = this.selectedAuthPath || this.selectedAuthType; |       const path = this.selectedAuthPath || this.selectedAuthType; | ||||||
|       let id = JSON.stringify([path, roleName]); |       const id = JSON.stringify([path, roleName]); | ||||||
|       let role = null; |       let role = null; | ||||||
|       try { |       try { | ||||||
|         role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } }); |         role = yield this.store.findRecord('role-jwt', id, { adapterOptions: { namespace: this.namespace } }); | ||||||
| @@ -137,7 +137,7 @@ export default Component.extend({ | |||||||
|     // in the state param in the format `<state_id>,ns=<namespace>`. So if |     // in the state param in the format `<state_id>,ns=<namespace>`. So if | ||||||
|     // `namespace` is empty, check for namespace in state as well. |     // `namespace` is empty, check for namespace in state as well. | ||||||
|     if (namespace === '' || this.featureFlagService.managedNamespaceRoot) { |     if (namespace === '' || this.featureFlagService.managedNamespaceRoot) { | ||||||
|       let i = state.indexOf(',ns='); |       const i = state.indexOf(',ns='); | ||||||
|       if (i >= 0) { |       if (i >= 0) { | ||||||
|         // ",ns=" is 4 characters |         // ",ns=" is 4 characters | ||||||
|         namespace = state.substring(i + 4); |         namespace = state.substring(i + 4); | ||||||
| @@ -152,7 +152,7 @@ export default Component.extend({ | |||||||
|     if (!path || !state || !code) { |     if (!path || !state || !code) { | ||||||
|       return this.handleOIDCError(ERROR_MISSING_PARAMS); |       return this.handleOIDCError(ERROR_MISSING_PARAMS); | ||||||
|     } |     } | ||||||
|     let adapter = this.store.adapterFor('auth-method'); |     const adapter = this.store.adapterFor('auth-method'); | ||||||
|     this.onNamespace(namespace); |     this.onNamespace(namespace); | ||||||
|     let resp; |     let resp; | ||||||
|     // do the OIDC exchange, set the token on the parent component |     // do the OIDC exchange, set the token on the parent component | ||||||
| @@ -190,13 +190,13 @@ export default Component.extend({ | |||||||
|           throw error; |           throw error; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       let win = this.getWindow(); |       const win = this.getWindow(); | ||||||
|  |  | ||||||
|       const POPUP_WIDTH = 500; |       const POPUP_WIDTH = 500; | ||||||
|       const POPUP_HEIGHT = 600; |       const POPUP_HEIGHT = 600; | ||||||
|       let left = win.screen.width / 2 - POPUP_WIDTH / 2; |       const left = win.screen.width / 2 - POPUP_WIDTH / 2; | ||||||
|       let top = win.screen.height / 2 - POPUP_HEIGHT / 2; |       const top = win.screen.height / 2 - POPUP_HEIGHT / 2; | ||||||
|       let oidcWindow = win.open( |       const oidcWindow = win.open( | ||||||
|         this.role.authUrl, |         this.role.authUrl, | ||||||
|         'vaultOIDCWindow', |         'vaultOIDCWindow', | ||||||
|         `width=${POPUP_WIDTH},height=${POPUP_HEIGHT},resizable,scrollbars=yes,top=${top},left=${left}` |         `width=${POPUP_WIDTH},height=${POPUP_HEIGHT},resizable,scrollbars=yes,top=${top},left=${left}` | ||||||
|   | |||||||
| @@ -116,12 +116,12 @@ export default Component.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   click() { |   click() { | ||||||
|     let val = this.value; |     const val = this.value; | ||||||
|     const isUTF8 = this.currentEncoding === UTF8; |     const isUTF8 = this.currentEncoding === UTF8; | ||||||
|     if (!val) { |     if (!val) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     let newVal = isUTF8 ? encodeString(val) : decodeString(val); |     const newVal = isUTF8 ? encodeString(val) : decodeString(val); | ||||||
|     const encoding = isUTF8 ? B64 : UTF8; |     const encoding = isUTF8 ? B64 : UTF8; | ||||||
|     set(this, 'value', newVal); |     set(this, 'value', newVal); | ||||||
|     set(this, '_value', newVal); |     set(this, '_value', newVal); | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ class CalendarWidget extends Component { | |||||||
|     return this.displayYear === this.currentYear; |     return this.displayYear === this.currentYear; | ||||||
|   } |   } | ||||||
|   get disablePastYear() { |   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 |     return this.displayYear === startYear; // if on startYear then don't let them click back to the year prior | ||||||
|   } |   } | ||||||
|   get widgetMonths() { |   get widgetMonths() { | ||||||
| @@ -98,7 +98,7 @@ class CalendarWidget extends Component { | |||||||
|   @action |   @action | ||||||
|   addTooltip() { |   addTooltip() { | ||||||
|     if (this.disablePastYear) { |     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.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'; |       this.tooltipTarget = '#previous-year'; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ export default class Attribution extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get chartText() { |   get chartText() { | ||||||
|     let dateText = this.isDateRange ? 'date range' : 'month'; |     const dateText = this.isDateRange ? 'date range' : 'month'; | ||||||
|     switch (this.isSingleNamespace) { |     switch (this.isSingleNamespace) { | ||||||
|       case true: |       case true: | ||||||
|         return { |         return { | ||||||
| @@ -108,14 +108,14 @@ export default class Attribution extends Component { | |||||||
|   destructureCountsToArray(object) { |   destructureCountsToArray(object) { | ||||||
|     // destructure the namespace object  {label: 'some-namespace', entity_clients: 171, non_entity_clients: 20, clients: 191} |     // destructure the namespace object  {label: 'some-namespace', entity_clients: 171, non_entity_clients: 20, clients: 191} | ||||||
|     // to get integers for CSV file |     // 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]; |     return [clients, entity_clients, non_entity_clients]; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   constructCsvRow(namespaceColumn, mountColumn = null, totalColumns, newColumns = null) { |   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 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 |     // 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 [ |     return [ | ||||||
|       `${typeof namespaceColumn === 'string' ? namespaceColumn : namespaceColumn.label}`, |       `${typeof namespaceColumn === 'string' ? namespaceColumn : namespaceColumn.label}`, | ||||||
|       `${mountColumn ? mountColumn.label : ''}`, |       `${mountColumn ? mountColumn.label : ''}`, | ||||||
| @@ -126,30 +126,30 @@ export default class Attribution extends Component { | |||||||
|   generateCsvData() { |   generateCsvData() { | ||||||
|     const totalAttribution = this.args.totalClientAttribution; |     const totalAttribution = this.args.totalClientAttribution; | ||||||
|     const newAttribution = this.barChartNewClients ? this.args.newClientAttribution : null; |     const newAttribution = this.barChartNewClients ? this.args.newClientAttribution : null; | ||||||
|     let csvData = [], |     const csvData = []; | ||||||
|       csvHeader = [ |     const csvHeader = [ | ||||||
|         'Namespace path', |       'Namespace path', | ||||||
|         'Authentication method', |       'Authentication method', | ||||||
|         'Total clients', |       'Total clients', | ||||||
|         'Entity clients', |       'Entity clients', | ||||||
|         'Non-entity clients', |       'Non-entity clients', | ||||||
|       ]; |     ]; | ||||||
|  |  | ||||||
|     if (newAttribution) { |     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) => { |     totalAttribution.forEach((totalClientsObject) => { | ||||||
|       let namespace = this.isSingleNamespace ? this.args.selectedNamespace : totalClientsObject; |       const namespace = this.isSingleNamespace ? this.args.selectedNamespace : totalClientsObject; | ||||||
|       let mount = this.isSingleNamespace ? totalClientsObject : null; |       const mount = this.isSingleNamespace ? totalClientsObject : null; | ||||||
|  |  | ||||||
|       // find new client data for namespace/mount object we're iterating over |       // 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) |         ? newAttribution.find((d) => d.label === totalClientsObject.label) | ||||||
|         : null; |         : null; | ||||||
|  |  | ||||||
|       let totalClients = this.destructureCountsToArray(totalClientsObject); |       const totalClients = this.destructureCountsToArray(totalClientsObject); | ||||||
|       let newClients = newClientsObject ? this.destructureCountsToArray(newClientsObject) : null; |       const newClients = newClientsObject ? this.destructureCountsToArray(newClientsObject) : null; | ||||||
|  |  | ||||||
|       csvData.push(this.constructCsvRow(namespace, mount, totalClients, newClients)); |       csvData.push(this.constructCsvRow(namespace, mount, totalClients, newClients)); | ||||||
|       // constructCsvRow returns an array that corresponds to a row in the csv file: |       // 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 |       // only iterate through mounts if NOT viewing a single namespace | ||||||
|       if (!this.isSingleNamespace && namespace.mounts) { |       if (!this.isSingleNamespace && namespace.mounts) { | ||||||
|         namespace.mounts.forEach((mount) => { |         namespace.mounts.forEach((mount) => { | ||||||
|           let newMountData = newAttribution |           const newMountData = newAttribution | ||||||
|             ? newClientsObject?.mounts.find((m) => m.label === mount.label) |             ? newClientsObject?.mounts.find((m) => m.label === mount.label) | ||||||
|             : null; |             : null; | ||||||
|           let mountTotalClients = this.destructureCountsToArray(mount); |           const mountTotalClients = this.destructureCountsToArray(mount); | ||||||
|           let mountNewClients = newMountData ? this.destructureCountsToArray(newMountData) : null; |           const mountNewClients = newMountData ? this.destructureCountsToArray(newMountData) : null; | ||||||
|           csvData.push(this.constructCsvRow(namespace, mount, mountTotalClients, mountNewClients)); |           csvData.push(this.constructCsvRow(namespace, mount, mountTotalClients, mountNewClients)); | ||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
| @@ -174,8 +174,8 @@ export default class Attribution extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get getCsvFileName() { |   get getCsvFileName() { | ||||||
|     let endRange = this.isDateRange ? `-${this.args.endTimeDisplay}` : ''; |     const endRange = this.isDateRange ? `-${this.args.endTimeDisplay}` : ''; | ||||||
|     let csvDateRange = this.args.startTimeDisplay + endRange; |     const csvDateRange = this.args.startTimeDisplay + endRange; | ||||||
|     return this.isSingleNamespace |     return this.isSingleNamespace | ||||||
|       ? `clients_by_auth_method_${csvDateRange}` |       ? `clients_by_auth_method_${csvDateRange}` | ||||||
|       : `clients_by_namespace_${csvDateRange}`; |       : `clients_by_namespace_${csvDateRange}`; | ||||||
| @@ -184,7 +184,7 @@ export default class Attribution extends Component { | |||||||
|   // ACTIONS |   // ACTIONS | ||||||
|   @action |   @action | ||||||
|   exportChartData(filename) { |   exportChartData(filename) { | ||||||
|     let contents = this.generateCsvData(); |     const contents = this.generateCsvData(); | ||||||
|     this.downloadCsv.download(filename, contents); |     this.downloadCsv.download(filename, contents); | ||||||
|     this.showCSVDownloadModal = false; |     this.showCSVDownloadModal = false; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ export default class ConfigComponent extends Component { | |||||||
|  |  | ||||||
|   @action |   @action | ||||||
|   updateBooleanValue(attr, value) { |   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; |     this.args.model[attr.name] = valueToSet; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,10 +23,10 @@ export default class Current extends Component { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // get upgrade data for initial upgrade to 1.9 and/or 1.10 |     // get upgrade data for initial upgrade to 1.9 and/or 1.10 | ||||||
|     let relevantUpgrades = []; |     const relevantUpgrades = []; | ||||||
|     const importantUpgrades = ['1.9', '1.10']; |     const importantUpgrades = ['1.9', '1.10']; | ||||||
|     importantUpgrades.forEach((version) => { |     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); |       if (findUpgrade) relevantUpgrades.push(findUpgrade); | ||||||
|     }); |     }); | ||||||
|     // array of upgrade data objects for noteworthy upgrades |     // array of upgrade data objects for noteworthy upgrades | ||||||
| @@ -71,7 +71,7 @@ export default class Current extends Component { | |||||||
|     } |     } | ||||||
|     const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { |     const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { | ||||||
|       // TODO how do timezones affect this? |       // 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 isAfter(upgradeDate, startOfMonth(new Date())); | ||||||
|     }); |     }); | ||||||
|     // return all upgrades that happened within date range of queried activity |     // return all upgrades that happened within date range of queried activity | ||||||
| @@ -83,10 +83,10 @@ export default class Current extends Component { | |||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     if (this.upgradeDuringCurrentMonth.length === 2) { |     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.`; |       return `Vault was upgraded to ${versions} during this month.`; | ||||||
|     } else { |     } else { | ||||||
|       let version = this.upgradeDuringCurrentMonth[0]; |       const version = this.upgradeDuringCurrentMonth[0]; | ||||||
|       return `Vault was upgraded to ${version.id} on this month.`; |       return `Vault was upgraded to ${version.id} on this month.`; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -96,7 +96,7 @@ export default class Current extends Component { | |||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     if (this.upgradeDuringCurrentMonth.length === 1) { |     if (this.upgradeDuringCurrentMonth.length === 1) { | ||||||
|       let version = this.upgradeDuringCurrentMonth[0].id; |       const version = this.upgradeDuringCurrentMonth[0].id; | ||||||
|       if (version.match('1.9')) { |       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.'; |         return ' How we count clients changed in 1.9, so keep that in mind when looking at the data below.'; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -98,10 +98,10 @@ export default class History extends Component { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // get upgrade data for initial upgrade to 1.9 and/or 1.10 |     // get upgrade data for initial upgrade to 1.9 and/or 1.10 | ||||||
|     let relevantUpgrades = []; |     const relevantUpgrades = []; | ||||||
|     const importantUpgrades = ['1.9', '1.10']; |     const importantUpgrades = ['1.9', '1.10']; | ||||||
|     importantUpgrades.forEach((version) => { |     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); |       if (findUpgrade) relevantUpgrades.push(findUpgrade); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| @@ -117,7 +117,7 @@ export default class History extends Component { | |||||||
|     const activityEnd = new Date(this.getActivityResponse.endTime); |     const activityEnd = new Date(this.getActivityResponse.endTime); | ||||||
|     const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { |     const upgradesWithinData = this.upgradeVersionHistory.filter((upgrade) => { | ||||||
|       // TODO how do timezones affect this? |       // 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 isAfter(upgradeDate, activityStart) && isBefore(upgradeDate, activityEnd); | ||||||
|     }); |     }); | ||||||
|     // return all upgrades that happened within date range of queried activity |     // return all upgrades that happened within date range of queried activity | ||||||
| @@ -129,13 +129,13 @@ export default class History extends Component { | |||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     if (this.upgradeDuringActivity.length === 2) { |     if (this.upgradeDuringActivity.length === 2) { | ||||||
|       let firstUpgrade = this.upgradeDuringActivity[0]; |       const firstUpgrade = this.upgradeDuringActivity[0]; | ||||||
|       let secondUpgrade = this.upgradeDuringActivity[1]; |       const secondUpgrade = this.upgradeDuringActivity[1]; | ||||||
|       let firstDate = dateFormat([firstUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); |       const firstDate = dateFormat([firstUpgrade.timestampInstalled, 'MMM d, yyyy'], { isFormatted: true }); | ||||||
|       let secondDate = dateFormat([secondUpgrade.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.`; |       return `Vault was upgraded to ${firstUpgrade.id} (${firstDate}) and ${secondUpgrade.id} (${secondDate}) during this time range.`; | ||||||
|     } else { |     } else { | ||||||
|       let upgrade = this.upgradeDuringActivity[0]; |       const upgrade = this.upgradeDuringActivity[0]; | ||||||
|       return `Vault was upgraded to ${upgrade.id} on ${dateFormat( |       return `Vault was upgraded to ${upgrade.id} on ${dateFormat( | ||||||
|         [upgrade.timestampInstalled, 'MMM d, yyyy'], |         [upgrade.timestampInstalled, 'MMM d, yyyy'], | ||||||
|         { isFormatted: true } |         { isFormatted: true } | ||||||
| @@ -148,7 +148,7 @@ export default class History extends Component { | |||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     if (this.upgradeDuringActivity.length === 1) { |     if (this.upgradeDuringActivity.length === 1) { | ||||||
|       let version = this.upgradeDuringActivity[0].id; |       const version = this.upgradeDuringActivity[0].id; | ||||||
|       if (version.match('1.9')) { |       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.'; |         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) { |     if (!this.startTimeFromResponse) { | ||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     let month = this.startTimeFromResponse[1]; |     const month = this.startTimeFromResponse[1]; | ||||||
|     let year = this.startTimeFromResponse[0]; |     const year = this.startTimeFromResponse[0]; | ||||||
|     return `${this.arrayOfMonths[month]} ${year}`; |     return `${this.arrayOfMonths[month]} ${year}`; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -173,8 +173,8 @@ export default class History extends Component { | |||||||
|     if (!this.endTimeFromResponse) { |     if (!this.endTimeFromResponse) { | ||||||
|       return null; |       return null; | ||||||
|     } |     } | ||||||
|     let month = this.endTimeFromResponse[1]; |     const month = this.endTimeFromResponse[1]; | ||||||
|     let year = this.endTimeFromResponse[0]; |     const year = this.endTimeFromResponse[0]; | ||||||
|     return `${this.arrayOfMonths[month]} ${year}`; |     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. |     // clicked "Edit" Billing start month in History which opens a modal. | ||||||
|     if (dateType === 'startTime') { |     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.startTimeRequested = [year.toString(), monthIndex]; // ['2021', 0] (e.g. January 2021) | ||||||
|       this.endTimeRequested = null; |       this.endTimeRequested = null; | ||||||
|     } |     } | ||||||
| @@ -302,7 +302,7 @@ export default class History extends Component { | |||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       this.isLoadingQuery = true; |       this.isLoadingQuery = true; | ||||||
|       let response = await this.store.queryRecord('clients/activity', { |       const response = await this.store.queryRecord('clients/activity', { | ||||||
|         start_time: this.startTimeRequested, |         start_time: this.startTimeRequested, | ||||||
|         end_time: this.endTimeRequested, |         end_time: this.endTimeRequested, | ||||||
|       }); |       }); | ||||||
|   | |||||||
| @@ -66,24 +66,24 @@ export default class HorizontalBarChart extends Component { | |||||||
|     // chart legend tells stackFunction how to stack/organize data |     // chart legend tells stackFunction how to stack/organize data | ||||||
|     // creates an array of data for each key name |     // creates an array of data for each key name | ||||||
|     // each array contains coordinates for each data bar |     // each array contains coordinates for each data bar | ||||||
|     let stackFunction = stack().keys(this.chartLegend.map((l) => l.key)); |     const stackFunction = stack().keys(this.chartLegend.map((l) => l.key)); | ||||||
|     let dataset = chartData; |     const dataset = chartData; | ||||||
|     let stackedData = stackFunction(dataset); |     const stackedData = stackFunction(dataset); | ||||||
|     let labelKey = this.labelKey; |     const labelKey = this.labelKey; | ||||||
|     let xKey = this.xKey; |     const xKey = this.xKey; | ||||||
|     let xScale = scaleLinear() |     const xScale = scaleLinear() | ||||||
|       .domain([0, max(dataset.map((d) => d[xKey]))]) |       .domain([0, max(dataset.map((d) => d[xKey]))]) | ||||||
|       .range([0, 75]); // 25% reserved for margins |       .range([0, 75]); // 25% reserved for margins | ||||||
|  |  | ||||||
|     let yScale = scaleBand() |     const yScale = scaleBand() | ||||||
|       .domain(dataset.map((d) => d[labelKey])) |       .domain(dataset.map((d) => d[labelKey])) | ||||||
|       .range([0, dataset.length * LINE_HEIGHT]) |       .range([0, dataset.length * LINE_HEIGHT]) | ||||||
|       .paddingInner(0.765); // percent of the total width to reserve for padding between bars |       .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}`); |     chartSvg.attr('width', '100%').attr('viewBox', `0 0 564 ${(dataset.length + 1) * LINE_HEIGHT}`); | ||||||
|  |  | ||||||
|     let dataBarGroup = chartSvg |     const dataBarGroup = chartSvg | ||||||
|       .selectAll('g') |       .selectAll('g') | ||||||
|       .remove() |       .remove() | ||||||
|       .exit() |       .exit() | ||||||
| @@ -95,9 +95,9 @@ export default class HorizontalBarChart extends Component { | |||||||
|       .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`) |       .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`) | ||||||
|       .style('fill', (d, i) => LIGHT_AND_DARK_BLUE[i]); |       .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') |       .append('g') | ||||||
|       .attr('data-test-group', 'y-labels') |       .attr('data-test-group', 'y-labels') | ||||||
|       .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`); |       .attr('transform', `translate(${CHART_MARGIN.left}, ${CHART_MARGIN.top})`); | ||||||
| @@ -105,7 +105,7 @@ export default class HorizontalBarChart extends Component { | |||||||
|  |  | ||||||
|     chartSvg.select('.domain').remove(); |     chartSvg.select('.domain').remove(); | ||||||
|  |  | ||||||
|     let truncate = (selection) => |     const truncate = (selection) => | ||||||
|       selection.text((string) => |       selection.text((string) => | ||||||
|         string.length < CHAR_LIMIT ? string : string.slice(0, CHAR_LIMIT - 3) + '...' |         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('rx', 3) | ||||||
|       .attr('ry', 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') |       .selectAll('.action-bar') | ||||||
|       .remove() |       .remove() | ||||||
|       .exit() |       .exit() | ||||||
| @@ -148,9 +148,9 @@ export default class HorizontalBarChart extends Component { | |||||||
|       .style('opacity', '0') |       .style('opacity', '0') | ||||||
|       .style('mix-blend-mode', 'multiply'); |       .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') |       .selectAll('.label-action-bar') | ||||||
|       .remove() |       .remove() | ||||||
|       .exit() |       .exit() | ||||||
| @@ -166,16 +166,16 @@ export default class HorizontalBarChart extends Component { | |||||||
|       .style('opacity', '0') |       .style('opacity', '0') | ||||||
|       .style('mix-blend-mode', 'multiply'); |       .style('mix-blend-mode', 'multiply'); | ||||||
|  |  | ||||||
|     let dataBars = chartSvg.selectAll('rect.data-bar'); |     const dataBars = chartSvg.selectAll('rect.data-bar'); | ||||||
|     let actionBarSelection = chartSvg.selectAll('rect.action-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}`); |       select(elementA).attr(`${attr}`) === select(elementB).attr(`${attr}`); | ||||||
|  |  | ||||||
|     // MOUSE EVENTS FOR DATA BARS |     // MOUSE EVENTS FOR DATA BARS | ||||||
|     actionBars |     actionBars | ||||||
|       .on('mouseover', (data) => { |       .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.tooltipTarget = hoveredElement; | ||||||
|         this.isLabel = false; |         this.isLabel = false; | ||||||
|         this.tooltipText = this.total |         this.tooltipText = this.total | ||||||
| @@ -206,7 +206,7 @@ export default class HorizontalBarChart extends Component { | |||||||
|     labelActionBar |     labelActionBar | ||||||
|       .on('mouseover', (data) => { |       .on('mouseover', (data) => { | ||||||
|         if (data[labelKey].length >= CHAR_LIMIT) { |         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.tooltipTarget = hoveredElement; | ||||||
|           this.isLabel = true; |           this.isLabel = true; | ||||||
|           this.tooltipText = data[labelKey]; |           this.tooltipText = data[labelKey]; | ||||||
| @@ -239,7 +239,7 @@ export default class HorizontalBarChart extends Component { | |||||||
|       }); |       }); | ||||||
|  |  | ||||||
|     // client count total values to the right |     // client count total values to the right | ||||||
|     let totalValueGroup = chartSvg |     const totalValueGroup = chartSvg | ||||||
|       .append('g') |       .append('g') | ||||||
|       .attr('data-test-group', 'total-values') |       .attr('data-test-group', 'total-values') | ||||||
|       .attr('transform', `translate(${TRANSLATE.left}, ${TRANSLATE.down})`); |       .attr('transform', `translate(${TRANSLATE.left}, ${TRANSLATE.down})`); | ||||||
|   | |||||||
| @@ -182,14 +182,14 @@ export default class LineChart extends Component { | |||||||
|       this.tooltipTotal = formatNumber([data[this.yKey]]) + ' total clients'; |       this.tooltipTotal = formatNumber([data[this.yKey]]) + ' total clients'; | ||||||
|       this.tooltipNew = (formatNumber([data?.new_clients[this.yKey]]) || '0') + ' new clients'; |       this.tooltipNew = (formatNumber([data?.new_clients[this.yKey]]) || '0') + ' new clients'; | ||||||
|       this.tooltipUpgradeText = ''; |       this.tooltipUpgradeText = ''; | ||||||
|       let upgradeInfo = findUpgradeData(data); |       const upgradeInfo = findUpgradeData(data); | ||||||
|       if (upgradeInfo) { |       if (upgradeInfo) { | ||||||
|         let { id, previousVersion } = upgradeInfo; |         const { id, previousVersion } = upgradeInfo; | ||||||
|         this.tooltipUpgradeText = `Vault was upgraded  |         this.tooltipUpgradeText = `Vault was upgraded  | ||||||
|         ${previousVersion ? 'from ' + previousVersion : ''} to ${id}`; |         ${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; |       this.tooltipTarget = node; | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -147,12 +147,12 @@ export default class VerticalBarChart extends Component { | |||||||
|  |  | ||||||
|     // MOUSE EVENT FOR TOOLTIP |     // MOUSE EVENT FOR TOOLTIP | ||||||
|     tooltipRect.on('mouseover', (data) => { |     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.tooltipTotal = `${formatNumber([data[this.yKey]])} ${data.new_clients ? 'total' : 'new'} clients`; | ||||||
|       this.entityClients = `${formatNumber([data.entity_clients])} entity clients`; |       this.entityClients = `${formatNumber([data.entity_clients])} entity clients`; | ||||||
|       this.nonEntityClients = `${formatNumber([data.non_entity_clients])} non-entity clients`; |       this.nonEntityClients = `${formatNumber([data.non_entity_clients])} non-entity clients`; | ||||||
|       // filter for the tether point that matches the hoveredMonth |       // 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 |       this.tooltipTarget = hoveredElement; // grab the node from the list of rects | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ export function stringifyObjectValues(data) { | |||||||
| export default Component.extend({ | export default Component.extend({ | ||||||
|   content: null, |   content: null, | ||||||
|   columns: computed('content', function () { |   columns: computed('content', function () { | ||||||
|     let data = this.content; |     const data = this.content; | ||||||
|     stringifyObjectValues(data); |     stringifyObjectValues(data); | ||||||
|  |  | ||||||
|     return columnify(data, { |     return columnify(data, { | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   executeCommand: task(function* (command, shouldThrow = false) { |   executeCommand: task(function* (command, shouldThrow = false) { | ||||||
|     this.set('inputValue', ''); |     this.set('inputValue', ''); | ||||||
|     let service = this.console; |     const service = this.console; | ||||||
|     let serviceArgs; |     let serviceArgs; | ||||||
|  |  | ||||||
|     if ( |     if ( | ||||||
| @@ -69,19 +69,19 @@ export default Component.extend({ | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     let [method, flagArray, path, dataArray] = serviceArgs; |     const [method, flagArray, path, dataArray] = serviceArgs; | ||||||
|  |  | ||||||
|     if (dataArray || flagArray) { |     if (dataArray || flagArray) { | ||||||
|       var { data, flags } = extractDataAndFlags(method, 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) { |     if (inputError) { | ||||||
|       this.logAndOutput(command, inputError); |       this.logAndOutput(command, inputError); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     try { |     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)); |       this.logAndOutput(command, logFromResponse(resp, path, method, flags)); | ||||||
|     } catch (error) { |     } catch (error) { | ||||||
|       if (error instanceof ControlGroupError) { |       if (error instanceof ControlGroupError) { | ||||||
| @@ -92,8 +92,8 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   refreshRoute: task(function* () { |   refreshRoute: task(function* () { | ||||||
|     let owner = getOwner(this); |     const owner = getOwner(this); | ||||||
|     let currentRoute = owner.lookup(`router:main`).get('currentRouteName'); |     const currentRoute = owner.lookup(`router:main`).get('currentRouteName'); | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       this.store.clearAllDatasets(); |       this.store.clearAllDatasets(); | ||||||
| @@ -105,7 +105,7 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   routeToExplore: task(function* (command) { |   routeToExplore: task(function* (command) { | ||||||
|     let filter = command.replace('api', '').trim(); |     const filter = command.replace('api', '').trim(); | ||||||
|     let content = |     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.'; |       '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) { |     if (filter) { | ||||||
|   | |||||||
| @@ -16,10 +16,10 @@ export default Component.extend({ | |||||||
|   unwrapData: null, |   unwrapData: null, | ||||||
|  |  | ||||||
|   unwrap: task(function* (token) { |   unwrap: task(function* (token) { | ||||||
|     let adapter = this.store.adapterFor('tools'); |     const adapter = this.store.adapterFor('tools'); | ||||||
|     this.set('error', null); |     this.set('error', null); | ||||||
|     try { |     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.set('unwrapData', response.auth || response.data); | ||||||
|       this.controlGroup.deleteControlGroupToken(this.model.id); |       this.controlGroup.deleteControlGroupToken(this.model.id); | ||||||
|     } catch (e) { |     } catch (e) { | ||||||
| @@ -29,7 +29,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   markAndNavigate: task(function* () { |   markAndNavigate: task(function* () { | ||||||
|     this.controlGroup.markTokenForUnwrap(this.model.id); |     this.controlGroup.markTokenForUnwrap(this.model.id); | ||||||
|     let { url } = this.controlGroupResponse.uiParams; |     const { url } = this.controlGroupResponse.uiParams; | ||||||
|     yield this.router.transitionTo(url); |     yield this.router.transitionTo(url); | ||||||
|   }).drop(), |   }).drop(), | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -14,8 +14,8 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   didReceiveAttrs() { |   didReceiveAttrs() { | ||||||
|     this._super(...arguments); |     this._super(...arguments); | ||||||
|     let accessor = this.model.id; |     const accessor = this.model.id; | ||||||
|     let data = this.controlGroup.wrapInfoForAccessor(accessor); |     const data = this.controlGroup.wrapInfoForAccessor(accessor); | ||||||
|     this.set('controlGroupResponse', data); |     this.set('controlGroupResponse', data); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -27,13 +27,13 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   currentUserHasAuthorized: computed('currentUserEntityId', 'model.authorizations.@each.id', function () { |   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)); |     return Boolean(authorizations.findBy('id', this.currentUserEntityId)); | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   isSuccess: or('currentUserHasAuthorized', 'model.approved'), |   isSuccess: or('currentUserHasAuthorized', 'model.approved'), | ||||||
|   requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function () { |   requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function () { | ||||||
|     let entity = this.model.requestEntity; |     const entity = this.model.requestEntity; | ||||||
|  |  | ||||||
|     if (this.currentUserIsRequesting) { |     if (this.currentUserIsRequesting) { | ||||||
|       return 'You'; |       return 'You'; | ||||||
| @@ -55,8 +55,8 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   bannerText: computed('model.approved', 'currentUserIsRequesting', 'currentUserHasAuthorized', function () { |   bannerText: computed('model.approved', 'currentUserIsRequesting', 'currentUserHasAuthorized', function () { | ||||||
|     let isApproved = this.model.approved; |     const isApproved = this.model.approved; | ||||||
|     let { currentUserHasAuthorized, currentUserIsRequesting } = this; |     const { currentUserHasAuthorized, currentUserIsRequesting } = this; | ||||||
|     if (currentUserHasAuthorized) { |     if (currentUserHasAuthorized) { | ||||||
|       return 'You have given authorization'; |       return 'You have given authorization'; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ export default class DatabaseConnectionEdit extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   rotateCredentials(backend, name) { |   rotateCredentials(backend, name) { | ||||||
|     let adapter = this.store.adapterFor('database/connection'); |     const adapter = this.store.adapterFor('database/connection'); | ||||||
|     return adapter.rotateRootCredentials(backend, name); |     return adapter.rotateRootCredentials(backend, name); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -61,8 +61,8 @@ export default class DatabaseConnectionEdit extends Component { | |||||||
|   @action |   @action | ||||||
|   async handleCreateConnection(evt) { |   async handleCreateConnection(evt) { | ||||||
|     evt.preventDefault(); |     evt.preventDefault(); | ||||||
|     let secret = this.args.model; |     const secret = this.args.model; | ||||||
|     let secretId = secret.name; |     const secretId = secret.name; | ||||||
|     secret.set('id', secretId); |     secret.set('id', secretId); | ||||||
|     secret |     secret | ||||||
|       .save() |       .save() | ||||||
| @@ -100,8 +100,8 @@ export default class DatabaseConnectionEdit extends Component { | |||||||
|   @action |   @action | ||||||
|   handleUpdateConnection(evt) { |   handleUpdateConnection(evt) { | ||||||
|     evt.preventDefault(); |     evt.preventDefault(); | ||||||
|     let secret = this.args.model; |     const secret = this.args.model; | ||||||
|     let secretId = secret.name; |     const secretId = secret.name; | ||||||
|     secret |     secret | ||||||
|       .save() |       .save() | ||||||
|       .then(() => { |       .then(() => { | ||||||
| @@ -126,7 +126,7 @@ export default class DatabaseConnectionEdit extends Component { | |||||||
|   @action |   @action | ||||||
|   reset() { |   reset() { | ||||||
|     const { name, backend } = this.args.model; |     const { name, backend } = this.args.model; | ||||||
|     let adapter = this.store.adapterFor('database/connection'); |     const adapter = this.store.adapterFor('database/connection'); | ||||||
|     adapter |     adapter | ||||||
|       .resetConnection(backend, name) |       .resetConnection(backend, name) | ||||||
|       .then(() => { |       .then(() => { | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ export default class DatabaseRoleEdit extends Component { | |||||||
|   @tracked loading = false; |   @tracked loading = false; | ||||||
|  |  | ||||||
|   get warningMessages() { |   get warningMessages() { | ||||||
|     let warnings = {}; |     const warnings = {}; | ||||||
|     if (this.args.model.canUpdateDb === false) { |     if (this.args.model.canUpdateDb === false) { | ||||||
|       warnings.database = `You don’t have permissions to update this database connection, so this role cannot be created.`; |       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; |     this.loading = true; | ||||||
|  |  | ||||||
|     const mode = this.args.mode; |     const mode = this.args.mode; | ||||||
|     let roleSecret = this.args.model; |     const roleSecret = this.args.model; | ||||||
|     let secretId = roleSecret.name; |     const secretId = roleSecret.name; | ||||||
|     if (mode === 'create') { |     if (mode === 'create') { | ||||||
|       roleSecret.set('id', secretId); |       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.set('path', path); | ||||||
|     } |     } | ||||||
|     roleSecret |     roleSecret | ||||||
| @@ -111,7 +111,7 @@ export default class DatabaseRoleEdit extends Component { | |||||||
|   @action |   @action | ||||||
|   rotateRoleCred(id) { |   rotateRoleCred(id) { | ||||||
|     const backend = this.args.model?.backend; |     const backend = this.args.model?.backend; | ||||||
|     let adapter = this.store.adapterFor('database/credential'); |     const adapter = this.store.adapterFor('database/credential'); | ||||||
|     adapter |     adapter | ||||||
|       .rotateRoleCredentials(backend, id) |       .rotateRoleCredentials(backend, id) | ||||||
|       .then(() => { |       .then(() => { | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ import { getStatementFields, getRoleFields } from '../utils/database-helpers'; | |||||||
| export default class DatabaseRoleSettingForm extends Component { | export default class DatabaseRoleSettingForm extends Component { | ||||||
|   get settingFields() { |   get settingFields() { | ||||||
|     if (!this.args.roleType) return null; |     if (!this.args.roleType) return null; | ||||||
|     let dbValidFields = getRoleFields(this.args.roleType); |     const dbValidFields = getRoleFields(this.args.roleType); | ||||||
|     return this.args.attrs.filter((a) => { |     return this.args.attrs.filter((a) => { | ||||||
|       return dbValidFields.includes(a.name); |       return dbValidFields.includes(a.name); | ||||||
|     }); |     }); | ||||||
| @@ -29,7 +29,7 @@ export default class DatabaseRoleSettingForm extends Component { | |||||||
|     const type = this.args.roleType; |     const type = this.args.roleType; | ||||||
|     const plugin = this.args.dbType; |     const plugin = this.args.dbType; | ||||||
|     if (!type) return null; |     if (!type) return null; | ||||||
|     let dbValidFields = getStatementFields(type, plugin); |     const dbValidFields = getStatementFields(type, plugin); | ||||||
|     return this.args.attrs.filter((a) => { |     return this.args.attrs.filter((a) => { | ||||||
|       return dbValidFields.includes(a.name); |       return dbValidFields.includes(a.name); | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -33,14 +33,14 @@ export default class DiffVersionSelector extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get leftSideDataInit() { |   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 |     return this.adapter | ||||||
|       .querySecretDataByVersion(string) |       .querySecretDataByVersion(string) | ||||||
|       .then((response) => response.data) |       .then((response) => response.data) | ||||||
|       .catch(() => null); |       .catch(() => null); | ||||||
|   } |   } | ||||||
|   get rightSideDataInit() { |   get rightSideDataInit() { | ||||||
|     let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`; |     const string = `["${this.args.model.engineId}", "${this.args.model.id}", "${this.rightSideVersionInit}"]`; | ||||||
|     return this.adapter |     return this.adapter | ||||||
|       .querySecretDataByVersion(string) |       .querySecretDataByVersion(string) | ||||||
|       .then((response) => response.data) |       .then((response) => response.data) | ||||||
| @@ -52,10 +52,10 @@ export default class DiffVersionSelector extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async createVisualDiff() { |   async createVisualDiff() { | ||||||
|     let diffpatcher = jsondiffpatch.create({}); |     const diffpatcher = jsondiffpatch.create({}); | ||||||
|     let leftSideVersionData = this.leftSideVersionDataSelected || (await this.leftSideDataInit); |     const leftSideVersionData = this.leftSideVersionDataSelected || (await this.leftSideDataInit); | ||||||
|     let rightSideVersionData = this.rightSideVersionDataSelected || (await this.rightSideDataInit); |     const rightSideVersionData = this.rightSideVersionDataSelected || (await this.rightSideDataInit); | ||||||
|     let delta = diffpatcher.diff(rightSideVersionData, leftSideVersionData); |     const delta = diffpatcher.diff(rightSideVersionData, leftSideVersionData); | ||||||
|     if (delta === undefined) { |     if (delta === undefined) { | ||||||
|       this.statesMatch = true; |       this.statesMatch = true; | ||||||
|       // params: value, replacer (all properties included), space (white space and indentation, line break, etc.) |       // 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 |   @action | ||||||
|   async selectVersion(selectedVersion, actions, side) { |   async selectVersion(selectedVersion, actions, side) { | ||||||
|     let string = `["${this.args.model.engineId}", "${this.args.model.id}", "${selectedVersion}"]`; |     const string = `["${this.args.model.engineId}", "${this.args.model.id}", "${selectedVersion}"]`; | ||||||
|     let secretData = await this.adapter.querySecretDataByVersion(string); |     const secretData = await this.adapter.querySecretDataByVersion(string); | ||||||
|     if (side === 'left') { |     if (side === 'left') { | ||||||
|       this.leftSideVersionDataSelected = secretData.data; |       this.leftSideVersionDataSelected = secretData.data; | ||||||
|       this.leftSideVersionSelected = selectedVersion; |       this.leftSideVersionSelected = selectedVersion; | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     pickedFile(e) { |     pickedFile(e) { | ||||||
|       let { files } = e.target; |       const { files } = e.target; | ||||||
|       if (!files.length) { |       if (!files.length) { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
| @@ -51,8 +51,8 @@ export default Component.extend({ | |||||||
|       this.send('onChange'); |       this.send('onChange'); | ||||||
|     }, |     }, | ||||||
|     onChange(fileAsBytes, fileMeta) { |     onChange(fileAsBytes, fileMeta) { | ||||||
|       let { name, size, lastModifiedDate } = fileMeta || {}; |       const { name, size, lastModifiedDate } = fileMeta || {}; | ||||||
|       let fileSize = size ? filesize(size) : null; |       const fileSize = size ? filesize(size) : null; | ||||||
|       this.set('file', fileAsBytes); |       this.set('file', fileAsBytes); | ||||||
|       this.set('fileName', name); |       this.set('fileName', name); | ||||||
|       this.set('fileSize', fileSize); |       this.set('fileSize', fileSize); | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     create() { |     create() { | ||||||
|       let model = this.model; |       const model = this.model; | ||||||
|       this.set('loading', true); |       this.set('loading', true); | ||||||
|       this.model |       this.model | ||||||
|         .save() |         .save() | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ export default class GeneratedItemList extends Component { | |||||||
|  |  | ||||||
|   @action |   @action | ||||||
|   refreshItemList() { |   refreshItemList() { | ||||||
|     let route = getOwner(this).lookup(`route:${this.router.currentRouteName}`); |     const route = getOwner(this).lookup(`route:${this.router.currentRouteName}`); | ||||||
|     this.store.clearAllDatasets(); |     this.store.clearAllDatasets(); | ||||||
|     route.refresh(); |     route.refresh(); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ export default Component.extend({ | |||||||
|       this.model.fieldGroups.forEach((element) => { |       this.model.fieldGroups.forEach((element) => { | ||||||
|         if (element.default) { |         if (element.default) { | ||||||
|           element.default.forEach((attr) => { |           element.default.forEach((attr) => { | ||||||
|             let fieldValue = attr.options && attr.options.fieldValue; |             const fieldValue = attr.options && attr.options.fieldValue; | ||||||
|             if (fieldValue) { |             if (fieldValue) { | ||||||
|               this.model[attr.name] = this.model[fieldValue]; |               this.model[attr.name] = this.model[fieldValue]; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -25,8 +25,8 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     performTransaction() { |     performTransaction() { | ||||||
|       let args = [...arguments]; |       const args = [...arguments]; | ||||||
|       let messageArgs = this.messageArgs(...args); |       const messageArgs = this.messageArgs(...args); | ||||||
|       return this.transaction(...args) |       return this.transaction(...args) | ||||||
|         .then(() => { |         .then(() => { | ||||||
|           this.onSuccess(); |           this.onSuccess(); | ||||||
|   | |||||||
| @@ -22,8 +22,8 @@ export default Component.extend({ | |||||||
|   onSave: () => {}, |   onSave: () => {}, | ||||||
|  |  | ||||||
|   cancelLink: computed('mode', 'model.identityType', function () { |   cancelLink: computed('mode', 'model.identityType', function () { | ||||||
|     let { model, mode } = this; |     const { model, mode } = this; | ||||||
|     let routes = { |     const routes = { | ||||||
|       'create-entity': 'vault.cluster.access.identity', |       'create-entity': 'vault.cluster.access.identity', | ||||||
|       'edit-entity': 'vault.cluster.access.identity.show', |       'edit-entity': 'vault.cluster.access.identity.show', | ||||||
|       'merge-entity-merge': 'vault.cluster.access.identity', |       'merge-entity-merge': 'vault.cluster.access.identity', | ||||||
| @@ -34,14 +34,14 @@ export default Component.extend({ | |||||||
|       'create-group-alias': 'vault.cluster.access.identity.aliases', |       'create-group-alias': 'vault.cluster.access.identity.aliases', | ||||||
|       'edit-group-alias': 'vault.cluster.access.identity.aliases.show', |       '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]; |     return routes[key]; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   getMessage(model, isDelete = false) { |   getMessage(model, isDelete = false) { | ||||||
|     let mode = this.mode; |     const mode = this.mode; | ||||||
|     let typeDisplay = humanize([model.identityType]); |     const typeDisplay = humanize([model.identityType]); | ||||||
|     let action = isDelete ? 'deleted' : 'saved'; |     const action = isDelete ? 'deleted' : 'saved'; | ||||||
|     if (mode === 'merge') { |     if (mode === 'merge') { | ||||||
|       return 'Successfully merged entities'; |       return 'Successfully merged entities'; | ||||||
|     } |     } | ||||||
| @@ -53,8 +53,8 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   save: task( |   save: task( | ||||||
|     waitFor(function* () { |     waitFor(function* () { | ||||||
|       let model = this.model; |       const model = this.model; | ||||||
|       let message = this.getMessage(model); |       const message = this.getMessage(model); | ||||||
|  |  | ||||||
|       try { |       try { | ||||||
|         yield model.save(); |         yield model.save(); | ||||||
| @@ -69,7 +69,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   willDestroy() { |   willDestroy() { | ||||||
|     this._super(...arguments); |     this._super(...arguments); | ||||||
|     let model = this.model; |     const model = this.model; | ||||||
|     if (!model) return; |     if (!model) return; | ||||||
|     if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) { |     if ((model.get('isDirty') && !model.isDestroyed) || !model.isDestroying) { | ||||||
|       model.rollbackAttributes(); |       model.rollbackAttributes(); | ||||||
| @@ -78,8 +78,8 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     deleteItem(model) { |     deleteItem(model) { | ||||||
|       let message = this.getMessage(model, true); |       const message = this.getMessage(model, true); | ||||||
|       let flash = this.flashMessages; |       const flash = this.flashMessages; | ||||||
|       model.destroyRecord().then(() => { |       model.destroyRecord().then(() => { | ||||||
|         flash.success(message); |         flash.success(message); | ||||||
|         return this.onSave({ saveType: 'delete', model }); |         return this.onSave({ saveType: 'delete', model }); | ||||||
|   | |||||||
| @@ -27,14 +27,14 @@ export default Component.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   adapter() { |   adapter() { | ||||||
|     let type = this.type; |     const type = this.type; | ||||||
|     let store = this.store; |     const store = this.store; | ||||||
|     return store.adapterFor(`identity/${type}`); |     return store.adapterFor(`identity/${type}`); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   data() { |   data() { | ||||||
|     let { param, paramValue, aliasMountAccessor } = this; |     const { param, paramValue, aliasMountAccessor } = this; | ||||||
|     let data = {}; |     const data = {}; | ||||||
|  |  | ||||||
|     data[underscore([param])] = paramValue; |     data[underscore([param])] = paramValue; | ||||||
|     if (param === 'alias name') { |     if (param === 'alias name') { | ||||||
| @@ -44,10 +44,10 @@ export default Component.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   lookup: task(function* () { |   lookup: task(function* () { | ||||||
|     let flash = this.flashMessages; |     const flash = this.flashMessages; | ||||||
|     let type = this.type; |     const type = this.type; | ||||||
|     let store = this.store; |     const store = this.store; | ||||||
|     let { param, paramValue } = this; |     const { param, paramValue } = this; | ||||||
|     let response; |     let response; | ||||||
|     try { |     try { | ||||||
|       response = yield this.adapter().lookup(store, this.data()); |       response = yield this.adapter().lookup(store, this.data()); | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ import Base from './_popup-base'; | |||||||
|  |  | ||||||
| export default Base.extend({ | export default Base.extend({ | ||||||
|   messageArgs(model) { |   messageArgs(model) { | ||||||
|     let type = model.get('identityType'); |     const type = model.get('identityType'); | ||||||
|     let id = model.id; |     const id = model.id; | ||||||
|     return [type, id]; |     return [type, id]; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -12,7 +12,7 @@ export default Base.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   errorMessage(e, type, id) { |   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}`; |     return `There was a problem deleting ${type}: ${id} - ${error}`; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,12 +22,12 @@ export default Base.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   errorMessage(e, model, groupArray, memberId) { |   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}`; |     return `There was a problem removing '${memberId}' from the group - ${error}`; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   transaction(model, groupArray, memberId) { |   transaction(model, groupArray, memberId) { | ||||||
|     let members = model.get(groupArray); |     const members = model.get(groupArray); | ||||||
|     model.set(groupArray, members.without(memberId)); |     model.set(groupArray, members.without(memberId)); | ||||||
|     return model.save(); |     return model.save(); | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -16,12 +16,12 @@ export default Base.extend({ | |||||||
|     return `Successfully removed '${key}' from metadata`; |     return `Successfully removed '${key}' from metadata`; | ||||||
|   }, |   }, | ||||||
|   errorMessage(e, model, key) { |   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}`; |     return `There was a problem removing '${key}' from the metadata - ${error}`; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   transaction(model, key) { |   transaction(model, key) { | ||||||
|     let metadata = model.metadata; |     const metadata = model.metadata; | ||||||
|     delete metadata[key]; |     delete metadata[key]; | ||||||
|     model.set('metadata', { ...metadata }); |     model.set('metadata', { ...metadata }); | ||||||
|     return model.save(); |     return model.save(); | ||||||
|   | |||||||
| @@ -17,12 +17,12 @@ export default Base.extend({ | |||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   errorMessage(e, model, policyName) { |   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}`; |     return `There was a problem removing '${policyName}' policy - ${error}`; | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   transaction(model, policyName) { |   transaction(model, policyName) { | ||||||
|     let policies = model.get('policies'); |     const policies = model.get('policies'); | ||||||
|     model.set('policies', policies.without(policyName)); |     model.set('policies', policies.without(policyName)); | ||||||
|     return model.save(); |     return model.save(); | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -24,9 +24,9 @@ import { allFeatures } from 'vault/helpers/all-features'; | |||||||
| export default class LicenseInfoComponent extends Component { | export default class LicenseInfoComponent extends Component { | ||||||
|   get featuresInfo() { |   get featuresInfo() { | ||||||
|     return allFeatures().map((feature) => { |     return allFeatures().map((feature) => { | ||||||
|       let active = this.args.features.includes(feature); |       const active = this.args.features.includes(feature); | ||||||
|       if (active && feature === 'Performance Standby') { |       if (active && feature === 'Performance Standby') { | ||||||
|         let count = this.args.performanceStandbyCount; |         const count = this.args.performanceStandbyCount; | ||||||
|         return { |         return { | ||||||
|           name: feature, |           name: feature, | ||||||
|           active: count ? active : false, |           active: count ? active : false, | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ export default class MfaLoginEnforcementForm extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   async flattenTargets() { |   async flattenTargets() { | ||||||
|     for (let { label, key } of this.targetTypes) { |     for (const { label, key } of this.targetTypes) { | ||||||
|       const targetArray = await this.args.model[key]; |       const targetArray = await this.args.model[key]; | ||||||
|       const targets = targetArray.map((value) => ({ label, key, value })); |       const targets = targetArray.map((value) => ({ label, key, value })); | ||||||
|       this.targets.addObjects(targets); |       this.targets.addObjects(targets); | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ export default class MfaSetupStepOne extends Component { | |||||||
|   @action |   @action | ||||||
|   async verifyUUID(evt) { |   async verifyUUID(evt) { | ||||||
|     evt.preventDefault(); |     evt.preventDefault(); | ||||||
|     let response = await this.postAdminGenerate(); |     const response = await this.postAdminGenerate(); | ||||||
|  |  | ||||||
|     if (response === 'stop_progress') { |     if (response === 'stop_progress') { | ||||||
|       this.args.isUUIDVerified(false); |       this.args.isUUIDVerified(false); | ||||||
| @@ -43,7 +43,7 @@ export default class MfaSetupStepOne extends Component { | |||||||
|   async postAdminGenerate() { |   async postAdminGenerate() { | ||||||
|     this.error = ''; |     this.error = ''; | ||||||
|     this.warning = ''; |     this.warning = ''; | ||||||
|     let adapter = this.store.adapterFor('mfa-setup'); |     const adapter = this.store.adapterFor('mfa-setup'); | ||||||
|     let response; |     let response; | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
| @@ -53,7 +53,7 @@ export default class MfaSetupStepOne extends Component { | |||||||
|       }); |       }); | ||||||
|       this.args.saveUUIDandQrCode(this.UUID, response.data?.url); |       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 |       // 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) { |       if (warnings.length > 0) { | ||||||
|         this.UUID = ''; // clear UUID |         this.UUID = ''; // clear UUID | ||||||
|         const alreadyGenerated = warnings.find((w) => |         const alreadyGenerated = warnings.find((w) => | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ export default class MfaSetupStepTwo extends Component { | |||||||
|   @action |   @action | ||||||
|   async restartSetup() { |   async restartSetup() { | ||||||
|     this.error = null; |     this.error = null; | ||||||
|     let adapter = this.store.adapterFor('mfa-setup'); |     const adapter = this.store.adapterFor('mfa-setup'); | ||||||
|     try { |     try { | ||||||
|       await adapter.adminDestroy({ |       await adapter.adminDestroy({ | ||||||
|         entity_id: this.args.entityId, |         entity_id: this.args.entityId, | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ export default class MountAccessorSelect extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   @task *authMethods() { |   @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) { |     if (!this.args.value && !this.args.noDefault) { | ||||||
|       const getValue = methods.get('firstObject.accessor'); |       const getValue = methods.get('firstObject.accessor'); | ||||||
|       this.args.onChange(getValue); |       this.args.onChange(getValue); | ||||||
|   | |||||||
| @@ -72,12 +72,12 @@ export default class MountBackendForm extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   checkPathChange(type) { |   checkPathChange(type) { | ||||||
|     let mount = this.mountModel; |     const mount = this.mountModel; | ||||||
|     let currentPath = mount.path; |     const currentPath = mount.path; | ||||||
|     let list = this.mountTypes; |     const list = this.mountTypes; | ||||||
|     // if the current path matches a type (meaning the user hasn't altered it), |     // if the current path matches a type (meaning the user hasn't altered it), | ||||||
|     // change it here to match the new type |     // change it here to match the new type | ||||||
|     let isUnchanged = list.findBy('type', currentPath); |     const isUnchanged = list.findBy('type', currentPath); | ||||||
|     if (!currentPath || isUnchanged) { |     if (!currentPath || isUnchanged) { | ||||||
|       mount.path = type; |       mount.path = type; | ||||||
|     } |     } | ||||||
| @@ -120,8 +120,8 @@ export default class MountBackendForm extends Component { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     let changedAttrKeys = Object.keys(mountModel.changedAttributes()); |     const changedAttrKeys = Object.keys(mountModel.changedAttributes()); | ||||||
|     let updatesConfig = |     const updatesConfig = | ||||||
|       changedAttrKeys.includes('casRequired') || |       changedAttrKeys.includes('casRequired') || | ||||||
|       changedAttrKeys.includes('deleteVersionAfter') || |       changedAttrKeys.includes('deleteVersionAfter') || | ||||||
|       changedAttrKeys.includes('maxVersions'); |       changedAttrKeys.includes('maxVersions'); | ||||||
| @@ -137,7 +137,7 @@ export default class MountBackendForm extends Component { | |||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       if (err.errors) { |       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); |           if (typeof e === 'object') return e.title || e.message || JSON.stringify(e); | ||||||
|           return e; |           return e; | ||||||
|         }); |         }); | ||||||
|   | |||||||
| @@ -13,15 +13,15 @@ export default Component.extend({ | |||||||
|   showLastSegment: false, |   showLastSegment: false, | ||||||
|  |  | ||||||
|   normalizedNamespace: computed('targetNamespace', function () { |   normalizedNamespace: computed('targetNamespace', function () { | ||||||
|     let ns = this.targetNamespace; |     const ns = this.targetNamespace; | ||||||
|     return (ns || '').replace(/\.+/g, '/').replace(/☃/g, '.'); |     return (ns || '').replace(/\.+/g, '/').replace(/☃/g, '.'); | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   namespaceDisplay: computed('normalizedNamespace', 'showLastSegment', function () { |   namespaceDisplay: computed('normalizedNamespace', 'showLastSegment', function () { | ||||||
|     let ns = this.normalizedNamespace; |     const ns = this.normalizedNamespace; | ||||||
|     if (!ns) return 'root'; |     if (!ns) return 'root'; | ||||||
|     let showLastSegment = this.showLastSegment; |     const showLastSegment = this.showLastSegment; | ||||||
|     let parts = ns?.split('/'); |     const parts = ns?.split('/'); | ||||||
|     return showLastSegment ? parts[parts.length - 1] : ns; |     return showLastSegment ? parts[parts.length - 1] : ns; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
| @@ -30,7 +30,7 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   get namespaceLink() { |   get namespaceLink() { | ||||||
|     let origin = |     const origin = | ||||||
|       window.location.protocol + |       window.location.protocol + | ||||||
|       '//' + |       '//' + | ||||||
|       window.location.hostname + |       window.location.hostname + | ||||||
|   | |||||||
| @@ -27,8 +27,8 @@ export default Component.extend({ | |||||||
|   didReceiveAttrs() { |   didReceiveAttrs() { | ||||||
|     this._super(...arguments); |     this._super(...arguments); | ||||||
|  |  | ||||||
|     let ns = this.namespace; |     const ns = this.namespace; | ||||||
|     let oldNS = this.oldNamespace; |     const oldNS = this.oldNamespace; | ||||||
|     if (!oldNS || ns !== oldNS) { |     if (!oldNS || ns !== oldNS) { | ||||||
|       this.setForAnimation.perform(); |       this.setForAnimation.perform(); | ||||||
|       this.fetchListCapability.perform(); |       this.fetchListCapability.perform(); | ||||||
| @@ -38,7 +38,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   fetchListCapability: task(function* () { |   fetchListCapability: task(function* () { | ||||||
|     try { |     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('listCapability', capability); | ||||||
|       this.set('canList', true); |       this.set('canList', true); | ||||||
|     } catch (e) { |     } catch (e) { | ||||||
| @@ -48,15 +48,15 @@ export default Component.extend({ | |||||||
|     } |     } | ||||||
|   }), |   }), | ||||||
|   setForAnimation: task(function* () { |   setForAnimation: task(function* () { | ||||||
|     let leaves = this.menuLeaves; |     const leaves = this.menuLeaves; | ||||||
|     let lastLeaves = this.lastMenuLeaves; |     const lastLeaves = this.lastMenuLeaves; | ||||||
|     if (!lastLeaves) { |     if (!lastLeaves) { | ||||||
|       this.set('lastMenuLeaves', leaves); |       this.set('lastMenuLeaves', leaves); | ||||||
|       yield timeout(0); |       yield timeout(0); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     let isAdding = leaves.length > lastLeaves.length; |     const isAdding = leaves.length > lastLeaves.length; | ||||||
|     let changedLeaf = (isAdding ? leaves : lastLeaves).get('lastObject'); |     const changedLeaf = (isAdding ? leaves : lastLeaves).get('lastObject'); | ||||||
|     this.set('isAdding', isAdding); |     this.set('isAdding', isAdding); | ||||||
|     this.set('changedLeaf', changedLeaf); |     this.set('changedLeaf', changedLeaf); | ||||||
|  |  | ||||||
| @@ -82,7 +82,7 @@ export default Component.extend({ | |||||||
|   inRootNamespace: alias('namespaceService.inRootNamespace'), |   inRootNamespace: alias('namespaceService.inRootNamespace'), | ||||||
|  |  | ||||||
|   namespaceTree: computed('accessibleNamespaces', function () { |   namespaceTree: computed('accessibleNamespaces', function () { | ||||||
|     let nsList = this.accessibleNamespaces; |     const nsList = this.accessibleNamespaces; | ||||||
|  |  | ||||||
|     if (!nsList) { |     if (!nsList) { | ||||||
|       return []; |       return []; | ||||||
| @@ -91,7 +91,7 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   maybeAddRoot(leaves) { |   maybeAddRoot(leaves) { | ||||||
|     let userRoot = this.auth.authData.userRootNamespace; |     const userRoot = this.auth.authData.userRootNamespace; | ||||||
|     if (userRoot === '') { |     if (userRoot === '') { | ||||||
|       leaves.unshift(''); |       leaves.unshift(''); | ||||||
|     } |     } | ||||||
| @@ -137,8 +137,8 @@ export default Component.extend({ | |||||||
|   // the nodes at the root of the namespace tree |   // the nodes at the root of the namespace tree | ||||||
|   // these will get rendered as the bottom layer |   // these will get rendered as the bottom layer | ||||||
|   rootLeaves: computed('namespaceTree', function () { |   rootLeaves: computed('namespaceTree', function () { | ||||||
|     let tree = this.namespaceTree; |     const tree = this.namespaceTree; | ||||||
|     let leaves = Object.keys(tree); |     const leaves = Object.keys(tree); | ||||||
|     return leaves; |     return leaves; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
| @@ -149,9 +149,9 @@ export default Component.extend({ | |||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   namespaceDisplay: computed('namespacePath', 'accessibleNamespaces', 'accessibleNamespaces.[]', function () { |   namespaceDisplay: computed('namespacePath', 'accessibleNamespaces', 'accessibleNamespaces.[]', function () { | ||||||
|     let namespace = this.namespacePath; |     const namespace = this.namespacePath; | ||||||
|     if (!namespace) return ''; |     if (!namespace) return ''; | ||||||
|     let parts = namespace?.split('/'); |     const parts = namespace?.split('/'); | ||||||
|     return parts[parts.length - 1]; |     return parts[parts.length - 1]; | ||||||
|   }), |   }), | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export default Component.extend({ | |||||||
|   navDrawerOpen: false, |   navDrawerOpen: false, | ||||||
|   consoleFullscreen: false, |   consoleFullscreen: false, | ||||||
|   hideLinks: computed('router.currentRouteName', function () { |   hideLinks: computed('router.currentRouteName', function () { | ||||||
|     let currentRoute = this.router.currentRouteName; |     const currentRoute = this.router.currentRouteName; | ||||||
|     if ('vault.cluster.oidc-provider' === currentRoute) { |     if ('vault.cluster.oidc-provider' === currentRoute) { | ||||||
|       return true; |       return true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ export default class OidcConsentBlockComponent extends Component { | |||||||
|  |  | ||||||
|   buildUrl(urlString, params) { |   buildUrl(urlString, params) { | ||||||
|     try { |     try { | ||||||
|       let url = new URL(urlString); |       const url = new URL(urlString); | ||||||
|       Object.keys(params).forEach((key) => { |       Object.keys(params).forEach((key) => { | ||||||
|         if (params[key] && validParameters.includes(key)) { |         if (params[key] && validParameters.includes(key)) { | ||||||
|           url.searchParams.append(key, params[key]); |           url.searchParams.append(key, params[key]); | ||||||
| @@ -42,8 +42,8 @@ export default class OidcConsentBlockComponent extends Component { | |||||||
|   @action |   @action | ||||||
|   handleSubmit(evt) { |   handleSubmit(evt) { | ||||||
|     evt.preventDefault(); |     evt.preventDefault(); | ||||||
|     let { redirect, ...params } = this.args; |     const { redirect, ...params } = this.args; | ||||||
|     let redirectUrl = this.buildUrl(redirect, params); |     const redirectUrl = this.buildUrl(redirect, params); | ||||||
|     if (Ember.testing) { |     if (Ember.testing) { | ||||||
|       this.args.testRedirect(redirectUrl.toString()); |       this.args.testRedirect(redirectUrl.toString()); | ||||||
|     } else { |     } else { | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ export default class OidcProviderForm extends Component { | |||||||
|   // function passed to search select |   // function passed to search select | ||||||
|   renderInfoTooltip(selection, dropdownOptions) { |   renderInfoTooltip(selection, dropdownOptions) { | ||||||
|     // if a client has been deleted it will not exist in dropdownOptions (response from search select's query) |     // 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; |     return !clientExists ? 'The application associated with this client_id no longer exists' : false; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default Component.extend({ | |||||||
|     if (num) { |     if (num) { | ||||||
|       num = parseInt(num, 10); |       num = parseInt(num, 10); | ||||||
|     } |     } | ||||||
|     let list = this.newList(num); |     const list = this.newList(num); | ||||||
|     this.set('listData', list); |     this.set('listData', list); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -45,7 +45,7 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     setKey(index, key) { |     setKey(index, key) { | ||||||
|       let { listData } = this; |       const { listData } = this; | ||||||
|       listData.splice(index, 1, key); |       listData.splice(index, 1, key); | ||||||
|       this.onDataUpdate(listData.compact().map((k) => k.value)); |       this.onDataUpdate(listData.compact().map((k) => k.value)); | ||||||
|     }, |     }, | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default Component.extend({ | |||||||
|   strokeWidth: 1, |   strokeWidth: 1, | ||||||
|  |  | ||||||
|   viewBox: computed('size', function () { |   viewBox: computed('size', function () { | ||||||
|     let s = this.size; |     const s = this.size; | ||||||
|     return `0 0 ${s} ${s}`; |     return `0 0 ${s} ${s}`; | ||||||
|   }), |   }), | ||||||
|   centerValue: computed('size', function () { |   centerValue: computed('size', function () { | ||||||
|   | |||||||
| @@ -47,11 +47,11 @@ export default Component.extend({ | |||||||
|  |  | ||||||
|   actions: { |   actions: { | ||||||
|     async removePeer(model) { |     async removePeer(model) { | ||||||
|       let { nodeId } = model; |       const { nodeId } = model; | ||||||
|       try { |       try { | ||||||
|         await model.destroyRecord(); |         await model.destroyRecord(); | ||||||
|       } catch (e) { |       } 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}`); |         this.flashMessages.danger(`There was an issue removing the peer ${nodeId}: ${errString}`); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
| @@ -72,7 +72,7 @@ export default Component.extend({ | |||||||
|       // then forcing a download by clicking a link that has a download attribute |       // then forcing a download by clicking a link that has a download attribute | ||||||
|       // |       // | ||||||
|       // this is not the default because |       // 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.'); |       this.flashMessages.success('The snapshot download has begun.'); | ||||||
|       let resp, blob; |       let resp, blob; | ||||||
| @@ -80,18 +80,18 @@ export default Component.extend({ | |||||||
|         resp = await adapter.rawRequest('/v1/sys/storage/raft/snapshot', 'GET'); |         resp = await adapter.rawRequest('/v1/sys/storage/raft/snapshot', 'GET'); | ||||||
|         blob = await resp.blob(); |         blob = await resp.blob(); | ||||||
|       } catch (e) { |       } 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}`); |         this.flashMessages.danger(`There was an error trying to download the snapshot: ${errString}`); | ||||||
|       } |       } | ||||||
|       let filename = 'snapshot.gz'; |       const filename = 'snapshot.gz'; | ||||||
|       let file = new Blob([blob], { type: 'application/x-gzip' }); |       const file = new Blob([blob], { type: 'application/x-gzip' }); | ||||||
|       file.name = filename; |       file.name = filename; | ||||||
|       if ('msSaveOrOpenBlob' in navigator) { |       if ('msSaveOrOpenBlob' in navigator) { | ||||||
|         navigator.msSaveOrOpenBlob(file, filename); |         navigator.msSaveOrOpenBlob(file, filename); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       let a = document.createElement('a'); |       const a = document.createElement('a'); | ||||||
|       let objectURL = window.URL.createObjectURL(file); |       const objectURL = window.URL.createObjectURL(file); | ||||||
|       a.href = objectURL; |       a.href = objectURL; | ||||||
|       a.download = filename; |       a.download = filename; | ||||||
|       document.body.appendChild(a); |       document.body.appendChild(a); | ||||||
|   | |||||||
| @@ -14,14 +14,14 @@ export default Component.extend({ | |||||||
|   abortController: null, |   abortController: null, | ||||||
|   restore: task(function* () { |   restore: task(function* () { | ||||||
|     this.set('errors', null); |     this.set('errors', null); | ||||||
|     let adapter = getOwner(this).lookup('adapter:application'); |     const adapter = getOwner(this).lookup('adapter:application'); | ||||||
|     try { |     try { | ||||||
|       let url = '/v1/sys/storage/raft/snapshot'; |       let url = '/v1/sys/storage/raft/snapshot'; | ||||||
|       if (this.forceRestore) { |       if (this.forceRestore) { | ||||||
|         url = `${url}-force`; |         url = `${url}-force`; | ||||||
|       } |       } | ||||||
|       let file = new Blob([this.file], { type: 'application/gzip' }); |       const file = new Blob([this.file], { type: 'application/gzip' }); | ||||||
|       let controller = new AbortController(); |       const controller = new AbortController(); | ||||||
|       this.set('abortController', controller); |       this.set('abortController', controller); | ||||||
|       yield adapter.rawRequest(url, 'POST', { body: file, signal: controller.signal }); |       yield adapter.rawRequest(url, 'POST', { body: file, signal: controller.signal }); | ||||||
|       this.flashMessages.success('The snapshot was successfully uploaded!'); |       this.flashMessages.success('The snapshot was successfully uploaded!'); | ||||||
| @@ -33,7 +33,7 @@ export default Component.extend({ | |||||||
|       if (e.json) { |       if (e.json) { | ||||||
|         resp = yield e.json(); |         resp = yield e.json(); | ||||||
|       } |       } | ||||||
|       let err = resp ? resp.errors : [e]; |       const err = resp ? resp.errors : [e]; | ||||||
|       this.set('errors', err); |       this.set('errors', err); | ||||||
|     } |     } | ||||||
|   }), |   }), | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ export default Component.extend(FocusOnInsertMixin, { | |||||||
|  |  | ||||||
|   waitForKeyUp: task(function* () { |   waitForKeyUp: task(function* () { | ||||||
|     while (true) { |     while (true) { | ||||||
|       let event = yield waitForEvent(document.body, 'keyup'); |       const event = yield waitForEvent(document.body, 'keyup'); | ||||||
|       this.onEscape(event); |       this.onEscape(event); | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export default RoleEdit.extend({ | |||||||
|   actions: { |   actions: { | ||||||
|     updateTtl(path, val) { |     updateTtl(path, val) { | ||||||
|       const model = this.model; |       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); |       model.set(path, valueToSet); | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -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, `A secret with this ${name} already exists.`) | ||||||
|         : set(this.validationMessages, name, ''); |         : set(this.validationMessages, name, ''); | ||||||
|     } |     } | ||||||
|     let values = Object.values(this.validationMessages); |     const values = Object.values(this.validationMessages); | ||||||
|     this.validationErrorCount = values.filter(Boolean).length; |     this.validationErrorCount = values.filter(Boolean).length; | ||||||
|   } |   } | ||||||
|   onEscape(e) { |   onEscape(e) { | ||||||
| @@ -107,22 +107,22 @@ export default class SecretCreateOrUpdate extends Component { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   pathHasWhiteSpace(value) { |   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); |     this.pathWhiteSpaceWarning = validation.test(value); | ||||||
|   } |   } | ||||||
|   // successCallback is called in the context of the component |   // successCallback is called in the context of the component | ||||||
|   persistKey(successCallback) { |   persistKey(successCallback) { | ||||||
|     let secret = this.args.model; |     const secret = this.args.model; | ||||||
|     let secretData = this.args.modelForData; |     const secretData = this.args.modelForData; | ||||||
|     let isV2 = this.args.isV2; |     const isV2 = this.args.isV2; | ||||||
|     let key = secretData.get('path') || secret.id; |     let key = secretData.get('path') || secret.id; | ||||||
|  |  | ||||||
|     if (key.startsWith('/')) { |     if (key.startsWith('/')) { | ||||||
|       key = key.replace(/^\/+/g, ''); |       key = key.replace(/^\/+/g, ''); | ||||||
|       secretData.set(secretData.pathAttr, key); |       secretData.set(secretData.pathAttr, key); | ||||||
|     } |     } | ||||||
|     let changed = secret.changedAttributes(); |     const changed = secret.changedAttributes(); | ||||||
|     let changedKeys = Object.keys(changed); |     const changedKeys = Object.keys(changed); | ||||||
|  |  | ||||||
|     return secretData |     return secretData | ||||||
|       .save() |       .save() | ||||||
| @@ -157,7 +157,7 @@ export default class SecretCreateOrUpdate extends Component { | |||||||
|       }) |       }) | ||||||
|       .catch((error) => { |       .catch((error) => { | ||||||
|         if (error instanceof ControlGroupError) { |         if (error instanceof ControlGroupError) { | ||||||
|           let errorMessage = this.controlGroup.logFromError(error); |           const errorMessage = this.controlGroup.logFromError(error); | ||||||
|           this.error = errorMessage.content; |           this.error = errorMessage.content; | ||||||
|         } |         } | ||||||
|         throw error; |         throw error; | ||||||
| @@ -174,7 +174,7 @@ export default class SecretCreateOrUpdate extends Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get isCreateNewVersionFromOldVersion() { |   get isCreateNewVersionFromOldVersion() { | ||||||
|     let model = this.args.model; |     const model = this.args.model; | ||||||
|     if (!model) { |     if (!model) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
| @@ -191,7 +191,7 @@ export default class SecretCreateOrUpdate extends Component { | |||||||
|   @(task(function* (name, value) { |   @(task(function* (name, value) { | ||||||
|     this.checkValidation(name, value); |     this.checkValidation(name, value); | ||||||
|     while (true) { |     while (true) { | ||||||
|       let event = yield waitForEvent(document.body, 'keyup'); |       const event = yield waitForEvent(document.body, 'keyup'); | ||||||
|       this.onEscape(event); |       this.onEscape(event); | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| @@ -263,7 +263,7 @@ export default class SecretCreateOrUpdate extends Component { | |||||||
|     if (!(e.keyCode === keys.ENTER && e.metaKey)) { |     if (!(e.keyCode === keys.ENTER && e.metaKey)) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     let $form = this.element.querySelector('form'); |     const $form = this.element.querySelector('form'); | ||||||
|     if ($form.length) { |     if ($form.length) { | ||||||
|       $form.submit(); |       $form.submit(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -8,7 +8,8 @@ import { alias } from '@ember/object/computed'; | |||||||
| import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; | import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; | ||||||
|  |  | ||||||
| const getErrorMessage = (errors) => { | const getErrorMessage = (errors) => { | ||||||
|   let errorMessage = errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.'; |   const errorMessage = | ||||||
|  |     errors?.join('. ') || 'Something went wrong. Check the Vault logs for more information.'; | ||||||
|   return errorMessage; |   return errorMessage; | ||||||
| }; | }; | ||||||
| export default class SecretDeleteMenu extends Component { | export default class SecretDeleteMenu extends Component { | ||||||
| @@ -22,7 +23,7 @@ export default class SecretDeleteMenu extends Component { | |||||||
|     'capabilities', |     'capabilities', | ||||||
|     (context) => { |     (context) => { | ||||||
|       if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; |       if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; | ||||||
|       let [backend, id] = JSON.parse(context.args.modelForData.id); |       const [backend, id] = JSON.parse(context.args.modelForData.id); | ||||||
|       return { |       return { | ||||||
|         id: `${backend}/undelete/${id}`, |         id: `${backend}/undelete/${id}`, | ||||||
|       }; |       }; | ||||||
| @@ -36,7 +37,7 @@ export default class SecretDeleteMenu extends Component { | |||||||
|     'capabilities', |     'capabilities', | ||||||
|     (context) => { |     (context) => { | ||||||
|       if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; |       if (!context.args || !context.args.modelForData || !context.args.modelForData.id) return; | ||||||
|       let [backend, id] = JSON.parse(context.args.modelForData.id); |       const [backend, id] = JSON.parse(context.args.modelForData.id); | ||||||
|       return { |       return { | ||||||
|         id: `${backend}/destroy/${id}`, |         id: `${backend}/destroy/${id}`, | ||||||
|       }; |       }; | ||||||
| @@ -50,8 +51,8 @@ export default class SecretDeleteMenu extends Component { | |||||||
|     'capabilities', |     'capabilities', | ||||||
|     (context) => { |     (context) => { | ||||||
|       if (!context.args.model || !context.args.model.engine || !context.args.model.id) return; |       if (!context.args.model || !context.args.model.engine || !context.args.model.id) return; | ||||||
|       let backend = context.args.model.engine.id; |       const backend = context.args.model.engine.id; | ||||||
|       let id = context.args.model.id; |       const id = context.args.model.id; | ||||||
|       return { |       return { | ||||||
|         id: `${backend}/metadata/${id}`, |         id: `${backend}/metadata/${id}`, | ||||||
|       }; |       }; | ||||||
| @@ -69,9 +70,9 @@ export default class SecretDeleteMenu extends Component { | |||||||
|       if (!context.args.model || context.args.mode === 'create') { |       if (!context.args.model || context.args.mode === 'create') { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       let backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; |       const backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; | ||||||
|       let id = context.args.model.id; |       const id = context.args.model.id; | ||||||
|       let path = context.args.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; |       const path = context.args.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; | ||||||
|       return { |       return { | ||||||
|         id: path, |         id: path, | ||||||
|       }; |       }; | ||||||
| @@ -90,9 +91,9 @@ export default class SecretDeleteMenu extends Component { | |||||||
|       if (!context.args.model || context.args.mode === 'create') { |       if (!context.args.model || context.args.mode === 'create') { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       let backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; |       const backend = context.args.isV2 ? context.args.model.engine.id : context.args.model.backend; | ||||||
|       let id = context.args.model.id; |       const id = context.args.model.id; | ||||||
|       let path = context.args.isV2 ? `${backend}/delete/${id}` : `${backend}/${id}`; |       const path = context.args.isV2 ? `${backend}/delete/${id}` : `${backend}/${id}`; | ||||||
|       return { |       return { | ||||||
|         id: path, |         id: path, | ||||||
|       }; |       }; | ||||||
| @@ -107,10 +108,10 @@ export default class SecretDeleteMenu extends Component { | |||||||
|  |  | ||||||
|   get isLatestVersion() { |   get isLatestVersion() { | ||||||
|     // must have metadata access. |     // must have metadata access. | ||||||
|     let { model } = this.args; |     const { model } = this.args; | ||||||
|     if (!model) return false; |     if (!model) return false; | ||||||
|     let latestVersion = model.currentVersion; |     const latestVersion = model.currentVersion; | ||||||
|     let selectedVersion = model.selectedVersion.version; |     const selectedVersion = model.selectedVersion.version; | ||||||
|     if (latestVersion !== selectedVersion) { |     if (latestVersion !== selectedVersion) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ export default class SecretEditMetadata extends Component { | |||||||
|   @tracked modelValidations; |   @tracked modelValidations; | ||||||
|  |  | ||||||
|   async save() { |   async save() { | ||||||
|     let model = this.args.model; |     const model = this.args.model; | ||||||
|     try { |     try { | ||||||
|       await model.save(); |       await model.save(); | ||||||
|     } catch (e) { |     } catch (e) { | ||||||
| @@ -49,7 +49,7 @@ export default class SecretEditMetadata extends Component { | |||||||
|       if (name === 'customMetadata') { |       if (name === 'customMetadata') { | ||||||
|         // atypical case where property is not set on model on change - validate independently |         // atypical case where property is not set on model on change - validate independently | ||||||
|         /* eslint-disable no-useless-escape */ |         /* 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)) { |         if (!value.match(regex)) { | ||||||
|           state[name] = { |           state[name] = { | ||||||
|             errors: ['Custom values cannot contain a backward slash.'], |             errors: ['Custom values cannot contain a backward slash.'], | ||||||
| @@ -63,7 +63,7 @@ export default class SecretEditMetadata extends Component { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     let count = 0; |     let count = 0; | ||||||
|     for (let key in state) { |     for (const key in state) { | ||||||
|       if (!state[key].isValid) { |       if (!state[key].isValid) { | ||||||
|         count++; |         count++; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -55,9 +55,9 @@ export default class SecretEdit extends Component { | |||||||
|       if (!context.args.model || context.args.mode === 'create') { |       if (!context.args.model || context.args.mode === 'create') { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       let backend = context.isV2 ? context.args.model.engine.id : context.args.model.backend; |       const backend = context.isV2 ? context.args.model.engine.id : context.args.model.backend; | ||||||
|       let id = context.args.model.id; |       const id = context.args.model.id; | ||||||
|       let path = context.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; |       const path = context.isV2 ? `${backend}/data/${id}` : `${backend}/${id}`; | ||||||
|       return { |       return { | ||||||
|         id: path, |         id: path, | ||||||
|       }; |       }; | ||||||
| @@ -98,7 +98,7 @@ export default class SecretEdit extends Component { | |||||||
|   @or('requestInFlight', 'model.isFolder', 'model.flagsIsInvalid') buttonDisabled; |   @or('requestInFlight', 'model.isFolder', 'model.flagsIsInvalid') buttonDisabled; | ||||||
|  |  | ||||||
|   get modelForData() { |   get modelForData() { | ||||||
|     let { model } = this.args; |     const { model } = this.args; | ||||||
|     if (!model) return null; |     if (!model) return null; | ||||||
|     return this.isV2 ? model.belongsTo('selectedVersion').value() : model; |     return this.isV2 ? model.belongsTo('selectedVersion').value() : model; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ export default class DatabaseListItem extends Component { | |||||||
|   @action |   @action | ||||||
|   resetConnection(id) { |   resetConnection(id) { | ||||||
|     const { backend } = this.args.item; |     const { backend } = this.args.item; | ||||||
|     let adapter = this.store.adapterFor('database/connection'); |     const adapter = this.store.adapterFor('database/connection'); | ||||||
|     adapter |     adapter | ||||||
|       .resetConnection(backend, id) |       .resetConnection(backend, id) | ||||||
|       .then(() => { |       .then(() => { | ||||||
| @@ -48,7 +48,7 @@ export default class DatabaseListItem extends Component { | |||||||
|   @action |   @action | ||||||
|   rotateRootCred(id) { |   rotateRootCred(id) { | ||||||
|     const { backend } = this.args.item; |     const { backend } = this.args.item; | ||||||
|     let adapter = this.store.adapterFor('database/connection'); |     const adapter = this.store.adapterFor('database/connection'); | ||||||
|     adapter |     adapter | ||||||
|       .rotateRootCredentials(backend, id) |       .rotateRootCredentials(backend, id) | ||||||
|       .then(() => { |       .then(() => { | ||||||
| @@ -61,7 +61,7 @@ export default class DatabaseListItem extends Component { | |||||||
|   @action |   @action | ||||||
|   rotateRoleCred(id) { |   rotateRoleCred(id) { | ||||||
|     const { backend } = this.args.item; |     const { backend } = this.args.item; | ||||||
|     let adapter = this.store.adapterFor('database/credential'); |     const adapter = this.store.adapterFor('database/credential'); | ||||||
|     adapter |     adapter | ||||||
|       .rotateRoleCredentials(backend, id) |       .rotateRoleCredentials(backend, id) | ||||||
|       .then(() => { |       .then(() => { | ||||||
|   | |||||||
| @@ -68,7 +68,7 @@ export default class TextFile extends Component { | |||||||
|   @action |   @action | ||||||
|   updateData(e) { |   updateData(e) { | ||||||
|     e.preventDefault(); |     e.preventDefault(); | ||||||
|     let file = this.args.file; |     const file = this.args.file; | ||||||
|     set(file, 'value', e.target.value); |     set(file, 'value', e.target.value); | ||||||
|     this.args.onChange(this.index, file); |     this.args.onChange(this.index, file); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ export default class TokenExpireWarning extends Component { | |||||||
|   @service router; |   @service router; | ||||||
|  |  | ||||||
|   get showWarning() { |   get showWarning() { | ||||||
|     let currentRoute = this.router.currentRouteName; |     const currentRoute = this.router.currentRouteName; | ||||||
|     if ('vault.cluster.oidc-provider' === currentRoute) { |     if ('vault.cluster.oidc-provider' === currentRoute) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -78,9 +78,9 @@ export default Component.extend(DEFAULTS, { | |||||||
|  |  | ||||||
|   handleSuccess(resp, action) { |   handleSuccess(resp, action) { | ||||||
|     let props = {}; |     let props = {}; | ||||||
|     let secret = (resp && resp.data) || resp.auth; |     const secret = (resp && resp.data) || resp.auth; | ||||||
|     if (secret && action === 'unwrap') { |     if (secret && action === 'unwrap') { | ||||||
|       let details = { |       const details = { | ||||||
|         'Request ID': resp.request_id, |         'Request ID': resp.request_id, | ||||||
|         'Lease ID': resp.lease_id || 'None', |         'Lease ID': resp.lease_id || 'None', | ||||||
|         Renewable: resp.renewable ? 'Yes' : 'No', |         Renewable: resp.renewable ? 'Yes' : 'No', | ||||||
|   | |||||||
| @@ -40,10 +40,10 @@ export default TransformBase.extend({ | |||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     Promise.all(promises).then((res) => { |     Promise.all(promises).then((res) => { | ||||||
|       let hasError = res.find((r) => !!r.errorStatus); |       const hasError = res.find((r) => !!r.errorStatus); | ||||||
|       if (hasError) { |       if (hasError) { | ||||||
|         let errorAdding = res.find((r) => r.errorStatus === 403 && r.action === 'ADD'); |         const errorAdding = res.find((r) => r.errorStatus === 403 && r.action === 'ADD'); | ||||||
|         let errorRemoving = res.find((r) => r.errorStatus === 403 && r.action === 'REMOVE'); |         const errorRemoving = res.find((r) => r.errorStatus === 403 && r.action === 'REMOVE'); | ||||||
|  |  | ||||||
|         let message = |         let message = | ||||||
|           'The edits to this role were successful, but allowed_roles for its transformations was not edited due to a lack of permissions.'; |           'The edits to this role were successful, but allowed_roles for its transformations was not edited due to a lack of permissions.'; | ||||||
|   | |||||||
| @@ -7,12 +7,12 @@ export default TransformBase.extend({ | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     let { type, allowed_roles, tweak_source, name } = this.model; |     const { type, allowed_roles, tweak_source, name } = this.model; | ||||||
|     let wildCardRole = allowed_roles.find((role) => role.includes('*')); |     const wildCardRole = allowed_roles.find((role) => role.includes('*')); | ||||||
|  |  | ||||||
|     // values to be returned |     // values to be returned | ||||||
|     let role = '<choose a role>'; |     let role = '<choose a role>'; | ||||||
|     let value = 'value=<enter your value here>'; |     const value = 'value=<enter your value here>'; | ||||||
|     let tweak = ''; |     let tweak = ''; | ||||||
|  |  | ||||||
|     // determine the role |     // determine the role | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 Jordan Reimer
					Jordan Reimer