diff --git a/pkg/defaults/defaults_test.go b/pkg/defaults/defaults_test.go index 444aa57..7a7c07e 100644 --- a/pkg/defaults/defaults_test.go +++ b/pkg/defaults/defaults_test.go @@ -205,11 +205,12 @@ func Test_InitIntegration_DeprecatedResourcesConfiguration(t *testing.T) { Entity: port.EntityMappings{ Mappings: []port.EntityMapping{ { - Identifier: "workload", - Title: "Workload", - Blueprint: "workload", + Identifier: "\"workload\"", + Title: "\"Workload\"", + Blueprint: "\"workload\"", + Icon: "\"Microservice\"", Properties: map[string]string{ - "namespace": "default", + "namespace": "\"default\"", }, }, }, diff --git a/pkg/k8s/controller_test.go b/pkg/k8s/controller_test.go index 78c8e37..7ab154c 100644 --- a/pkg/k8s/controller_test.go +++ b/pkg/k8s/controller_test.go @@ -164,6 +164,7 @@ func TestCreateDeployment(t *testing.T) { { Identifier: ".metadata.name", Blueprint: "\"k8s-export-test-bp\"", + Icon: "\"Microservice\"", Team: "\"Test\"", Properties: map[string]string{ "text": "\"pod\"", @@ -190,6 +191,7 @@ func TestUpdateDeployment(t *testing.T) { { Identifier: ".metadata.name", Blueprint: "\"k8s-export-test-bp\"", + Icon: "\"Microservice\"", Team: "[\"Test\", \"Test2\"]", Properties: map[string]string{ "text": "\"pod\"", diff --git a/pkg/port/mapping/entity.go b/pkg/port/mapping/entity.go index fa8180b..e0e951c 100644 --- a/pkg/port/mapping/entity.go +++ b/pkg/port/mapping/entity.go @@ -28,6 +28,12 @@ func NewEntity(obj interface{}, mapping port.EntityMapping) (*port.Entity, error return &port.Entity{}, err } } + if mapping.Icon != "" { + entity.Icon, err = jq.ParseString(mapping.Icon, obj) + if err != nil { + return &port.Entity{}, err + } + } entity.Properties, err = jq.ParseMapInterface(mapping.Properties, obj) if err != nil { return &port.Entity{}, err diff --git a/pkg/port/models.go b/pkg/port/models.go index b5e472c..f631be6 100644 --- a/pkg/port/models.go +++ b/pkg/port/models.go @@ -22,6 +22,7 @@ type ( Identifier string `json:"identifier,omitempty"` Title string `json:"title"` Blueprint string `json:"blueprint"` + Icon string `json:"icon,omitempty"` Team interface{} `json:"team,omitempty"` Properties map[string]interface{} `json:"properties"` Relations map[string]interface{} `json:"relations"` @@ -181,6 +182,7 @@ type EntityMapping struct { Identifier string `json:"identifier"` Title string `json:"title"` Blueprint string `json:"blueprint"` + Icon string `json:"icon,omitempty"` Team string `json:"team,omitempty"` Properties map[string]string `json:"properties,omitempty"` Relations map[string]string `json:"relations,omitempty"`