Skip to content

Commit

Permalink
Merge pull request #39 from bgreg1012/chart_attributes
Browse files Browse the repository at this point in the history
Add chartAttributes support
  • Loading branch information
louism517 committed Apr 21, 2020
2 parents 8eeb0ca + 8caa7d5 commit 0c6883f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Changelog for go-wavefront.

## [1.8.0]

*Add Chart Attributes*

- Added chartAttributes struct and the required nested structs for drilldown link support

## [1.7.0]

*Feature to configure http client timeout*
Expand Down
15 changes: 15 additions & 0 deletions dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ type Chart struct {

// ChartSettings are custom settings for the chart
ChartSettings ChartSetting `json:"chartSettings"`

// ChartAttributes are custom attributes for the chart
ChartAttributes ChartAttributes `json:"chartAttributes,omitempty"`
}

// Source represents a single Source for a Chart
Expand Down Expand Up @@ -237,6 +240,18 @@ type Dashboards struct {
client Wavefronter
}

type ChartAttributes struct {
DashboardLinks DashboardLinks `json:"dashboardLinks,omitempty"`
}

type DashboardLinks struct {
DashboardLink DashboardLink `json:"*,omitempty"`
}

type DashboardLink struct {
Destination string `json:"destination,omitempty"`
}

const baseDashboardPath = "/api/v2/dashboard"

// UnmarshalJSON is a custom JSON unmarshaller for an Dashboard, used in order to
Expand Down
7 changes: 7 additions & 0 deletions fixtures/paginated-dashboard-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
"xmin": 0,
"timeBasedColoring": false
},
"chartAttributes": {
"dashboardLinks": {
"*": {
"destination": "/dashboards/test-url"
}
}
},
"summarization": "MEAN"
}
]
Expand Down

0 comments on commit 0c6883f

Please sign in to comment.