fix(webui): localize Campaign delivery reporting
This commit is contained in:
@@ -29,7 +29,8 @@ import {
|
||||
useGuardedNavigate,
|
||||
type AuthInfo
|
||||
} from "@govoplan/core-webui";
|
||||
import { asRecord, formatDateTime, humanize } from "../campaigns/utils/campaignView";
|
||||
import { asRecord, formatDateTime } from "../campaigns/utils/campaignView";
|
||||
import { deliveryModeLabel } from "../campaigns/utils/deliveryMode";
|
||||
import {
|
||||
operatorQueueActionBlocks,
|
||||
type OperatorQueueAction,
|
||||
@@ -237,7 +238,7 @@ export default function OperatorQueuePage({ settings, auth }: {settings: ApiSett
|
||||
const columns = useMemo<DataGridColumn<OperatorRow>[]>(() => [
|
||||
{ id: "campaign", header: "i18n:govoplan-campaign.campaign.69390e16", width: "minmax(260px, 1.2fr)", sticky: "start", sortable: true, filterable: true, value: (row) => row.campaign.name },
|
||||
{ id: "status", header: "i18n:govoplan-campaign.status.bae7d5be", width: 145, sortable: true, filterable: true, render: (row) => <StatusBadge status={row.campaign.status} />, value: (row) => row.campaign.status },
|
||||
{ id: "mode", header: "i18n:govoplan-campaign.mode.a7b93d21", width: 155, sortable: true, filterable: true, value: (row) => row.mode ? humanize(row.mode) : "—", sortValue: (row) => row.mode ?? "" },
|
||||
{ id: "mode", header: "i18n:govoplan-campaign.mode.a7b93d21", width: 155, sortable: true, filterable: true, value: (row) => deliveryModeLabel(row.mode), sortValue: (row) => row.mode ?? "" },
|
||||
{ id: "attention", header: "i18n:govoplan-campaign.attention.74e0b9c8", width: 120, align: "right", sortable: true, filterType: "integer", value: (row) => row.needsAttention },
|
||||
{ id: "failed", header: "i18n:govoplan-campaign.failed.09fef5d8", width: 100, align: "right", sortable: true, filterType: "integer", value: (row) => row.failed },
|
||||
{ id: "unknown", header: "i18n:govoplan-campaign.unknown.bc7819b3", width: 110, align: "right", sortable: true, filterType: "integer", value: (row) => row.outcomeUnknown },
|
||||
|
||||
@@ -25,7 +25,7 @@ export type OperatorQueueFacts = {
|
||||
};
|
||||
|
||||
export const OPERATOR_QUEUE_REASON = {
|
||||
permission: "i18n:govoplan-campaign.you_do_not_have_permission_for_this_action.dfcfbad6",
|
||||
permissionDenied: "i18n:govoplan-campaign.you_do_not_have_permission_for_this_action.dfcfbad6",
|
||||
noQueued: "i18n:govoplan-campaign.no_queued_jobs_can_be_paused.acaa0b4e",
|
||||
noPaused: "i18n:govoplan-campaign.no_paused_jobs_can_be_resumed.869b6275",
|
||||
noFailed: "i18n:govoplan-campaign.no_failed_jobs_are_eligible_for_retry.e65a69f9",
|
||||
@@ -43,34 +43,34 @@ export function operatorQueueActionBlocks(
|
||||
permissions: OperatorQueuePermissions
|
||||
): Record<OperatorQueueAction, string | null> {
|
||||
return {
|
||||
details: permissions.canRead ? null : OPERATOR_QUEUE_REASON.permission,
|
||||
details: permissions.canRead ? null : OPERATOR_QUEUE_REASON.permissionDenied,
|
||||
pause: !permissions.canControl
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.queued > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noQueued,
|
||||
resume: !permissions.canControl
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.paused > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noPaused,
|
||||
retry: !permissions.canRetry
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.retryable > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noFailed,
|
||||
"queue-unsent": !permissions.canQueue
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.queueableUnattempted > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noUnsent,
|
||||
reconcile: !permissions.canReconcile
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.outcomeUnknown > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noUnknown,
|
||||
cancel: !permissions.canControl
|
||||
? OPERATOR_QUEUE_REASON.permission
|
||||
? OPERATOR_QUEUE_REASON.permissionDenied
|
||||
: facts.cancellable > 0
|
||||
? null
|
||||
: OPERATOR_QUEUE_REASON.noCancellable
|
||||
|
||||
Reference in New Issue
Block a user