mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 16:27:46 +00:00
Fix SSH table UI user groups issues
This commit is contained in:
@@ -351,8 +351,7 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
name={`loginMappings.${i}.allowedPrincipals`}
|
name={`loginMappings.${i}.allowedPrincipals`}
|
||||||
render={({ field: { value = [], onChange }, fieldState: { error } }) => (
|
render={({ field: { value = [], onChange }, fieldState: { error } }) => (
|
||||||
<div className="flex flex-col space-y-2">
|
<div className="flex flex-col space-y-2">
|
||||||
{(value.length === 0 ? [{ type: "user", value: "" }] : value).map(
|
{value.map((principal, principalIndex) => (
|
||||||
(principal, principalIndex) => (
|
|
||||||
<div
|
<div
|
||||||
key={`principal-${i + 1}-${principalIndex + 1}-${principal.type}`}
|
key={`principal-${i + 1}-${principalIndex + 1}-${principal.type}`}
|
||||||
className="flex items-center space-x-2"
|
className="flex items-center space-x-2"
|
||||||
@@ -431,8 +430,7 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
))}
|
||||||
)}
|
|
||||||
{error && <span className="text-sm text-red-500">{error.message}</span>}
|
{error && <span className="text-sm text-red-500">{error.message}</span>}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
const filteredGroups = allowedPrincipals.groups?.filter(
|
const filteredGroups = allowedPrincipals.groups?.filter(
|
||||||
(g) => !existing.groups?.has(g)
|
(g) => !existing.groups?.has(g)
|
||||||
);
|
);
|
||||||
return (filteredGroups?.length ?? 0) > 0
|
return ((filteredGroups?.length || filteredUsernames?.length) ?? 0) >
|
||||||
|
0
|
||||||
? {
|
? {
|
||||||
loginUser,
|
loginUser,
|
||||||
source: LoginMappingSource.HOST_GROUP,
|
source: LoginMappingSource.HOST_GROUP,
|
||||||
|
|||||||
Reference in New Issue
Block a user