3 Commits
13 changed files with 138 additions and 81 deletions

No files matched your search

+10
View File
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [2.1.2] - 2026-11-29
### 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.
- Mail Rules editor: alternatives and exceptions keep their place. Adding an exception no longer moves the "Add alternative" button below it, and the add buttons are evenly spaced.
## [2.1.1] - 2026-11-23
### Added
+2 -2
View File
@@ -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
View File
@@ -1,7 +1,7 @@
{
"name": "stalwart-webui",
"private": true,
"version": "2.1.1",
"version": "2.1.2",
"stalwart": {
"minServerVersion": "1.0.0"
},
+6 -4
View File
@@ -21,6 +21,7 @@ import { UnsavedChangesDialog } from '@/components/forms/UnsavedChangesDialog';
import { formFieldLabels } from '@/components/forms/formLogic';
import { useDynamicForm, type DynamicFormModel, type DynamicFormOptions } from '@/components/forms/useDynamicForm';
import type { FieldValues, RenderableSection } from '@/components/forms/formLogic';
import { withDestroyContentsNotice } from '@/lib/destroyContents';
import { cn } from '@/lib/utils';
const SECTION_INDEX_MIN = 3;
@@ -299,10 +300,11 @@ export function DynamicForm({
onOpenChange={setDeleteConfirmOpen}
variant="destructive"
title={t('form.deleteTitle', 'Delete {{name}}?', { name: capitalize(deleteLabel) })}
description={t(
'form.deleteDescription',
'This action cannot be undone. This will permanently delete this {{name}}.',
{ name: deleteLabel },
description={withDestroyContentsNotice(
t('form.deleteDescription', 'This action cannot be undone. This will permanently delete this {{name}}.', {
name: deleteLabel,
}),
resolved.object.objectName,
)}
confirmLabel={t('common.delete', 'Delete')}
onConfirm={model.remove}
+23 -18
View File
@@ -14,6 +14,7 @@ import { ConfirmDialog } from '@/components/common/ConfirmDialog';
import { EnterpriseUpsell } from '@/components/common/EnterpriseUpsell';
import { useIsCommunity, usePermissionCheckers } from '@/hooks/usePermissions';
import { useResolvedView } from '@/hooks/useResolvedView';
import { withDestroyContentsNotice } from '@/lib/destroyContents';
import { layoutViewFor } from '@/lib/layout';
import { canAccessView } from '@/lib/permissions';
import { getDisplayProperty } from '@/lib/schemaResolver';
@@ -128,20 +129,23 @@ function DynamicListView({ viewName, schema, resolved, list }: DynamicListViewPr
title: allMatching
? t('list.deleteAllMatchingTitle', 'Delete all matching {{name}}', { name: list.pluralName })
: t('list.deleteManyTitle', 'Delete {{count}} {{name}}', { count, name }),
description: allMatching
? t(
'list.deleteAllMatchingDescription',
'Are you sure you want to delete ALL {{name}} matching the current filters? This action cannot be undone.',
{ name: list.pluralName },
)
: t(
'list.deleteManyDescription',
'Are you sure you want to delete {{count}} {{name}}? This action cannot be undone.',
{
count,
name,
},
),
description: withDestroyContentsNotice(
allMatching
? t(
'list.deleteAllMatchingDescription',
'Are you sure you want to delete ALL {{name}} matching the current filters? This action cannot be undone.',
{ name: list.pluralName },
)
: t(
'list.deleteManyDescription',
'Are you sure you want to delete {{count}} {{name}}? This action cannot be undone.',
{
count,
name,
},
),
objectName,
),
confirmLabel: t('list.deleteAll', 'Delete all'),
destructive: true,
onConfirm: run,
@@ -170,10 +174,11 @@ function DynamicListView({ viewName, schema, resolved, list }: DynamicListViewPr
if (action.type === 'delete') {
setConfirm({
title: t('list.deleteItemTitle', 'Delete {{name}}?', { name: list.singularName }),
description: t(
'list.deleteItemDescription',
'Are you sure you want to delete {{label}}? This action cannot be undone.',
{ label },
description: withDestroyContentsNotice(
t('list.deleteItemDescription', 'Are you sure you want to delete {{label}}? This action cannot be undone.', {
label,
}),
objectName,
),
confirmLabel: t('list.delete', 'Delete'),
destructive: true,
@@ -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);
+23
View File
@@ -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;
}
@@ -210,8 +210,6 @@ export function RuleBuilderRow({ data: body, errors, readOnly, onFieldChange }:
);
};
const emptyGroups = OPTIONAL_GROUPS.filter((name) => conditions[name].length === 0);
return (
<div className="space-y-1" data-testid="mail-rule-builder">
<RulePreview body={body} incomplete={needsAction(actions)} />
@@ -225,35 +223,29 @@ export function RuleBuilderRow({ data: body, errors, readOnly, onFieldChange }:
<FieldScopeProvider name="conditions" readOnly={readOnly}>
<div className="space-y-5">
{group('matchAll')}
{OPTIONAL_GROUPS.filter((name) => conditions[name].length > 0).map(group)}
{!readOnly && emptyGroups.length > 0 && (
<ul className="space-y-2">
{emptyGroups.map((name) => {
const text = groupText(name);
return (
<li key={name} className="flex flex-wrap items-center gap-x-3 gap-y-1">
<Button
type="button"
variant="secondary"
size="sm"
autoFocus={focusGroup === name}
onClick={() => {
setFocusGroup(null);
change(
name,
appendItem(groups[name], buildNewObjectValue(schema, MAIL_RULE_CONDITION_OBJECT)),
);
}}
>
<Plus className="size-4" aria-hidden="true" />
{text.add}
</Button>
<span className="text-[12.5px] text-muted-foreground">{text.addHint}</span>
</li>
);
})}
</ul>
)}
{OPTIONAL_GROUPS.map((name) => {
if (conditions[name].length > 0) return group(name);
if (readOnly) return null;
const text = groupText(name);
return (
<div key={name} className="flex flex-wrap items-center gap-x-3 gap-y-1">
<Button
type="button"
variant="secondary"
size="sm"
autoFocus={focusGroup === name}
onClick={() => {
setFocusGroup(null);
change(name, appendItem(groups[name], buildNewObjectValue(schema, MAIL_RULE_CONDITION_OBJECT)));
}}
>
<Plus className="size-4" aria-hidden="true" />
{text.add}
</Button>
<span className="text-[12.5px] text-muted-foreground">{text.addHint}</span>
</div>
);
})}
</div>
</FieldScopeProvider>
</Step>
+5
View File
@@ -151,6 +151,11 @@
"viewDetails": "View details",
"waiting": "Waiting for more events"
},
"destroyContents": {
"AddressBook": "Every contact in it is deleted too.",
"Calendar": "Every event in it is deleted too.",
"Mailbox": "Every message in it is deleted too."
},
"duration": {
"days": "Days",
"hours": "Hours",
+4 -4
View File
@@ -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;
+25
View File
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
import i18n from '@/i18n';
export function destroyContentsNotice(objectName: string): string | null {
switch (objectName) {
case 'Mailbox':
return i18n.t('destroyContents.Mailbox', 'Every message in it is deleted too.');
case 'Calendar':
return i18n.t('destroyContents.Calendar', 'Every event in it is deleted too.');
case 'AddressBook':
return i18n.t('destroyContents.AddressBook', 'Every contact in it is deleted too.');
default:
return null;
}
}
export function withDestroyContentsNotice(description: string, objectName: string): string {
const notice = destroyContentsNotice(objectName);
return notice ? `${description} ${notice}` : description;
}
-1
View File
@@ -224,7 +224,6 @@ export async function startAuthFlow(username: string, returnUrl?: string | null)
code_challenge_method: codeChallengeMethod,
state,
login_hint: username,
prompt: 'login',
});
const scope = selectScopes(discovery);
+11 -1
View File
@@ -168,11 +168,21 @@ export function jmapQuery(
return jmapCall<JmapQueryResponse>(`${objectType}/query`, args, options.signal);
}
const DESTROY_CONTENTS_ARGS: ReadonlyMap<string, string> = new Map([
['Mailbox', 'onDestroyRemoveEmails'],
['Calendar', 'onDestroyRemoveEvents'],
['AddressBook', 'onDestroyRemoveContents'],
]);
export function jmapSetArgs(objectType: string, set: JmapSetOptions, accountId?: string): Record<string, unknown> {
const args: Record<string, unknown> = { accountId: accountId ?? getAccountId(objectType) };
if (set.create && Object.keys(set.create).length > 0) args.create = set.create;
if (set.update && Object.keys(set.update).length > 0) args.update = set.update;
if (set.destroy && set.destroy.length > 0) args.destroy = set.destroy;
if (set.destroy && set.destroy.length > 0) {
args.destroy = set.destroy;
const destroyContents = DESTROY_CONTENTS_ARGS.get(objectType);
if (destroyContents) args[destroyContents] = true;
}
return args;
}