@@ -3,11 +3,13 @@ import { makeStyles } from "@material-ui/core/styles"
3
3
import React from "react"
4
4
import { WorkspaceResource } from "../../api/typesGenerated"
5
5
6
+ const FALLBACK_ICON = "/icon/widgets.svg"
7
+
6
8
// NOTE @jsjoeio , @BrunoQuaresma
7
9
// These resources (i.e. docker_image, kubernetes_deployment) map to Terraform
8
10
// resource types. These are the most used ones and are based on user usage.
9
11
// We may want to update from time-to-time.
10
- const DEFAULT_ICON_PATHS : {
12
+ const BUILT_IN_ICON_PATHS : {
11
13
[ resourceType : WorkspaceResource [ "type" ] ] : string
12
14
} = {
13
15
docker_volume : "/icon/folder.svg" ,
@@ -19,15 +21,15 @@ const DEFAULT_ICON_PATHS: {
19
21
google_compute_instance : "/icon/memory.svg" ,
20
22
aws_instance : "/icon/memory.svg" ,
21
23
kubernetes_deployment : "/icon/memory.svg" ,
22
- null_resource : "/icon/widgets.svg" ,
24
+ null_resource : FALLBACK_ICON ,
23
25
}
24
26
25
27
const getIconPathResource = ( resourceType : string ) : string => {
26
- if ( resourceType in DEFAULT_ICON_PATHS ) {
27
- return DEFAULT_ICON_PATHS [ resourceType ]
28
+ if ( resourceType in BUILT_IN_ICON_PATHS ) {
29
+ return BUILT_IN_ICON_PATHS [ resourceType ]
28
30
}
29
31
30
- return DEFAULT_ICON_PATHS [ resourceType ]
32
+ return FALLBACK_ICON
31
33
}
32
34
33
35
export type ResourceAvatarProps = { resource : WorkspaceResource }
0 commit comments