Files
doona/src/api/labels.ts
T
Zakk 6ec531e9c4 perf(features): reduce polling and centralize page ownership
Limit event refetches, load search and font assets on demand and keep active views stable. Move tabs, capability gates and data reads into their feature controllers.
2026-09-23 15:19:41 +10:00

50 lines
1.7 KiB
TypeScript

import type {Key} from '../i18n';
import type {MessageRef} from './selectors';
// Wire values of flow and connection details that read better as words. Only the connection and rule pages use them,
// so they stay out of the startup bundle.
const flowWords: Record<string, Key> = {
kernel: 'flow.v.kernel',
userspace: 'flow.v.userspace',
matched: 'flow.v.matched',
other_family_trusted: 'flow.v.otherFamilyTrusted',
failed: 'flow.v.failed',
not_required: 'flow.v.notRequired',
unavailable: 'flow.v.unavailable',
pass: 'flow.v.pass',
redirect: 'flow.v.redirect',
hold: 'flow.v.hold',
arm_direct: 'flow.v.armDirect',
activate_direct: 'flow.v.activateDirect',
activate_proxy: 'flow.v.activateProxy',
drop: 'flow.v.drop',
started: 'flow.v.started',
succeeded: 'flow.v.succeeded',
cancelled: 'flow.v.cancelled',
transport_ready: 'flow.v.transportReady',
target_request_sent: 'flow.v.targetRequestSent',
target_confirmed: 'flow.v.targetConfirmed',
first_reply: 'flow.v.firstReply',
terminal: 'flow.v.terminal',
unknown: 'ui.unknown',
route_selected: 'flow.v.routeSelected',
no_new_routing_input: 'flow.v.noNewRoutingInput',
reply_received: 'flow.v.replyReceived',
hit: 'flow.v.hit',
miss: 'flow.v.miss',
stale: 'flow.v.stale',
bypass: 'flow.v.bypass',
hosts: 'flow.v.hosts',
coalesced: 'flow.v.coalesced',
cache: 'flow.v.cache',
upstream: 'ui.upstream',
lan: 'flow.v.lan',
wan: 'flow.v.wan',
tls_sni: 'flow.v.tlsSni',
http_host: 'flow.v.httpHost',
quic_sni: 'flow.v.quicSni',
dns_mapping: 'flow.v.dnsMapping',
explicit: 'flow.v.explicit'
};
export const word = (value: string | null | undefined): string | MessageRef => (value == null ? '—' : flowWords[value] ? {key: flowWords[value]} : value);