templates.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package models
  2. // FormContext is the target context
  3. type FormContext struct {
  4. Type string `yaml:"type" json:"type"`
  5. Config map[string]string `yaml:"config" json:"config"`
  6. }
  7. // FormTab is a tab rendered in a form
  8. type FormTab struct {
  9. Context *FormContext `yaml:"context" json:"context"`
  10. Name string `yaml:"name" json:"name"`
  11. Label string `yaml:"label" json:"label"`
  12. Sections []*FormSection `yaml:"sections" json:"sections,omitempty"`
  13. Settings struct {
  14. OmitFromLaunch bool `yaml:"omitFromLaunch,omitempty" json:"omitFromLaunch,omitempty"`
  15. } `yaml:"settings,omitempty" json:"settings,omitempty"`
  16. }
  17. // FormSection is a section of a form
  18. type FormSection struct {
  19. Context *FormContext `yaml:"context" json:"context"`
  20. Name string `yaml:"name" json:"name"`
  21. ShowIf interface{} `yaml:"show_if" json:"show_if"`
  22. Contents []*FormContent `yaml:"contents" json:"contents,omitempty"`
  23. }
  24. // FormContent is a form's atomic unit
  25. type FormContent struct {
  26. Context *FormContext `yaml:"context" json:"context"`
  27. Type string `yaml:"type" json:"type"`
  28. Label string `yaml:"label" json:"label"`
  29. Required bool `json:"required"`
  30. Name string `yaml:"name,omitempty" json:"name,omitempty"`
  31. Variable string `yaml:"variable,omitempty" json:"variable,omitempty"`
  32. Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
  33. Value interface{} `yaml:"value,omitempty" json:"value,omitempty"`
  34. Settings struct {
  35. Docs string `yaml:"docs,omitempty" json:"docs,omitempty"`
  36. Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
  37. Unit interface{} `yaml:"unit,omitempty" json:"unit,omitempty"`
  38. OmitUnitFromValue bool `yaml:"omitUnitFromValue,omitempty" json:"omitUnitFromValue,omitempty"`
  39. DisableAfterLaunch bool `yaml:"disableAfterLaunch,omitempty" json:"disableAfterLaunch,omitempty"`
  40. Options interface{} `yaml:"options,omitempty" json:"options,omitempty"`
  41. Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
  42. } `yaml:"settings,omitempty" json:"settings,omitempty"`
  43. }
  44. // FormYAML represents a chart's values.yaml form abstraction
  45. type FormYAML struct {
  46. Name string `yaml:"name" json:"name"`
  47. Icon string `yaml:"icon" json:"icon"`
  48. HasSource string `yaml:"hasSource" json:"hasSource"`
  49. IncludeHiddenFields string `yaml:"includeHiddenFields,omitempty" json:"includeHiddenFields,omitempty"`
  50. Description string `yaml:"description" json:"description"`
  51. Tags []string `yaml:"tags" json:"tags"`
  52. Tabs []*FormTab `yaml:"tabs" json:"tabs,omitempty"`
  53. }