mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
Use delete operator instead of destructuring
This commit is contained in:
@@ -48,30 +48,16 @@ function hasPromptData(launchData) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeOverrides(resource, overrides) {
|
function omitOverrides(resource, overrides) {
|
||||||
const filteredResource = Object.keys(overrides).reduce(
|
const clonedResource = {
|
||||||
(acc, value) => {
|
...resource,
|
||||||
let root;
|
summary_fields: { ...resource.summary_fields },
|
||||||
let nested;
|
};
|
||||||
|
Object.keys(overrides).forEach(keyToOmit => {
|
||||||
({
|
delete clonedResource[keyToOmit];
|
||||||
[value]: acc[value],
|
delete clonedResource.summary_fields[keyToOmit];
|
||||||
summary_fields: { [value]: acc[value], ...nested },
|
});
|
||||||
...root
|
return clonedResource;
|
||||||
} = acc);
|
|
||||||
|
|
||||||
const filtered = {
|
|
||||||
...root,
|
|
||||||
summary_fields: {
|
|
||||||
...nested,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return filtered;
|
|
||||||
},
|
|
||||||
{ ...resource }
|
|
||||||
);
|
|
||||||
return filteredResource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: When prompting is hooked up, update function
|
// TODO: When prompting is hooked up, update function
|
||||||
@@ -143,7 +129,7 @@ function partitionPromptDetails(resource, launchConfig) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const withoutOverrides = removeOverrides(resource, overrides);
|
const withoutOverrides = omitOverrides(resource, overrides);
|
||||||
|
|
||||||
return [withoutOverrides, overrides];
|
return [withoutOverrides, overrides];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user