-
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.
- Loading branch information
1 parent
6acf70d
commit d6c8089
Showing
2 changed files
with
44 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useMemo } from "react"; | ||
import { Icon } from "../Icon"; | ||
|
||
export const configSpecTypesIconMap = new Map<string, string>([ | ||
["kubernetes", "kubernetes"], | ||
["azure", "azure"], | ||
["kubernetesFile", "kubernetes"], | ||
["sql", "sql"], | ||
["trivy", "trivy"], | ||
["aws", "aws"], | ||
["file", "folder"], | ||
["githubActions", "git"], | ||
["http", "http"], | ||
["azureDevops", "azure-devops"], | ||
["custom", "cog"] | ||
]); | ||
|
||
type Props = { | ||
spec: Record<string, any>; | ||
}; | ||
|
||
export default function ConfigScrapperIcon({ spec }: Props) { | ||
const icon = useMemo(() => { | ||
const keys = Object.keys(spec); | ||
const specKeys = keys.find((key) => typeof spec[key] === "object"); | ||
return configSpecTypesIconMap.get(specKeys ?? ""); | ||
}, [spec]); | ||
|
||
if (!icon) { | ||
return null; | ||
} | ||
|
||
return <Icon name={icon} className="w-5 h-5" />; | ||
} |
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