mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
do all the things (#25573)
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
import AdapterError from '@ember-data/adapter/error';
|
import AdapterError from '@ember-data/adapter/error';
|
||||||
import RESTAdapter from '@ember-data/adapter/rest';
|
import RESTAdapter from '@ember-data/adapter/rest';
|
||||||
import { service } from '@ember/service';
|
import { service } from '@ember/service';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
import RSVP from 'rsvp';
|
import RSVP from 'rsvp';
|
||||||
import config from '../config/environment';
|
import config from '../config/environment';
|
||||||
@@ -53,7 +52,7 @@ export default RESTAdapter.extend({
|
|||||||
if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) {
|
if (namespace && !NAMESPACE_ROOT_URLS.some((str) => url.includes(str))) {
|
||||||
headers['X-Vault-Namespace'] = namespace;
|
headers['X-Vault-Namespace'] = namespace;
|
||||||
}
|
}
|
||||||
options.headers = assign(options.headers || {}, headers);
|
options.headers = Object.assign(options.headers || {}, headers);
|
||||||
},
|
},
|
||||||
|
|
||||||
_preRequest(url, options, method) {
|
_preRequest(url, options, method) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import AdapterError from '@ember-data/adapter/error';
|
import AdapterError from '@ember-data/adapter/error';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
@@ -55,7 +54,7 @@ export default ApplicationAdapter.extend({
|
|||||||
// ember data doesn't like 204s if it's not a DELETE
|
// ember data doesn't like 204s if it's not a DELETE
|
||||||
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
|
||||||
return {
|
return {
|
||||||
data: assign({}, data, { path: path + '/', id: path }),
|
data: { ...data, path: path + '/', id: path },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { assert } from '@ember/debug';
|
import { assert } from '@ember/debug';
|
||||||
import ControlGroupError from 'vault/lib/control-group-error';
|
import ControlGroupError from 'vault/lib/control-group-error';
|
||||||
import ApplicationAdapter from '../application';
|
import ApplicationAdapter from '../application';
|
||||||
@@ -97,7 +96,7 @@ export default ApplicationAdapter.extend({
|
|||||||
type,
|
type,
|
||||||
};
|
};
|
||||||
|
|
||||||
resp.data = assign({}, successful.data);
|
resp.data = { ...successful.data };
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
@@ -130,13 +129,13 @@ export default ApplicationAdapter.extend({
|
|||||||
dynamicRoles = dynamicResp.value.data.keys;
|
dynamicRoles = dynamicResp.value.data.keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.data = assign(
|
resp.data = {
|
||||||
{},
|
...resp.data,
|
||||||
resp.data,
|
keys: [...staticRoles, ...dynamicRoles],
|
||||||
{ keys: [...staticRoles, ...dynamicRoles] },
|
backend,
|
||||||
{ backend },
|
staticRoles,
|
||||||
{ staticRoles, dynamicRoles }
|
dynamicRoles,
|
||||||
);
|
};
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
});
|
});
|
||||||
@@ -170,7 +169,7 @@ export default ApplicationAdapter.extend({
|
|||||||
return this.ajax(this.urlFor(backend, id, roleType), 'POST', { data }).then(() => {
|
return this.ajax(this.urlFor(backend, id, roleType), 'POST', { data }).then(() => {
|
||||||
// ember data doesn't like 204s if it's not a DELETE
|
// ember data doesn't like 204s if it's not a DELETE
|
||||||
return {
|
return {
|
||||||
data: assign({}, data, { id }),
|
data: { ...data, ...id },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
import { service } from '@ember/service';
|
import { service } from '@ember/service';
|
||||||
@@ -34,7 +33,7 @@ export default ApplicationAdapter.extend({
|
|||||||
id,
|
id,
|
||||||
method: id,
|
method: id,
|
||||||
};
|
};
|
||||||
return assign({}, resp, data);
|
return { ...resp, ...data };
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import ApplicationAdapter from '../application';
|
import ApplicationAdapter from '../application';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
|
|
||||||
export default class PkiRoleAdapter extends ApplicationAdapter {
|
export default class PkiRoleAdapter extends ApplicationAdapter {
|
||||||
@@ -56,7 +55,7 @@ export default class PkiRoleAdapter extends ApplicationAdapter {
|
|||||||
backend,
|
backend,
|
||||||
};
|
};
|
||||||
|
|
||||||
return assign({}, resp, data);
|
return { ...resp, ...data };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
|
|
||||||
export default ApplicationAdapter.extend({
|
export default ApplicationAdapter.extend({
|
||||||
@@ -21,7 +20,7 @@ export default ApplicationAdapter.extend({
|
|||||||
return this.ajax(this.buildURL(type.modelName, name), 'PUT', { data }).then(() => {
|
return this.ajax(this.buildURL(type.modelName, name), 'PUT', { data }).then(() => {
|
||||||
// doing this to make it like a Vault response - ember data doesn't like 204s if it's not a DELETE
|
// doing this to make it like a Vault response - ember data doesn't like 204s if it's not a DELETE
|
||||||
return {
|
return {
|
||||||
data: assign({}, this.serialize(snapshot), { id: name }),
|
data: { ...this.serialize(snapshot), id: name },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { resolve, allSettled } from 'rsvp';
|
import { resolve, allSettled } from 'rsvp';
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
@@ -81,9 +80,9 @@ export default ApplicationAdapter.extend({
|
|||||||
results.forEach((result) => {
|
results.forEach((result) => {
|
||||||
if (result.value) {
|
if (result.value) {
|
||||||
if (result.value.data.roles) {
|
if (result.value.data.roles) {
|
||||||
resp.data = assign({}, resp.data, { zero_address_roles: result.value.data.roles });
|
resp.data = { ...resp.data, zero_address_roles: result.value.data.roles };
|
||||||
} else {
|
} else {
|
||||||
resp.data = assign({}, resp.data, result.value.data);
|
resp.data = { ...resp.data, ...result.value.data };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
import { splitObject } from 'vault/helpers/split-object';
|
import { splitObject } from 'vault/helpers/split-object';
|
||||||
@@ -76,13 +75,13 @@ export default ApplicationAdapter.extend({
|
|||||||
// we do not handle the error here because we want the secret-engine to mount successfully and to continue the flow.
|
// we do not handle the error here because we want the secret-engine to mount successfully and to continue the flow.
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
data: assign({}, data, { path: path + '/', id: path }),
|
data: { ...data, path: path + '/', id: path },
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return this.ajax(this.url(path), 'POST', { data }).then(() => {
|
return this.ajax(this.url(path), 'POST', { data }).then(() => {
|
||||||
// ember data doesn't like 204s if it's not a DELETE
|
// ember data doesn't like 204s if it's not a DELETE
|
||||||
return {
|
return {
|
||||||
data: assign({}, data, { path: path + '/', id: path }),
|
data: { ...data, path: path + '/', id: path },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { allSettled } from 'rsvp';
|
import { allSettled } from 'rsvp';
|
||||||
import ApplicationAdapter from './application';
|
import ApplicationAdapter from './application';
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
@@ -85,7 +84,7 @@ export default ApplicationAdapter.extend({
|
|||||||
};
|
};
|
||||||
delete d.templates;
|
delete d.templates;
|
||||||
}
|
}
|
||||||
resp.data = assign({}, resp.data, d);
|
resp.data = { ...resp.data, ...d };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return resp;
|
return resp;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { match } from '@ember/object/computed';
|
import { match } from '@ember/object/computed';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { service } from '@ember/service';
|
import { service } from '@ember/service';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { setProperties, computed, set } from '@ember/object';
|
import { setProperties, computed, set } from '@ember/object';
|
||||||
@@ -91,12 +90,12 @@ export default Component.extend(DEFAULTS, {
|
|||||||
Renewable: resp.renewable ? 'Yes' : 'No',
|
Renewable: resp.renewable ? 'Yes' : 'No',
|
||||||
'Lease Duration': resp.lease_duration || 'None',
|
'Lease Duration': resp.lease_duration || 'None',
|
||||||
};
|
};
|
||||||
props = assign({}, props, { unwrap_data: secret }, { details: details });
|
props = { ...props, unwrap_data: secret, details: details };
|
||||||
}
|
}
|
||||||
props = assign({}, props, secret);
|
props = { ...props, ...secret };
|
||||||
if (resp && resp.wrap_info) {
|
if (resp && resp.wrap_info) {
|
||||||
const keyName = action === 'rewrap' ? 'rewrap_token' : 'token';
|
const keyName = action === 'rewrap' ? 'rewrap_token' : 'token';
|
||||||
props = assign({}, props, { [keyName]: resp.wrap_info.token });
|
props = { ...props, [keyName]: resp.wrap_info.token };
|
||||||
}
|
}
|
||||||
setProperties(this, props);
|
setProperties(this, props);
|
||||||
this.flashMessages.success(`${capitalize(action)} was successful.`);
|
this.flashMessages.success(`${capitalize(action)} was successful.`);
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export default class TransitKeyActions extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.wrapTTL) {
|
if (options.wrapTTL) {
|
||||||
this.props = { ...this.props, ...{ wrappedToken: resp.wrap_info.token } };
|
this.props = { ...this.props, wrappedToken: resp.wrap_info.token };
|
||||||
}
|
}
|
||||||
this.isModalActive = true;
|
this.isModalActive = true;
|
||||||
// verify doesn't trigger a success message
|
// verify doesn't trigger a success message
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import JSONSerializer from '@ember-data/serializer/json';
|
import JSONSerializer from '@ember-data/serializer/json';
|
||||||
import { isNone, isBlank } from '@ember/utils';
|
import { isNone, isBlank } from '@ember/utils';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
|
|
||||||
export default JSONSerializer.extend({
|
export default JSONSerializer.extend({
|
||||||
@@ -30,7 +29,7 @@ export default JSONSerializer.extend({
|
|||||||
});
|
});
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
assign(payload, payload.data);
|
Object.assign(payload, payload.data);
|
||||||
delete payload.data;
|
delete payload.data;
|
||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
import IdentityManager from '../utils/identity-manager';
|
import IdentityManager from '../utils/identity-manager';
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ export default RESTSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
|
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
|
||||||
// FIXME when multiple clusters lands
|
// FIXME when multiple clusters lands
|
||||||
const transformedPayload = {
|
const transformedPayload = {
|
||||||
clusters: assign({ id: '1' }, payload.data || payload),
|
clusters: Object.assign({ id: '1' }, payload.data || payload),
|
||||||
};
|
};
|
||||||
|
|
||||||
return this._super(store, primaryModelClass, transformedPayload, id, requestType);
|
return this._super(store, primaryModelClass, transformedPayload, id, requestType);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import RESTSerializer from '@ember-data/serializer/rest';
|
import RESTSerializer from '@ember-data/serializer/rest';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
|
|
||||||
export default RESTSerializer.extend({
|
export default RESTSerializer.extend({
|
||||||
@@ -14,7 +13,7 @@ export default RESTSerializer.extend({
|
|||||||
|
|
||||||
normalizeAll(payload) {
|
normalizeAll(payload) {
|
||||||
if (payload.data) {
|
if (payload.data) {
|
||||||
const data = assign({}, payload, payload.data);
|
const data = { ...payload, ...payload.data };
|
||||||
return [data];
|
return [data];
|
||||||
}
|
}
|
||||||
return [payload];
|
return [payload];
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import ApplicationSerializer from '../application';
|
import ApplicationSerializer from '../application';
|
||||||
|
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
@@ -19,7 +18,7 @@ export default ApplicationSerializer.extend({
|
|||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
assign(payload, payload.data);
|
Object.assign(payload, payload.data);
|
||||||
delete payload.data;
|
delete payload.data;
|
||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
|
|
||||||
export default RESTSerializer.extend(EmbeddedRecordsMixin, {
|
export default RESTSerializer.extend(EmbeddedRecordsMixin, {
|
||||||
@@ -25,7 +24,7 @@ export default RESTSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
|
|
||||||
nodeFromObject(name, payload) {
|
nodeFromObject(name, payload) {
|
||||||
const nodeObj = payload.nodes[name];
|
const nodeObj = payload.nodes[name];
|
||||||
return assign(nodeObj, {
|
return Object.assign(nodeObj, {
|
||||||
name,
|
name,
|
||||||
id: name,
|
id: name,
|
||||||
});
|
});
|
||||||
@@ -34,7 +33,7 @@ export default RESTSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
|
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
|
||||||
const nodes = payload.nodes
|
const nodes = payload.nodes
|
||||||
? Object.keys(payload.nodes).map((name) => this.nodeFromObject(name, payload))
|
? Object.keys(payload.nodes).map((name) => this.nodeFromObject(name, payload))
|
||||||
: [assign(payload, { id: '1' })];
|
: [Object.assign(payload, { id: '1' })];
|
||||||
|
|
||||||
const transformedPayload = { nodes: nodes };
|
const transformedPayload = { nodes: nodes };
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import ApplicationSerializer from './application';
|
import ApplicationSerializer from './application';
|
||||||
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (struct.data) {
|
if (struct.data) {
|
||||||
struct = assign({}, struct, struct.data);
|
struct = { ...struct, ...struct.data };
|
||||||
delete struct.data;
|
delete struct.data;
|
||||||
}
|
}
|
||||||
// strip the trailing slash off of the path so we
|
// strip the trailing slash off of the path so we
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import RESTSerializer from '@ember-data/serializer/rest';
|
import RESTSerializer from '@ember-data/serializer/rest';
|
||||||
import { isNone, isBlank } from '@ember/utils';
|
import { isNone, isBlank } from '@ember/utils';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
|
|
||||||
export default RESTSerializer.extend({
|
export default RESTSerializer.extend({
|
||||||
@@ -25,7 +24,7 @@ export default RESTSerializer.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
normalizeItems(payload) {
|
normalizeItems(payload) {
|
||||||
assign(payload, payload.data);
|
Object.assign(payload, payload.data);
|
||||||
delete payload.data;
|
delete payload.data;
|
||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import RESTSerializer from '@ember-data/serializer/rest';
|
import RESTSerializer from '@ember-data/serializer/rest';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { decamelize } from '@ember/string';
|
import { decamelize } from '@ember/string';
|
||||||
|
|
||||||
export default RESTSerializer.extend({
|
export default RESTSerializer.extend({
|
||||||
@@ -19,7 +18,7 @@ export default RESTSerializer.extend({
|
|||||||
const secrets = payload.data.keys.map((secret) => ({ name: secret, backend: payload.backend }));
|
const secrets = payload.data.keys.map((secret) => ({ name: secret, backend: payload.backend }));
|
||||||
return secrets;
|
return secrets;
|
||||||
}
|
}
|
||||||
assign(payload, payload.data);
|
Object.assign(payload, payload.data);
|
||||||
delete payload.data;
|
delete payload.data;
|
||||||
// timestamps for these two are in seconds...
|
// timestamps for these two are in seconds...
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import Model from '@ember-data/model';
|
|||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
||||||
import { getOwner } from '@ember/application';
|
import { getOwner } from '@ember/application';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { expandOpenApiProps, combineAttributes } from 'vault/utils/openapi-to-attrs';
|
import { expandOpenApiProps, combineAttributes } from 'vault/utils/openapi-to-attrs';
|
||||||
import fieldToAttrs from 'vault/utils/field-to-attrs';
|
import fieldToAttrs from 'vault/utils/field-to-attrs';
|
||||||
import { resolve, reject } from 'rsvp';
|
import { resolve, reject } from 'rsvp';
|
||||||
@@ -183,7 +182,7 @@ export default Service.extend({
|
|||||||
}
|
}
|
||||||
// put url params (e.g. {name}, {role})
|
// put url params (e.g. {name}, {role})
|
||||||
// at the front of the props list
|
// at the front of the props list
|
||||||
const newProps = assign({}, paramProp, props);
|
const newProps = { ...paramProp, ...props };
|
||||||
return expandOpenApiProps(newProps);
|
return expandOpenApiProps(newProps);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { attr } from '@ember-data/model';
|
import { attr } from '@ember-data/model';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { camelize, capitalize } from '@ember/string';
|
import { camelize, capitalize } from '@ember/string';
|
||||||
|
|
||||||
export const expandOpenApiProps = function (props) {
|
export const expandOpenApiProps = function (props) {
|
||||||
@@ -90,7 +89,7 @@ export const combineAttributes = function (oldAttrs, newProps) {
|
|||||||
if (oldAttrs) {
|
if (oldAttrs) {
|
||||||
oldAttrs.forEach(function (value, name) {
|
oldAttrs.forEach(function (value, name) {
|
||||||
if (newProps[name]) {
|
if (newProps[name]) {
|
||||||
newAttrs[name] = attr(newProps[name].type, assign({}, newProps[name], value.options));
|
newAttrs[name] = attr(newProps[name].type, { ...newProps[name], ...value.options });
|
||||||
} else {
|
} else {
|
||||||
newAttrs[name] = attr(value.type, value.options);
|
newAttrs[name] = attr(value.type, value.options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupRenderingTest } from 'ember-qunit';
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
import { render } from '@ember/test-helpers';
|
import { render } from '@ember/test-helpers';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
|
||||||
const REPLICATION_DETAILS = {
|
const REPLICATION_DETAILS = {
|
||||||
@@ -116,7 +115,7 @@ module('Integration | Component | replication-dashboard', function (hooks) {
|
|||||||
IS_REINDEXING.reindex_building_progress,
|
IS_REINDEXING.reindex_building_progress,
|
||||||
'shows the reindexing progress inside the alert banner'
|
'shows the reindexing progress inside the alert banner'
|
||||||
);
|
);
|
||||||
const reindexingInProgress = assign({}, IS_REINDEXING, { reindex_building_progress: 152721 });
|
const reindexingInProgress = { ...IS_REINDEXING, reindex_building_progress: 152721 };
|
||||||
this.set('replicationDetails', reindexingInProgress);
|
this.set('replicationDetails', reindexingInProgress);
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-reindexing-progress]')
|
.dom('[data-test-reindexing-progress]')
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import { run } from '@ember/runloop';
|
import { run } from '@ember/runloop';
|
||||||
import { resolve } from 'rsvp';
|
import { resolve } from 'rsvp';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupRenderingTest } from 'ember-qunit';
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
@@ -25,12 +24,12 @@ const storeStub = Service.extend({
|
|||||||
keyAction(action, { backend, id, payload }, options) {
|
keyAction(action, { backend, id, payload }, options) {
|
||||||
self.set('callArgs', { action, backend, id, payload });
|
self.set('callArgs', { action, backend, id, payload });
|
||||||
self.set('callArgsOptions', options);
|
self.set('callArgsOptions', options);
|
||||||
const rootResp = assign({}, self.get('rootKeyActionReturnVal'));
|
const rootResp = { ...self.get('rootKeyActionReturnVal') };
|
||||||
const resp =
|
const resp =
|
||||||
Object.keys(rootResp).length > 0
|
Object.keys(rootResp).length > 0
|
||||||
? rootResp
|
? rootResp
|
||||||
: {
|
: {
|
||||||
data: assign({}, self.get('keyActionReturnVal')),
|
data: { ...self.get('keyActionReturnVal') },
|
||||||
};
|
};
|
||||||
return resolve(resp);
|
return resolve(resp);
|
||||||
},
|
},
|
||||||
@@ -105,7 +104,7 @@ module('Integration | Component | transit key actions', function (hooks) {
|
|||||||
async function doEncrypt(assert, actions = [], keyattrs = {}) {
|
async function doEncrypt(assert, actions = [], keyattrs = {}) {
|
||||||
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat(actions) };
|
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat(actions) };
|
||||||
|
|
||||||
const key = assign({}, keyDefaults, keyattrs);
|
const key = { ...keyDefaults, ...keyattrs };
|
||||||
this.set('key', key);
|
this.set('key', key);
|
||||||
this.set('selectedAction', 'encrypt');
|
this.set('selectedAction', 'encrypt');
|
||||||
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
||||||
@@ -156,7 +155,7 @@ module('Integration | Component | transit key actions', function (hooks) {
|
|||||||
test('it shows key version selection', async function (assert) {
|
test('it shows key version selection', async function (assert) {
|
||||||
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) };
|
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) };
|
||||||
const keyattrs = { keysForEncryption: [3, 2, 1], latestVersion: 3 };
|
const keyattrs = { keysForEncryption: [3, 2, 1], latestVersion: 3 };
|
||||||
const key = assign({}, keyDefaults, keyattrs);
|
const key = { ...keyDefaults, ...keyattrs };
|
||||||
this.set('key', key);
|
this.set('key', key);
|
||||||
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
||||||
await render(hbs`
|
await render(hbs`
|
||||||
@@ -185,7 +184,7 @@ module('Integration | Component | transit key actions', function (hooks) {
|
|||||||
test('it hides key version selection', async function (assert) {
|
test('it hides key version selection', async function (assert) {
|
||||||
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) };
|
const keyDefaults = { backend: 'transit', id: 'akey', supportedActions: ['encrypt'].concat([]) };
|
||||||
const keyattrs = { keysForEncryption: [1] };
|
const keyattrs = { keysForEncryption: [1] };
|
||||||
const key = assign({}, keyDefaults, keyattrs);
|
const key = { ...keyDefaults, ...keyattrs };
|
||||||
this.set('key', key);
|
this.set('key', key);
|
||||||
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
this.set('storeService.keyActionReturnVal', { ciphertext: 'secret' });
|
||||||
await render(hbs`
|
await render(hbs`
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import EmberObject from '@ember/object';
|
import EmberObject from '@ember/object';
|
||||||
import ClusterRouteMixin from 'vault/mixins/cluster-route';
|
import ClusterRouteMixin from 'vault/mixins/cluster-route';
|
||||||
import {
|
import {
|
||||||
@@ -25,7 +24,7 @@ module('Unit | Mixin | cluster route', function () {
|
|||||||
) {
|
) {
|
||||||
const ClusterRouteObject = EmberObject.extend(
|
const ClusterRouteObject = EmberObject.extend(
|
||||||
ClusterRouteMixin,
|
ClusterRouteMixin,
|
||||||
assign(methods, { clusterModel: () => clusterModel })
|
Object.assign(methods, { clusterModel: () => clusterModel })
|
||||||
);
|
);
|
||||||
return ClusterRouteObject.create();
|
return ClusterRouteObject.create();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user