UI: AlertStateChip.LABELS and .COLORS no longer include ACKNOWLEDGED (dropped in V17). AlertStateChip.test.tsx test-cases trimmed to the three remaining states. LayoutShell CMD-K now searches FIRING alerts with acked=false (was state=[FIRING,ACKNOWLEDGED]). Test: V17MigrationIT.open_rule_index_predicate_is_reworked replaced with a structural-only assertion (index exists, indisunique). The pg_get_indexdef pretty-printer varies across Postgres versions, so predicate semantics are verified behaviorally in PostgresAlertInstanceRepositoryIT (findOpenForRule_* + save_rejectsSecondOpenInstanceForSameRuleAndExchange). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
757 B
TypeScript
26 lines
757 B
TypeScript
import { Badge } from '@cameleer/design-system';
|
|
import type { AlertDto } from '../api/queries/alerts';
|
|
|
|
type State = NonNullable<AlertDto['state']>;
|
|
|
|
const LABELS: Record<State, string> = {
|
|
PENDING: 'Pending',
|
|
FIRING: 'Firing',
|
|
RESOLVED: 'Resolved',
|
|
};
|
|
|
|
const COLORS: Record<State, 'auto' | 'success' | 'warning' | 'error'> = {
|
|
PENDING: 'warning',
|
|
FIRING: 'error',
|
|
RESOLVED: 'success',
|
|
};
|
|
|
|
export function AlertStateChip({ state, silenced }: { state: State; silenced?: boolean }) {
|
|
return (
|
|
<span style={{ display: 'inline-flex', gap: 4, alignItems: 'center' }}>
|
|
<Badge label={LABELS[state]} color={COLORS[state]} variant="filled" />
|
|
{silenced && <Badge label="Silenced" color="auto" variant="outlined" />}
|
|
</span>
|
|
);
|
|
}
|