Skip to content

Commit

Permalink
feat(dashboards): add yAxisRight, isLabelVisible and alter the functi…
Browse files Browse the repository at this point in the history
…oning of thresholds (#1144)
  • Loading branch information
pranav-new-relic authored May 23, 2024
1 parent 818be66 commit 1c48ee1
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 9 deletions.
33 changes: 24 additions & 9 deletions pkg/dashboards/dashboards_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dashboards

import "time"
import (
"time"
)

// Dashboard represents information about a New Relic dashboard.
type Dashboard struct {
Expand Down Expand Up @@ -305,14 +307,14 @@ type RawConfiguration struct {
// Used by viz.markdown
Text string `json:"text,omitempty"`

// Used by viz.billboard
Thresholds []DashboardBillboardWidgetThresholdInput `json:"thresholds,omitempty"`
Legend *DashboardWidgetLegend `json:"legend,omitempty"`
YAxisLeft *DashboardWidgetYAxisLeft `json:"yAxisLeft,omitempty"`
NullValues *DashboardWidgetNullValues `json:"nullValues,omitempty"`
Units *DashboardWidgetUnits `json:"units,omitempty"`
Colors *DashboardWidgetColors `json:"colors,omitempty"`
Facet *DashboardWidgetFacet `json:"facet,omitempty"`
Thresholds interface{} `json:"thresholds,omitempty"`
Legend *DashboardWidgetLegend `json:"legend,omitempty"`
YAxisLeft *DashboardWidgetYAxisLeft `json:"yAxisLeft,omitempty"`
YAxisRight *DashboardWidgetYAxisRight `json:"yAxisRight,omitempty"`
NullValues *DashboardWidgetNullValues `json:"nullValues,omitempty"`
Units *DashboardWidgetUnits `json:"units,omitempty"`
Colors *DashboardWidgetColors `json:"colors,omitempty"`
Facet *DashboardWidgetFacet `json:"facet,omitempty"`
}

// RawConfigurationPlatformOptions represents the platform widget options
Expand All @@ -330,6 +332,19 @@ type DashboardWidgetYAxisLeft struct {
Zero *bool `json:"zero,omitempty"`
}

type DashboardWidgetYAxisRight struct {
Max float64 `json:"max,omitempty"`
Min *float64 `json:"min,omitempty"`
Zero *bool `json:"zero,omitempty"`
Series []DashboardWidgetYAxisRightSeries `json:"series,omitempty"`
}

type DashboardWidgetYAxisRightSeries struct {
Name DashboardWidgetYAxisRightSeriesName `json:"name,omitempty"`
}

type DashboardWidgetYAxisRightSeriesName string

type DashboardWidgetNullValues struct {
NullValue string `json:"nullValue,omitempty"`
SeriesOverrides []DashboardWidgetNullValueOverrides `json:"seriesOverrides,omitempty"`
Expand Down
35 changes: 35 additions & 0 deletions pkg/dashboards/type_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,38 @@ type DashboardBillboardWidgetThresholdInput struct {
// value.
Value *float64 `json:"value,omitempty"`
}

type DashboardLineWidgetThresholdInput struct {
IsLabelVisible *bool `json:"isLabelVisible,omitempty"`
Thresholds []DashboardLineWidgetThresholdThresholdInput `json:"thresholds,omitempty"`
}

type DashboardLineWidgetThresholdThresholdInput struct {
From *int `json:"from,omitempty"`
To *int `json:"to,omitempty"`
Name string `json:"name,omitempty"`
Severity DashboardLineTableWidgetsAlertSeverity `json:"severity,omitempty"`
}

type DashboardTableWidgetThresholdInput struct {
From *int `json:"from,omitempty"`
To *int `json:"to,omitempty"`
ColumnName string `json:"columnName,omitempty"`
Severity DashboardLineTableWidgetsAlertSeverity `json:"severity,omitempty"`
}

type DashboardLineTableWidgetsAlertSeverity string

var DashboardLineTableWidgetsAlertSeverityTypes = struct {
SUCCESS DashboardLineTableWidgetsAlertSeverity
WARNING DashboardLineTableWidgetsAlertSeverity
UNAVAILABLE DashboardLineTableWidgetsAlertSeverity
SEVERE DashboardLineTableWidgetsAlertSeverity
CRITICAL DashboardLineTableWidgetsAlertSeverity
}{
SUCCESS: "success",
WARNING: "warning",
UNAVAILABLE: "unavailable",
SEVERE: "severe",
CRITICAL: "critical",
}

0 comments on commit 1c48ee1

Please sign in to comment.