MCPcopy
hub / github.com/redpanda-data/console / PatchDefinition

Method PatchDefinition

backend/pkg/connector/patch/all.go:88–114  ·  view source on GitHub ↗

PatchDefinition implements the ConfigPatch.PatchDefinition interface.

(d model.ConfigDefinition, _ string)

Source from the content-addressed store, hash-verified

86
87// PatchDefinition implements the ConfigPatch.PatchDefinition interface.
88func (c *ConfigPatchAll) PatchDefinition(d model.ConfigDefinition, _ string) model.ConfigDefinition {
89 if d.Definition.DisplayName == "" || d.Definition.DisplayName == d.Definition.Name {
90 computedDisplayName := c.configNameToDisplayName(d.Definition.Name)
91 d.SetDisplayName(computedDisplayName)
92 }
93
94 if d.Definition.Name == "errors.tolerance" {
95 d.SetDisplayName("Error tolerance").
96 SetComponentType(model.ComponentRadioGroup).
97 AddRecommendedValueWithMetadata("none", "NONE").
98 AddRecommendedValueWithMetadata("all", "ALL")
99 }
100
101 d.SetDocumentation(strings.TrimRight(d.Definition.Documentation, "."))
102
103 for i := range d.Value.Errors {
104 d.Value.Errors[i] = strings.TrimRight(d.Value.Errors[i], ".")
105 }
106
107 d.SetDocumentation(strings.TrimRight(d.Definition.Documentation, "."))
108
109 for i := range d.Value.Errors {
110 d.Value.Errors[i] = strings.TrimRight(d.Value.Errors[i], ".")
111 }
112
113 return d
114}
115
116// ConfigNameToDisplayName computes a display name by title casing the input key
117// and replacing known abbreviations with the correctly formatted abbreviation.

Callers 1

TestPatchConfigAllFunction · 0.95

Calls 5

SetDisplayNameMethod · 0.80
SetComponentTypeMethod · 0.80
SetDocumentationMethod · 0.80

Tested by 1

TestPatchConfigAllFunction · 0.76