1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Merge pull request #459 from Unleash/fix/envs-drag-permission

Fix/envs drag permission
This commit is contained in:
Youssef Khedher 2021-10-22 12:28:38 +01:00 committed by GitHub
commit 1ed807a56f

View File

@ -110,11 +110,15 @@ const EnvironmentListItem = ({
});
const opacity = isDragging ? 0 : 1;
drag(drop(ref));
const { hasAccess } = useContext(AccessContext);
const updatePermission = hasAccess(UPDATE_ENVIRONMENT);
const tooltipText = env.enabled ? 'Disable' : 'Enable';
if (updatePermission) {
drag(drop(ref));
}
return (
<ListItem
style={{ position: 'relative', opacity }}
@ -148,14 +152,18 @@ const EnvironmentListItem = ({
</>
}
/>
<Tooltip title="Drag to reorder">
<IconButton>
<DragIndicator />
</IconButton>
</Tooltip>
<ConditionallyRender
condition={hasAccess(UPDATE_ENVIRONMENT)}
condition={updatePermission}
show={
<Tooltip title="Drag to reorder">
<IconButton>
<DragIndicator />
</IconButton>
</Tooltip>
}
/>
<ConditionallyRender
condition={updatePermission}
show={
<Tooltip title={`${tooltipText} environment`}>
<IconButton
@ -172,7 +180,7 @@ const EnvironmentListItem = ({
}
/>
<ConditionallyRender
condition={hasAccess(UPDATE_ENVIRONMENT)}
condition={updatePermission}
show={
<Tooltip title="Update environment">
<IconButton