diff --git a/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx b/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx index 88e1442f94b..2b0dba246f2 100644 --- a/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx @@ -69,8 +69,7 @@ export const CloudReceiverForm = ({ contactPoint, alertManagerSourceName, readOn // this basically checks if we can manage the selected alert manager data source, either because it's a Grafana Managed one // or a Mimir-based AlertManager - const isManageableAlertManagerDataSource = - !readOnly ?? !isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName); + const isManageableAlertManagerDataSource = !readOnly && !isVanillaAM; return ( <> diff --git a/public/app/features/alerting/unified/components/rules/central-state-history/EventDetails.tsx b/public/app/features/alerting/unified/components/rules/central-state-history/EventDetails.tsx index 2e3fff3dac2..a037703c420 100644 --- a/public/app/features/alerting/unified/components/rules/central-state-history/EventDetails.tsx +++ b/public/app/features/alerting/unified/components/rules/central-state-history/EventDetails.tsx @@ -180,7 +180,8 @@ function StateVisualization({ ruleUID, timeRange, labels }: StateVisualizationPr return null; } - const numberOfTransitions = dataFrames[0]?.fields[0]?.values?.length - 1 ?? 0; // we subtract 1 as the first value is the initial state + // we subtract 1 as the first value is the initial state + const numberOfTransitions = dataFrames[0]?.fields[0]?.values?.length - 1 || 0; return ( <> diff --git a/public/app/features/canvas/runtime/frame.tsx b/public/app/features/canvas/runtime/frame.tsx index 8ed68e62b2f..1ffb1d6c3af 100644 --- a/public/app/features/canvas/runtime/frame.tsx +++ b/public/app/features/canvas/runtime/frame.tsx @@ -135,7 +135,7 @@ export class FrameState extends ElementState { if (shiftItemsOnDuplicate) { const { constraint, placement: oldPlacement } = element.options; const { vertical, horizontal } = constraint ?? {}; - const placement: Placement = { ...oldPlacement } ?? {}; + const placement: Placement = { ...oldPlacement }; switch (vertical) { case VerticalConstraint.Top: diff --git a/public/app/features/commandPalette/actions/staticActions.ts b/public/app/features/commandPalette/actions/staticActions.ts index ed82e1cf994..ca70c8f7c1f 100644 --- a/public/app/features/commandPalette/actions/staticActions.ts +++ b/public/app/features/commandPalette/actions/staticActions.ts @@ -8,7 +8,7 @@ import { ACTIONS_PRIORITY, DEFAULT_PRIORITY, PREFERENCES_PRIORITY } from '../val // TODO: Clean this once ID is mandatory on nav items function idForNavItem(navItem: NavModelItem) { - return 'navModel.' + navItem.id ?? navItem.url ?? navItem.text ?? navItem.subTitle; + return 'navModel.' + (navItem.id ?? navItem.url ?? navItem.text ?? navItem.subTitle); } function navTreeToActions(navTree: NavModelItem[], parents: NavModelItem[] = []): CommandPaletteAction[] { diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts index 618d684ab16..02efa8b8ff0 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -855,7 +855,7 @@ export class DashboardMigrator { // Update any overrides referencing the cell display mode if (panel.fieldConfig?.overrides) { for (const override of panel.fieldConfig.overrides) { - for (let j = 0; j < override.properties?.length ?? 0; j++) { + for (let j = 0; j < (override.properties?.length || 0); j++) { let overrideDisplayMode = override.properties[j].value; if (override.properties[j].id === 'custom.displayMode') { override.properties[j].id = 'custom.cellOptions'; diff --git a/public/app/features/transformers/calculateHeatmap/heatmap.ts b/public/app/features/transformers/calculateHeatmap/heatmap.ts index 068e9a1c3ec..0b086eb0907 100644 --- a/public/app/features/transformers/calculateHeatmap/heatmap.ts +++ b/public/app/features/transformers/calculateHeatmap/heatmap.ts @@ -57,8 +57,8 @@ export const heatmapTransformer: SynchronousDataTransformerInfo s.value === query?.selectorName ?? '')} + value={[...SELECTORS, ...templateVariableOptions].find((s) => s.value === query?.selectorName)} options={[ { label: 'Template Variables', diff --git a/public/app/plugins/panel/canvas/components/connections/Connections.tsx b/public/app/plugins/panel/canvas/components/connections/Connections.tsx index d2e9a76fba9..3e402dfe47d 100644 --- a/public/app/plugins/panel/canvas/components/connections/Connections.tsx +++ b/public/app/plugins/panel/canvas/components/connections/Connections.tsx @@ -208,8 +208,8 @@ export class Connections { return; } - const x = event.pageX - parentBoundingRect.x ?? 0; - const y = event.pageY - parentBoundingRect.y ?? 0; + const x = event.pageX - (parentBoundingRect.x ?? 0); + const y = event.pageY - (parentBoundingRect.y ?? 0); this.connectionLine.setAttribute('x2', `${x / transformScale}`); this.connectionLine.setAttribute('y2', `${y / transformScale}`); @@ -328,8 +328,8 @@ export class Connections { return; } - const x = (event.pageX - parentBoundingRect.x) / transformScale ?? 0; - const y = (event.pageY - parentBoundingRect.y) / transformScale ?? 0; + const x = (event.pageX - parentBoundingRect.x) / transformScale; + const y = (event.pageY - parentBoundingRect.y) / transformScale; this.connectionVertex?.setAttribute('cx', `${x}`); this.connectionVertex?.setAttribute('cy', `${y}`); @@ -483,8 +483,8 @@ export class Connections { return; } - const x = (event.pageX - parentBoundingRect.x) / transformScale ?? 0; - const y = (event.pageY - parentBoundingRect.y) / transformScale ?? 0; + const x = (event.pageX - parentBoundingRect.x) / transformScale; + const y = (event.pageY - parentBoundingRect.y) / transformScale; this.connectionVertex?.setAttribute('cx', `${x}`); this.connectionVertex?.setAttribute('cy', `${y}`); diff --git a/public/app/plugins/panel/geomap/utils/getLayersExtent.ts b/public/app/plugins/panel/geomap/utils/getLayersExtent.ts index 425009cbec1..2ab535a61d7 100644 --- a/public/app/plugins/panel/geomap/utils/getLayersExtent.ts +++ b/public/app/plugins/panel/geomap/utils/getLayersExtent.ts @@ -20,19 +20,19 @@ export function getLayersExtent( } else if (l instanceof VectorLayer || l instanceof VectorImage) { if (allLayers) { // Return everything from all layers - return [l.getSource().getExtent()] ?? []; + return [l.getSource().getExtent()]; } else if (lastOnly && layer === ll.options.name) { // Return last only for selected layer const feat = l.getSource().getFeatures(); const featOfInterest = feat[feat.length - 1]; const geo = featOfInterest?.getGeometry(); if (geo) { - return [geo.getExtent()] ?? []; + return [geo.getExtent()]; } return []; } else if (!lastOnly && layer === ll.options.name) { // Return all points for selected layer - return [l.getSource().getExtent()] ?? []; + return [l.getSource().getExtent()]; } return []; } else { diff --git a/public/app/plugins/panel/timeseries/utils.ts b/public/app/plugins/panel/timeseries/utils.ts index b4569ef51b9..fb5ca669376 100644 --- a/public/app/plugins/panel/timeseries/utils.ts +++ b/public/app/plugins/panel/timeseries/utils.ts @@ -137,7 +137,7 @@ export function prepareGraphableFields( const frameFields = nullToValue(nulledFrame).fields; - for (let fieldIdx = 0; fieldIdx < frameFields?.length ?? 0; fieldIdx++) { + for (let fieldIdx = 0; fieldIdx < (frameFields?.length || 0); fieldIdx++) { const field = frameFields[fieldIdx]; switch (field.type) {