fix: resolve CI failures from navigation refactoring

TypeScript fixes:
- Add 'as const' to icon type in useAlertRulesNav.test.tsx for proper type narrowing
- Remove unused imports in NotificationPoliciesPage.test.tsx and ContactPoints.test.tsx
- Remove unused import in triage/Triage.tsx
- Restore missing useURLSearchParams import in ContactPoints.tsx
- Restore ActiveTab enum export (used by template pages for URL generation)

Go lint fixes:
- Move nolint:staticcheck comment to line directly before flagged usage in navtree.go

i18n:
- Run yarn i18n-extract to update translation files

All tests passing:
- Backend navtree tests: ✅
- TypeScript compilation: ✅
This commit is contained in:
Alejandro Fraenkel
2026-01-13 13:12:24 +01:00
parent 30bacc4ef1
commit 2635a67630
7 changed files with 25 additions and 28 deletions
+1 -1
View File
@@ -436,8 +436,8 @@ func (s *ServiceImpl) buildAlertNavLinks(c *contextmodel.ReqContext) *navtree.Na
hasAccess := ac.HasAccess(s.accessControl, c)
var alertChildNavs []*navtree.NavLink
//nolint:staticcheck // not yet migrated to OpenFeature
var alertActivityChildren []*navtree.NavLink
//nolint:staticcheck // not yet migrated to OpenFeature
if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagAlertingTriage) {
if hasAccess(ac.EvalAny(ac.EvalPermission(ac.ActionAlertingRuleRead), ac.EvalPermission(ac.ActionAlertingRuleExternalRead))) {
alertActivityChildren = append(alertActivityChildren, &navtree.NavLink{
@@ -1,6 +1,6 @@
import { produce } from 'immer';
import { clickSelectOption } from 'test/helpers/selectOptionInTest';
import { render, screen, testWithFeatureToggles, userEvent, within } from 'test/test-utils';
import { render, screen, userEvent, within } from 'test/test-utils';
import { byLabelText, byRole, byTestId } from 'testing-library-selector';
import { AppNotificationList } from 'app/core/components/AppNotifications/AppNotificationList';
@@ -1,14 +1,6 @@
import { MemoryHistoryBuildOptions } from 'history';
import { ComponentProps, ReactNode } from 'react';
import {
render,
screen,
testWithFeatureToggles,
userEvent,
waitFor,
waitForElementToBeRemoved,
within,
} from 'test/test-utils';
import { render, screen, userEvent, waitFor, waitForElementToBeRemoved, within } from 'test/test-utils';
import { selectors } from '@grafana/e2e-selectors';
import { MIMIR_DATASOURCE_UID } from 'app/features/alerting/unified/mocks/server/constants';
@@ -7,6 +7,7 @@ import { AccessControlAction } from 'app/types/accessControl';
import { AlertmanagerAction, useAlertmanagerAbility } from '../../hooks/useAbilities';
import { usePagination } from '../../hooks/usePagination';
import { useURLSearchParams } from '../../hooks/useURLSearchParams';
import { useNotificationConfigNav } from '../../navigation/useNotificationConfigNav';
import { useAlertmanager } from '../../state/AlertmanagerContext';
import { isExtraConfig } from '../../utils/alertmanager/extraConfigs';
@@ -23,6 +24,11 @@ import { useContactPointsSearch } from './useContactPointsSearch';
import { ALL_CONTACT_POINTS, useExportContactPoint } from './useExportContactPoint';
import { ContactPointWithMetadata } from './utils';
export enum ActiveTab {
ContactPoints = 'contact_points',
NotificationTemplates = 'templates',
}
const DEFAULT_PAGE_SIZE = 10;
const ContactPointsTab = () => {
@@ -11,7 +11,7 @@ describe('useAlertRulesNav', () => {
id: 'alert-rules',
text: 'Alert rules',
url: '/alerting/list',
icon: 'list-ul',
icon: 'list-ul' as const,
},
'alert-rules-list': {
id: 'alert-rules-list',
@@ -1,4 +1,3 @@
import { t } from '@grafana/i18n';
import { UrlSyncContextProvider } from '@grafana/scenes';
import { withErrorBoundary } from '@grafana/ui';
+15 -15
View File
@@ -938,10 +938,6 @@
"label-search-by-name-or-type": "Search by name or type",
"placeholder-search": "Search"
},
"contact-points-page-contents": {
"label-contact-points": "Contact Points",
"label-notification-templates": "Notification Templates"
},
"contact-points-tab": {
"aria-label-add-contact-point": "add contact point",
"aria-label-export-all": "export all",
@@ -1645,7 +1641,9 @@
"insights": {
"monitor-status-of-system": "Monitor the status of your system",
"monitor-status-system-tooltip": "Alerting insights provides pre-built dashboards to monitor your alerting data.",
"monitor-status-system-tooltip-identify": "You can identify patterns in why things go wrong and discover trends in alerting performance within your organization."
"monitor-status-system-tooltip-identify": "You can identify patterns in why things go wrong and discover trends in alerting performance within your organization.",
"not-available": "Insights are not available. Please configure the required data sources.",
"subtitle": "Analytics and history for alerting"
},
"insights-menu-button-renderer": {
"aria-label-rate-this-panel": "Rate this panel",
@@ -1928,6 +1926,18 @@
"select-group": "Select group",
"select-namespace": "Select namespace"
},
"navigation": {
"active-notifications": "Active notifications",
"alert-rules": "Alert rules",
"alert-state-history": "Alert state history",
"alerts": "Alerts",
"contact-points": "Contact points",
"notification-policies": "Notification policies",
"notification-templates": "Notification templates",
"recently-deleted": "Recently deleted",
"system-insights": "System Insights",
"time-intervals": "Time intervals"
},
"need-help-info": {
"need-help": "Need help?"
},
@@ -1976,10 +1986,6 @@
"title-error-loading-alertmanager-config": "Error loading Alertmanager config",
"title-notification-policies-have-changed": "Notification policies have changed"
},
"notification-policies-tabs": {
"label-notification-policies": "Notification Policies",
"label-time-intervals": "Time intervals"
},
"notification-policy-drawer": {
"view-notification-policy-tree": "View notification policy tree"
},
@@ -2045,12 +2051,6 @@
"body-selected-alertmanager-not-found": "The selected Alertmanager no longer exists or you may not have permission to access it. You can select a different Alertmanager from the dropdown.",
"title-selected-alertmanager-not-found": "Selected Alertmanager not found."
},
"pages": {
"triage": {
"subtitle": "See what is currently alerting and explore historical data to investigate current or past issues.",
"title": "Alerts"
}
},
"panel-alert-tab-content": {
"alert": {
"title-errors-loading-rules": "Errors loading rules"