Skip to content

Commit b07362f

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

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
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. If you were still using the `GRAFANA_ANNOTATION_TAG_SELECTOR` annotation, it is now required you replace it with the `GRAFANA_ANNOTATION_DASHBOARD_SELECTOR` annotation.

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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ export const GRAFANA_ANNOTATION_DASHBOARD_SELECTOR =
8686
export const GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD =
8787
'grafana/overview-dashboard';
8888

89-
// @public @deprecated
90-
export const GRAFANA_ANNOTATION_TAG_SELECTOR = 'grafana/tag-selector';
91-
9289
// @public
9390
export interface GrafanaApi {
9491
alertsForSelector(selectors: string | string[]): Promise<Alert[]>;
@@ -105,18 +102,13 @@ export const grafanaPlugin: BackstagePlugin<{}, {}, {}>;
105102
export const isAlertSelectorAvailable: (entity: Entity) => boolean;
106103

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

112107
// @public
113108
export const isOverviewDashboardAvailable: (entity: Entity) => boolean;
114109

115110
// @public
116111
export const overviewDashboardFromEntity: (entity: Entity) => string;
117112

118-
// @public @deprecated
119-
export const tagSelectorFromEntity: (entity: Entity) => string;
120-
121113
// (No @packageDocumentation comment for this package)
122114
```

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 & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616

1717
import { Entity } from '@backstage/catalog-model';
1818

19-
/**
20-
* Grafana tag selector annotation
21-
* @public
22-
* @deprecated Use GRAFANA_ANNOTATION_DASHBOARD_SELECTOR instead.
23-
*/
24-
export const GRAFANA_ANNOTATION_TAG_SELECTOR = 'grafana/tag-selector';
25-
2619
/**
2720
* Grafana dashboard selector annotation
2821
* @public
@@ -49,8 +42,7 @@ export const GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD =
4942
* @public
5043
*/
5144
export const isDashboardSelectorAvailable = (entity: Entity) =>
52-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ||
53-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_TAG_SELECTOR];
45+
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ?? '';
5446

5547
/**
5648
* Returns if the alert selector annotation for an entity is set
@@ -75,9 +67,7 @@ export const isOverviewDashboardAvailable = (entity: Entity) =>
7567
* @public
7668
*/
7769
export const dashboardSelectorFromEntity = (entity: Entity) =>
78-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ??
79-
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_TAG_SELECTOR] ??
80-
'';
70+
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_DASHBOARD_SELECTOR] ?? '';
8171
/**
8272
* Returns the alert selector annotation for an entity
8373
* @public
@@ -99,10 +89,3 @@ export const alertSelectorFromEntity = (entity: Entity) => {
9989
*/
10090
export const overviewDashboardFromEntity = (entity: Entity) =>
10191
entity?.metadata.annotations?.[GRAFANA_ANNOTATION_OVERVIEW_DASHBOARD] ?? '';
102-
103-
/**
104-
* Returns the dashboard selector annotation for an entity
105-
* @public
106-
* @deprecated Use dashboardSelectorFromEntity instead
107-
*/
108-
export const tagSelectorFromEntity = dashboardSelectorFromEntity;

0 commit comments

Comments
 (0)