/** * How long a source may stay "deleting" before the UI gives up waiting. A stuck * teardown must not leave "Add source" disabled forever. */ export declare const SOURCE_DELETION_TIMEOUT_MS = 120000; export interface DeletingSource { name: string; /** Captured when the delete starts — the form no longer holds the source afterwards. */ typeLabel?: string; } export interface SourceDeletion { /** Sources whose removal RDI has not finished yet, in the order they started. */ deletingSources: DeletingSource[]; /** True while any source is being removed — gates "Add source". */ isDeletionInProgress: boolean; /** Call right before the delete request; the source is tracked from that moment. */ beginDelete: (source: DeletingSource) => void; /** Call when the delete request failed and the form was restored. */ cancelDelete: (name: string) => void; } /** * Tracks the sources RDI is still removing. * * Deleting a source from an ongoing pipeline is a full-config redeploy: the API * accepts the new config in milliseconds, but the collector keeps running for * much longer. The completion signal is the already-polled pipeline status — * the source's `collector-` component disappears from `components` once * the teardown is done (see {@link getDeletingSourceNames}). * * A tracked source therefore has two lives: * - **locally started** — from `beginDelete` until the pipeline config refetch * drops the source. Needed because until then the source is still configured, * so nothing looks orphaned yet and the UI would flicker back to "idle". * - **server observed** — a collector with no configured source. This is the * authoritative signal and, because it is derived, it survives the Manage-tab * remounts that reset in-tree React state. * - **given up on** — a teardown that outlived {@link SOURCE_DELETION_TIMEOUT_MS}. * The orphan observation does not go away on its own, so the name is * remembered as timed out and skipped, otherwise the very next poll would * re-adopt it and the card, the disabled button and the warning would cycle * forever. The name is forgiven once the observation genuinely changes: the * collector disappears, or the source is configured again. * * Called once per surface tree (the dashboard) and drilled down as props, so the * button and the source cards can never disagree about what is being deleted. */ export declare const useSourceDeletion: () => SourceDeletion;