remove other superfluous slices

This commit is contained in:
Chelsea Shaw 2024-03-08 18:52:23 -06:00
parent f81de50687
commit 51df83f44e
6 changed files with 10 additions and 11 deletions

View file

@ -117,7 +117,7 @@ const MOUNTABLE_AUTH_METHODS = [
];
export function methods() {
return MOUNTABLE_AUTH_METHODS.slice();
return MOUNTABLE_AUTH_METHODS;
}
export function allMethods() {

View file

@ -135,7 +135,7 @@ const MOUNTABLE_SECRET_ENGINES = [
];
export function mountableEngines() {
return MOUNTABLE_SECRET_ENGINES.slice();
return MOUNTABLE_SECRET_ENGINES;
}
export function allEngines() {

View file

@ -83,7 +83,7 @@ const TABS_FOR_SHOW = {};
export function tabsForAuthSection([model, sectionType = 'authSettings', paths]) {
let tabs;
if (sectionType === 'authSettings') {
tabs = (TABS_FOR_SETTINGS[model.type] || []).slice();
tabs = TABS_FOR_SETTINGS[model.type] || [];
tabs.push({
label: 'Method Options',
routeParams: ['vault.cluster.settings.auth.configure.section', 'options'],
@ -104,7 +104,7 @@ export function tabsForAuthSection([model, sectionType = 'authSettings', paths])
};
});
} else {
tabs = (TABS_FOR_SHOW[model.type] || []).slice();
tabs = TABS_FOR_SHOW[model.type] || [];
}
tabs.push({
label: 'Configuration',

View file

@ -15,7 +15,7 @@ export const COMPUTEDS = {
}),
operationFieldsWithoutSpecial: computed('operationFields', function () {
return this.operationFields.slice().removeObjects(['operationAll', 'operationNone']);
return this.operationFields.removeObjects(['operationAll', 'operationNone']);
}),
tlsFields: computed(function () {
@ -25,12 +25,12 @@ export const COMPUTEDS = {
// For rendering on the create/edit pages
defaultFields: computed('newFields', 'operationFields', 'tlsFields', function () {
const excludeFields = ['role'].concat(this.operationFields, this.tlsFields);
return this.newFields.slice().removeObjects(excludeFields);
return this.newFields.removeObjects(excludeFields);
}),
// For adapter/serializer
nonOperationFields: computed('newFields', 'operationFields', function () {
return this.newFields.slice().removeObjects(this.operationFields);
return this.newFields.removeObjects(this.operationFields);
}),
};
@ -64,9 +64,7 @@ export default Model.extend(COMPUTEDS, {
const attributes = ['operationAddAttribute', 'operationGetAttributes'];
const server = ['operationDiscoverVersions'];
const others = this.operationFieldsWithoutSpecial
.slice()
.removeObjects(objects.concat(attributes, server));
const others = this.operationFieldsWithoutSpecial.removeObjects(objects.concat(attributes, server));
const groups = [
{ 'Managed Cryptographic Objects': objects },
{ 'Object Attributes': attributes },

View file

@ -46,7 +46,7 @@ export default Service.extend({
const log = this.log;
let history;
if (!clearAll) {
history = this.commandHistory.slice();
history = this.commandHistory;
history.setEach('hidden', true);
}
log.clear();

View file

@ -187,6 +187,7 @@ export default class StoreService extends Store {
);
// Hack to make sure all records get in model correctly. remove with update to ember-data@4.12
this.peekAll(modelName).length;
// Removing .slice() causes list.empty in ListView to behave incorrectly
const model = this.peekAll(modelName).slice();
model.set('meta', response.meta);
resolve(model);