diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index c902f91c..98f2b796 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -485,6 +485,8 @@
"time": "Time"
},
"grafana": {
+ "dashboards": "Dashboards",
+ "datasources": "Data Sources",
"totalalerts": "Total Alerts",
"alertstriggered": "Alerts Triggered"
}
diff --git a/src/widgets/grafana/component.jsx b/src/widgets/grafana/component.jsx
index 2d6520dd..98d4c42b 100755
--- a/src/widgets/grafana/component.jsx
+++ b/src/widgets/grafana/component.jsx
@@ -8,15 +8,18 @@ export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
+ const { data: statsData, error: statsError } = useWidgetAPI(widget, "stats");
const { data: alertsData, error: alertsError } = useWidgetAPI(widget, "alerts");
- if (alertsError) {
- return ;
+ if (statsError || alertsError) {
+ return ;
}
- if (!alertsData) {
+ if (!statsData || !alertsData) {
return (
+
+
@@ -25,7 +28,9 @@ export default function Component({ service }) {
return (
-
+
+
+
a.state === "alerting").length })} />
);
diff --git a/src/widgets/grafana/widget.js b/src/widgets/grafana/widget.js
index 6ab53db0..64051925 100755
--- a/src/widgets/grafana/widget.js
+++ b/src/widgets/grafana/widget.js
@@ -8,6 +8,12 @@ const widget = {
alerts: {
endpoint: "alerts",
},
+ stats: {
+ endpoint: "admin/stats",
+ validate: [
+ "dashboards"
+ ]
+ },
},
};