Skip to content

Commit

Permalink
feat: Displays what entity is being edited in side modal (#4927)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Fonseca <[email protected]>
  • Loading branch information
tiagoapolo authored Dec 18, 2024
1 parent cafb663 commit c1e0aea
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
28 changes: 14 additions & 14 deletions frontend/web/components/EditPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,19 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(
})
}

const getEditText = () => {
if (isGroup) {
return `the ${group?.name || ''} group`
}
if (user) {
return `${user.first_name || ''} ${user.last_name || ''}`
}
if (role) {
return role.name
}
return name
}

const rolesAdded = getRoles(roles, rolesSelected || [])
const isAdmin = admin()

Expand Down Expand Up @@ -917,20 +930,7 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(

<p className='text-right mt-5 text-dark'>
This will edit the permissions for{' '}
<strong>
{isGroup ? (
`the ${group?.name || ''} group`
) : user ? (
<>
{user.first_name || ''} {user.last_name || ''}
</>
) : role ? (
` ${role.name}`
) : (
` ${name}`
)}
</strong>
.
<strong>{getEditText()}</strong>.
</p>

{!!parentWarning && (
Expand Down
4 changes: 4 additions & 0 deletions frontend/web/components/PermissionsTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ const PermissionsTabs: FC<PermissionsTabsType> = ({
/>
)}
</div>
<p className='text-right mt-5 text-dark'>
This will edit the permissions for{' '}
<strong>the {group?.name} group</strong>.
</p>
</TabItem>
</Tabs>
</PlanBasedAccess>
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/RolePermissionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useGetRoleProjectPermissionsQuery,
} from 'common/services/useRolePermission'
import { PermissionLevel } from 'common/types/requests'
import { Role, User, UserGroup, UserGroupSummary } from 'common/types/responses'
import { Role, User, UserGroupSummary } from 'common/types/responses'
import PanelSearch from './PanelSearch'
import PermissionsSummaryList from './PermissionsSummaryList'

Expand Down
3 changes: 3 additions & 0 deletions frontend/web/components/modals/CreateRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ const CreateRole: FC<CreateRoleType> = ({
))}
</div>
</div>
<p className='text-right mt-5 text-dark'>
This will edit the members for <strong>{role?.name}</strong>.
</p>
</div>
</TabItem>
<TabItem
Expand Down

0 comments on commit c1e0aea

Please sign in to comment.