-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add permissions view for connections
fixes #2246 fix: fix incorrect reference to permissions instead of connection
- Loading branch information
1 parent
1e66998
commit fb38f21
Showing
6 changed files
with
104 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Icon } from "@flanksource-ui/ui/Icons/Icon"; | ||
import { useMemo } from "react"; | ||
import { Connection } from "./ConnectionFormModal"; | ||
import { connectionTypes } from "./connectionTypes"; | ||
|
||
type ConnectionIconProps = { | ||
connection: Pick<Connection, "type" | "name" | "id">; | ||
showLabel?: boolean; | ||
}; | ||
export default function ConnectionIcon({ | ||
connection, | ||
showLabel = false | ||
}: ConnectionIconProps) { | ||
const icon = useMemo(() => { | ||
return connectionTypes.find((item) => item.value === connection.type)?.icon; | ||
}, [connection.type]); | ||
|
||
return ( | ||
<div className="flex flex-row items-center gap-1"> | ||
{typeof icon === "string" ? ( | ||
<Icon name={icon} className="h-5" /> | ||
) : ( | ||
// if not a string, it's a react component | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
icon && <>{icon}</> | ||
)} | ||
{showLabel && <span>{connection.name}</span>} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters