Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
001a1f3a15 | ||
|
|
782dde0573 | ||
|
|
cbe77f9e4a | ||
|
|
e9b9efa084 | ||
|
|
dee0f7fbe3 |
@@ -2,6 +2,25 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [1.0.4] - 2026-05-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Align `base32` alphabet with the server.
|
||||||
|
|
||||||
|
## [1.0.3] - 2026-05-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Broken "Delivery History" link on OSS/Community editions.
|
||||||
|
- Resolve object ids in map keys.
|
||||||
|
|
||||||
## [1.0.2] - 2026-04-30
|
## [1.0.2] - 2026-04-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "stalwart-webui",
|
"name": "stalwart-webui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.1",
|
"version": "1.0.4",
|
||||||
"description": "Stalwart WebUI",
|
"description": "Stalwart WebUI",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1979,6 +1979,29 @@ function ObjectIdMultiSelectPill({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MapEntryKeyLabel({ keyClass, keyValue, schema }: { keyClass: ScalarType; keyValue: string; schema: Schema }) {
|
||||||
|
if (keyClass.type === 'enum') {
|
||||||
|
const variants = schema.enums[keyClass.enumName] ?? [];
|
||||||
|
const variant = variants.find((v) => v.name === keyValue);
|
||||||
|
return <>{variant?.label ?? keyValue}</>;
|
||||||
|
}
|
||||||
|
if (keyClass.type === 'objectId') {
|
||||||
|
return <ObjectIdKeyLabel objectName={keyClass.objectName} keyValue={keyValue} schema={schema} />;
|
||||||
|
}
|
||||||
|
return <>{keyValue}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectIdKeyLabel({ objectName, keyValue, schema }: { objectName: string; keyValue: string; schema: Schema }) {
|
||||||
|
const list = useObjectList(objectName, schema);
|
||||||
|
const fromList = list.options.find((o) => o.id === keyValue)?.label;
|
||||||
|
const { label: cheapLabel, loading } = useObjectLabel(objectName, fromList ? null : keyValue, schema);
|
||||||
|
const display = fromList ?? cheapLabel;
|
||||||
|
if (loading && !display) {
|
||||||
|
return <Loader2 className="h-3 w-3 animate-spin text-muted-foreground" />;
|
||||||
|
}
|
||||||
|
return <>{display ?? keyValue}</>;
|
||||||
|
}
|
||||||
|
|
||||||
interface MapFieldProps {
|
interface MapFieldProps {
|
||||||
keyClass: ScalarType;
|
keyClass: ScalarType;
|
||||||
valueClass: MapValueType;
|
valueClass: MapValueType;
|
||||||
@@ -2038,15 +2061,6 @@ function MapField({ keyClass, valueClass, value, onChange, readOnly, schema, min
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getKeyLabel = (key: string): string => {
|
|
||||||
if (keyClass.type === 'enum') {
|
|
||||||
const variants = schema.enums[keyClass.enumName] ?? [];
|
|
||||||
const variant = variants.find((v) => v.name === key);
|
|
||||||
if (variant) return variant.label;
|
|
||||||
}
|
|
||||||
return key;
|
|
||||||
};
|
|
||||||
|
|
||||||
const existingKeys = new Set(Object.keys(mapValue));
|
const existingKeys = new Set(Object.keys(mapValue));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -2063,7 +2077,7 @@ function MapField({ keyClass, valueClass, value, onChange, readOnly, schema, min
|
|||||||
className="flex flex-1 items-center gap-2 p-3 text-sm font-medium hover:bg-accent/50 rounded-t-md transition-colors [&[data-state=closed]>svg]:rotate-0 [&[data-state=open]>svg]:rotate-90"
|
className="flex flex-1 items-center gap-2 p-3 text-sm font-medium hover:bg-accent/50 rounded-t-md transition-colors [&[data-state=closed]>svg]:rotate-0 [&[data-state=open]>svg]:rotate-90"
|
||||||
>
|
>
|
||||||
<ChevronRight className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
<ChevronRight className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
||||||
{getKeyLabel(key)}
|
<MapEntryKeyLabel keyClass={keyClass} keyValue={key} schema={schema} />
|
||||||
</button>
|
</button>
|
||||||
</CollapsibleTrigger>
|
</CollapsibleTrigger>
|
||||||
{!readOnly && (
|
{!readOnly && (
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
ArrowUpDown,
|
ArrowUpDown,
|
||||||
Filter,
|
Filter,
|
||||||
Loader2,
|
Loader2,
|
||||||
|
Lock,
|
||||||
Search,
|
Search,
|
||||||
RotateCcw,
|
RotateCcw,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
@@ -46,6 +47,7 @@ import {
|
|||||||
} from '@/components/ui/alert-dialog';
|
} from '@/components/ui/alert-dialog';
|
||||||
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
|
||||||
import { ObjectPicker } from '@/components/common/ObjectPicker';
|
import { ObjectPicker } from '@/components/common/ObjectPicker';
|
||||||
|
import { EnterpriseUpsell } from '@/components/common/EnterpriseUpsell';
|
||||||
import { toast } from '@/hooks/use-toast';
|
import { toast } from '@/hooks/use-toast';
|
||||||
import { friendlySetError } from '@/lib/jmapErrors';
|
import { friendlySetError } from '@/lib/jmapErrors';
|
||||||
import { coerceLabel } from '@/lib/objectOptions';
|
import { coerceLabel } from '@/lib/objectOptions';
|
||||||
@@ -319,6 +321,8 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
const schema = useSchemaStore((s) => s.schema);
|
const schema = useSchemaStore((s) => s.schema);
|
||||||
const viewToSection = useSchemaStore((s) => s.viewToSection);
|
const viewToSection = useSchemaStore((s) => s.viewToSection);
|
||||||
const hasObjectPermission = useAccountStore((s) => s.hasObjectPermission);
|
const hasObjectPermission = useAccountStore((s) => s.hasObjectPermission);
|
||||||
|
const edition = useAccountStore((s) => s.edition);
|
||||||
|
const [upsellOpen, setUpsellOpen] = useState(false);
|
||||||
|
|
||||||
const resolved = useMemo(() => {
|
const resolved = useMemo(() => {
|
||||||
if (!schema) return null;
|
if (!schema) return null;
|
||||||
@@ -1020,17 +1024,20 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
function renderItemActions(item: Record<string, unknown>): React.ReactNode {
|
function renderItemActions(item: Record<string, unknown>): React.ReactNode {
|
||||||
if (!hasItemActions || !list.itemActions) return null;
|
if (!hasItemActions || !list.itemActions) return null;
|
||||||
|
|
||||||
const filteredActions = list.itemActions.filter((action) => {
|
const filteredActions = list.itemActions.flatMap((action): { action: ItemAction; locked: boolean }[] => {
|
||||||
if (action.type === 'separator') return true;
|
if (action.type === 'separator') return [{ action, locked: false }];
|
||||||
if (action.type === 'delete') return canDelete;
|
if (action.type === 'delete') return canDelete ? [{ action, locked: false }] : [];
|
||||||
if (action.type === 'setProperty') return canUpdate;
|
if (action.type === 'setProperty') return canUpdate ? [{ action, locked: false }] : [];
|
||||||
if (action.type === 'view' || action.type === 'query') {
|
if (action.type === 'view' || action.type === 'query') {
|
||||||
const targetObj = resolveObject(schema!, action.objectName);
|
const targetObj = resolveObject(schema!, action.objectName);
|
||||||
if (targetObj && !hasObjectPermission(targetObj.permissionPrefix, 'Get')) {
|
if (!targetObj) return [];
|
||||||
return false;
|
if (targetObj.enterprise) {
|
||||||
|
if (edition === 'oss') return [];
|
||||||
|
if (edition === 'community') return [{ action, locked: true }];
|
||||||
}
|
}
|
||||||
|
if (!hasObjectPermission(targetObj.permissionPrefix, 'Get')) return [];
|
||||||
}
|
}
|
||||||
return true;
|
return [{ action, locked: false }];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filteredActions.length === 0) return null;
|
if (filteredActions.length === 0) return null;
|
||||||
@@ -1043,7 +1050,7 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
{filteredActions.map((action, idx) => {
|
{filteredActions.map(({ action, locked }, idx) => {
|
||||||
if (action.type === 'separator') {
|
if (action.type === 'separator') {
|
||||||
return <DropdownMenuSeparator key={`sep-${idx}`} />;
|
return <DropdownMenuSeparator key={`sep-${idx}`} />;
|
||||||
}
|
}
|
||||||
@@ -1057,7 +1064,9 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
className={isDestructive ? 'text-destructive' : undefined}
|
className={isDestructive ? 'text-destructive' : undefined}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (needsConfirmation) {
|
if (locked) {
|
||||||
|
setUpsellOpen(true);
|
||||||
|
} else if (needsConfirmation) {
|
||||||
setConfirmAction({
|
setConfirmAction({
|
||||||
label: action.label,
|
label: action.label,
|
||||||
onConfirm: () => executeItemAction(action, item),
|
onConfirm: () => executeItemAction(action, item),
|
||||||
@@ -1068,6 +1077,7 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{action.label}
|
{action.label}
|
||||||
|
{locked && <Lock className="ml-auto h-3 w-3 text-muted-foreground" />}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -1352,6 +1362,8 @@ export function DynamicList({ viewName }: DynamicListProps) {
|
|||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
|
|
||||||
|
<EnterpriseUpsell open={upsellOpen} onClose={() => setUpsellOpen(false)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,16 @@
|
|||||||
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import { Check, X, HelpCircle, ChevronRight } from 'lucide-react';
|
import { Check, X, HelpCircle, ChevronRight, Loader2 } from 'lucide-react';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { jmapMapToArray, SECRET_MASK } from '@/lib/jmapUtils';
|
import { jmapMapToArray, SECRET_MASK } from '@/lib/jmapUtils';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
||||||
import { resolveSchema, resolveVariantForm, resolveForm } from '@/lib/schemaResolver';
|
import { resolveSchema, resolveVariantForm, resolveForm } from '@/lib/schemaResolver';
|
||||||
|
import { useObjectList, useObjectLabel } from '@/lib/objectOptions';
|
||||||
import { formatSize, formatDuration } from '@/lib/durationFormat';
|
import { formatSize, formatDuration } from '@/lib/durationFormat';
|
||||||
import type { Schema, Field, FieldType, FormField, Form, Fields, EnumVariant } from '@/types/schema';
|
import type { Schema, Field, FieldType, FormField, Form, Fields, EnumVariant, ScalarType } from '@/types/schema';
|
||||||
|
|
||||||
export interface DynamicViewProps {
|
export interface DynamicViewProps {
|
||||||
schema: Schema;
|
schema: Schema;
|
||||||
@@ -401,7 +402,7 @@ function MapValue({
|
|||||||
schema,
|
schema,
|
||||||
}: {
|
}: {
|
||||||
value: unknown;
|
value: unknown;
|
||||||
keyClass: { type: string; enumName?: string };
|
keyClass: ScalarType;
|
||||||
valueClass: { type: string; objectName?: string };
|
valueClass: { type: string; objectName?: string };
|
||||||
schema: Schema;
|
schema: Schema;
|
||||||
}) {
|
}) {
|
||||||
@@ -417,12 +418,7 @@ function MapValue({
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{entries.map(([k, v]) => {
|
{entries.map(([k, v]) => {
|
||||||
let keyLabel = k;
|
const keyLabel = <MapKeyLabel keyClass={keyClass} keyValue={k} schema={schema} />;
|
||||||
if (keyClass.type === 'enum' && keyClass.enumName) {
|
|
||||||
const variants = schema.enums[keyClass.enumName] ?? [];
|
|
||||||
const variant = variants.find((e: EnumVariant) => e.name === k);
|
|
||||||
if (variant) keyLabel = variant.label;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valueClass.type === 'object' && valueClass.objectName) {
|
if (valueClass.type === 'object' && valueClass.objectName) {
|
||||||
return (
|
return (
|
||||||
@@ -446,6 +442,29 @@ function MapValue({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MapKeyLabel({ keyClass, keyValue, schema }: { keyClass: ScalarType; keyValue: string; schema: Schema }) {
|
||||||
|
if (keyClass.type === 'enum') {
|
||||||
|
const variants = schema.enums[keyClass.enumName] ?? [];
|
||||||
|
const variant = variants.find((e: EnumVariant) => e.name === keyValue);
|
||||||
|
return <>{variant?.label ?? keyValue}</>;
|
||||||
|
}
|
||||||
|
if (keyClass.type === 'objectId') {
|
||||||
|
return <ObjectIdKeyLabel objectName={keyClass.objectName} keyValue={keyValue} schema={schema} />;
|
||||||
|
}
|
||||||
|
return <>{keyValue}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectIdKeyLabel({ objectName, keyValue, schema }: { objectName: string; keyValue: string; schema: Schema }) {
|
||||||
|
const list = useObjectList(objectName, schema);
|
||||||
|
const fromList = list.options.find((o) => o.id === keyValue)?.label;
|
||||||
|
const { label: cheapLabel, loading } = useObjectLabel(objectName, fromList ? null : keyValue, schema);
|
||||||
|
const display = fromList ?? cheapLabel;
|
||||||
|
if (loading && !display) {
|
||||||
|
return <Loader2 className="h-3 w-3 animate-spin text-muted-foreground" />;
|
||||||
|
}
|
||||||
|
return <>{display ?? keyValue}</>;
|
||||||
|
}
|
||||||
|
|
||||||
function FieldTooltip({ description }: { description: string }) {
|
function FieldTooltip({ description }: { description: string }) {
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CircleDot, CircleX, Clock } from 'lucide-react';
|
|||||||
import { useSchemaStore } from '@/stores/schemaStore';
|
import { useSchemaStore } from '@/stores/schemaStore';
|
||||||
import type { TraceEvent, TraceKeyValue, TraceValue } from '../types';
|
import type { TraceEvent, TraceKeyValue, TraceValue } from '../types';
|
||||||
|
|
||||||
const BASE32_ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567';
|
const BASE32_ALPHABET = 'abcdefghijklmnopqrstuvwxyz792013';
|
||||||
|
|
||||||
function intToBase32(input: number | string): string {
|
function intToBase32(input: number | string): string {
|
||||||
let n: bigint;
|
let n: bigint;
|
||||||
|
|||||||
Reference in New Issue
Block a user