Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Displays what entity is being edited in side modal #4927

Merged
merged 10 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading