Skip to content

Commit c256f8f

Browse files
committed
enable list deprecations for workspace and resolve existing
Signed-off-by: Kurt King <[email protected]>
1 parent e6f17b0 commit c256f8f

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-grafana': minor
3+
---
4+
5+
All existing deprecated references have been removed.

workspaces/grafana/bcp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"autoVersionBump": true,
3-
"knipReports": false
3+
"knipReports": false,
4+
"listDeprecations": true
45
}

workspaces/grafana/plugins/grafana/report.api.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ export const grafanaPlugin: BackstagePlugin<{}, {}, {}>;
105105
export const isAlertSelectorAvailable: (entity: Entity) => boolean;
106106

107107
// @public
108-
export const isDashboardSelectorAvailable: (
109-
entity: Entity,
110-
) => string | undefined;
108+
export const isDashboardSelectorAvailable: (entity: Entity) => string;
111109

112110
// @public
113111
export const isOverviewDashboardAvailable: (entity: Entity) => boolean;

workspaces/grafana/plugins/grafana/src/__fixtures__/entity.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
GRAFANA_ANNOTATION_ALERT_LABEL_SELECTOR,
1818
GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD,
1919
GRAFANA_ANNOTATION_DASHBOARD_SELECTOR,
20-
GRAFANA_ANNOTATION_TAG_SELECTOR,
2120
} from '../constants';
2221

2322
export const sampleEntity = {
@@ -28,7 +27,6 @@ export const sampleEntity = {
2827
name: 'awesome-service',
2928
annotations: {
3029
[GRAFANA_ANNOTATION_ALERT_LABEL_SELECTOR]: 'service=awesome-service',
31-
[GRAFANA_ANNOTATION_TAG_SELECTOR]: 'awesome-tag',
3230
[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR]:
3331
"(tags @> 'my-service' || tags @> 'my-service-slo') && tags @> 'generated'",
3432
[GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD]:

workspaces/grafana/plugins/grafana/src/components/AlertsCard/AlertsCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ import useAsync from 'react-use/lib/useAsync';
3737
import { Alert } from '@material-ui/lab';
3838
import { AlertsCardOpts, Alert as GrafanaAlert } from '../../types';
3939
import {
40-
GRAFANA_ANNOTATION_TAG_SELECTOR,
4140
GRAFANA_ANNOTATION_ALERT_LABEL_SELECTOR,
4241
isAlertSelectorAvailable,
4342
isDashboardSelectorAvailable,
44-
tagSelectorFromEntity,
4543
alertSelectorFromEntity,
44+
GRAFANA_ANNOTATION_DASHBOARD_SELECTOR,
45+
dashboardSelectorFromEntity,
4646
} from '../../constants';
4747

4848
const AlertStatusBadge = ({ alert }: { alert: GrafanaAlert }) => {
@@ -128,7 +128,7 @@ const Alerts = ({ entity, opts }: { entity: Entity; opts: AlertsCardOpts }) => {
128128
configApi.getOptionalBoolean('grafana.unifiedAlerting') || false;
129129
const alertSelector = unifiedAlertingEnabled
130130
? alertSelectorFromEntity(entity)
131-
: tagSelectorFromEntity(entity);
131+
: dashboardSelectorFromEntity(entity);
132132

133133
const { value, loading, error } = useAsync(
134134
async () => await grafanaApi.alertsForSelector(alertSelector),
@@ -152,7 +152,7 @@ export const AlertsCard = (opts?: AlertsCardOpts) => {
152152
if (!unifiedAlertingEnabled && !isDashboardSelectorAvailable(entity)) {
153153
return (
154154
<MissingAnnotationEmptyState
155-
annotation={GRAFANA_ANNOTATION_TAG_SELECTOR}
155+
annotation={GRAFANA_ANNOTATION_DASHBOARD_SELECTOR}
156156
/>
157157
);
158158
}

workspaces/grafana/plugins/grafana/src/constants.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ export const GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD =
4949
* @public
5050
*/
5151
export const isDashboardSelectorAvailable = (entity: Entity) =>
52-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ||
53-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_TAG_SELECTOR];
52+
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ?? '';
5453

5554
/**
5655
* Returns if the alert selector annotation for an entity is set
@@ -75,9 +74,7 @@ export const isOverviewDashboardAvailable = (entity: Entity) =>
7574
* @public
7675
*/
7776
export const dashboardSelectorFromEntity = (entity: Entity) =>
78-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ??
79-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_TAG_SELECTOR] ??
80-
'';
77+
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ?? '';
8178
/**
8279
* Returns the alert selector annotation for an entity
8380
* @public

0 commit comments

Comments
 (0)