@backstage/plugin-api-docs 0.0.0-nightly-20240814021923 → 0.0.0-nightly-20240816021916
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 +11 -9
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +111 -1
- package/dist/alpha.esm.js +127 -104
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js +3 -3
- package/dist/components/ComponentsCards/ConsumingComponentsCard.esm.js.map +1 -1
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js +3 -3
- package/dist/components/ComponentsCards/ProvidingComponentsCard.esm.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
# @backstage/plugin-api-docs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20240816021916
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- 770ba02: `ConsumingComponentsCard` and `ProvidingComponentsCard` will now optionally accept `columns` to override which table columns are displayed
|
|
8
|
+
- fe1fbb2: Migrating usages of the deprecated `createExtension` `v1` format to the newer `v2` format, and old `create*Extension` extension creators to blueprints.
|
|
7
9
|
- 4b6d2cb: Updated dependency `@graphiql/react` to `^0.23.0`.
|
|
8
10
|
- 6582799: Add `tableOptions` to all tables and additionally `title` to API tables.
|
|
9
11
|
- Updated dependencies
|
|
10
|
-
- @backstage/
|
|
11
|
-
- @backstage/plugin-
|
|
12
|
-
- @backstage/plugin-catalog-react@0.0.0-nightly-
|
|
13
|
-
- @backstage/core-components@0.0.0-nightly-
|
|
14
|
-
- @backstage/core-compat-api@0.0.0-nightly-
|
|
15
|
-
- @backstage/catalog-model@0.0.0-nightly-
|
|
12
|
+
- @backstage/plugin-catalog@0.0.0-nightly-20240816021916
|
|
13
|
+
- @backstage/frontend-plugin-api@0.0.0-nightly-20240816021916
|
|
14
|
+
- @backstage/plugin-catalog-react@0.0.0-nightly-20240816021916
|
|
15
|
+
- @backstage/core-components@0.0.0-nightly-20240816021916
|
|
16
|
+
- @backstage/core-compat-api@0.0.0-nightly-20240816021916
|
|
17
|
+
- @backstage/catalog-model@0.0.0-nightly-20240816021916
|
|
16
18
|
- @backstage/core-plugin-api@1.9.3
|
|
17
|
-
- @backstage/plugin-catalog-common@0.0.0-nightly-
|
|
18
|
-
- @backstage/plugin-permission-react@0.0.0-nightly-
|
|
19
|
+
- @backstage/plugin-catalog-common@0.0.0-nightly-20240816021916
|
|
20
|
+
- @backstage/plugin-permission-react@0.0.0-nightly-20240816021916
|
|
19
21
|
|
|
20
22
|
## 0.11.8-next.3
|
|
21
23
|
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -1,9 +1,119 @@
|
|
|
1
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
2
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
1
3
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
4
|
+
import React__default from 'react';
|
|
2
5
|
|
|
3
6
|
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
|
|
4
7
|
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
5
8
|
}, {
|
|
6
9
|
registerApi: _backstage_frontend_plugin_api.ExternalRouteRef<undefined>;
|
|
7
|
-
}, {
|
|
10
|
+
}, {
|
|
11
|
+
"nav-item:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{}, {}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
|
|
12
|
+
title: string;
|
|
13
|
+
icon: _backstage_core_plugin_api.IconComponent;
|
|
14
|
+
routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
15
|
+
}, "core.nav-item.target", {}>, {}, "nav-item", undefined, undefined>;
|
|
16
|
+
"api:api-docs/config": _backstage_frontend_plugin_api.ExtensionDefinition<{}, {}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>, {}, "api", undefined, "config">;
|
|
17
|
+
"page:api-docs": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
18
|
+
initiallySelectedFilter: "all" | "owned" | "starred" | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
path: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
initiallySelectedFilter?: "all" | "owned" | "starred" | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
path?: string | undefined;
|
|
25
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
26
|
+
optional: true;
|
|
27
|
+
}>, {
|
|
28
|
+
[x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
|
|
29
|
+
optional: boolean;
|
|
30
|
+
singleton: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
}, "page", undefined, undefined>;
|
|
33
|
+
"entity-card:api-docs/has-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
34
|
+
filter: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
filter?: string | undefined;
|
|
37
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
38
|
+
optional: true;
|
|
39
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
40
|
+
optional: true;
|
|
41
|
+
}>, {}, "entity-card", undefined, "has-apis">;
|
|
42
|
+
"entity-card:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
43
|
+
filter: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
filter?: string | undefined;
|
|
46
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
47
|
+
optional: true;
|
|
48
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
49
|
+
optional: true;
|
|
50
|
+
}>, {}, "entity-card", undefined, "definition">;
|
|
51
|
+
"entity-card:api-docs/consumed-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
52
|
+
filter: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
filter?: string | undefined;
|
|
55
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
56
|
+
optional: true;
|
|
57
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
58
|
+
optional: true;
|
|
59
|
+
}>, {}, "entity-card", undefined, "consumed-apis">;
|
|
60
|
+
"entity-card:api-docs/provided-apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
61
|
+
filter: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
filter?: string | undefined;
|
|
64
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
65
|
+
optional: true;
|
|
66
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
67
|
+
optional: true;
|
|
68
|
+
}>, {}, "entity-card", undefined, "provided-apis">;
|
|
69
|
+
"entity-card:api-docs/consuming-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
70
|
+
filter: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
filter?: string | undefined;
|
|
73
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
74
|
+
optional: true;
|
|
75
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
76
|
+
optional: true;
|
|
77
|
+
}>, {}, "entity-card", undefined, "consuming-components">;
|
|
78
|
+
"entity-card:api-docs/providing-components": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
79
|
+
filter: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
filter?: string | undefined;
|
|
82
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
83
|
+
optional: true;
|
|
84
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
85
|
+
optional: true;
|
|
86
|
+
}>, {}, "entity-card", undefined, "providing-components">;
|
|
87
|
+
"entity-content:api-docs/definition": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
88
|
+
path: string | undefined;
|
|
89
|
+
title: string | undefined;
|
|
90
|
+
filter: string | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
filter?: string | undefined;
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
path?: string | undefined;
|
|
95
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
96
|
+
optional: true;
|
|
97
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
98
|
+
optional: true;
|
|
99
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
100
|
+
optional: true;
|
|
101
|
+
}>, {}, "entity-content", undefined, "definition">;
|
|
102
|
+
"entity-content:api-docs/apis": _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
103
|
+
path: string | undefined;
|
|
104
|
+
title: string | undefined;
|
|
105
|
+
filter: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
filter?: string | undefined;
|
|
108
|
+
title?: string | undefined;
|
|
109
|
+
path?: string | undefined;
|
|
110
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React__default.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
111
|
+
optional: true;
|
|
112
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
113
|
+
optional: true;
|
|
114
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
115
|
+
optional: true;
|
|
116
|
+
}>, {}, "entity-content", undefined, "apis">;
|
|
117
|
+
}>;
|
|
8
118
|
|
|
9
119
|
export { _default as default };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Grid from '@material-ui/core/Grid';
|
|
3
|
-
import {
|
|
3
|
+
import { NavItemBlueprint, ApiBlueprint, createApiFactory, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
|
|
5
|
-
import { createEntityCardExtension, createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
|
|
6
5
|
import { RELATION_HAS_PART, parseEntityRef } from '@backstage/catalog-model';
|
|
7
6
|
import '@backstage/plugin-catalog-react';
|
|
8
7
|
import '@material-ui/lab/Alert';
|
|
@@ -12,132 +11,156 @@ import '@backstage/core-plugin-api';
|
|
|
12
11
|
import { defaultDefinitionWidgets } from './components/ApiDefinitionCard/ApiDefinitionWidget.esm.js';
|
|
13
12
|
import '@material-ui/core/Typography';
|
|
14
13
|
import { rootRoute, registerComponentRouteRef } from './routes.esm.js';
|
|
14
|
+
import { EntityCardBlueprint, EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
15
15
|
|
|
16
|
-
const apiDocsNavItem =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const apiDocsNavItem = NavItemBlueprint.make({
|
|
17
|
+
params: {
|
|
18
|
+
title: "APIs",
|
|
19
|
+
routeRef: convertLegacyRouteRef(rootRoute),
|
|
20
|
+
icon: () => compatWrapper(/* @__PURE__ */ React.createElement(AppIcon, { id: "kind:api" }))
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const apiDocsConfigApi =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const apiDocsConfigApi = ApiBlueprint.make({
|
|
24
|
+
name: "config",
|
|
25
|
+
params: {
|
|
26
|
+
factory: createApiFactory({
|
|
27
|
+
api: apiDocsConfigRef,
|
|
28
|
+
deps: {},
|
|
29
|
+
factory: () => {
|
|
30
|
+
const definitionWidgets = defaultDefinitionWidgets();
|
|
31
|
+
return {
|
|
32
|
+
getApiDefinitionWidget: (apiEntity) => {
|
|
33
|
+
return definitionWidgets.find((d) => d.type === apiEntity.spec.type);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
34
39
|
});
|
|
35
|
-
const apiDocsExplorerPage =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Mapping DefaultApiExplorerPageProps to config
|
|
39
|
-
configSchema: createSchemaFromZod(
|
|
40
|
-
(z) => z.object({
|
|
41
|
-
path: z.string().default("/api-docs"),
|
|
42
|
-
initiallySelectedFilter: z.enum(["owned", "starred", "all"]).optional()
|
|
40
|
+
const apiDocsExplorerPage = PageBlueprint.makeWithOverrides({
|
|
41
|
+
config: {
|
|
42
|
+
schema: {
|
|
43
43
|
// Ommiting columns and actions for now as their types are too complex to map to zod
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
initiallySelectedFilter: (z) => z.enum(["owned", "starred", "all"]).optional()
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
factory(originalFactory, { config }) {
|
|
48
|
+
return originalFactory({
|
|
49
|
+
defaultPath: "/api-docs",
|
|
50
|
+
routeRef: convertLegacyRouteRef(rootRoute),
|
|
51
|
+
loader: () => import('./components/ApiExplorerPage/index.esm.js').then(
|
|
52
|
+
(m) => compatWrapper(
|
|
53
|
+
/* @__PURE__ */ React.createElement(
|
|
54
|
+
m.ApiExplorerIndexPage,
|
|
55
|
+
{
|
|
56
|
+
initiallySelectedFilter: config.initiallySelectedFilter
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
)
|
|
53
60
|
)
|
|
54
|
-
)
|
|
55
|
-
|
|
61
|
+
});
|
|
62
|
+
}
|
|
56
63
|
});
|
|
57
|
-
const apiDocsHasApisEntityCard =
|
|
64
|
+
const apiDocsHasApisEntityCard = EntityCardBlueprint.make({
|
|
58
65
|
name: "has-apis",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(
|
|
69
|
-
|
|
66
|
+
params: {
|
|
67
|
+
// Ommiting configSchema for now
|
|
68
|
+
// We are skipping variants and columns are too complex to map to zod
|
|
69
|
+
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
70
|
+
filter: (entity) => {
|
|
71
|
+
return entity.kind === "Component" && entity.relations?.some(
|
|
72
|
+
({ type, targetRef }) => type.toLocaleLowerCase("en-US") === RELATION_HAS_PART && parseEntityRef(targetRef).kind === "API"
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
76
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.HasApisCard, null))
|
|
77
|
+
)
|
|
78
|
+
}
|
|
70
79
|
});
|
|
71
|
-
const apiDocsDefinitionEntityCard =
|
|
80
|
+
const apiDocsDefinitionEntityCard = EntityCardBlueprint.make({
|
|
72
81
|
name: "definition",
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
(
|
|
76
|
-
|
|
82
|
+
params: {
|
|
83
|
+
filter: "kind:api",
|
|
84
|
+
loader: () => import('./components/ApiDefinitionCard/index.esm.js').then(
|
|
85
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null))
|
|
86
|
+
)
|
|
87
|
+
}
|
|
77
88
|
});
|
|
78
|
-
const apiDocsConsumedApisEntityCard =
|
|
89
|
+
const apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({
|
|
79
90
|
name: "consumed-apis",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
91
|
+
params: {
|
|
92
|
+
// Ommiting configSchema for now
|
|
93
|
+
// We are skipping variants and columns are too complex to map to zod
|
|
94
|
+
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
95
|
+
filter: "kind:component",
|
|
96
|
+
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
97
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumedApisCard, null))
|
|
98
|
+
)
|
|
99
|
+
}
|
|
87
100
|
});
|
|
88
|
-
const apiDocsProvidedApisEntityCard =
|
|
101
|
+
const apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({
|
|
89
102
|
name: "provided-apis",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
|
|
103
|
+
params: {
|
|
104
|
+
// Ommiting configSchema for now
|
|
105
|
+
// We are skipping variants and columns are too complex to map to zod
|
|
106
|
+
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
107
|
+
filter: "kind:component",
|
|
108
|
+
loader: () => import('./components/ApisCards/index.esm.js').then(
|
|
109
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidedApisCard, null))
|
|
110
|
+
)
|
|
111
|
+
}
|
|
97
112
|
});
|
|
98
|
-
const apiDocsConsumingComponentsEntityCard =
|
|
113
|
+
const apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({
|
|
99
114
|
name: "consuming-components",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
115
|
+
params: {
|
|
116
|
+
// Ommiting configSchema for now
|
|
117
|
+
// We are skipping variants
|
|
118
|
+
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
119
|
+
filter: "kind:api",
|
|
120
|
+
loader: () => import('./components/ComponentsCards/index.esm.js').then(
|
|
121
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ConsumingComponentsCard, null))
|
|
122
|
+
)
|
|
123
|
+
}
|
|
107
124
|
});
|
|
108
|
-
const apiDocsProvidingComponentsEntityCard =
|
|
125
|
+
const apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({
|
|
109
126
|
name: "providing-components",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
(
|
|
116
|
-
|
|
127
|
+
params: {
|
|
128
|
+
// Ommiting configSchema for now
|
|
129
|
+
// We are skipping variants
|
|
130
|
+
// See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252
|
|
131
|
+
filter: "kind:api",
|
|
132
|
+
loader: () => import('./components/ComponentsCards/index.esm.js').then(
|
|
133
|
+
(m) => compatWrapper(/* @__PURE__ */ React.createElement(m.ProvidingComponentsCard, null))
|
|
134
|
+
)
|
|
135
|
+
}
|
|
117
136
|
});
|
|
118
|
-
const apiDocsDefinitionEntityContent =
|
|
137
|
+
const apiDocsDefinitionEntityContent = EntityContentBlueprint.make({
|
|
119
138
|
name: "definition",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
(
|
|
125
|
-
|
|
139
|
+
params: {
|
|
140
|
+
defaultPath: "/defintion",
|
|
141
|
+
defaultTitle: "Definition",
|
|
142
|
+
filter: "kind:api",
|
|
143
|
+
loader: async () => import('./components/ApiDefinitionCard/index.esm.js').then(
|
|
144
|
+
(m) => compatWrapper(
|
|
145
|
+
/* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ApiDefinitionCard, null)))
|
|
146
|
+
)
|
|
126
147
|
)
|
|
127
|
-
|
|
148
|
+
}
|
|
128
149
|
});
|
|
129
|
-
const apiDocsApisEntityContent =
|
|
150
|
+
const apiDocsApisEntityContent = EntityContentBlueprint.make({
|
|
130
151
|
name: "apis",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(
|
|
136
|
-
|
|
152
|
+
params: {
|
|
153
|
+
defaultPath: "/apis",
|
|
154
|
+
defaultTitle: "APIs",
|
|
155
|
+
filter: "kind:component",
|
|
156
|
+
loader: async () => import('./components/ApisCards/index.esm.js').then(
|
|
157
|
+
(m) => compatWrapper(
|
|
158
|
+
/* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, alignItems: "stretch" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ProvidedApisCard, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(m.ConsumedApisCard, null)))
|
|
159
|
+
)
|
|
137
160
|
)
|
|
138
|
-
|
|
161
|
+
}
|
|
139
162
|
});
|
|
140
|
-
var alpha =
|
|
163
|
+
var alpha = createFrontendPlugin({
|
|
141
164
|
id: "api-docs",
|
|
142
165
|
routes: {
|
|
143
166
|
root: convertLegacyRouteRef(rootRoute)
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n createApiExtension,\n createApiFactory,\n createNavItemExtension,\n createPageExtension,\n createPlugin,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n createEntityCardExtension,\n createEntityContentExtension,\n} from '@backstage/plugin-catalog-react/alpha';\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nconst apiDocsNavItem = createNavItemExtension({\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n});\n\nconst apiDocsConfigApi = createApiExtension({\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n});\n\nconst apiDocsExplorerPage = createPageExtension({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n // Mapping DefaultApiExplorerPageProps to config\n configSchema: createSchemaFromZod(z =>\n z.object({\n path: z.string().default('/api-docs'),\n initiallySelectedFilter: z.enum(['owned', 'starred', 'all']).optional(),\n // Ommiting columns and actions for now as their types are too complex to map to zod\n }),\n ),\n loader: ({ config }) =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n});\n\nconst apiDocsHasApisEntityCard = createEntityCardExtension({\n name: 'has-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n});\n\nconst apiDocsDefinitionEntityCard = createEntityCardExtension({\n name: 'definition',\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n});\n\nconst apiDocsConsumedApisEntityCard = createEntityCardExtension({\n name: 'consumed-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n});\n\nconst apiDocsProvidedApisEntityCard = createEntityCardExtension({\n name: 'provided-apis',\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n});\n\nconst apiDocsConsumingComponentsEntityCard = createEntityCardExtension({\n name: 'consuming-components',\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n});\n\nconst apiDocsProvidingComponentsEntityCard = createEntityCardExtension({\n name: 'providing-components',\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n});\n\nconst apiDocsDefinitionEntityContent = createEntityContentExtension({\n name: 'definition',\n defaultPath: '/defintion',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n});\n\nconst apiDocsApisEntityContent = createEntityContentExtension({\n name: 'apis',\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n});\n\nexport default createPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgDA,MAAM,iBAAiB,sBAAuB,CAAA;AAAA,EAC5C,KAAO,EAAA,MAAA;AAAA,EACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,EACzC,MAAM,MAAM,aAAA,qCAAe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IACA,wBAAA;AAAA,IACA,2BAAA;AAAA,IACA,6BAAA;AAAA,IACA,6BAAA;AAAA,IACA,oCAAA;AAAA,IACA,oCAAA;AAAA,IACA,8BAAA;AAAA,IACA,wBAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n ApiBlueprint,\n NavItemBlueprint,\n PageBlueprint,\n createApiFactory,\n createFrontendPlugin,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\n\nimport {\n ApiEntity,\n parseEntityRef,\n RELATION_HAS_PART,\n} from '@backstage/catalog-model';\n\nimport { defaultDefinitionWidgets } from './components/ApiDefinitionCard';\nimport { rootRoute, registerComponentRouteRef } from './routes';\nimport { apiDocsConfigRef } from './config';\nimport { AppIcon } from '@backstage/core-components';\n\nimport {\n EntityCardBlueprint,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\n\nconst apiDocsNavItem = NavItemBlueprint.make({\n params: {\n title: 'APIs',\n routeRef: convertLegacyRouteRef(rootRoute),\n icon: () => compatWrapper(<AppIcon id=\"kind:api\" />),\n },\n});\n\nconst apiDocsConfigApi = ApiBlueprint.make({\n name: 'config',\n params: {\n factory: createApiFactory({\n api: apiDocsConfigRef,\n deps: {},\n factory: () => {\n const definitionWidgets = defaultDefinitionWidgets();\n return {\n getApiDefinitionWidget: (apiEntity: ApiEntity) => {\n return definitionWidgets.find(d => d.type === apiEntity.spec.type);\n },\n };\n },\n }),\n },\n});\n\nconst apiDocsExplorerPage = PageBlueprint.makeWithOverrides({\n config: {\n schema: {\n // Ommiting columns and actions for now as their types are too complex to map to zod\n initiallySelectedFilter: z =>\n z.enum(['owned', 'starred', 'all']).optional(),\n },\n },\n factory(originalFactory, { config }) {\n return originalFactory({\n defaultPath: '/api-docs',\n routeRef: convertLegacyRouteRef(rootRoute),\n loader: () =>\n import('./components/ApiExplorerPage').then(m =>\n compatWrapper(\n <m.ApiExplorerIndexPage\n initiallySelectedFilter={config.initiallySelectedFilter}\n />,\n ),\n ),\n });\n },\n});\n\nconst apiDocsHasApisEntityCard = EntityCardBlueprint.make({\n name: 'has-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: entity => {\n return (\n entity.kind === 'Component' &&\n entity.relations?.some(\n ({ type, targetRef }) =>\n type.toLocaleLowerCase('en-US') === RELATION_HAS_PART &&\n parseEntityRef(targetRef).kind === 'API',\n )!!\n );\n },\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.HasApisCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityCard = EntityCardBlueprint.make({\n name: 'definition',\n params: {\n filter: 'kind:api',\n loader: () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(<m.ApiDefinitionCard />),\n ),\n },\n});\n\nconst apiDocsConsumedApisEntityCard = EntityCardBlueprint.make({\n name: 'consumed-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ConsumedApisCard />),\n ),\n },\n});\n\nconst apiDocsProvidedApisEntityCard = EntityCardBlueprint.make({\n name: 'provided-apis',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants and columns are too complex to map to zod\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:component',\n loader: () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(<m.ProvidedApisCard />),\n ),\n },\n});\n\nconst apiDocsConsumingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'consuming-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ConsumingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsProvidingComponentsEntityCard = EntityCardBlueprint.make({\n name: 'providing-components',\n params: {\n // Ommiting configSchema for now\n // We are skipping variants\n // See: https://github.com/backstage/backstage/pull/22619#discussion_r1477333252\n filter: 'kind:api',\n loader: () =>\n import('./components/ComponentsCards').then(m =>\n compatWrapper(<m.ProvidingComponentsCard />),\n ),\n },\n});\n\nconst apiDocsDefinitionEntityContent = EntityContentBlueprint.make({\n name: 'definition',\n params: {\n defaultPath: '/defintion',\n defaultTitle: 'Definition',\n filter: 'kind:api',\n loader: async () =>\n import('./components/ApiDefinitionCard').then(m =>\n compatWrapper(\n <Grid container spacing={3}>\n <Grid item xs={12}>\n <m.ApiDefinitionCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nconst apiDocsApisEntityContent = EntityContentBlueprint.make({\n name: 'apis',\n params: {\n defaultPath: '/apis',\n defaultTitle: 'APIs',\n filter: 'kind:component',\n loader: async () =>\n import('./components/ApisCards').then(m =>\n compatWrapper(\n <Grid container spacing={3} alignItems=\"stretch\">\n <Grid item xs={12}>\n <m.ProvidedApisCard />\n </Grid>\n <Grid item xs={12}>\n <m.ConsumedApisCard />\n </Grid>\n </Grid>,\n ),\n ),\n },\n});\n\nexport default createFrontendPlugin({\n id: 'api-docs',\n routes: {\n root: convertLegacyRouteRef(rootRoute),\n },\n externalRoutes: {\n registerApi: convertLegacyRouteRef(registerComponentRouteRef),\n },\n extensions: [\n apiDocsNavItem,\n apiDocsConfigApi,\n apiDocsExplorerPage,\n apiDocsHasApisEntityCard,\n apiDocsDefinitionEntityCard,\n apiDocsProvidedApisEntityCard,\n apiDocsConsumedApisEntityCard,\n apiDocsConsumingComponentsEntityCard,\n apiDocsProvidingComponentsEntityCard,\n apiDocsDefinitionEntityContent,\n apiDocsApisEntityContent,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgDA,MAAM,cAAA,GAAiB,iBAAiB,IAAK,CAAA;AAAA,EAC3C,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,IACP,QAAA,EAAU,sBAAsB,SAAS,CAAA;AAAA,IACzC,MAAM,MAAM,aAAA,qCAAe,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAW,CAAE,CAAA;AAAA,GACrD;AACF,CAAC,CAAA,CAAA;AAED,MAAM,gBAAA,GAAmB,aAAa,IAAK,CAAA;AAAA,EACzC,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,gBAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AACb,QAAA,MAAM,oBAAoB,wBAAyB,EAAA,CAAA;AACnD,QAAO,OAAA;AAAA,UACL,sBAAA,EAAwB,CAAC,SAAyB,KAAA;AAChD,YAAA,OAAO,kBAAkB,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,SAAA,CAAU,KAAK,IAAI,CAAA,CAAA;AAAA,WACnE;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF,CAAC,CAAA,CAAA;AAED,MAAM,mBAAA,GAAsB,cAAc,iBAAkB,CAAA;AAAA,EAC1D,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAAA,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ATION_API_CONSUMED_BY } from '@backstage/catalog-model';
|
|
2
2
|
import Typography from '@material-ui/core/Typography';
|
|
3
|
-
import { useEntity, useRelatedEntities
|
|
3
|
+
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
6
|
|
|
7
7
|
const ConsumingComponentsCard = (props) => {
|
|
8
|
-
const { variant = "gridItem" } = props;
|
|
8
|
+
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
9
9
|
const { entity } = useEntity();
|
|
10
10
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
11
|
type: RELATION_API_CONSUMED_BY
|
|
@@ -29,7 +29,7 @@ const ConsumingComponentsCard = (props) => {
|
|
|
29
29
|
title: "Consumers",
|
|
30
30
|
variant,
|
|
31
31
|
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component consumes this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional" }, "Learn how to change this."))),
|
|
32
|
-
columns
|
|
32
|
+
columns,
|
|
33
33
|
entities
|
|
34
34
|
}
|
|
35
35
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem'
|
|
1
|
+
{"version":3,"file":"ConsumingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ConsumingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_CONSUMED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/**\n * @public\n */\nexport const ConsumingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_CONSUMED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Consumers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Consumers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component consumes this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specconsumesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n }\n columns={columns}\n entities={entities as ComponentEntity[]}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwCa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AACJ,EAAA,MAAM,EAAE,OAAU,GAAA,UAAA,EAAY,OAAU,GAAA,WAAA,CAAY,wBAClD,GAAA,KAAA,CAAA;AACF,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,QAAU,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,mBAAmB,MAAQ,EAAA;AAAA,IAC9D,IAAM,EAAA,wBAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CACG,QAAS,EAAA,EAAA,OAAA,EAAkB,OAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAI,IAAA,KAAA,IAAS,CAAC,QAAU,EAAA;AACtB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAkB,EAAA,KAAA,EAAM,WAChC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,OAAA;AAAA,QACT,KAAM,EAAA,2BAAA;AAAA,QACN,OAAA,sCAAU,WAAY,EAAA,EAAA,IAAA,EAAM,GAAG,KAAK,CAAA,CAAA,EAAI,UAAS,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAE5D,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,OAAA;AAAA,MACA,YAAA,kBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,KAAO,EAAA,EAAE,WAAW,QAAS,EAAA,EAAA,kBAC/B,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
|
|
2
2
|
import Typography from '@material-ui/core/Typography';
|
|
3
|
-
import { useEntity, useRelatedEntities
|
|
3
|
+
import { EntityTable, useEntity, useRelatedEntities } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { InfoCard, Progress, WarningPanel, CodeSnippet, Link } from '@backstage/core-components';
|
|
6
6
|
|
|
7
7
|
const ProvidingComponentsCard = (props) => {
|
|
8
|
-
const { variant = "gridItem" } = props;
|
|
8
|
+
const { variant = "gridItem", columns = EntityTable.componentEntityColumns } = props;
|
|
9
9
|
const { entity } = useEntity();
|
|
10
10
|
const { entities, loading, error } = useRelatedEntities(entity, {
|
|
11
11
|
type: RELATION_API_PROVIDED_BY
|
|
@@ -29,7 +29,7 @@ const ProvidingComponentsCard = (props) => {
|
|
|
29
29
|
title: "Providers",
|
|
30
30
|
variant,
|
|
31
31
|
emptyContent: /* @__PURE__ */ React.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No component provides this API."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional" }, "Learn how to change this."))),
|
|
32
|
-
columns
|
|
32
|
+
columns,
|
|
33
33
|
entities
|
|
34
34
|
}
|
|
35
35
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n}) => {\n const { variant = 'gridItem'
|
|
1
|
+
{"version":3,"file":"ProvidingComponentsCard.esm.js","sources":["../../../src/components/ComponentsCards/ProvidingComponentsCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentEntity,\n RELATION_API_PROVIDED_BY,\n} from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\nimport {\n EntityTable,\n useEntity,\n useRelatedEntities,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n CodeSnippet,\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n TableColumn,\n WarningPanel,\n} from '@backstage/core-components';\n\n/** @public */\nexport const ProvidingComponentsCard = (props: {\n variant?: InfoCardVariants;\n columns?: TableColumn<ComponentEntity>[];\n}) => {\n const { variant = 'gridItem', columns = EntityTable.componentEntityColumns } =\n props;\n const { entity } = useEntity();\n const { entities, loading, error } = useRelatedEntities(entity, {\n type: RELATION_API_PROVIDED_BY,\n });\n\n if (loading) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <Progress />\n </InfoCard>\n );\n }\n\n if (error || !entities) {\n return (\n <InfoCard variant={variant} title=\"Providers\">\n <WarningPanel\n severity=\"error\"\n title=\"Could not load components\"\n message={<CodeSnippet text={`${error}`} language=\"text\" />}\n />\n </InfoCard>\n );\n }\n\n return (\n <EntityTable\n title=\"Providers\"\n variant={variant}\n emptyContent={\n <div style={{ textAlign: 'center' }}>\n <Typography variant=\"body1\">\n No component provides this API.\n </Typography>\n <Typography variant=\"body2\">\n <Link to=\"https://backstage.io/docs/features/software-catalog/descriptor-format#specprovidesapis-optional\">\n Learn how to change this.\n </Link>\n </Typography>\n </div>\n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AAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,iCAE5B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAClB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAG,EAAA,iGAAA,EAAA,EAAkG,2BAE3G,CACF,CACF,CAAA;AAAA,MAEF,OAAA;AAAA,MACA,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import * as _backstage_core_components from '@backstage/core-components';
|
|
|
5
5
|
import { TableColumn, TableProps, InfoCardVariants, TableOptions } from '@backstage/core-components';
|
|
6
6
|
import { CatalogTableRow } from '@backstage/plugin-catalog';
|
|
7
7
|
import { UserListFilterKind, EntityOwnerPickerProps } from '@backstage/plugin-catalog-react';
|
|
8
|
-
import
|
|
8
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
9
|
+
import { ApiEntity, ComponentEntity } from '@backstage/catalog-model';
|
|
9
10
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -103,11 +104,13 @@ declare const AsyncApiDefinitionWidget: (props: AsyncApiDefinitionWidgetProps) =
|
|
|
103
104
|
*/
|
|
104
105
|
declare const ConsumingComponentsCard: (props: {
|
|
105
106
|
variant?: InfoCardVariants;
|
|
107
|
+
columns?: TableColumn<ComponentEntity>[];
|
|
106
108
|
}) => React__default.JSX.Element;
|
|
107
109
|
|
|
108
110
|
/** @public */
|
|
109
111
|
declare const ProvidingComponentsCard: (props: {
|
|
110
112
|
variant?: InfoCardVariants;
|
|
113
|
+
columns?: TableColumn<ComponentEntity>[];
|
|
111
114
|
}) => React__default.JSX.Element;
|
|
112
115
|
|
|
113
116
|
/** @public */
|
|
@@ -168,6 +171,7 @@ declare const EntityConsumedApisCard: (props: {
|
|
|
168
171
|
/** @public */
|
|
169
172
|
declare const EntityConsumingComponentsCard: (props: {
|
|
170
173
|
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
174
|
+
columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
|
|
171
175
|
}) => React.JSX.Element;
|
|
172
176
|
/** @public */
|
|
173
177
|
declare const EntityProvidedApisCard: (props: {
|
|
@@ -179,6 +183,7 @@ declare const EntityProvidedApisCard: (props: {
|
|
|
179
183
|
/** @public */
|
|
180
184
|
declare const EntityProvidingComponentsCard: (props: {
|
|
181
185
|
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
186
|
+
columns?: _backstage_core_components.TableColumn<_backstage_catalog_model.ComponentEntity>[] | undefined;
|
|
182
187
|
}) => React.JSX.Element;
|
|
183
188
|
/** @public */
|
|
184
189
|
declare const EntityHasApisCard: (props: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-api-docs",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240816021916",
|
|
4
4
|
"description": "A Backstage plugin that helps represent API entities in the frontend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@asyncapi/react-component": "1.3.1",
|
|
56
|
-
"@backstage/catalog-model": "^0.0.0-nightly-
|
|
57
|
-
"@backstage/core-compat-api": "^0.0.0-nightly-
|
|
58
|
-
"@backstage/core-components": "^0.0.0-nightly-
|
|
56
|
+
"@backstage/catalog-model": "^0.0.0-nightly-20240816021916",
|
|
57
|
+
"@backstage/core-compat-api": "^0.0.0-nightly-20240816021916",
|
|
58
|
+
"@backstage/core-components": "^0.0.0-nightly-20240816021916",
|
|
59
59
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
60
|
-
"@backstage/frontend-plugin-api": "^0.0.0-nightly-
|
|
61
|
-
"@backstage/plugin-catalog": "^0.0.0-nightly-
|
|
62
|
-
"@backstage/plugin-catalog-common": "^0.0.0-nightly-
|
|
63
|
-
"@backstage/plugin-catalog-react": "^0.0.0-nightly-
|
|
64
|
-
"@backstage/plugin-permission-react": "^0.0.0-nightly-
|
|
60
|
+
"@backstage/frontend-plugin-api": "^0.0.0-nightly-20240816021916",
|
|
61
|
+
"@backstage/plugin-catalog": "^0.0.0-nightly-20240816021916",
|
|
62
|
+
"@backstage/plugin-catalog-common": "^0.0.0-nightly-20240816021916",
|
|
63
|
+
"@backstage/plugin-catalog-react": "^0.0.0-nightly-20240816021916",
|
|
64
|
+
"@backstage/plugin-permission-react": "^0.0.0-nightly-20240816021916",
|
|
65
65
|
"@graphiql/react": "^0.23.0",
|
|
66
66
|
"@material-ui/core": "^4.12.2",
|
|
67
67
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"swagger-ui-react": "^5.0.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@backstage/cli": "^0.0.0-nightly-
|
|
79
|
-
"@backstage/core-app-api": "^0.0.0-nightly-
|
|
80
|
-
"@backstage/dev-utils": "^0.0.0-nightly-
|
|
81
|
-
"@backstage/test-utils": "^0.0.0-nightly-
|
|
78
|
+
"@backstage/cli": "^0.0.0-nightly-20240816021916",
|
|
79
|
+
"@backstage/core-app-api": "^0.0.0-nightly-20240816021916",
|
|
80
|
+
"@backstage/dev-utils": "^0.0.0-nightly-20240816021916",
|
|
81
|
+
"@backstage/test-utils": "^0.0.0-nightly-20240816021916",
|
|
82
82
|
"@testing-library/dom": "^10.0.0",
|
|
83
83
|
"@testing-library/jest-dom": "^6.0.0",
|
|
84
84
|
"@testing-library/react": "^15.0.0",
|