mirror of
https://github.com/stalwartlabs/webui.git
synced 2026-12-05 08:05:25 +00:00
Dashboard: zero-fill empty counter buckets and teal-first series colours
This commit is contained in:
6 files changed
+38
-26
No files matched your search
@@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file. This projec
|
||||
### Fixed
|
||||
- Sign-in no longer sends `prompt=login`, so an existing single sign-on session at an external OpenID Connect provider is reused instead of asking for the login again.
|
||||
- Calendars, address books and mailboxes that still hold events, contacts or messages can be deleted. The delete confirmation says that their contents are deleted with them.
|
||||
- Dashboard:
|
||||
- Counter charts drop to zero in empty intervals instead of repeating the last value, so a short burst (for example the morning DMARC and TLS reports) no longer shows as hours of steady activity.
|
||||
- Pass, ham and other good series are drawn in teal and fail or spam in red, instead of the reverse.
|
||||
|
||||
## [2.1.1] - 2026-11-23
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "stalwart-webui",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "stalwart-webui",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"dependencies": {
|
||||
"@daypicker/react": "^10.0.2",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "stalwart-webui",
|
||||
"private": true,
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"stalwart": {
|
||||
"minServerVersion": "1.0.0"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ import { HelpTooltip } from '@/components/common/HelpTooltip';
|
||||
import { ChartTooltipContent, getChartColor } from '@/components/ui/chart';
|
||||
import type { Chart as ChartSchema, Placement } from '../types/schema';
|
||||
import type { Metric, Period } from '../types/metrics';
|
||||
import { bucketTimestamps, bucketValues, getBucketCount, formatTimeTick, formatValue } from '../helpers';
|
||||
import { bucketTimestamps, chartBucketValues, getBucketCount, formatTimeTick, formatValue } from '../helpers';
|
||||
import { ChartSizedContainer } from './ChartSizedContainer';
|
||||
import { toneClasses } from './tone';
|
||||
import { cn } from '@/lib/utils';
|
||||
@@ -33,10 +33,12 @@ export function DashboardChart({ chart, historySamples, historyWindow, period, c
|
||||
const valueFormat = chart.valueFormat ?? 'number';
|
||||
|
||||
const data = useMemo(() => {
|
||||
const seriesValues = chart.series.map((series) => bucketValues(series, historySamples, from, to, bucketCount));
|
||||
const seriesValues = chart.series.map((series) =>
|
||||
chartBucketValues(series, historySamples, from, to, bucketCount, chart.stacked ?? false),
|
||||
);
|
||||
const timestamps = bucketTimestamps(from, to, bucketCount);
|
||||
|
||||
const points = timestamps.map((ts, i) => {
|
||||
return timestamps.map((ts, i) => {
|
||||
const point: Record<string, unknown> = {
|
||||
time: ts.getTime(),
|
||||
timeLabel: formatTimeTick(ts, period),
|
||||
@@ -46,22 +48,6 @@ export function DashboardChart({ chart, historySamples, historyWindow, period, c
|
||||
});
|
||||
return point;
|
||||
});
|
||||
|
||||
if (chart.stacked) {
|
||||
const lastSeen: Record<string, number> = {};
|
||||
for (const point of points) {
|
||||
for (const series of chart.series) {
|
||||
const v = point[series.label];
|
||||
if (typeof v === 'number') {
|
||||
lastSeen[series.label] = v;
|
||||
} else {
|
||||
point[series.label] = lastSeen[series.label] ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return points;
|
||||
}, [historySamples, from, to, bucketCount, chart.series, chart.stacked, period]);
|
||||
|
||||
const tickFormatter = (value: number) => formatValue(value, valueFormat);
|
||||
|
||||
@@ -249,6 +249,29 @@ export function bucketValues(
|
||||
});
|
||||
}
|
||||
|
||||
export function chartBucketValues(
|
||||
target: MetricTarget,
|
||||
samples: Metric[],
|
||||
from: Date,
|
||||
to: Date,
|
||||
bucketCount: number,
|
||||
stacked: boolean,
|
||||
): (number | null)[] {
|
||||
const values = bucketValues(target, samples, from, to, bucketCount);
|
||||
const index = indexSamples(samples);
|
||||
const kind = target.metrics.map((id) => index.get(id)?.[0]).find((m) => m !== undefined)?.['@type'];
|
||||
if (kind === 'Gauge') {
|
||||
if (!stacked) return values;
|
||||
let lastSeen = 0;
|
||||
return values.map((v) => {
|
||||
if (v !== null) lastSeen = v;
|
||||
return lastSeen;
|
||||
});
|
||||
}
|
||||
if (kind === 'Histogram' && !stacked) return values;
|
||||
return values.map((v) => v ?? 0);
|
||||
}
|
||||
|
||||
export function cardValue(card: Card, samples: Metric[]): number {
|
||||
return reduceSamples(card, selectSamples(card, samples)) ?? 0;
|
||||
}
|
||||
|
||||
+4
-4
@@ -80,8 +80,8 @@
|
||||
--shadow-c2: rgb(62 44 26 / 0.05);
|
||||
--hi: rgb(255 255 255 / 0);
|
||||
|
||||
--chart-1: #db2d54;
|
||||
--chart-2: #2a9d8f;
|
||||
--chart-1: #2a9d8f;
|
||||
--chart-2: #db2d54;
|
||||
--chart-3: #d9822b;
|
||||
--chart-4: #4a3f8f;
|
||||
--chart-5: #8b7e6e;
|
||||
@@ -153,8 +153,8 @@
|
||||
--shadow-c2: rgb(0 0 0 / 0.3);
|
||||
--hi: rgb(255 255 255 / 0.045);
|
||||
|
||||
--chart-1: #ff5c7f;
|
||||
--chart-2: #4cc3b3;
|
||||
--chart-1: #4cc3b3;
|
||||
--chart-2: #ff5c7f;
|
||||
--chart-3: #f0a35a;
|
||||
--chart-4: #a99bf0;
|
||||
--chart-5: #9e9ea4;
|
||||
|
||||
Reference in new issue
Block a user