All files / src/apps/user/pages/knowledge scales.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52              11x                     11x                           11x                   11x                  
import type { StatusScale } from "@/components/detail";
 
/**
 * Where a source (or a repository) stands, at a glance, on its card: a
 * meaning, drawn by `StatusBadge`. The reading is `sourceHealth` /
 * `repositoryHealth` (`figures.ts`), from the figures svc-core serves.
 */
export const SOURCE_HEALTH: StatusScale = {
  // A trust signal asks for a look: a blocked site, behind its refresh,
  // documents that could not be indexed.
  attention: "warning",
  indexing: "progress",
  ready: "success",
  empty: "neutral",
  // A database or API source: read where it lives, not indexed here.
  in_place: "muted",
};
 
export const SOURCE_HEALTH_LABEL: Record<string, string> = {
  attention: "Needs attention",
  indexing: "Indexing",
  ready: "Ready",
  empty: "Empty",
  in_place: "Read in place",
};
 
/**
 * A trust signal's state (svc-core `services/knowledge/trust.py`
 * `SignalState`): a meaning, never a score. A blocked site is a conflict; a
 * gap in the record (no licence on file) is a warning at most; what does not
 * apply to the source is set aside.
 */
export const TRUST_STATE: StatusScale = {
  met: "success",
  partial: "neutral",
  unmet: "warning",
  conflict: "danger",
  in_progress: "progress",
  unknown: "neutral",
  not_applicable: "muted",
};
 
export const TRUST_STATE_LABEL: Record<string, string> = {
  met: "Met",
  partial: "Partly",
  unmet: "Not met",
  conflict: "Conflict",
  in_progress: "In progress",
  unknown: "Unknown",
  not_applicable: "Not applicable",
};