-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add enums, consts, and icon functions
- Loading branch information
1 parent
2a6b6a5
commit a9be77c
Showing
8 changed files
with
231 additions
and
3 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,23 @@ | ||
import { ACTION_TYPE, type SVG } from '../../@types' | ||
import { AddClusterInfoIcon, DeleteAttributeIcon, PiiMaskingIcon, RenameAttributeIcon, SamplerIcon } from '../../icons' | ||
|
||
export const getActionIcon = (type: ACTION_TYPE | 'sampler' | 'attributes') => { | ||
const typeLowerCased = type?.toLowerCase() | ||
const isSamplerCategory = typeLowerCased?.includes('sampler') | ||
const isAttributesCategory = typeLowerCased === 'attributes' | ||
|
||
if (isSamplerCategory) return SamplerIcon | ||
if (isAttributesCategory) return PiiMaskingIcon | ||
|
||
const LOGOS: Record<ACTION_TYPE, SVG> = { | ||
[ACTION_TYPE.ADD_CLUSTER_INFO]: AddClusterInfoIcon, | ||
[ACTION_TYPE.DELETE_ATTRIBUTES]: DeleteAttributeIcon, | ||
[ACTION_TYPE.PII_MASKING]: PiiMaskingIcon, | ||
[ACTION_TYPE.RENAME_ATTRIBUTES]: RenameAttributeIcon, | ||
[ACTION_TYPE.ERROR_SAMPLER]: SamplerIcon, | ||
[ACTION_TYPE.PROBABILISTIC_SAMPLER]: SamplerIcon, | ||
[ACTION_TYPE.LATENCY_SAMPLER]: SamplerIcon, | ||
} | ||
|
||
return LOGOS[type as ACTION_TYPE] | ||
} |
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,13 @@ | ||
import { ENTITY_TYPES, type SVG } from '../../@types' | ||
import { ActionsIcon, DestinationsIcon, RulesIcon, SourcesIcon } from '../../icons' | ||
|
||
export const getEntityIcon = (type: ENTITY_TYPES) => { | ||
const LOGOS: Record<ENTITY_TYPES, SVG> = { | ||
[ENTITY_TYPES.SOURCE]: SourcesIcon, | ||
[ENTITY_TYPES.DESTINATION]: DestinationsIcon, | ||
[ENTITY_TYPES.ACTION]: ActionsIcon, | ||
[ENTITY_TYPES.INSTRUMENTATION_RULE]: RulesIcon, | ||
} | ||
|
||
return LOGOS[type] | ||
} |
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,12 @@ | ||
import { INSTRUMENTATION_RULE_TYPE, type SVG } from '../../@types' | ||
import { CodeAttributesIcon, OdigosLogo, PayloadCollectionIcon } from '../../icons' | ||
|
||
export const getInstrumentationRuleIcon = (type: INSTRUMENTATION_RULE_TYPE) => { | ||
const LOGOS: Record<INSTRUMENTATION_RULE_TYPE, SVG> = { | ||
[INSTRUMENTATION_RULE_TYPE.PAYLOAD_COLLECTION]: PayloadCollectionIcon, | ||
[INSTRUMENTATION_RULE_TYPE.CODE_ATTRIBUTES]: CodeAttributesIcon, | ||
[INSTRUMENTATION_RULE_TYPE.UNKNOWN_TYPE]: OdigosLogo, | ||
} | ||
|
||
return LOGOS[type] | ||
} |
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,22 @@ | ||
import { PROGRAMMING_LANGUAGES } from '../../@types' | ||
|
||
export const getProgrammingLanguageIcon = (language: PROGRAMMING_LANGUAGES) => { | ||
const BASE_URL = 'https://d1n7d4xz7fr8b4.cloudfront.net/' | ||
|
||
const LOGOS: Record<PROGRAMMING_LANGUAGES, string> = { | ||
[PROGRAMMING_LANGUAGES.JAVA]: `${BASE_URL}java.svg`, | ||
[PROGRAMMING_LANGUAGES.GO]: `${BASE_URL}go.svg`, | ||
[PROGRAMMING_LANGUAGES.JAVASCRIPT]: `${BASE_URL}nodejs.svg`, | ||
[PROGRAMMING_LANGUAGES.PYTHON]: `${BASE_URL}python.svg`, | ||
[PROGRAMMING_LANGUAGES.DOTNET]: `${BASE_URL}dotnet.svg`, | ||
[PROGRAMMING_LANGUAGES.MYSQL]: `${BASE_URL}mysql.svg`, | ||
[PROGRAMMING_LANGUAGES.NGINX]: `${BASE_URL}nginx.svg`, | ||
[PROGRAMMING_LANGUAGES.IGNORED]: '', // TODO: good icon | ||
[PROGRAMMING_LANGUAGES.UNKNOWN]: '', // TODO: good icon | ||
[PROGRAMMING_LANGUAGES.PROCESSING]: '', // TODO: good icon | ||
[PROGRAMMING_LANGUAGES.NO_CONTAINERS]: '', // TODO: good icon | ||
[PROGRAMMING_LANGUAGES.NO_RUNNING_PODS]: '', // TODO: good icon | ||
} | ||
|
||
return LOGOS[language] | ||
} |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
export * from './get-action-icon' | ||
export * from './get-entity-icon' | ||
export * from './get-instrumentation-rule-icon' | ||
export * from './get-monitor-icon' | ||
export * from './get-programming-language-icon' | ||
export * from './get-status-icon' | ||
export * from './is-emtpy' |