From 55ec05b5605cabab6c948a24db05bb89a05fa329 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Thu, 13 Jan 2022 16:23:49 +0100 Subject: [PATCH] Alerting: remove dead code (#43956) --- .../unified/utils/alertmanager.test.ts | 21 +------------------ .../alerting/unified/utils/alertmanager.ts | 8 ------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/public/app/features/alerting/unified/utils/alertmanager.test.ts b/public/app/features/alerting/unified/utils/alertmanager.test.ts index 408764ce083..a3bc0e6f067 100644 --- a/public/app/features/alerting/unified/utils/alertmanager.test.ts +++ b/public/app/features/alerting/unified/utils/alertmanager.test.ts @@ -1,12 +1,6 @@ import { Matcher, MatcherOperator, Route } from 'app/plugins/datasource/alertmanager/types'; import { Labels } from 'app/types/unified-alerting-dto'; -import { - parseMatcher, - parseMatchers, - stringifyMatcher, - labelsMatchMatchers, - removeMuteTimingFromRoute, -} from './alertmanager'; +import { parseMatcher, parseMatchers, labelsMatchMatchers, removeMuteTimingFromRoute } from './alertmanager'; describe('Alertmanager utils', () => { describe('parseMatcher', () => { @@ -61,19 +55,6 @@ describe('Alertmanager utils', () => { }); }); - describe('stringifyMatcher', () => { - it('should stringify matcher correctly', () => { - expect( - stringifyMatcher({ - name: 'foo', - value: 'boo="bar"', - isRegex: true, - isEqual: false, - }) - ).toEqual('foo!~"boo=\\"bar\\""'); - }); - }); - describe('parseMatchers', () => { it('should parse all operators', () => { expect(parseMatchers('foo=bar, bar=~ba.+, severity!=warning, email!~@grafana.com')).toEqual([ diff --git a/public/app/features/alerting/unified/utils/alertmanager.ts b/public/app/features/alerting/unified/utils/alertmanager.ts index 236b5366bc2..4b2c27ad119 100644 --- a/public/app/features/alerting/unified/utils/alertmanager.ts +++ b/public/app/features/alerting/unified/utils/alertmanager.ts @@ -125,14 +125,6 @@ function unescapeMatcherValue(value: string) { return trimmed.replace(/\\"/g, '"'); } -function escapeMatcherValue(value: string) { - return '"' + value.replace(/"/g, '\\"') + '"'; -} - -export function stringifyMatcher(matcher: Matcher): string { - return `${matcher.name}${matcherToOperator(matcher)}${escapeMatcherValue(matcher.value)}`; -} - export function parseMatcher(matcher: string): Matcher { const trimmed = matcher.trim(); if (trimmed.startsWith('{') && trimmed.endsWith('}')) {