IO-3020 IO-3036 Remove Audit and Lifecycle feature wraps.

This commit is contained in:
Patrick Fic
2024-12-13 08:27:54 -08:00
parent c0dc5f50e3
commit e0f4b6daf2
9 changed files with 60 additions and 34 deletions

View File

@@ -14,10 +14,11 @@ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
});
const LockWrapper = ({ featureName, bodyshop, children, disabled = true }) => {
const LockWrapper = ({ featureName, bodyshop, children, disabled = true, bypass }) => {
let renderedChildren = children;
if (disabled) {
//Mark the child prop as disabled.
if (disabled && !bypass) {
renderedChildren = React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
return React.cloneElement(child, {
@@ -28,7 +29,16 @@ const LockWrapper = ({ featureName, bodyshop, children, disabled = true }) => {
});
}
return (
if (bypass) {
if (import.meta.env.DEV) {
console.trace("*** Lock Wrapper BYPASS USED", featureName);
}
return <span>{children}</span>;
}
return HasFeatureAccess({ featureName: featureName, bodyshop }) ? (
children
) : (
<Space>
{!HasFeatureAccess({ featureName: featureName, bodyshop }) && <LockOutlined style={{ color: "tomato" }} />}
{renderedChildren}