diff --git a/frontend/src/api/moments.ts b/frontend/src/api/moments.ts index d939e177..180aca27 100644 --- a/frontend/src/api/moments.ts +++ b/frontend/src/api/moments.ts @@ -1,4 +1,4 @@ -import { apiGet, apiPost, apiDelete } from "@/api/client"; +import { apiGet, apiPost, apiPut, apiDelete } from "@/api/client"; import type { RuleEnforcement, RuleSalience, RuleTrigger } from "@/api/rulebooks"; /** @@ -279,6 +279,37 @@ export interface AdherencePayload { by_moment: MomentAdherenceRow[]; } +/** One door of the kind×moment table: where a record search fires, and + * the kinds of record it may consider. */ +export interface RecordKindsDoor { + /** A catalog moment, or `message` for the operator's message. */ + door: string; + label: string; + fires: string; + kinds: string[]; + default: string[]; + /** The user changed this door; otherwise it follows the shipped default. */ + changed: boolean; + /** Lines this door pushed of each kind, and how many were opened. */ + evidence: Record; +} + +export interface RecordKindsTable { + days: number; + evidence_failed: boolean; + kinds: { kind: string; label: string }[]; + doors: RecordKindsDoor[]; +} + +export function getRecordKinds(days = 30): Promise { + return apiGet(`/api/retrieval/record-kinds?days=${days}`); +} + +/** `kinds: null` puts the door back to its shipped default. */ +export function setRecordKinds(door: string, kinds: string[] | null): Promise { + return apiPut("/api/retrieval/record-kinds", { door, kinds }); +} + /** How a record arrived in front of a session. */ export type RecordWay = "pushed" | "asked" | "direct"; diff --git a/frontend/src/components/MomentsSettings.vue b/frontend/src/components/MomentsSettings.vue index f070755a..c4e7530a 100644 --- a/frontend/src/components/MomentsSettings.vue +++ b/frontend/src/components/MomentsSettings.vue @@ -4,6 +4,7 @@ import { useMomentsStore } from "@/stores/moments"; import MomentProposals from "@/components/MomentProposals.vue"; import MomentRuleUsage from "@/components/MomentRuleUsage.vue"; import WeightProposals from "@/components/WeightProposals.vue"; +import RecordKinds from "@/components/RecordKinds.vue"; import RecordReach from "@/components/RecordReach.vue"; import RuleAdherence from "@/components/RuleAdherence.vue"; import { getAdherence, getRecordReach } from "@/api/moments"; @@ -172,6 +173,7 @@ onMounted(async () => { +
  • diff --git a/frontend/src/components/RecordKinds.vue b/frontend/src/components/RecordKinds.vue new file mode 100644 index 00000000..681fa5fe --- /dev/null +++ b/frontend/src/components/RecordKinds.vue @@ -0,0 +1,130 @@ + + + + + + +