mirror of
https://github.com/stalwartlabs/webui.git
synced 2026-12-06 16:04:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
792530ab3c | ||
|
|
cb0af4334f | ||
|
|
6e76d2f9e9 | ||
|
|
51f47f0f81 | ||
|
|
64bebee21a | ||
|
|
337437bf31 |
No files matched your search
@@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [2.1.3] - 2026-12-03
|
||||
|
||||
### Fixed
|
||||
- Browser auto-translation (Chrome, Edge, Safari) is turned off for the web interface, which crashed with a `removeChild` error when the translator rewrote the page.
|
||||
- Forms: Save is enabled as soon as a field is edited, without leaving the field first, and the Delete, Cancel and Save buttons no longer move when the "Unsaved changes" label appears.
|
||||
|
||||
## [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
-1
@@ -1,8 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" translate="no">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="google" content="notranslate" />
|
||||
<base href="/" />
|
||||
<meta name="oauth-client-id" content="" />
|
||||
<meta name="oauth-scopes" content="" />
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "stalwart-webui",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "stalwart-webui",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.3",
|
||||
"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.3",
|
||||
"stalwart": {
|
||||
"minServerVersion": "1.0.0"
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
@@ -154,6 +155,7 @@ export function DynamicForm({
|
||||
const model = useDynamicForm(viewName, objectId, { accountId, fieldOverrides, createValues, showCreatedValues });
|
||||
const { schema, resolved, mode, isSingleton, state, isDirty, saving, loading, loadError } = model;
|
||||
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false);
|
||||
const [pendingInput, setPendingInput] = useState(false);
|
||||
const title = useFormTitle(model);
|
||||
const sectionPrefix = useId();
|
||||
const wide = useSyncExternalStore(subscribeWide, isWide, () => false);
|
||||
@@ -164,6 +166,7 @@ export function DynamicForm({
|
||||
const isCreate = mode === 'create';
|
||||
const readOnly = !isCreate && !canUpdate;
|
||||
const canDelete = !isCreate && !isSingleton && canDestroy;
|
||||
const hasChanges = isDirty || pendingInput;
|
||||
const subtitle = (model.parentForm ?? model.variantForm)?.subtitle;
|
||||
const errorText = state.generalError ?? loadError;
|
||||
const header = (
|
||||
@@ -221,7 +224,15 @@ export function DynamicForm({
|
||||
|
||||
<div className={cn(showIndex && 'xl:grid xl:grid-cols-[11rem_minmax(0,1fr)] xl:items-start xl:gap-6')}>
|
||||
{showIndex && wide && <SectionIndex sections={model.sections} sectionId={sectionId} />}
|
||||
<div className="space-y-3.5">
|
||||
<div
|
||||
className="space-y-3.5"
|
||||
onInput={(e) => {
|
||||
if (!pendingInput && e.target instanceof Node && e.currentTarget.contains(e.target)) setPendingInput(true);
|
||||
}}
|
||||
onBlur={() => {
|
||||
if (pendingInput) setPendingInput(false);
|
||||
}}
|
||||
>
|
||||
<FormProvider
|
||||
schema={schema}
|
||||
mode={mode}
|
||||
@@ -265,8 +276,13 @@ export function DynamicForm({
|
||||
<FloatingActionDivider />
|
||||
</>
|
||||
)}
|
||||
{isDirty && (
|
||||
<span className="flex items-center gap-2 px-2 text-[13px] text-ink-muted max-sm:hidden">
|
||||
{!readOnly && (
|
||||
<span
|
||||
className={cn(
|
||||
'flex items-center gap-2 px-2 text-[13px] text-ink-muted max-sm:hidden',
|
||||
!hasChanges && 'invisible',
|
||||
)}
|
||||
>
|
||||
<FloatingActionDot />
|
||||
{t('form.unsavedChangesLabel', 'Unsaved changes')}
|
||||
</span>
|
||||
@@ -280,7 +296,7 @@ export function DynamicForm({
|
||||
size="sm"
|
||||
className="shadow-none"
|
||||
onClick={() => void model.save()}
|
||||
disabled={saving || (!isCreate && !isDirty)}
|
||||
disabled={saving || (!isCreate && !hasChanges)}
|
||||
>
|
||||
{saving ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" />
|
||||
@@ -299,10 +315,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}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user