mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-05 21:47:48 +01:00
Feature: fields highlighting (#5868)
This commit is contained in:
@@ -118,6 +118,47 @@ Each widget can optionally provide a list of which fields should be visible via
|
||||
key: apikeyapikeyapikeyapikeyapikey
|
||||
```
|
||||
|
||||
### Block Highlighting
|
||||
|
||||
Widgets can tint their metric block text automatically based on rules defined alongside the service. Attach a `highlight` section to the widget configuration and map each block to one or more numeric or string rules using the field key (for example, `queued`, `lan_users`).
|
||||
|
||||
```yaml
|
||||
- Sonarr:
|
||||
icon: sonarr.png
|
||||
href: http://sonarr.host.or.ip
|
||||
widget:
|
||||
type: sonarr
|
||||
url: http://sonarr.host.or.ip
|
||||
key: ${SONARR_API_KEY}
|
||||
highlight:
|
||||
queued:
|
||||
numeric:
|
||||
- level: danger
|
||||
when: gte
|
||||
value: 20
|
||||
- level: warn
|
||||
when: gte
|
||||
value: 5
|
||||
- level: good
|
||||
when: eq
|
||||
value: 0
|
||||
status:
|
||||
string:
|
||||
- level: danger
|
||||
when: regex
|
||||
value: "(failed|import) pending"
|
||||
- level: good
|
||||
when: equals
|
||||
value: "All good"
|
||||
status_code:
|
||||
string:
|
||||
- level: warn
|
||||
when: regex
|
||||
value: "^5\\d{2}$"
|
||||
```
|
||||
|
||||
Supported numeric operators for the `when` property are `gt`, `gte`, `lt`, `lte`, `eq`, `ne`, `between`, and `outside`. String rules support `equals`, `includes`, `startsWith`, `endsWith`, and `regex`. Each rule can be inverted with `negate: true`, and string rules may pass `caseSensitive: true` or custom regex `flags`. The highlight engine does its best to coerce formatted values, but you will get the most reliable results when you pass plain numbers or strings into `<Block>`.
|
||||
|
||||
## Descriptions
|
||||
|
||||
Services may have descriptions,
|
||||
|
||||
@@ -109,6 +109,20 @@ color: slate
|
||||
|
||||
Supported colors are: `slate`, `gray`, `zinc`, `neutral`, `stone`, `amber`, `yellow`, `lime`, `green`, `emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`, `violet`, `purple`, `fuchsia`, `pink`, `rose`, `red`, `white`
|
||||
|
||||
## Block Highlight Levels
|
||||
|
||||
You can override the default Tailwind classes applied when a widget highlight rule resolves to the `good`, `warn`, or `danger` level.
|
||||
|
||||
```yaml
|
||||
blockHighlights:
|
||||
levels:
|
||||
good: "bg-emerald-500/40 text-emerald-950 dark:bg-emerald-900/60 dark:text-emerald-400"
|
||||
warn: "bg-amber-300/30 text-amber-900 dark:bg-amber-900/30 dark:text-amber-200"
|
||||
danger: "bg-rose-700/45 text-rose-200 dark:bg-rose-950/70 dark:text-rose-400"
|
||||
```
|
||||
|
||||
Any unspecified level falls back to the built-in defaults.
|
||||
|
||||
## Layout
|
||||
|
||||
You can configure service and bookmarks sections to be either "column" or "row" based layouts, like so:
|
||||
|
||||
Reference in New Issue
Block a user