Skip to content

Commit

Permalink
Always omit slug/UID in yaml if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Feb 19, 2023
1 parent dd251ec commit d709c33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions decoder/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var ErrInvalidTimezone = fmt.Errorf("invalid timezone")

type DashboardModel struct {
Title string
Slug string
UID string `yaml:",omitempty"`
Slug string `yaml:",omitempty"`
UID string `yaml:"uid,omitempty"`
Editable bool
SharedCrosshair bool `yaml:"shared_crosshair"`
Tags []string
Expand All @@ -40,11 +40,11 @@ func (d *DashboardModel) ToBuilder() (dashboard.Builder, error) {
opts = append(opts, dashboard.Tags(d.Tags))
}

if len(d.Slug) != 0 {
if d.Slug != "" {
opts = append(opts, dashboard.Slug(d.Slug))
}

if len(d.UID) != 0 {
if d.UID != "" {
opts = append(opts, dashboard.UID(d.UID))
}

Expand Down

0 comments on commit d709c33

Please sign in to comment.