QueryLibrary: Adding Tags as new set field to queries (#105702)

This commit is contained in:
Collin Fingar
2025-05-29 08:47:30 -04:00
committed by GitHub
parent 301d78bf96
commit c23ee1e116
3 changed files with 29 additions and 0 deletions
@@ -17,6 +17,10 @@ type QueryTemplate struct {
// Toggle for visible/hidden queries
IsVisible bool `json:"isVisible,omitempty"`
// The tags that can be used to filter the template
// +listType=set
Tags []string `json:"tags,omitempty"`
// Whether the query is locked and cannot be edited
// Note: This is purely for UI display purposes and not for security
IsLocked bool `json:"isLocked,omitempty"`
@@ -26,6 +26,11 @@ func (in *Position) DeepCopy() *Position {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *QueryTemplate) DeepCopyInto(out *QueryTemplate) {
*out = *in
if in.Tags != nil {
in, out := &in.Tags, &out.Tags
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Variables != nil {
in, out := &in.Variables, &out.Variables
*out = make([]TemplateVariable, len(*in))
@@ -409,6 +409,26 @@ func schema_apis_query_v0alpha1_template_QueryTemplate(ref common.ReferenceCallb
Format: "",
},
},
"tags": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "set",
},
},
SchemaProps: spec.SchemaProps{
Description: "The tags that can be used to filter the template",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"isLocked": {
SchemaProps: spec.SchemaProps{
Description: "Whether the query is locked and cannot be edited Note: This is purely for UI display purposes and not for security",