@backstage/plugin-catalog-react 0.0.0-nightly-20250221023113 → 0.0.0-nightly-20250222022959
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 +24 -22
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js +9 -9
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js.map +1 -1
- package/dist/alpha/blueprints/EntityContentBlueprint.esm.js.map +1 -1
- package/dist/alpha/blueprints/{EntityCardLauyoutBlueprint.esm.js → EntityContentLayoutBlueprint.esm.js} +12 -18
- package/dist/alpha/blueprints/EntityContentLayoutBlueprint.esm.js.map +1 -0
- package/dist/alpha/blueprints/extensionData.esm.js +8 -4
- package/dist/alpha/blueprints/extensionData.esm.js.map +1 -1
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js +1 -1
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js +1 -1
- package/dist/alpha.d.ts +32 -35
- package/dist/alpha.esm.js +2 -2
- package/package.json +4 -4
- package/dist/alpha/blueprints/EntityCardLauyoutBlueprint.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20250222022959
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
- a3d93ca: Introduces a new `
|
|
54
|
+
- a3d93ca: Introduces a new `EntityContentLayoutBlueprint` that creates custom entity content layouts.
|
|
55
55
|
|
|
56
56
|
The layout components receive card elements and can render them as they see fit. Cards is an array of objects with the following properties:
|
|
57
57
|
|
|
58
58
|
- element: `JSx.Element`;
|
|
59
|
-
-
|
|
59
|
+
- type: `"peek" | "info" | "full" | undefined`;
|
|
60
60
|
|
|
61
61
|
### Usage example
|
|
62
62
|
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
|
|
65
65
|
```tsx
|
|
66
66
|
import {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
EntityContentLayoutProps,
|
|
68
|
+
EntityContentLayoutBlueprint,
|
|
69
69
|
} from '@backstage/plugin-catalog-react/alpha';
|
|
70
70
|
// ...
|
|
71
71
|
|
|
72
|
-
function StickyEntityContentOverviewLayout(props:
|
|
72
|
+
function StickyEntityContentOverviewLayout(props: EntityContentLayoutProps) {
|
|
73
73
|
const { cards } = props;
|
|
74
74
|
const classes = useStyles();
|
|
75
75
|
return (
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
>
|
|
83
83
|
<Grid container spacing={3}>
|
|
84
84
|
{cards
|
|
85
|
-
.filter(card => card.
|
|
85
|
+
.filter(card => card.type === 'info')
|
|
86
86
|
.map((card, index) => (
|
|
87
87
|
<Grid key={index} xs={12} item>
|
|
88
88
|
{card.element}
|
|
@@ -93,14 +93,14 @@
|
|
|
93
93
|
<Grid xs={12} md={8} item>
|
|
94
94
|
<Grid container spacing={3}>
|
|
95
95
|
{cards
|
|
96
|
-
.filter(card => card.
|
|
96
|
+
.filter(card => card.type === 'peek')
|
|
97
97
|
.map((card, index) => (
|
|
98
98
|
<Grid key={index} className={classes.card} xs={12} md={6} item>
|
|
99
99
|
{card.element}
|
|
100
100
|
</Grid>
|
|
101
101
|
))}
|
|
102
102
|
{cards
|
|
103
|
-
.filter(card => !card.
|
|
103
|
+
.filter(card => !card.type || card.type === 'full')
|
|
104
104
|
.map((card, index) => (
|
|
105
105
|
<Grid key={index} className={classes.card} xs={12} md={6} item>
|
|
106
106
|
{card.element}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
export const customEntityContentOverviewStickyLayoutModule = createFrontendModule({
|
|
116
116
|
pluginId: 'app',
|
|
117
117
|
extensions: [
|
|
118
|
-
|
|
118
|
+
EntityContentLayoutBlueprint.make({
|
|
119
119
|
name: 'sticky',
|
|
120
120
|
params: {
|
|
121
121
|
// (optional) defaults the `() => false` filter function
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
# app-config.yaml
|
|
133
133
|
app:
|
|
134
134
|
extensions:
|
|
135
|
-
- entity-
|
|
135
|
+
- entity-content-layout:app/sticky: false
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
Overriding the custom layout filter:
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
# app-config.yaml
|
|
142
142
|
app:
|
|
143
143
|
extensions:
|
|
144
|
-
- entity-
|
|
144
|
+
- entity-content-layout:app/sticky:
|
|
145
145
|
config:
|
|
146
146
|
# This layout will be used only with component entities
|
|
147
147
|
filter: 'kind:component'
|
|
@@ -150,42 +150,44 @@
|
|
|
150
150
|
- d78bb71: Added `hidden` prop to `EntityTagPicker`, `EntityAutocompletePicker` and `UserListPicker`.
|
|
151
151
|
Added `initialFilter` prop to `EntityTagPicker` to set an initial filter for the picker.
|
|
152
152
|
Added `alwaysKeepFilters` prop to `UserListPicker` to prevent filters from resetting when no entities match the initial filters.
|
|
153
|
-
- a3d93ca: Add an optional `
|
|
153
|
+
- a3d93ca: Add an optional `type` parameter to `EntityCard` extensions. A card's type determines characteristics such as its expected size and where it will be rendered by the entity content layout.
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
Initially the following three types are supported:
|
|
156
156
|
|
|
157
|
-
- `peek`:
|
|
158
|
-
- `info`:
|
|
159
|
-
- `full`:
|
|
157
|
+
- `peek`: small vertical cards that provide information at a glance, for example recent builds, deployments, and service health.
|
|
158
|
+
- `info`: medium size cards with high priority and frequently used information such as common actions, entity metadata, and links.
|
|
159
|
+
- `full`: Large cards that are more feature rich with more information, typically used by plugins that don't quite need the full content view and want to show a card instead.
|
|
160
160
|
|
|
161
161
|
### Usage examples
|
|
162
162
|
|
|
163
|
-
Defining a default
|
|
163
|
+
Defining a default type when creating a card:
|
|
164
164
|
|
|
165
165
|
```diff
|
|
166
166
|
const myCard = EntityCardBlueprint.make({
|
|
167
167
|
name: 'myCard',
|
|
168
168
|
params: {
|
|
169
|
-
+
|
|
169
|
+
+ type: 'info',
|
|
170
170
|
loader: import('./MyCard).then(m => { default: m.MyCard }),
|
|
171
171
|
},
|
|
172
172
|
});
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
Changing the card
|
|
175
|
+
Changing the card type via `app-config.yaml` file:
|
|
176
176
|
|
|
177
177
|
```diff
|
|
178
178
|
app:
|
|
179
179
|
extensions:
|
|
180
180
|
+ - entity-card:myPlugin/myCard:
|
|
181
181
|
+ config:
|
|
182
|
-
+
|
|
182
|
+
+ type: info
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
### Patch Changes
|
|
186
186
|
|
|
187
187
|
- Updated dependencies
|
|
188
|
-
- @backstage/
|
|
188
|
+
- @backstage/frontend-plugin-api@0.0.0-nightly-20250222022959
|
|
189
|
+
- @backstage/core-compat-api@0.0.0-nightly-20250222022959
|
|
190
|
+
- @backstage/frontend-test-utils@0.0.0-nightly-20250222022959
|
|
189
191
|
- @backstage/integration-react@1.2.4
|
|
190
192
|
|
|
191
193
|
## 1.15.2
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import { entityFilterFunctionDataRef, entityFilterExpressionDataRef,
|
|
2
|
+
import { entityFilterFunctionDataRef, entityFilterExpressionDataRef, entityCardTypeDataRef, entityCardTypes } from './extensionData.esm.js';
|
|
3
3
|
|
|
4
4
|
const EntityCardBlueprint = createExtensionBlueprint({
|
|
5
5
|
kind: "entity-card",
|
|
@@ -8,23 +8,23 @@ const EntityCardBlueprint = createExtensionBlueprint({
|
|
|
8
8
|
coreExtensionData.reactElement,
|
|
9
9
|
entityFilterFunctionDataRef.optional(),
|
|
10
10
|
entityFilterExpressionDataRef.optional(),
|
|
11
|
-
|
|
11
|
+
entityCardTypeDataRef.optional()
|
|
12
12
|
],
|
|
13
13
|
dataRefs: {
|
|
14
14
|
filterFunction: entityFilterFunctionDataRef,
|
|
15
15
|
filterExpression: entityFilterExpressionDataRef,
|
|
16
|
-
|
|
16
|
+
type: entityCardTypeDataRef
|
|
17
17
|
},
|
|
18
18
|
config: {
|
|
19
19
|
schema: {
|
|
20
20
|
filter: (z) => z.string().optional(),
|
|
21
|
-
|
|
21
|
+
type: (z) => z.enum(entityCardTypes).optional()
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
*factory({
|
|
25
25
|
loader,
|
|
26
26
|
filter,
|
|
27
|
-
|
|
27
|
+
type
|
|
28
28
|
}, { node, config }) {
|
|
29
29
|
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
30
30
|
if (config.filter) {
|
|
@@ -34,12 +34,12 @@ const EntityCardBlueprint = createExtensionBlueprint({
|
|
|
34
34
|
} else if (typeof filter === "function") {
|
|
35
35
|
yield entityFilterFunctionDataRef(filter);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
yield
|
|
37
|
+
const finalType = config.type ?? type;
|
|
38
|
+
if (finalType) {
|
|
39
|
+
yield entityCardTypeDataRef(finalType);
|
|
40
40
|
} else {
|
|
41
41
|
console.warn(
|
|
42
|
-
`DEPRECATION WARNING: Not providing
|
|
42
|
+
`DEPRECATION WARNING: Not providing type for entity cards is deprecated. Missing from '${node.spec.id}'`
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCardBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityCardBlueprint.ts"],"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 {\n ExtensionBoundary,\n coreExtensionData,\n createExtensionBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n
|
|
1
|
+
{"version":3,"file":"EntityCardBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityCardBlueprint.ts"],"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 {\n ExtensionBoundary,\n coreExtensionData,\n createExtensionBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n entityCardTypeDataRef,\n entityCardTypes,\n EntityCardType,\n} from './extensionData';\n\n/**\n * @alpha\n * A blueprint for creating cards for the entity pages in the catalog.\n */\nexport const EntityCardBlueprint = createExtensionBlueprint({\n kind: 'entity-card',\n attachTo: { id: 'entity-content:catalog/overview', input: 'cards' },\n output: [\n coreExtensionData.reactElement,\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityCardTypeDataRef.optional(),\n ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n type: entityCardTypeDataRef,\n },\n config: {\n schema: {\n filter: z => z.string().optional(),\n type: z => z.enum(entityCardTypes).optional(),\n },\n },\n *factory(\n {\n loader,\n filter,\n type,\n }: {\n loader: () => Promise<JSX.Element>;\n filter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\n type?: EntityCardType;\n },\n { node, config },\n ) {\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n if (config.filter) {\n yield entityFilterExpressionDataRef(config.filter);\n } else if (typeof filter === 'string') {\n yield entityFilterExpressionDataRef(filter);\n } else if (typeof filter === 'function') {\n yield entityFilterFunctionDataRef(filter);\n }\n\n const finalType = config.type ?? type;\n if (finalType) {\n yield entityCardTypeDataRef(finalType);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `DEPRECATION WARNING: Not providing type for entity cards is deprecated. Missing from '${node.spec.id}'`,\n );\n }\n },\n});\n"],"names":[],"mappings":";;;AAiCO,MAAM,sBAAsB,wBAAyB,CAAA;AAAA,EAC1D,IAAM,EAAA,aAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,iCAAA,EAAmC,OAAO,OAAQ,EAAA;AAAA,EAClE,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,YAAA;AAAA,IAClB,4BAA4B,QAAS,EAAA;AAAA,IACrC,8BAA8B,QAAS,EAAA;AAAA,IACvC,sBAAsB,QAAS;AAAA,GACjC;AAAA,EACA,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,2BAAA;AAAA,IAChB,gBAAkB,EAAA,6BAAA;AAAA,IAClB,IAAM,EAAA;AAAA,GACR;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,MAAQ,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MACjC,MAAM,CAAK,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,eAAe,EAAE,QAAS;AAAA;AAC9C,GACF;AAAA,EACA,CAAC,OACC,CAAA;AAAA,IACE,MAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GAQF,EAAA,EAAE,IAAM,EAAA,MAAA,EACR,EAAA;AACA,IAAA,MAAM,kBAAkB,YAAa,CAAA,iBAAA,CAAkB,IAAK,CAAA,IAAA,EAAM,MAAM,CAAC,CAAA;AAEzE,IAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,MAAM,MAAA,6BAAA,CAA8B,OAAO,MAAM,CAAA;AAAA,KACnD,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAA,MAAM,8BAA8B,MAAM,CAAA;AAAA,KAC5C,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAA,MAAM,4BAA4B,MAAM,CAAA;AAAA;AAG1C,IAAM,MAAA,SAAA,GAAY,OAAO,IAAQ,IAAA,IAAA;AACjC,IAAA,IAAI,SAAW,EAAA;AACb,MAAA,MAAM,sBAAsB,SAAS,CAAA;AAAA,KAChC,MAAA;AAEL,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,CAAA,sFAAA,EAAyF,IAAK,CAAA,IAAA,CAAK,EAAE,CAAA,CAAA;AAAA,OACvG;AAAA;AACF;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityContentBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentBlueprint.ts"],"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 {\n coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n RouteRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityContentTitleDataRef,\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n entityContentGroupDataRef,\n defaultEntityContentGroups,\n} from './extensionData';\n\n/**\n * @alpha\n * Creates an EntityContent extension.\n */\nexport const EntityContentBlueprint = createExtensionBlueprint({\n kind: 'entity-content',\n attachTo: { id: 'page:catalog/entity', input: 'contents' },\n output: [\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n entityContentTitleDataRef,\n coreExtensionData.routeRef.optional(),\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityContentGroupDataRef.optional(),\n ],\n dataRefs: {\n title: entityContentTitleDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n group: entityContentGroupDataRef,\n },\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z => z.string().optional(),\n group: z => z.literal(false).or(z.string()).optional(),\n },\n },\n *factory(\n {\n loader,\n defaultPath,\n defaultTitle,\n defaultGroup,\n filter,\n routeRef,\n }: {\n loader: () => Promise<JSX.Element>;\n defaultPath: string;\n defaultTitle: string;\n defaultGroup?: keyof typeof defaultEntityContentGroups;\n routeRef?: RouteRef;\n filter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\n },\n { node, config },\n ) {\n const path = config.path ?? defaultPath;\n const title = config.title ?? defaultTitle;\n const group = config.group ?? defaultGroup;\n\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n yield coreExtensionData.routePath(path);\n\n yield entityContentTitleDataRef(title);\n\n if (routeRef) {\n yield coreExtensionData.routeRef(routeRef);\n }\n\n if (config.filter) {\n yield entityFilterExpressionDataRef(config.filter);\n } else if (typeof filter === 'string') {\n yield entityFilterExpressionDataRef(filter);\n } else if (typeof filter === 'function') {\n yield entityFilterFunctionDataRef(filter);\n }\n\n if (group) {\n yield entityContentGroupDataRef(group);\n }\n },\n});\n"],"names":[],"mappings":";;;AAkCO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,E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AA;AAE9B,IAAA,MAAM,kBAAkB,YAAa,CAAA,iBAAA,CAAkB,IAAK,CAAA,IAAA,EAAM,MAAM,CAAC,CAAA;AAEzE,IAAM,MAAA,iBAAA,CAAkB,UAAU,IAAI,CAAA;AAEtC,IAAA,MAAM,0BAA0B,KAAK,CAAA;AAErC,IAAA,IAAI,QAAU,EAAA;AACZ,MAAM,MAAA,iBAAA,CAAkB,SAAS,QAAQ,CAAA;AAAA;AAG3C,IAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,MAAM,MAAA,6BAAA,CAA8B,OAAO,MAAM,CAAA;AAAA,KACnD,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAA,MAAM,8BAA8B,MAAM,CAAA;AAAA,KAC5C,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAA,MAAM,4BAA4B,MAAM,CAAA;AAAA;AAG1C,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,MAAM,0BAA0B,KAAK,CAAA;AAAA;AACvC;AAEJ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityContentBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentBlueprint.ts"],"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 {\n coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n RouteRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityContentTitleDataRef,\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n entityContentGroupDataRef,\n defaultEntityContentGroups,\n} from './extensionData';\n\n/**\n * @alpha\n * Creates an EntityContent extension.\n */\nexport const EntityContentBlueprint = createExtensionBlueprint({\n kind: 'entity-content',\n attachTo: { id: 'page:catalog/entity', input: 'contents' },\n output: [\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n entityContentTitleDataRef,\n coreExtensionData.routeRef.optional(),\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityContentGroupDataRef.optional(),\n ],\n dataRefs: {\n title: entityContentTitleDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n group: entityContentGroupDataRef,\n },\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z => z.string().optional(),\n group: z => z.literal(false).or(z.string()).optional(),\n },\n },\n *factory(\n {\n loader,\n defaultPath,\n defaultTitle,\n defaultGroup,\n filter,\n routeRef,\n }: {\n loader: () => Promise<JSX.Element>;\n defaultPath: string;\n defaultTitle: string;\n defaultGroup?: keyof typeof defaultEntityContentGroups | (string & {});\n routeRef?: RouteRef;\n filter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\n },\n { node, config },\n ) {\n const path = config.path ?? defaultPath;\n const title = config.title ?? defaultTitle;\n const group = config.group ?? defaultGroup;\n\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n yield coreExtensionData.routePath(path);\n\n yield entityContentTitleDataRef(title);\n\n if (routeRef) {\n yield coreExtensionData.routeRef(routeRef);\n }\n\n if (config.filter) {\n yield entityFilterExpressionDataRef(config.filter);\n } else if (typeof filter === 'string') {\n yield entityFilterExpressionDataRef(filter);\n } else if (typeof filter === 'function') {\n yield entityFilterFunctionDataRef(filter);\n }\n\n if (group) {\n yield entityContentGroupDataRef(group);\n }\n },\n});\n"],"names":[],"mappings":";;;AAkCO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,E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AA;AAE9B,IAAA,MAAM,kBAAkB,YAAa,CAAA,iBAAA,CAAkB,IAAK,CAAA,IAAA,EAAM,MAAM,CAAC,CAAA;AAEzE,IAAM,MAAA,iBAAA,CAAkB,UAAU,IAAI,CAAA;AAEtC,IAAA,MAAM,0BAA0B,KAAK,CAAA;AAErC,IAAA,IAAI,QAAU,EAAA;AACZ,MAAM,MAAA,iBAAA,CAAkB,SAAS,QAAQ,CAAA;AAAA;AAG3C,IAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,MAAM,MAAA,6BAAA,CAA8B,OAAO,MAAM,CAAA;AAAA,KACnD,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAA,MAAM,8BAA8B,MAAM,CAAA;AAAA,KAC5C,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAA,MAAM,4BAA4B,MAAM,CAAA;AAAA;AAG1C,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,MAAM,0BAA0B,KAAK,CAAA;AAAA;AACvC;AAEJ,CAAC;;;;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { createExtensionDataRef, createExtensionBlueprint, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { entityFilterFunctionDataRef, entityFilterExpressionDataRef } from './extensionData.esm.js';
|
|
3
|
-
import React, { lazy } from 'react';
|
|
4
3
|
|
|
5
4
|
const entityCardLayoutComponentDataRef = createExtensionDataRef().with({
|
|
6
|
-
id: "catalog.entity-
|
|
5
|
+
id: "catalog.entity-content-layout.component"
|
|
7
6
|
});
|
|
8
|
-
const
|
|
9
|
-
kind: "entity-
|
|
7
|
+
const EntityContentLayoutBlueprint = createExtensionBlueprint({
|
|
8
|
+
kind: "entity-content-layout",
|
|
10
9
|
attachTo: { id: "entity-content:catalog/overview", input: "layouts" },
|
|
11
10
|
output: [
|
|
12
11
|
entityFilterFunctionDataRef.optional(),
|
|
@@ -20,31 +19,26 @@ const EntityCardLayoutBlueprint = createExtensionBlueprint({
|
|
|
20
19
|
},
|
|
21
20
|
config: {
|
|
22
21
|
schema: {
|
|
23
|
-
|
|
22
|
+
type: (z) => z.string().optional(),
|
|
24
23
|
filter: (z) => z.string().optional()
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
26
|
*factory({
|
|
28
27
|
loader,
|
|
29
|
-
|
|
28
|
+
filter
|
|
30
29
|
}, { node, config }) {
|
|
31
30
|
if (config.filter) {
|
|
32
31
|
yield entityFilterExpressionDataRef(config.filter);
|
|
33
|
-
} else if (typeof
|
|
34
|
-
yield entityFilterExpressionDataRef(
|
|
35
|
-
} else if (typeof
|
|
36
|
-
yield entityFilterFunctionDataRef(
|
|
32
|
+
} else if (typeof filter === "string") {
|
|
33
|
+
yield entityFilterExpressionDataRef(filter);
|
|
34
|
+
} else if (typeof filter === "function") {
|
|
35
|
+
yield entityFilterFunctionDataRef(filter);
|
|
37
36
|
}
|
|
38
|
-
const ExtensionComponent = lazy(
|
|
39
|
-
() => loader().then((component) => ({ default: component }))
|
|
40
|
-
);
|
|
41
37
|
yield entityCardLayoutComponentDataRef(
|
|
42
|
-
(
|
|
43
|
-
return /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props }));
|
|
44
|
-
}
|
|
38
|
+
ExtensionBoundary.lazyComponent(node, loader)
|
|
45
39
|
);
|
|
46
40
|
}
|
|
47
41
|
});
|
|
48
42
|
|
|
49
|
-
export {
|
|
50
|
-
//# sourceMappingURL=
|
|
43
|
+
export { EntityContentLayoutBlueprint };
|
|
44
|
+
//# sourceMappingURL=EntityContentLayoutBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityContentLayoutBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentLayoutBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 createExtensionDataRef,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterExpressionDataRef,\n entityFilterFunctionDataRef,\n EntityCardType,\n} from './extensionData';\nimport React from 'react';\n\n/** @alpha */\nexport interface EntityContentLayoutProps {\n cards: Array<{\n type?: EntityCardType;\n element: React.JSX.Element;\n }>;\n}\n\nconst entityCardLayoutComponentDataRef = createExtensionDataRef<\n (props: EntityContentLayoutProps) => React.JSX.Element\n>().with({\n id: 'catalog.entity-content-layout.component',\n});\n\n/** @alpha */\nexport const EntityContentLayoutBlueprint = createExtensionBlueprint({\n kind: 'entity-content-layout',\n attachTo: { id: 'entity-content:catalog/overview', input: 'layouts' },\n output: [\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityCardLayoutComponentDataRef,\n ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n component: entityCardLayoutComponentDataRef,\n },\n config: {\n schema: {\n type: z => z.string().optional(),\n filter: z => z.string().optional(),\n },\n },\n *factory(\n {\n loader,\n filter,\n }: {\n filter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\n loader: () => Promise<\n (props: EntityContentLayoutProps) => React.JSX.Element\n >;\n },\n { node, config },\n ) {\n if (config.filter) {\n yield entityFilterExpressionDataRef(config.filter);\n } else if (typeof filter === 'string') {\n yield entityFilterExpressionDataRef(filter);\n } else if (typeof filter === 'function') {\n yield entityFilterFunctionDataRef(filter);\n }\n\n yield entityCardLayoutComponentDataRef(\n ExtensionBoundary.lazy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C;;;;"}
|
|
@@ -16,10 +16,14 @@ const defaultEntityContentGroups = {
|
|
|
16
16
|
const entityContentGroupDataRef = createExtensionDataRef().with({
|
|
17
17
|
id: "catalog.entity-content-group"
|
|
18
18
|
});
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const entityCardTypes = [
|
|
20
|
+
"peek",
|
|
21
|
+
"info",
|
|
22
|
+
"full"
|
|
23
|
+
];
|
|
24
|
+
const entityCardTypeDataRef = createExtensionDataRef().with({
|
|
25
|
+
id: "catalog.entity-card-type"
|
|
22
26
|
});
|
|
23
27
|
|
|
24
|
-
export {
|
|
28
|
+
export { defaultEntityContentGroups, entityCardTypeDataRef, entityCardTypes, entityContentGroupDataRef, entityContentTitleDataRef, entityFilterExpressionDataRef, entityFilterFunctionDataRef };
|
|
25
29
|
//# sourceMappingURL=extensionData.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef
|
|
1
|
+
{"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-group',\n});\n\n/**\n * @internal\n * Available entity card types\n */\nexport const entityCardTypes = [\n 'peek',\n 'info',\n 'full',\n] as const satisfies readonly EntityCardType[];\n\n/** @alpha */\nexport type EntityCardType = 'peek' | 'info' | 'full';\n\n/** @internal */\nexport const entityCardTypeDataRef =\n createExtensionDataRef<EntityCardType>().with({\n id: 'catalog.entity-card-type',\n });\n"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA;AACN,CAAC;AAMI,MAAM,0BAA6B,GAAA;AAAA,EACxC,aAAe,EAAA,eAAA;AAAA,EACf,WAAa,EAAA,aAAA;AAAA,EACb,UAAY,EAAA,YAAA;AAAA,EACZ,aAAe,EAAA;AACjB;AAGa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAMM,MAAM,eAAkB,GAAA;AAAA,EAC7B,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAMa,MAAA,qBAAA,GACX,sBAAuC,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5C,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -3,7 +3,7 @@ import { getComponentData } from '@backstage/core-plugin-api';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { EntityCardBlueprint } from '../blueprints/EntityCardBlueprint.esm.js';
|
|
5
5
|
import '../blueprints/EntityContentBlueprint.esm.js';
|
|
6
|
-
import '../blueprints/
|
|
6
|
+
import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
7
7
|
import '../blueprints/extensionData.esm.js';
|
|
8
8
|
import kebabCase from 'lodash/kebabCase';
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import startCase from 'lodash/startCase';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import '../blueprints/EntityCardBlueprint.esm.js';
|
|
7
7
|
import { EntityContentBlueprint } from '../blueprints/EntityContentBlueprint.esm.js';
|
|
8
|
-
import '../blueprints/
|
|
8
|
+
import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
9
9
|
import '../blueprints/extensionData.esm.js';
|
|
10
10
|
|
|
11
11
|
function convertLegacyEntityContentExtension(LegacyExtension, overrides) {
|
package/dist/alpha.d.ts
CHANGED
|
@@ -19,6 +19,19 @@ import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
|
19
19
|
*/
|
|
20
20
|
declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @alpha
|
|
24
|
+
* Default entity content groups.
|
|
25
|
+
*/
|
|
26
|
+
declare const defaultEntityContentGroups: {
|
|
27
|
+
documentation: string;
|
|
28
|
+
development: string;
|
|
29
|
+
deployment: string;
|
|
30
|
+
observability: string;
|
|
31
|
+
};
|
|
32
|
+
/** @alpha */
|
|
33
|
+
type EntityCardType = 'peek' | 'info' | 'full';
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* @alpha
|
|
24
37
|
* A blueprint for creating cards for the entity pages in the catalog.
|
|
@@ -29,28 +42,28 @@ declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
|
|
|
29
42
|
params: {
|
|
30
43
|
loader: () => Promise<JSX.Element>;
|
|
31
44
|
filter?: string | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
32
|
-
|
|
45
|
+
type?: EntityCardType | undefined;
|
|
33
46
|
};
|
|
34
47
|
output: _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", {
|
|
35
48
|
optional: true;
|
|
36
49
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
37
50
|
optional: true;
|
|
38
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
51
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<EntityCardType, "catalog.entity-card-type", {
|
|
39
52
|
optional: true;
|
|
40
53
|
}>;
|
|
41
54
|
inputs: {};
|
|
42
55
|
config: {
|
|
43
56
|
filter: string | undefined;
|
|
44
|
-
|
|
57
|
+
type: "full" | "info" | "peek" | undefined;
|
|
45
58
|
};
|
|
46
59
|
configInput: {
|
|
47
60
|
filter?: string | undefined;
|
|
48
|
-
|
|
61
|
+
type?: "full" | "info" | "peek" | undefined;
|
|
49
62
|
};
|
|
50
63
|
dataRefs: {
|
|
51
64
|
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
52
65
|
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
53
|
-
|
|
66
|
+
type: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<EntityCardType, "catalog.entity-card-type", {}>;
|
|
54
67
|
};
|
|
55
68
|
}>;
|
|
56
69
|
|
|
@@ -65,7 +78,7 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
65
78
|
loader: () => Promise<JSX.Element>;
|
|
66
79
|
defaultPath: string;
|
|
67
80
|
defaultTitle: string;
|
|
68
|
-
defaultGroup?: "documentation" | "development" | "deployment" | "observability" | undefined;
|
|
81
|
+
defaultGroup?: (string & {}) | "documentation" | "development" | "deployment" | "observability" | undefined;
|
|
69
82
|
routeRef?: RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
70
83
|
filter?: string | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
71
84
|
};
|
|
@@ -75,7 +88,7 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
75
88
|
optional: true;
|
|
76
89
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
77
90
|
optional: true;
|
|
78
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string
|
|
91
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-group", {
|
|
79
92
|
optional: true;
|
|
80
93
|
}>;
|
|
81
94
|
inputs: {};
|
|
@@ -95,59 +108,43 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
95
108
|
title: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}>;
|
|
96
109
|
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
97
110
|
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
98
|
-
group: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string
|
|
111
|
+
group: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-group", {}>;
|
|
99
112
|
};
|
|
100
113
|
}>;
|
|
101
114
|
|
|
102
|
-
/**
|
|
103
|
-
* @alpha
|
|
104
|
-
* Default entity content groups.
|
|
105
|
-
*/
|
|
106
|
-
declare const defaultEntityContentGroups: {
|
|
107
|
-
documentation: string;
|
|
108
|
-
development: string;
|
|
109
|
-
deployment: string;
|
|
110
|
-
observability: string;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* @alpha
|
|
114
|
-
* Default entity content groups.
|
|
115
|
-
*/
|
|
116
|
-
declare const defaultEntityCardAreas: readonly ["peek", "info", "full"];
|
|
117
|
-
|
|
118
115
|
/** @alpha */
|
|
119
|
-
interface
|
|
116
|
+
interface EntityContentLayoutProps {
|
|
120
117
|
cards: Array<{
|
|
121
|
-
|
|
118
|
+
type?: EntityCardType;
|
|
122
119
|
element: React__default.JSX.Element;
|
|
123
120
|
}>;
|
|
124
121
|
}
|
|
125
122
|
/** @alpha */
|
|
126
|
-
declare const
|
|
127
|
-
kind: "entity-
|
|
123
|
+
declare const EntityContentLayoutBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
124
|
+
kind: "entity-content-layout";
|
|
128
125
|
name: undefined;
|
|
129
126
|
params: {
|
|
130
|
-
|
|
131
|
-
loader: () => Promise<(props:
|
|
127
|
+
filter?: string | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
128
|
+
loader: () => Promise<(props: EntityContentLayoutProps) => React__default.JSX.Element>;
|
|
132
129
|
};
|
|
133
130
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
134
131
|
optional: true;
|
|
135
132
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
136
133
|
optional: true;
|
|
137
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props:
|
|
134
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) => React__default.JSX.Element, "catalog.entity-content-layout.component", {}>;
|
|
138
135
|
inputs: {};
|
|
139
136
|
config: {
|
|
140
|
-
|
|
137
|
+
type: string | undefined;
|
|
141
138
|
filter: string | undefined;
|
|
142
139
|
};
|
|
143
140
|
configInput: {
|
|
144
141
|
filter?: string | undefined;
|
|
145
|
-
|
|
142
|
+
type?: string | undefined;
|
|
146
143
|
};
|
|
147
144
|
dataRefs: {
|
|
148
145
|
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
149
146
|
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
150
|
-
component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props:
|
|
147
|
+
component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) => React__default.JSX.Element, "catalog.entity-content-layout.component", {}>;
|
|
151
148
|
};
|
|
152
149
|
}>;
|
|
153
150
|
|
|
@@ -237,4 +234,4 @@ declare function useEntityPermission(permission: ResourcePermission<'catalog-ent
|
|
|
237
234
|
error?: Error;
|
|
238
235
|
};
|
|
239
236
|
|
|
240
|
-
export { EntityCardBlueprint,
|
|
237
|
+
export { EntityCardBlueprint, type EntityCardType, EntityContentBlueprint, EntityContentLayoutBlueprint, type EntityContentLayoutProps, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, defaultEntityContentGroups, isOwnerOf, useEntityPermission };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { EntityCardBlueprint } from './alpha/blueprints/EntityCardBlueprint.esm.js';
|
|
2
2
|
export { EntityContentBlueprint } from './alpha/blueprints/EntityContentBlueprint.esm.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { EntityContentLayoutBlueprint } from './alpha/blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
4
|
+
export { defaultEntityContentGroups } from './alpha/blueprints/extensionData.esm.js';
|
|
5
5
|
export { convertLegacyEntityCardExtension } from './alpha/converters/convertLegacyEntityCardExtension.esm.js';
|
|
6
6
|
export { convertLegacyEntityContentExtension } from './alpha/converters/convertLegacyEntityContentExtension.esm.js';
|
|
7
7
|
export { catalogReactTranslationRef } from './translation.esm.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-react",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20250222022959",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@backstage/catalog-client": "1.9.1",
|
|
77
77
|
"@backstage/catalog-model": "1.7.3",
|
|
78
|
-
"@backstage/core-compat-api": "0.
|
|
78
|
+
"@backstage/core-compat-api": "0.0.0-nightly-20250222022959",
|
|
79
79
|
"@backstage/core-components": "0.16.4",
|
|
80
80
|
"@backstage/core-plugin-api": "1.10.4",
|
|
81
81
|
"@backstage/errors": "1.2.7",
|
|
82
|
-
"@backstage/frontend-plugin-api": "0.
|
|
83
|
-
"@backstage/frontend-test-utils": "0.
|
|
82
|
+
"@backstage/frontend-plugin-api": "0.0.0-nightly-20250222022959",
|
|
83
|
+
"@backstage/frontend-test-utils": "0.0.0-nightly-20250222022959",
|
|
84
84
|
"@backstage/integration-react": "1.2.4",
|
|
85
85
|
"@backstage/plugin-catalog-common": "1.1.3",
|
|
86
86
|
"@backstage/plugin-permission-common": "0.8.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCardLauyoutBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityCardLauyoutBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 createExtensionDataRef,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterExpressionDataRef,\n entityFilterFunctionDataRef,\n defaultEntityCardAreas,\n} from './extensionData';\nimport React, { lazy as reactLazy, ComponentProps } from 'react';\n\n/** @alpha */\nexport interface EntityCardLayoutProps {\n cards: Array<{\n area?: (typeof defaultEntityCardAreas)[number];\n element: React.JSX.Element;\n }>;\n}\n\nconst entityCardLayoutComponentDataRef = createExtensionDataRef<\n (props: EntityCardLayoutProps) => React.JSX.Element\n>().with({\n id: 'catalog.entity-card-layout.component',\n});\n\n/** @alpha */\nexport const EntityCardLayoutBlueprint = createExtensionBlueprint({\n kind: 'entity-card-layout',\n attachTo: { id: 'entity-content:catalog/overview', input: 'layouts' },\n output: [\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityCardLayoutComponentDataRef,\n ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n component: entityCardLayoutComponentDataRef,\n },\n config: {\n schema: {\n area: z => z.string().optional(),\n filter: z => z.string().optional(),\n },\n },\n *factory(\n {\n loader,\n defaultFilter,\n }: {\n defaultFilter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\n loader: () => Promise<\n (props: EntityCardLayoutProps) => React.JSX.Element\n >;\n },\n { node, config },\n ) {\n if (config.filter) {\n yield entityFilterExpressionDataRef(config.filter);\n } else if (typeof defaultFilter === 'string') {\n yield entityFilterExpressionDataRef(defaultFilter);\n } else if (typeof defaultFilter === 'function') {\n yield entityFilterFunctionDataRef(defaultFilter);\n }\n\n const ExtensionComponent = reactLazy(() =>\n loader().then(component => ({ default: component })),\n );\n\n yield entityCardLayoutComponentDataRef(\n (props: ComponentProps<typeof ExtensionComponent>) => {\n return (\n <ExtensionBoundary node={node}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n },\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;AAoCA,MAAM,gCAAA,GAAmC,sBAEvC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAGM,MAAM,4BAA4B,wBAAyB,CAAA;AAAA,EAChE,IAAM,EAAA,oBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,iCAAA,EAAmC,OA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