mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
disable drag and drop for envs based on permissions
This commit is contained in:
parent
f2879cea79
commit
0a7517fd7b
@ -110,11 +110,15 @@ const EnvironmentListItem = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const opacity = isDragging ? 0 : 1;
|
const opacity = isDragging ? 0 : 1;
|
||||||
drag(drop(ref));
|
|
||||||
|
|
||||||
const { hasAccess } = useContext(AccessContext);
|
const { hasAccess } = useContext(AccessContext);
|
||||||
|
const updatePermission = hasAccess(UPDATE_ENVIRONMENT);
|
||||||
const tooltipText = env.enabled ? 'Disable' : 'Enable';
|
const tooltipText = env.enabled ? 'Disable' : 'Enable';
|
||||||
|
|
||||||
|
if (updatePermission) {
|
||||||
|
drag(drop(ref));
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
style={{ position: 'relative', opacity }}
|
style={{ position: 'relative', opacity }}
|
||||||
@ -148,14 +152,18 @@ const EnvironmentListItem = ({
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Tooltip title="Drag to reorder">
|
|
||||||
<IconButton>
|
|
||||||
<DragIndicator />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={hasAccess(UPDATE_ENVIRONMENT)}
|
condition={updatePermission}
|
||||||
|
show={
|
||||||
|
<Tooltip title="Drag to reorder">
|
||||||
|
<IconButton>
|
||||||
|
<DragIndicator />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={updatePermission}
|
||||||
show={
|
show={
|
||||||
<Tooltip title={`${tooltipText} environment`}>
|
<Tooltip title={`${tooltipText} environment`}>
|
||||||
<IconButton
|
<IconButton
|
||||||
@ -172,7 +180,7 @@ const EnvironmentListItem = ({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={hasAccess(UPDATE_ENVIRONMENT)}
|
condition={updatePermission}
|
||||||
show={
|
show={
|
||||||
<Tooltip title="Update environment">
|
<Tooltip title="Update environment">
|
||||||
<IconButton
|
<IconButton
|
||||||
|
Loading…
Reference in New Issue
Block a user