IO-3020 IO-3036 Remove Audit and Lifecycle feature wraps.
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user