remove superfluous that used to be toArray

This commit is contained in:
Chelsea Shaw 2024-03-08 18:48:22 -06:00
parent 32d301b9a4
commit f81de50687
10 changed files with 15 additions and 15 deletions

View file

@ -74,7 +74,7 @@ export default class MfaLoginEnforcementForm extends Component {
const types = ['identity/group', 'identity/entity'];
for (const type of types) {
try {
options[type] = (await this.store.query(type, {})).slice();
options[type] = await this.store.query(type, {});
} catch (error) {
options[type] = [];
}
@ -89,7 +89,7 @@ export default class MfaLoginEnforcementForm extends Component {
}
}
async fetchAuthMethods() {
const mounts = (await this.store.findAll('auth-method')).slice();
const mounts = await this.store.findAll('auth-method');
this.authMethods = mounts.map((auth) => auth.type);
}

View file

@ -41,7 +41,7 @@ export default class MfaLoginEnforcementHeaderComponent extends Component {
async fetchEnforcements() {
try {
// cache initial values for lookup in select handler
this._enforcements = (await this.store.query('mfa-login-enforcement', {})).slice();
this._enforcements = await this.store.query('mfa-login-enforcement', {});
this.enforcements = [...this._enforcements];
} catch (error) {
this.enforcements = [];

View file

@ -324,7 +324,7 @@ export default Service.extend(DEFAULTS, {
getCompletedFeatures() {
if (this.storageHasKey(COMPLETED_FEATURES)) {
return this.getExtState(COMPLETED_FEATURES).slice();
return this.getExtState(COMPLETED_FEATURES);
}
return [];
},
@ -337,7 +337,7 @@ export default Service.extend(DEFAULTS, {
completed.push(done);
this.saveExtState(COMPLETED_FEATURES, completed);
} else {
this.saveExtState(COMPLETED_FEATURES, this.getExtState(COMPLETED_FEATURES).slice().addObject(done));
this.saveExtState(COMPLETED_FEATURES, this.getExtState(COMPLETED_FEATURES).addObject(done));
}
this.saveExtState(FEATURE_LIST, features.length ? features : null);

View file

@ -69,7 +69,7 @@ export default class SearchSelectWithModal extends Component {
addSearchText(optionsToFormat) {
// maps over array models from query
return optionsToFormat.slice().map((option) => {
return optionsToFormat.map((option) => {
option.searchText = `${option.name} ${option.id}`;
return option;
});

View file

@ -100,7 +100,7 @@ export default class SearchSelect extends Component {
addSearchText(optionsToFormat) {
// maps over array of objects or response from query
return optionsToFormat.slice().map((option) => {
return optionsToFormat.map((option) => {
const id = option[this.idKey] ? option[this.idKey] : option.id;
option.searchText = `${option[this.nameKey]} ${id}`;
return option;

View file

@ -50,7 +50,7 @@ export default function (server) {
records.push(server.create(`mfa-${type}-method`));
});
} else {
records = server.createList('mfa-login-enforcement', 4).slice();
records = server.createList('mfa-login-enforcement', 4);
}
}
const dataKey = isMethod ? 'id' : 'name';

View file

@ -17,7 +17,7 @@ export function setupModels(hooks) {
id: destination.name,
});
this.destination = this.store.peekRecord(destinationModelName, destination.name);
this.destinations = this.store.peekAll(destinationModelName).slice();
this.destinations = this.store.peekAll(destinationModelName);
this.destinations.meta = {
filteredTotal: this.destinations.length,
currentPage: 1,
@ -43,7 +43,7 @@ export function setupModels(hooks) {
});
this.association = this.store.peekRecord(associationModelName, associationId);
this.associations = this.store.peekAll(associationModelName).slice();
this.associations = this.store.peekAll(associationModelName);
this.associations.meta = {
filteredTotal: this.associations.length,
currentPage: 1,

View file

@ -152,7 +152,7 @@ module('Integration | Component | mfa-login-enforcement-form', function (hooks)
test('it should populate fields with model data', async function (assert) {
this.model.name = 'foo';
const [method] = (await this.store.query('mfa-method', {})).slice();
const [method] = await this.store.query('mfa-method', {});
this.model.mfa_methods.addObject(method);
this.model.auth_method_accessors.addObject('auth_userpass_1234');
@ -209,9 +209,9 @@ module('Integration | Component | mfa-login-enforcement-form', function (hooks)
}));
this.model.auth_method_accessors.addObject('auth_userpass_1234');
this.model.auth_method_types.addObject('userpass');
const [entity] = (await this.store.query('identity/entity', {})).slice();
const [entity] = await this.store.query('identity/entity', {});
this.model.identity_entities.addObject(entity);
const [group] = (await this.store.query('identity/group', {})).slice();
const [group] = await this.store.query('identity/group', {});
this.model.identity_groups.addObject(group);
await render(hbs`

View file

@ -35,7 +35,7 @@ module('Integration | Component | pki-paginated-list', function (hooks) {
},
});
// mimic what happens in lazyPaginatedQuery
const keyModels = this.store.peekAll('pki/key').slice();
const keyModels = this.store.peekAll('pki/key');
keyModels.meta = STANDARD_META;
this.list = keyModels;
const emptyList = this.store.peekAll('pki/foo');

View file

@ -46,7 +46,7 @@ module('Integration | Component | sync | Page::Destinations', function (hooks) {
});
// mimic what happens in lazyPaginatedQuery
this.destinations = store.peekAll(modelName).slice();
this.destinations = store.peekAll(modelName);
this.destinations.meta = {
filteredTotal: this.destinations.length,
currentPage: 1,