From 9f0877dfc708e4f28fbf5fcbdc6e434cdd4043bb Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Tue, 9 Jan 2024 10:41:22 +0530 Subject: [PATCH 1/2] chore: add hidden field in component spec --- api/v1/component_types.go | 2 ++ pkg/system_api.go | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/api/v1/component_types.go b/api/v1/component_types.go index 0b626dbdc..3349c5910 100644 --- a/api/v1/component_types.go +++ b/api/v1/component_types.go @@ -24,6 +24,8 @@ type ComponentSpec struct { Id *Template `json:"id,omitempty"` //nolint Order int `json:"order,omitempty"` Labels map[string]string `json:"labels,omitempty"` + // If set to true, do not display in UI + Hidden bool `json:"hidden,omitempty"` // The type of component, e.g. service, API, website, library, database, etc. Type string `json:"type,omitempty"` // The lifecycle state of the component e.g. production, staging, dev, etc. diff --git a/pkg/system_api.go b/pkg/system_api.go index b9b113ed4..a0f330472 100644 --- a/pkg/system_api.go +++ b/pkg/system_api.go @@ -108,16 +108,18 @@ func (components Components) Walk() Components { // Component mirrors the models.Component struct except that instead of raw JSON serialized to the DB, it has the full CRD based spec. type Component struct { - Name string `json:"name,omitempty"` - ID uuid.UUID `json:"id,omitempty" gorm:"default:generate_ulid()"` //nolint - Text string `json:"text,omitempty"` - Schedule string `json:"schedule,omitempty"` - TopologyType string `json:"topology_type,omitempty"` - Namespace string `json:"namespace,omitempty"` - Labels dutyTypes.JSONStringMap `json:"labels,omitempty"` - Tooltip string `json:"tooltip,omitempty"` - Icon string `json:"icon,omitempty"` - Owner string `json:"owner,omitempty"` + Name string `json:"name,omitempty"` + ID uuid.UUID `json:"id,omitempty" gorm:"default:generate_ulid()"` //nolint + Text string `json:"text,omitempty"` + Schedule string `json:"schedule,omitempty"` + TopologyType string `json:"topology_type,omitempty"` + Namespace string `json:"namespace,omitempty"` + Labels dutyTypes.JSONStringMap `json:"labels,omitempty"` + Tooltip string `json:"tooltip,omitempty"` + Icon string `json:"icon,omitempty"` + Owner string `json:"owner,omitempty"` + // If set to true, do not display in UI + Hidden bool `json:"hidden,omitempty"` Status dutyTypes.ComponentStatus `json:"status,omitempty"` StatusReason dutyTypes.NullString `json:"status_reason,omitempty"` Path string `json:"path,omitempty"` @@ -250,6 +252,7 @@ func NewComponent(c v1.ComponentSpec) *Component { Owner: c.Owner, Type: c.Type, Order: c.Order, + Hidden: c.Hidden, Lifecycle: c.Lifecycle, Tooltip: c.Tooltip, Icon: c.Icon, From d13071338971eff08e86db12067b36ff796c2830 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Tue, 9 Jan 2024 11:40:30 +0530 Subject: [PATCH 2/2] chore: make resources --- config/deploy/crd.yaml | 6 ++++++ config/deploy/manifests.yaml | 6 ++++++ config/schemas/component.schema.json | 6 ++++++ config/schemas/topology.schema.json | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/config/deploy/crd.yaml b/config/deploy/crd.yaml index 20586be5f..4f29985e5 100644 --- a/config/deploy/crd.yaml +++ b/config/deploy/crd.yaml @@ -6860,6 +6860,9 @@ spec: forEach: description: Only applies when using lookup, when specified the components and properties specified under ForEach will be templated using the components returned by the lookup ${.properties} can be used to reference the properties of the component ${.component} can be used to reference the component itself type: object + hidden: + description: If set to true, do not display in UI + type: boolean icon: type: string id: @@ -7180,6 +7183,9 @@ spec: forEach: description: Only applies when using lookup, when specified the components and properties specified under ForEach will be templated using the components returned by the lookup ${.properties} can be used to reference the properties of the component ${.component} can be used to reference the component itself type: object + hidden: + description: If set to true, do not display in UI + type: boolean icon: type: string id: diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index fdecab482..98c7bc357 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -7128,6 +7128,9 @@ spec: forEach: description: Only applies when using lookup, when specified the components and properties specified under ForEach will be templated using the components returned by the lookup ${.properties} can be used to reference the properties of the component ${.component} can be used to reference the component itself type: object + hidden: + description: If set to true, do not display in UI + type: boolean icon: type: string id: @@ -7448,6 +7451,9 @@ spec: forEach: description: Only applies when using lookup, when specified the components and properties specified under ForEach will be templated using the components returned by the lookup ${.properties} can be used to reference the properties of the component ${.component} can be used to reference the component itself type: object + hidden: + description: If set to true, do not display in UI + type: boolean icon: type: string id: diff --git a/config/schemas/component.schema.json b/config/schemas/component.schema.json index 773328100..ba2792ee8 100644 --- a/config/schemas/component.schema.json +++ b/config/schemas/component.schema.json @@ -815,6 +815,9 @@ }, "type": "object" }, + "hidden": { + "type": "boolean" + }, "type": { "type": "string" }, @@ -898,6 +901,9 @@ }, "type": "object" }, + "hidden": { + "type": "boolean" + }, "type": { "type": "string" }, diff --git a/config/schemas/topology.schema.json b/config/schemas/topology.schema.json index a3e7d6ae0..c1653b7a2 100644 --- a/config/schemas/topology.schema.json +++ b/config/schemas/topology.schema.json @@ -794,6 +794,9 @@ }, "type": "object" }, + "hidden": { + "type": "boolean" + }, "type": { "type": "string" }, @@ -877,6 +880,9 @@ }, "type": "object" }, + "hidden": { + "type": "boolean" + }, "type": { "type": "string" },