mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-05 08:00:59 +00:00
chore(features): remove unused exports and dialog state
Keep implementation types private, remove unused template option snapshots and the node-link re-export, and align comments with existing behavior. No consumer needs the removed surface.
This commit is contained in:
1 parent
57898f9424
commit
616b671d87
8 files changed
+12
-17
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import {isNodeLink} from '../../dae/nodes';
|
||||
export {isNodeLink} from '../../dae/nodes';
|
||||
import type {Capabilities, ConfigSource, HealthObservation, Node, Provider, ProviderCreate} from '../../api/model';
|
||||
import {enumLabel} from '../../i18n/enum';
|
||||
import {
|
||||
@@ -220,7 +219,6 @@ export function providerRows(providers: Provider[], nodes: Node[], entries: Subs
|
||||
return {list: [...pseudo, ...rows]};
|
||||
}
|
||||
|
||||
// Null selects loose nodes; built-in outbounds have their own provenance.
|
||||
// The provider the link names while it is listed; a stale one falls back to the first real source, not every node.
|
||||
export function selectedProvider(list: ProviderRow[], requested: string | null): string | null {
|
||||
if (requested !== null && list.some(item => item.id === requested)) return requested;
|
||||
|
||||
@@ -12,15 +12,15 @@ import {addRuleReason, addRuleTip, removalView, ruleDraftView, type ReasonKeys,
|
||||
import {useDraftGuard} from '../../shell/draft';
|
||||
|
||||
// A rule of either list as the editor needs it: GET /rules and GET /dns/rules entries share these fields.
|
||||
export type EditedRule = {rule_id: string; kind: 'rule' | 'fallback'; expression: string; source: RuleSource | null};
|
||||
type EditedRule = {rule_id: string; kind: 'rule' | 'fallback'; expression: string; source: RuleSource | null};
|
||||
// An edit starts from the located source condition and the listed target.
|
||||
export type Opened<R> = {kind: 'add'; preset?: RuleSeed} | {kind: 'remove'; rule: R} | {kind: 'edit'; rule: R; outbound: string; must: boolean};
|
||||
type Opened<R> = {kind: 'add'; preset?: RuleSeed} | {kind: 'remove'; rule: R} | {kind: 'edit'; rule: R; outbound: string; must: boolean};
|
||||
type Dialog<R> = Opened<R> & {
|
||||
generation: string;
|
||||
sources: ConfigSource[];
|
||||
rules: R[];
|
||||
};
|
||||
export type RuleForm = {condition: string; outbound: string; must: boolean; before: string};
|
||||
type RuleForm = {condition: string; outbound: string; must: boolean; before: string};
|
||||
export type RuleEditorModel = {
|
||||
canWrite: boolean;
|
||||
busy: boolean;
|
||||
@@ -46,7 +46,7 @@ export type RuleEditorModel = {
|
||||
// Why the switch back to Select was refused, shown under the expression.
|
||||
expressionHint: string | null;
|
||||
};
|
||||
export type RuleEditorOptions<R extends EditedRule> = {
|
||||
type RuleEditorOptions<R extends EditedRule> = {
|
||||
canWrite: boolean;
|
||||
// The listed rules and the configuration they were read with; an edit needs both from one generation.
|
||||
list: {rules: R[]; generation_id: string} | undefined;
|
||||
|
||||
@@ -38,7 +38,6 @@ import {
|
||||
// If-Match names, so a change on disk since is refused rather than overwritten. `withDns` is the same write with the
|
||||
// DNS split appended, offered while the configuration has no `dns` block.
|
||||
type Pending = {
|
||||
options: TemplateOptions;
|
||||
optionImpact: string[];
|
||||
choice: TemplateChoice;
|
||||
source: ConfigSource;
|
||||
@@ -159,7 +158,6 @@ export function useRuleTemplates({go, query}: PageProps): RuleTemplatesModel {
|
||||
setAddDns(true);
|
||||
setInvalid(null);
|
||||
setDialog({
|
||||
options,
|
||||
optionImpact: templateOptionKeys
|
||||
.filter(key => view.current && options[key] !== view[key])
|
||||
.map(key => t(templateOptionText[key][options[key] ? 'on' : 'off'])),
|
||||
@@ -176,7 +174,6 @@ export function useRuleTemplates({go, query}: PageProps): RuleTemplatesModel {
|
||||
});
|
||||
},
|
||||
dialog: dialog && {
|
||||
options: dialog.options,
|
||||
optionImpact: dialog.optionImpact,
|
||||
choice: dialog.choice,
|
||||
source: dialog.source,
|
||||
|
||||
@@ -14,7 +14,7 @@ const blankForm = {
|
||||
pname: '',
|
||||
dscp: '',
|
||||
mark: '',
|
||||
// Null until the backend says what it offers: live when it can resolve, else none.
|
||||
// Null keeps resolution automatic: live or DNS query for a domain when offered, otherwise none.
|
||||
resolve: null as TraceResolve | null
|
||||
};
|
||||
// Held by the rules page rather than the trace tab, so what was typed survives a tab switch. A link that names a
|
||||
|
||||
@@ -2,7 +2,7 @@ import {configManagement, engineOf, type EngineAction, type EngineReason} from '
|
||||
import type {Capabilities, RuntimeSettings, Version} from '../../api/model';
|
||||
|
||||
// The resources the overview's feature list shows, in its order.
|
||||
export const limitResources = [
|
||||
const limitResources = [
|
||||
'connections',
|
||||
'flows',
|
||||
'routing_trace',
|
||||
@@ -28,7 +28,7 @@ const unlisted = ['dns_rules', 'reload', 'suspend', 'resume'] as const;
|
||||
export type LimitId = Resource | (typeof unlisted)[number] | EngineAction;
|
||||
|
||||
// Why features are off, in the order the overview lists them.
|
||||
export const limitCauses = [
|
||||
const limitCauses = [
|
||||
'configNotLoaded',
|
||||
'configReadOnly',
|
||||
'mainReadOnly',
|
||||
@@ -42,7 +42,7 @@ export const limitCauses = [
|
||||
'notProvided'
|
||||
] as const;
|
||||
export type LimitCause = (typeof limitCauses)[number];
|
||||
export type LimitClass = {cause: LimitCause; ids: LimitId[]};
|
||||
type LimitClass = {cause: LimitCause; ids: LimitId[]};
|
||||
|
||||
// The group a resource that is off joins by the engine's reason; one the engine gives no such reason for is not
|
||||
// provided, or, for flows that are off, idle.
|
||||
|
||||
@@ -29,7 +29,7 @@ export function outboundTag(name: string | null, groups: ReadonlyArray<{id: stri
|
||||
|
||||
// The routing trace with its form filled in from a link: the target, and the source and process when the link knows
|
||||
// them. The person runs the trace.
|
||||
export type TraceLink = {network: 'tcp' | 'udp'; domain: string; dst_ip: string; dst_port: string; src_ip: string; src_port: string; pname: string};
|
||||
type TraceLink = {network: 'tcp' | 'udp'; domain: string; dst_ip: string; dst_port: string; src_ip: string; src_port: string; pname: string};
|
||||
const traceKeys = ['network', 'domain', 'dst_ip', 'dst_port', 'src_ip', 'src_port', 'pname'] as const;
|
||||
export const traceQuery = (link: Partial<TraceLink>) => within('', {tab: 'trace', ...Object.fromEntries(traceKeys.map(key => [key, link[key] || null]))});
|
||||
// Null when the link names no target, so a plain visit to the tab keeps what was typed.
|
||||
|
||||
@@ -55,7 +55,7 @@ export const answerAddresses = (answers: ReadonlyArray<Pick<DnsLogRecord['answer
|
||||
...new Set(answers.filter(answer => answer.type === 'A' || answer.type === 'AAAA').map(answer => answer.data))
|
||||
];
|
||||
|
||||
export type RuleTarget = {kind: RuleConditionKind; condition: string};
|
||||
type RuleTarget = {kind: RuleConditionKind; condition: string};
|
||||
// Every condition the seed allows in a list, the default first, each address as one host; a value dae cannot hold is
|
||||
// left out. Routing: the exact domain, then its subdomains and keyword, the destination IP and the source IP. A DNS request: the
|
||||
// exact name, then its subdomains, and the client. A DNS response: each answered address, and the client.
|
||||
@@ -156,7 +156,7 @@ export function acceptedRule(rules: RoutingRule[], condition: string, outbound:
|
||||
}
|
||||
|
||||
// A listed rule as the duplicate notice compares it: its condition, and what it writes after its arrow.
|
||||
export type ListedTarget = {kind: 'rule' | 'fallback'; index: number; expression: string; target: string};
|
||||
type ListedTarget = {kind: 'rule' | 'fallback'; index: number; expression: string; target: string};
|
||||
// Where the list already holds a rule with this condition and target, or a rule held for it does, as the dialog says
|
||||
// it; null when neither does. The accepted rule is named first, since it already applies. DNS upstream names compare
|
||||
// without regard to case, as honk resolves them.
|
||||
|
||||
@@ -9,7 +9,7 @@ import {byFile, failureToast, insertRules, partialFailure, ruleFailure} from './
|
||||
import {ruleWritten} from './ruleNotice';
|
||||
|
||||
// How many rules reached their files, and the failure that stopped the rest, if any.
|
||||
export type ApplyOutcome = {written: number; failure: PendingFailure | null};
|
||||
type ApplyOutcome = {written: number; failure: PendingFailure | null};
|
||||
type FileOutcome = {written: boolean; failure: PendingFailure | null};
|
||||
|
||||
const reread = () => void refetchAll();
|
||||
|
||||
Reference in new issue
Block a user