Skip to content

Commit

Permalink
Merge pull request #43 from K-Phoen/extend-graph-support
Browse files Browse the repository at this point in the history
Bootstrap an extended support for graph vizualisation options
  • Loading branch information
K-Phoen authored Jan 18, 2021
2 parents 97c6e18 + 46c9e45 commit d5e25ab
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/K-Phoen/dark
go 1.13

require (
github.com/K-Phoen/grabana v0.12.10
github.com/K-Phoen/grabana v0.12.11
github.com/caarlos0/env v3.5.0+incompatible
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/grafana-tools/sdk v0.0.0-20201123153837-5fb28a7aa2ef
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/K-Phoen/grabana v0.12.9 h1:IRb+SxafmjEAV8oepn/Qs2mQoKmENzHoOhSQ+gaU1nQ=
github.com/K-Phoen/grabana v0.12.9/go.mod h1:jAPE2R3uNda/vMMFlDjG/S7RjmtfULhd50hh5cgVi4E=
github.com/K-Phoen/grabana v0.12.10 h1:DzB0np0ER6KgthzCqN0YWkMtNr/eyySd+m1dweaGH8Q=
github.com/K-Phoen/grabana v0.12.10/go.mod h1:jAPE2R3uNda/vMMFlDjG/S7RjmtfULhd50hh5cgVi4E=
github.com/K-Phoen/grabana v0.12.11 h1:JR381d/aNGrCKe1802n5cXAtWUw80Ldl1jpFeAuC2OQ=
github.com/K-Phoen/grabana v0.12.11/go.mod h1:jAPE2R3uNda/vMMFlDjG/S7RjmtfULhd50hh5cgVi4E=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
Expand Down
12 changes: 11 additions & 1 deletion internal/pkg/converter/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ func (converter *JSON) convertGraph(panel sdk.Panel) grabana.DashboardPanel {
Axes: &grabana.GraphAxes{
Bottom: converter.convertAxis(panel.Xaxis),
},
Legend: converter.convertLegend(panel.Legend),
Legend: converter.convertLegend(panel.Legend),
Visualization: converter.convertVisualization(panel),
}

if panel.Height != nil {
Expand All @@ -341,6 +342,15 @@ func (converter *JSON) convertGraph(panel sdk.Panel) grabana.DashboardPanel {
return grabana.DashboardPanel{Graph: graph}
}

func (converter *JSON) convertVisualization(panel sdk.Panel) *grabana.GraphVisualization {
graphViz := &grabana.GraphVisualization{
NullValue: panel.GraphPanel.NullPointMode,
Staircase: panel.GraphPanel.SteppedLine,
}

return graphViz
}

func (converter *JSON) convertLegend(sdkLegend sdk.Legend) []string {
var legend []string

Expand Down
54 changes: 45 additions & 9 deletions vendor/github.com/K-Phoen/grabana/decoder/graph.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cloud.google.com/go v0.38.0
cloud.google.com/go/compute/metadata
# github.com/K-Phoen/grabana v0.12.10
# github.com/K-Phoen/grabana v0.12.11
github.com/K-Phoen/grabana
github.com/K-Phoen/grabana/alert
github.com/K-Phoen/grabana/axis
Expand Down

0 comments on commit d5e25ab

Please sign in to comment.