Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHORE - Enhance panel types #46

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions grafana_dashboards/schema/panel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from grafana_dashboards.schema.panel.stat import Stat
from grafana_dashboards.schema.panel.text import Text
from grafana_dashboards.schema.panel.table import Table
from grafana_dashboards.schema.panel.gauge import Gauge
from grafana_dashboards.schema.panel.bargauge import Bargauge
from grafana_dashboards.schema.panel.timeseries import Timeseries
from grafana_dashboards.schema.panel.piechart import PieChart
Expand Down Expand Up @@ -50,6 +51,8 @@ def validate_individually(self, panel: dict):
schema = Text(usingNewSchema=self.usingNewSchema).get_schema()
elif panel["type"] == "table":
schema = Table(usingNewSchema=self.usingNewSchema).get_schema()
elif panel["type"] == "gauge":
schema = Gauge(usingNewSchema=self.usingNewSchema).get_schema()
elif panel["type"] == "bargauge":
schema = Bargauge(usingNewSchema=self.usingNewSchema).get_schema()
elif panel["type"] == "timeseries":
Expand Down
1 change: 1 addition & 0 deletions grafana_dashboards/schema/panel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def __init__(self, usingNewSchema=False):
"text",
"stat",
"table",
"gauge",
"bargauge",
"timeseries",
"piechart",
Expand Down
1 change: 1 addition & 0 deletions grafana_dashboards/schema/panel/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def get_schema(self):
v.Required("colorMode"): v.Any(str),
v.Required("graphMode"): v.Any(str),
v.Required("justifyMode"): v.Any(str),
v.Optional("showPercentChange", default=False): v.Any(bool),
v.Optional("reduceOptions"): v.All(reduceOptions),
}

Expand Down
1 change: 1 addition & 0 deletions tests/schema/panels/test_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_defaults(self):
"values": False,
},
"textMode": "auto",
"showPercentChange": False,
},
"span": 12,
"targets": [],
Expand Down
Loading