Compare commits

..

1 Commits

Author SHA1 Message Date
Crowdin Bot
9ec2b1a669 New Crowdin translations by GitHub Action 2025-12-04 12:15:42 +00:00
4 changed files with 5 additions and 24 deletions

View File

@@ -159,19 +159,6 @@ Widgets can tint their metric block text automatically based on rules defined al
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>`.
#### Value Only Highlighting
You can optionally apply highlighting only to the value portion of a block (not the label) by setting `valueOnly: true` on the field configuration. This keeps the label visible while highlighting only the metric value itself.
```yaml
- Sonarr:
...
highlight:
queued:
valueOnly: true
...
```
## Descriptions
Services may have descriptions,

View File

@@ -32,8 +32,6 @@ export default function Block({ value, label, field }) {
return getHighlightClass(highlight.level, highlightConfig);
}, [highlight, highlightConfig]);
const applyToValueOnly = highlight?.valueOnly === true;
return (
<div
className={classNames(
@@ -46,11 +44,7 @@ export default function Block({ value, label, field }) {
data-highlight-source={highlight?.source}
>
<div className="font-thin text-sm">{value === undefined || value === null ? "-" : value}</div>
<div
className={classNames("font-bold text-xs uppercase", applyToValueOnly && "text-theme-700 dark:text-theme-200")}
>
{t(label)}
</div>
<div className="font-bold text-xs uppercase">{t(label)}</div>
</div>
);
}

View File

@@ -111,7 +111,7 @@ export async function servicesFromDocker() {
};
}
let substitutedVal = substituteEnvironmentVars(containerLabels[label]);
if (value === "widget.version" || /^widgets\[\d+\]\.version$/.test(value)) {
if (value === "widget.version") {
substitutedVal = parseInt(substitutedVal, 10);
}
shvl.set(constructedService, value, substitutedVal);

View File

@@ -200,7 +200,7 @@ const ensureArray = (value) => {
};
const findHighlightLevel = (ruleSet, numericValue, stringValue) => {
const { numeric, string, valueOnly } = ruleSet;
const { numeric, string } = ruleSet;
if (numeric && numericValue !== undefined) {
const numericRules = ensureArray(numeric);
@@ -208,7 +208,7 @@ const findHighlightLevel = (ruleSet, numericValue, stringValue) => {
for (const candidate of numericCandidates) {
for (const rule of numericRules) {
if (rule?.level && evaluateNumericRule(candidate, rule)) {
return { level: rule.level, source: "numeric", rule, valueOnly };
return { level: rule.level, source: "numeric", rule };
}
}
}
@@ -218,7 +218,7 @@ const findHighlightLevel = (ruleSet, numericValue, stringValue) => {
const stringRules = ensureArray(string);
for (const rule of stringRules) {
if (rule?.level && evaluateStringRule(stringValue, rule)) {
return { level: rule.level, source: "string", rule, valueOnly };
return { level: rule.level, source: "string", rule };
}
}
}