fix(campaign): use stable aggregate status filters

This commit is contained in:
2026-07-22 09:11:14 +02:00
parent 4eb651c6ac
commit ac3329cafe
2 changed files with 43 additions and 1 deletions

View File

@@ -14,7 +14,8 @@ import {
formatDateTime,
i18nMessage,
type ApiSettings,
type DataGridColumn
type DataGridColumn,
type DataGridListOption
} from "@govoplan/core-webui";
import {
getAggregateCampaignReport,
@@ -24,6 +25,21 @@ import {
type AggregateReportCount
} from "../../api/campaigns";
const CAMPAIGN_STATUS_OPTIONS: DataGridListOption[] = [
{ value: "draft", label: "i18n:govoplan-campaign.draft.23d33e22" },
{ value: "validated", label: "i18n:govoplan-campaign.valid.a4aefa35" },
{ value: "needs_review", label: "i18n:govoplan-campaign.needs_review.33a506cf" },
{ value: "ready_to_queue", label: "i18n:govoplan-campaign.ready.20c7c552" },
{ value: "queued", label: "i18n:govoplan-campaign.queued.6a599877" },
{ value: "sending", label: "i18n:govoplan-campaign.sending.cf765512" },
{ value: "sent", label: "i18n:govoplan-campaign.sent.35f49dcf" },
{ value: "partially_completed", label: "i18n:govoplan-campaign.partially_completed.760bc5e6" },
{ value: "outcome_unknown", label: "i18n:govoplan-campaign.outcome_unknown.6e929fca" },
{ value: "failed", label: "i18n:govoplan-campaign.failed.09fef5d8" },
{ value: "cancelled", label: "i18n:govoplan-campaign.cancelled.a1bf92ef" },
{ value: "archived", label: "i18n:govoplan-campaign.archived.eddc813f" }
];
export default function AggregateReportsPage({ settings }: {settings: ApiSettings;}) {
const [searchParams, setSearchParams] = useSearchParams();
const selectedFromUrl = searchParams.get("campaign") ?? "";
@@ -110,6 +126,8 @@ export default function AggregateReportsPage({ settings }: {settings: ApiSetting
width: 170,
sortable: true,
filterable: true,
columnType: "from-list",
list: { options: CAMPAIGN_STATUS_OPTIONS, display: "pill" },
render: (campaign) => <StatusBadge status={campaign.status} />,
value: (campaign) => campaign.status
},
@@ -190,6 +208,8 @@ export default function AggregateReportsPage({ settings }: {settings: ApiSetting
</dl>
</Card>
{/* Aggregate outcome cards are deliberately not filter shortcuts: each subgroup
would require a separately suppressed aggregate response from the server. */}
<div className="dashboard-grid">
<MetricCard label="i18n:govoplan-campaign.smtp_accepted.e3aa7603" value={countValue(outcomes.smtp_accepted)} tone="good" />
<MetricCard label="i18n:govoplan-campaign.failed.09fef5d8" value={countValue(outcomes.failed)} tone="danger" />