templates.go 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package models
  2. import "helm.sh/helm/v3/pkg/chart"
  3. // PorterChartList is how a chart gets displayed when listed
  4. type PorterChartList struct {
  5. Name string `json:"name"`
  6. Versions []string `json:"versions"`
  7. Description string `json:"description"`
  8. Icon string `json:"icon"`
  9. }
  10. // PorterChartRead is a chart with detailed information and a form for reading
  11. type PorterChartRead struct {
  12. Markdown string `json:"markdown"`
  13. Metadata *chart.Metadata `json:"metadata"`
  14. Values map[string]interface{} `json:"values"`
  15. Form *FormYAML `json:"form"`
  16. }
  17. // FormContext is the target context
  18. type FormContext struct {
  19. Type string `yaml:"type" json:"type"`
  20. Config map[string]string `yaml:"config" json:"config"`
  21. }
  22. // FormTab is a tab rendered in a form
  23. type FormTab struct {
  24. Context *FormContext `yaml:"context" json:"context"`
  25. Name string `yaml:"name" json:"name"`
  26. Label string `yaml:"label" json:"label"`
  27. Sections []*FormSection `yaml:"sections" json:"sections,omitempty"`
  28. Settings struct {
  29. OmitFromLaunch bool `yaml:"omitFromLaunch,omitempty" json:"omitFromLaunch,omitempty"`
  30. } `yaml:"settings,omitempty" json:"settings,omitempty"`
  31. }
  32. // FormSection is a section of a form
  33. type FormSection struct {
  34. Context *FormContext `yaml:"context" json:"context"`
  35. Name string `yaml:"name" json:"name"`
  36. ShowIf interface{} `yaml:"show_if" json:"show_if"`
  37. Contents []*FormContent `yaml:"contents" json:"contents,omitempty"`
  38. }
  39. // FormContent is a form's atomic unit
  40. type FormContent struct {
  41. Context *FormContext `yaml:"context" json:"context"`
  42. Type string `yaml:"type" json:"type"`
  43. Label string `yaml:"label" json:"label"`
  44. Required bool `json:"required"`
  45. Name string `yaml:"name,omitempty" json:"name,omitempty"`
  46. Variable string `yaml:"variable,omitempty" json:"variable,omitempty"`
  47. Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
  48. Value interface{} `yaml:"value,omitempty" json:"value,omitempty"`
  49. Settings struct {
  50. Docs string `yaml:"docs,omitempty" json:"docs,omitempty"`
  51. Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
  52. Unit interface{} `yaml:"unit,omitempty" json:"unit,omitempty"`
  53. OmitUnitFromValue bool `yaml:"omitUnitFromValue,omitempty" json:"omitUnitFromValue,omitempty"`
  54. DisableAfterLaunch bool `yaml:"disableAfterLaunch,omitempty" json:"disableAfterLaunch,omitempty"`
  55. Options interface{} `yaml:"options,omitempty" json:"options,omitempty"`
  56. Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
  57. } `yaml:"settings,omitempty" json:"settings,omitempty"`
  58. }
  59. // FormYAML represents a chart's values.yaml form abstraction
  60. type FormYAML struct {
  61. Name string `yaml:"name" json:"name"`
  62. Icon string `yaml:"icon" json:"icon"`
  63. HasSource string `yaml:"hasSource" json:"hasSource"`
  64. IncludeHiddenFields string `yaml:"includeHiddenFields,omitempty" json:"includeHiddenFields,omitempty"`
  65. Description string `yaml:"description" json:"description"`
  66. Tags []string `yaml:"tags" json:"tags"`
  67. Tabs []*FormTab `yaml:"tabs" json:"tabs,omitempty"`
  68. }