@backstage-community/plugin-grafana 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/alpha/package.json +1 -1
- package/dist/alpha/apis.esm.js +24 -22
- package/dist/alpha/apis.esm.js.map +1 -1
- package/dist/alpha/entityCards.esm.js +16 -10
- package/dist/alpha/entityCards.esm.js.map +1 -1
- package/dist/alpha.d.ts +50 -1
- package/dist/alpha.esm.js +2 -2
- package/dist/alpha.esm.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
package/alpha/package.json
CHANGED
package/dist/alpha/apis.esm.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiBlueprint, createApiFactory, discoveryApiRef, identityApiRef, configApiRef, fetchApiRef } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { grafanaApiRef, GrafanaApiClient, UnifiedAlertingGrafanaApiClient } from '../api.esm.js';
|
|
3
3
|
|
|
4
|
-
const grafanaApiExtension =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const grafanaApiExtension = ApiBlueprint.make({
|
|
5
|
+
params: {
|
|
6
|
+
factory: createApiFactory({
|
|
7
|
+
api: grafanaApiRef,
|
|
8
|
+
deps: {
|
|
9
|
+
discoveryApi: discoveryApiRef,
|
|
10
|
+
identityApi: identityApiRef,
|
|
11
|
+
configApi: configApiRef,
|
|
12
|
+
fetchApi: fetchApiRef
|
|
13
|
+
},
|
|
14
|
+
factory: ({ discoveryApi, configApi, fetchApi }) => {
|
|
15
|
+
const unifiedAlertingEnabled = configApi.getOptionalBoolean("grafana.unifiedAlerting") || false;
|
|
16
|
+
if (!unifiedAlertingEnabled) {
|
|
17
|
+
return new GrafanaApiClient({
|
|
18
|
+
fetchApi,
|
|
19
|
+
discoveryApi,
|
|
20
|
+
domain: configApi.getString("grafana.domain"),
|
|
21
|
+
proxyPath: configApi.getOptionalString("grafana.proxyPath")
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return new UnifiedAlertingGrafanaApiClient({
|
|
17
25
|
fetchApi,
|
|
18
26
|
discoveryApi,
|
|
19
27
|
domain: configApi.getString("grafana.domain"),
|
|
20
28
|
proxyPath: configApi.getOptionalString("grafana.proxyPath")
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
discoveryApi,
|
|
26
|
-
domain: configApi.getString("grafana.domain"),
|
|
27
|
-
proxyPath: configApi.getOptionalString("grafana.proxyPath")
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
+
})
|
|
32
|
+
}
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
export { grafanaApiExtension };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"sourcesContent":["import {\n configApiRef,\n
|
|
1
|
+
{"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"sourcesContent":["import {\n configApiRef,\n ApiBlueprint,\n createApiFactory,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n GrafanaApiClient,\n grafanaApiRef,\n UnifiedAlertingGrafanaApiClient,\n} from '../api';\n\n/**\n * @alpha\n */\nexport const grafanaApiExtension = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: grafanaApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ discoveryApi, configApi, fetchApi }) => {\n const unifiedAlertingEnabled =\n configApi.getOptionalBoolean('grafana.unifiedAlerting') || false;\n\n if (!unifiedAlertingEnabled) {\n return new GrafanaApiClient({\n fetchApi,\n discoveryApi,\n domain: configApi.getString('grafana.domain'),\n proxyPath: configApi.getOptionalString('grafana.proxyPath'),\n });\n }\n\n return new UnifiedAlertingGrafanaApiClient({\n fetchApi,\n discoveryApi,\n domain: configApi.getString('grafana.domain'),\n proxyPath: configApi.getOptionalString('grafana.proxyPath'),\n });\n },\n }),\n },\n});\n"],"names":[],"mappings":";;;AAiBa,MAAA,mBAAA,GAAsB,aAAa,IAAK,CAAA;AAAA,EACnD,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,aAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,WAAa,EAAA,cAAA;AAAA,QACb,SAAW,EAAA,YAAA;AAAA,QACX,QAAU,EAAA,WAAA;AAAA,OACZ;AAAA,MACA,SAAS,CAAC,EAAE,YAAc,EAAA,SAAA,EAAW,UAAe,KAAA;AAClD,QAAA,MAAM,sBACJ,GAAA,SAAA,CAAU,kBAAmB,CAAA,yBAAyB,CAAK,IAAA,KAAA,CAAA;AAE7D,QAAA,IAAI,CAAC,sBAAwB,EAAA;AAC3B,UAAA,OAAO,IAAI,gBAAiB,CAAA;AAAA,YAC1B,QAAA;AAAA,YACA,YAAA;AAAA,YACA,MAAA,EAAQ,SAAU,CAAA,SAAA,CAAU,gBAAgB,CAAA;AAAA,YAC5C,SAAA,EAAW,SAAU,CAAA,iBAAA,CAAkB,mBAAmB,CAAA;AAAA,WAC3D,CAAA,CAAA;AAAA,SACH;AAEA,QAAA,OAAO,IAAI,+BAAgC,CAAA;AAAA,UACzC,QAAA;AAAA,UACA,YAAA;AAAA,UACA,MAAA,EAAQ,SAAU,CAAA,SAAA,CAAU,gBAAgB,CAAA;AAAA,UAC5C,SAAA,EAAW,SAAU,CAAA,iBAAA,CAAkB,mBAAmB,CAAA;AAAA,SAC3D,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
3
3
|
|
|
4
|
-
const entityGrafanaDashboardsCard =
|
|
4
|
+
const entityGrafanaDashboardsCard = EntityCardBlueprint.make({
|
|
5
5
|
name: "dashboards",
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
params: {
|
|
7
|
+
filter: "kind:component",
|
|
8
|
+
loader: () => import('../components/DashboardsCard/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.DashboardsCard, null))
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const entityGrafanaAlertsCard =
|
|
11
|
+
const entityGrafanaAlertsCard = EntityCardBlueprint.make({
|
|
10
12
|
name: "alerts",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
params: {
|
|
14
|
+
filter: "kind:component",
|
|
15
|
+
loader: () => import('../components/AlertsCard/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.AlertsCard, null))
|
|
16
|
+
}
|
|
13
17
|
});
|
|
14
|
-
const entityGrafanaOverviewDashboardViewer =
|
|
18
|
+
const entityGrafanaOverviewDashboardViewer = EntityCardBlueprint.make({
|
|
15
19
|
name: "overview-dashboard",
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
params: {
|
|
21
|
+
filter: "kind:component",
|
|
22
|
+
loader: () => import('../components/DashboardViewer/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.EntityDashboardViewer, null))
|
|
23
|
+
}
|
|
18
24
|
});
|
|
19
25
|
|
|
20
26
|
export { entityGrafanaAlertsCard, entityGrafanaDashboardsCard, entityGrafanaOverviewDashboardViewer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["import React from 'react';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\n\n/**\n * @alpha\n */\nexport const entityGrafanaDashboardsCard = EntityCardBlueprint.make({\n name: 'dashboards',\n params: {\n filter: 'kind:component',\n loader: () =>\n import('../components/DashboardsCard').then(m => <m.DashboardsCard />),\n },\n});\n\n/**\n * @alpha\n */\nexport const entityGrafanaAlertsCard = EntityCardBlueprint.make({\n name: 'alerts',\n params: {\n filter: 'kind:component',\n loader: () =>\n import('../components/AlertsCard').then(m => <m.AlertsCard />),\n },\n});\n\n/**\n * @alpha\n */\nexport const entityGrafanaOverviewDashboardViewer = EntityCardBlueprint.make({\n name: 'overview-dashboard',\n params: {\n filter: 'kind:component',\n loader: () =>\n import('../components/DashboardViewer').then(m => (\n <m.EntityDashboardViewer />\n )),\n },\n});\n"],"names":[],"mappings":";;;AAMa,MAAA,2BAAA,GAA8B,oBAAoB,IAAK,CAAA;AAAA,EAClE,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,gBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,2CAA8B,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAAM,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,cAAF,EAAA,IAAiB,CAAE,CAAA;AAAA,GACzE;AACF,CAAC,EAAA;AAKY,MAAA,uBAAA,GAA0B,oBAAoB,IAAK,CAAA;AAAA,EAC9D,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,gBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,uCAA0B,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAAM,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,UAAF,EAAA,IAAa,CAAE,CAAA;AAAA,GACjE;AACF,CAAC,EAAA;AAKY,MAAA,oCAAA,GAAuC,oBAAoB,IAAK,CAAA;AAAA,EAC3E,IAAM,EAAA,oBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,gBAAA;AAAA,IACR,MAAA,EAAQ,MACN,OAAO,4CAA+B,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAC1C,KAAA,CAAA,aAAA,CAAA,CAAA,CAAE,qBAAF,EAAA,IAAwB,CAC1B,CAAA;AAAA,GACL;AACF,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,10 +1,59 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
3
|
+
import * as react from 'react';
|
|
1
4
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
5
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* The Grafana backstage plugin.
|
|
5
9
|
*
|
|
6
10
|
* @alpha
|
|
7
11
|
*/
|
|
8
|
-
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{}, {}
|
|
12
|
+
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{}, {}, {
|
|
13
|
+
"api:grafana": _backstage_frontend_plugin_api.ExtensionDefinition<{}, {}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_core_plugin_api.AnyApiFactory, "core.api.factory", {}>, {}, {
|
|
14
|
+
kind: "api";
|
|
15
|
+
namespace: undefined;
|
|
16
|
+
name: undefined;
|
|
17
|
+
}>;
|
|
18
|
+
"entity-card:grafana/dashboards": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
19
|
+
filter: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
filter?: string | undefined;
|
|
22
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
23
|
+
optional: true;
|
|
24
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
25
|
+
optional: true;
|
|
26
|
+
}>, {}, {
|
|
27
|
+
kind: "entity-card";
|
|
28
|
+
namespace: undefined;
|
|
29
|
+
name: "dashboards";
|
|
30
|
+
}>;
|
|
31
|
+
"entity-card:grafana/alerts": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
32
|
+
filter: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
filter?: string | undefined;
|
|
35
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
36
|
+
optional: true;
|
|
37
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
38
|
+
optional: true;
|
|
39
|
+
}>, {}, {
|
|
40
|
+
kind: "entity-card";
|
|
41
|
+
namespace: undefined;
|
|
42
|
+
name: "alerts";
|
|
43
|
+
}>;
|
|
44
|
+
"entity-card:grafana/overview-dashboard": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
45
|
+
filter: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
filter?: string | undefined;
|
|
48
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
49
|
+
optional: true;
|
|
50
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
51
|
+
optional: true;
|
|
52
|
+
}>, {}, {
|
|
53
|
+
kind: "entity-card";
|
|
54
|
+
namespace: undefined;
|
|
55
|
+
name: "overview-dashboard";
|
|
56
|
+
}>;
|
|
57
|
+
}>;
|
|
9
58
|
|
|
10
59
|
export { _default as default };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { grafanaApiExtension } from './alpha/apis.esm.js';
|
|
3
3
|
import { entityGrafanaAlertsCard, entityGrafanaDashboardsCard, entityGrafanaOverviewDashboardViewer } from './alpha/entityCards.esm.js';
|
|
4
4
|
|
|
5
|
-
var alpha =
|
|
5
|
+
var alpha = createFrontendPlugin({
|
|
6
6
|
id: "grafana",
|
|
7
7
|
extensions: [
|
|
8
8
|
grafanaApiExtension,
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["import { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n entityGrafanaAlertsCard,\n entityGrafanaDashboardsCard,\n entityGrafanaOverviewDashboardViewer,\n grafanaApiExtension,\n} from './alpha/index';\n\n/**\n * The Grafana backstage plugin.\n *\n * @alpha\n */\nexport default createFrontendPlugin({\n id: 'grafana',\n extensions: [\n grafanaApiExtension,\n entityGrafanaAlertsCard,\n entityGrafanaDashboardsCard,\n entityGrafanaOverviewDashboardViewer,\n ],\n});\n"],"names":[],"mappings":";;;;AAaA,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,SAAA;AAAA,EACJ,UAAY,EAAA;AAAA,IACV,mBAAA;AAAA,IACA,uBAAA;AAAA,IACA,2BAAA;AAAA,IACA,oCAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-grafana",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A Backstage backend plugin that integrates towards Grafana",
|
|
5
5
|
"main": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"postpack": "backstage-cli package postpack"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@backstage/catalog-model": "^1.
|
|
52
|
-
"@backstage/core-components": "^0.14.
|
|
51
|
+
"@backstage/catalog-model": "^1.6.0",
|
|
52
|
+
"@backstage/core-components": "^0.14.10",
|
|
53
53
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
54
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
55
|
-
"@backstage/plugin-catalog-react": "^1.12.
|
|
54
|
+
"@backstage/frontend-plugin-api": "^0.7.0",
|
|
55
|
+
"@backstage/plugin-catalog-react": "^1.12.3",
|
|
56
56
|
"@material-ui/core": "^4.12.2",
|
|
57
57
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
58
58
|
"cross-fetch": "^4.0.0",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@backstage/cli": "^0.
|
|
69
|
-
"@backstage/core-app-api": "^1.14.
|
|
70
|
-
"@backstage/dev-utils": "^1.0.
|
|
71
|
-
"@backstage/frontend-test-utils": "^0.1.
|
|
72
|
-
"@backstage/test-utils": "^1.5.
|
|
68
|
+
"@backstage/cli": "^0.27.0",
|
|
69
|
+
"@backstage/core-app-api": "^1.14.2",
|
|
70
|
+
"@backstage/dev-utils": "^1.0.37",
|
|
71
|
+
"@backstage/frontend-test-utils": "^0.1.12",
|
|
72
|
+
"@backstage/test-utils": "^1.5.10",
|
|
73
73
|
"@testing-library/dom": "^10.0.0",
|
|
74
74
|
"@testing-library/jest-dom": "^6.0.0",
|
|
75
75
|
"@testing-library/react": "^15.0.0",
|