From 571f627b3bc47af26c93ccba8a73e0bbe991ff47 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 4 Oct 2023 22:12:57 -0700
Subject: [PATCH] Enhancement: statusStyle improvements (#2119)
---
docs/configs/services.md | 9 +--
docs/configs/settings.md | 24 ++++++++
public/locales/en/common.json | 4 +-
src/components/services/item.jsx | 9 +--
src/components/services/kubernetes-status.jsx | 47 ++++++++-------
src/components/services/ping.jsx | 25 ++++----
src/components/services/status.jsx | 59 ++++++++-----------
src/utils/config/service-helpers.js | 3 +
8 files changed, 100 insertions(+), 80 deletions(-)
diff --git a/docs/configs/services.md b/docs/configs/services.md
index 834b98ce..9f47cbbf 100644
--- a/docs/configs/services.md
+++ b/docs/configs/services.md
@@ -123,14 +123,7 @@ Services may have an optional `ping` property that allows you to monitor the ava
-You can also apply different styles to the ping indicator by using the `statusStyle` property. The default is no value, and displays the response time in ms, but you can also use `dot` or `basic`. `dot` shows a green dot for a successful ping, and `basic` shows either ONLINE or OFFLINE to match the status style of Docker containers. For example:
-
-```yaml
- - Sonarr:
- ...
- ping: http://sonarr.host/
- statusStyle: dot
-```
+You can also apply different styles to the ping indicator by using the `statusStyle` property, see [settings](settings.md#status-style).
## Docker Integration
diff --git a/docs/configs/settings.md b/docs/configs/settings.md
index e9f9c7f6..06b6b40a 100644
--- a/docs/configs/settings.md
+++ b/docs/configs/settings.md
@@ -380,6 +380,30 @@ or per-service (`services.yaml`) with:
If you have both set the per-service settings take precedence.
+## Status Style
+
+You can choose from the following styles for docker or k8s status and ping: `dot` or `basic`
+
+- The default is no value, and displays the ping response time in ms and the docker / k8s container status
+- `dot` shows a green dot for a successful ping or healthy status.
+- `basic` shows either UP or DOWN for ping
+
+For example:
+
+```yaml
+statusStyle: 'dot'
+```
+
+or per-service (`services.yaml`) with:
+
+```yaml
+- Example Service:
+ ...
+ statusStyle: 'dot'
+```
+
+If you have both set, the per-service settings take precedence.
+
## Hide Widget Error Messages
Hide the visible API error messages either globally in `settings.yaml`:
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 813c8e2a..a4a7a32f 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -80,7 +80,9 @@
},
"ping": {
"error": "Error",
- "ping": "Ping"
+ "ping": "Ping",
+ "down": "Down",
+ "up": "Up"
},
"emby": {
"playing": "Playing",
diff --git a/src/components/services/item.jsx b/src/components/services/item.jsx
index 056d5cfc..d3dfedcb 100644
--- a/src/components/services/item.jsx
+++ b/src/components/services/item.jsx
@@ -15,6 +15,7 @@ export default function Item({ service, group }) {
const hasLink = service.href && service.href !== "#";
const { settings } = useContext(SettingsContext);
const showStats = (service.showStats === false) ? false : settings.showStats;
+ const statusStyle = (service.statusStyle !== undefined) ? service.statusStyle : settings.statusStyle;
const [statsOpen, setStatsOpen] = useState(service.showStats);
const [statsClosing, setStatsClosing] = useState(false);
@@ -76,10 +77,10 @@ export default function Item({ service, group }) {
)}
-