@backstage/plugin-catalog-react 1.18.1-next.1 → 1.19.0
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 +136 -0
- package/dist/alpha/blueprints/EntityIconLinkBlueprint.esm.js +44 -0
- package/dist/alpha/blueprints/EntityIconLinkBlueprint.esm.js.map +1 -0
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js +1 -0
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js.map +1 -1
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js +1 -0
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js.map +1 -1
- package/dist/alpha.d.ts +33 -1
- package/dist/alpha.esm.js +1 -0
- package/dist/alpha.esm.js.map +1 -1
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,141 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 406acb6: Introduces a new `EntityIconLinkBlueprint` that customizes the `About` card icon links on the `Catalog` entity page.
|
|
8
|
+
|
|
9
|
+
The blueprint currently accepts a `useProps` hook as `param` and this function returns the following props that will be passed to the icon link component:
|
|
10
|
+
|
|
11
|
+
| Name | Description | Type | Default Value |
|
|
12
|
+
| ---------- | --------------------------------------------------- | ------------- | ------------- |
|
|
13
|
+
| `icon` | The icon to display. | `JSX.Element` | N/A |
|
|
14
|
+
| `label` | The label for the element. | `string` | N/A |
|
|
15
|
+
| `title` | The title for the element. | `string` | N/A |
|
|
16
|
+
| `disabled` | Whether the element is disabled. | `boolean` | `false` |
|
|
17
|
+
| `href` | The URL to navigate to when the element is clicked. | `string` | N/A |
|
|
18
|
+
| `onClick` | A function to call when the element is clicked. | `() => void` | N/A |
|
|
19
|
+
|
|
20
|
+
Here is an usage example:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { EntityIconLinkBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
24
|
+
//...
|
|
25
|
+
|
|
26
|
+
EntityIconLinkBlueprint.make({
|
|
27
|
+
name: 'my-icon-link',
|
|
28
|
+
params: {
|
|
29
|
+
useProps() {
|
|
30
|
+
const { t } = useTranslationRef(myIconLinkTranslationRef);
|
|
31
|
+
return {
|
|
32
|
+
label: t('myIconLink.label'),
|
|
33
|
+
icon: <MyIconLinkIcon />,
|
|
34
|
+
href: '/my-plugin',
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Additionally, the `app-config.yaml` file allows you to override some of the default icon link parameters, including `label` and `title` values. Here's how to set them:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
app:
|
|
45
|
+
extensions:
|
|
46
|
+
- entity-icon-link:my-plugin/my-icon-link:
|
|
47
|
+
config:
|
|
48
|
+
label: 'My Custom Icon Link label'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Finally, you can disable all links if you want to hide the About card header completely (useful, for example, when links are displayed on separate cards). The header is hidden when no icon links extensions are enabled.
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- @backstage/core-components@0.17.3
|
|
57
|
+
- @backstage/catalog-client@1.10.1
|
|
58
|
+
- @backstage/core-plugin-api@1.10.8
|
|
59
|
+
- @backstage/frontend-plugin-api@0.10.3
|
|
60
|
+
- @backstage/integration-react@1.2.8
|
|
61
|
+
- @backstage/catalog-model@1.7.4
|
|
62
|
+
- @backstage/core-compat-api@0.4.3
|
|
63
|
+
- @backstage/errors@1.2.7
|
|
64
|
+
- @backstage/frontend-test-utils@0.3.3
|
|
65
|
+
- @backstage/types@1.2.1
|
|
66
|
+
- @backstage/version-bridge@1.0.11
|
|
67
|
+
- @backstage/plugin-catalog-common@1.1.4
|
|
68
|
+
- @backstage/plugin-permission-common@0.9.0
|
|
69
|
+
- @backstage/plugin-permission-react@0.4.35
|
|
70
|
+
|
|
71
|
+
## 1.19.0-next.2
|
|
72
|
+
|
|
73
|
+
### Minor Changes
|
|
74
|
+
|
|
75
|
+
- 406acb6: Introduces a new `EntityIconLinkBlueprint` that customizes the `About` card icon links on the `Catalog` entity page.
|
|
76
|
+
|
|
77
|
+
The blueprint currently accepts a `useProps` hook as `param` and this function returns the following props that will be passed to the icon link component:
|
|
78
|
+
|
|
79
|
+
| Name | Description | Type | Default Value |
|
|
80
|
+
| ---------- | --------------------------------------------------- | ------------- | ------------- |
|
|
81
|
+
| `icon` | The icon to display. | `JSX.Element` | N/A |
|
|
82
|
+
| `label` | The label for the element. | `string` | N/A |
|
|
83
|
+
| `title` | The title for the element. | `string` | N/A |
|
|
84
|
+
| `disabled` | Whether the element is disabled. | `boolean` | `false` |
|
|
85
|
+
| `href` | The URL to navigate to when the element is clicked. | `string` | N/A |
|
|
86
|
+
| `onClick` | A function to call when the element is clicked. | `() => void` | N/A |
|
|
87
|
+
|
|
88
|
+
Here is an usage example:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { EntityIconLinkBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
92
|
+
//...
|
|
93
|
+
|
|
94
|
+
EntityIconLinkBlueprint.make({
|
|
95
|
+
name: 'my-icon-link',
|
|
96
|
+
params: {
|
|
97
|
+
useProps() {
|
|
98
|
+
const { t } = useTranslationRef(myIconLinkTranslationRef);
|
|
99
|
+
return {
|
|
100
|
+
label: t('myIconLink.label'),
|
|
101
|
+
icon: <MyIconLinkIcon />,
|
|
102
|
+
href: '/my-plugin',
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Additionally, the `app-config.yaml` file allows you to override some of the default icon link parameters, including `label` and `title` values. Here's how to set them:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
app:
|
|
113
|
+
extensions:
|
|
114
|
+
- entity-icon-link:my-plugin/my-icon-link:
|
|
115
|
+
config:
|
|
116
|
+
label: 'My Custom Icon Link label'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Finally, you can disable all links if you want to hide the About card header completely (useful, for example, when links are displayed on separate cards). The header is hidden when no icon links extensions are enabled.
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies
|
|
124
|
+
- @backstage/core-components@0.17.3-next.0
|
|
125
|
+
- @backstage/frontend-plugin-api@0.10.3-next.1
|
|
126
|
+
- @backstage/integration-react@1.2.7
|
|
127
|
+
- @backstage/catalog-client@1.10.1-next.0
|
|
128
|
+
- @backstage/catalog-model@1.7.4
|
|
129
|
+
- @backstage/core-compat-api@0.4.3-next.2
|
|
130
|
+
- @backstage/core-plugin-api@1.10.7
|
|
131
|
+
- @backstage/errors@1.2.7
|
|
132
|
+
- @backstage/frontend-test-utils@0.3.3-next.1
|
|
133
|
+
- @backstage/types@1.2.1
|
|
134
|
+
- @backstage/version-bridge@1.0.11
|
|
135
|
+
- @backstage/plugin-catalog-common@1.1.4
|
|
136
|
+
- @backstage/plugin-permission-common@0.9.0
|
|
137
|
+
- @backstage/plugin-permission-react@0.4.34
|
|
138
|
+
|
|
3
139
|
## 1.18.1-next.1
|
|
4
140
|
|
|
5
141
|
### Patch Changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createExtensionDataRef, createExtensionBlueprint } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema.esm.js';
|
|
3
|
+
import { entityFilterFunctionDataRef, entityFilterExpressionDataRef } from './extensionData.esm.js';
|
|
4
|
+
import { resolveEntityFilterData } from './resolveEntityFilterData.esm.js';
|
|
5
|
+
|
|
6
|
+
const entityIconLinkPropsDataRef = createExtensionDataRef().with({
|
|
7
|
+
id: "entity-icon-link-props"
|
|
8
|
+
});
|
|
9
|
+
const EntityIconLinkBlueprint = createExtensionBlueprint({
|
|
10
|
+
kind: "entity-icon-link",
|
|
11
|
+
attachTo: { id: "entity-card:catalog/about", input: "iconLinks" },
|
|
12
|
+
output: [
|
|
13
|
+
entityFilterFunctionDataRef.optional(),
|
|
14
|
+
entityFilterExpressionDataRef.optional(),
|
|
15
|
+
entityIconLinkPropsDataRef
|
|
16
|
+
],
|
|
17
|
+
dataRefs: {
|
|
18
|
+
useProps: entityIconLinkPropsDataRef,
|
|
19
|
+
filterFunction: entityFilterFunctionDataRef,
|
|
20
|
+
filterExpression: entityFilterExpressionDataRef
|
|
21
|
+
},
|
|
22
|
+
config: {
|
|
23
|
+
schema: {
|
|
24
|
+
label: (z) => z.string().optional(),
|
|
25
|
+
title: (z) => z.string().optional(),
|
|
26
|
+
filter: (z) => createEntityPredicateSchema(z).optional()
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
*factory(params, { config, node }) {
|
|
30
|
+
const { filter, useProps } = params;
|
|
31
|
+
yield* resolveEntityFilterData(filter, config, node);
|
|
32
|
+
const configProps = Object.entries(config).reduce(
|
|
33
|
+
(rest, [key, value]) => value !== void 0 ? {
|
|
34
|
+
...rest,
|
|
35
|
+
[key]: value
|
|
36
|
+
} : rest,
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
39
|
+
yield entityIconLinkPropsDataRef(() => ({ ...useProps(), ...configProps }));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { EntityIconLinkBlueprint };
|
|
44
|
+
//# sourceMappingURL=EntityIconLinkBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityIconLinkBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityIconLinkBlueprint.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 { IconLinkVerticalProps } from '@backstage/core-components';\nimport {\n createExtensionBlueprint,\n createExtensionDataRef,\n} from '@backstage/frontend-plugin-api';\n\nimport { EntityPredicate } from '../predicates';\nimport { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema';\n\nimport {\n entityFilterExpressionDataRef,\n entityFilterFunctionDataRef,\n} from './extensionData';\nimport { Entity } from '@backstage/catalog-model';\nimport { resolveEntityFilterData } from './resolveEntityFilterData';\n\nconst entityIconLinkPropsDataRef = createExtensionDataRef<\n () => IconLinkVerticalProps\n>().with({\n id: 'entity-icon-link-props',\n});\n\n/** @alpha */\nexport const EntityIconLinkBlueprint = createExtensionBlueprint({\n kind: 'entity-icon-link',\n attachTo: { id: 'entity-card:catalog/about', input: 'iconLinks' },\n output: [\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityIconLinkPropsDataRef,\n ],\n dataRefs: {\n useProps: entityIconLinkPropsDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n },\n config: {\n schema: {\n label: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z => createEntityPredicateSchema(z).optional(),\n },\n },\n *factory(\n params: {\n useProps: () => Omit<IconLinkVerticalProps, 'color'>;\n filter?: EntityPredicate | ((entity: Entity) => boolean);\n },\n { config, node },\n ) {\n const { filter, useProps } = params;\n yield* resolveEntityFilterData(filter, config, node);\n // Only include properties that are defined in the config\n // to avoid overriding defaults with undefined values\n const configProps = Object.entries(config).reduce(\n (rest, [key, value]) =>\n value !== undefined\n ? {\n ...rest,\n [key]: value,\n }\n : rest,\n {},\n );\n yield entityIconLinkPropsDataRef(() => ({ ...useProps(), ...configProps }));\n },\n});\n"],"names":[],"mappings":";;;;;AAgCA,MAAM,0BAAA,GAA6B,sBAEjC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAGM,MAAM,0BAA0B,wBAAyB,CAAA;AAAA,EAC9D,IAAM,EAAA,kBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,2BAAA,EAA6B,OAAO,WAAY,EAAA;AAAA,EAChE,MAAQ,EAAA;AAAA,IACN,4BAA4B,QAAS,EAAA;AAAA,IACrC,8BAA8B,QAAS,EAAA;AAAA,IACvC;AAAA,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,0BAAA;AAAA,IACV,cAAgB,EAAA,2BAAA;AAAA,IAChB,gBAAkB,EAAA;AAAA,GACpB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MAChC,KAAO,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MAChC,MAAQ,EAAA,CAAA,CAAA,KAAK,2BAA4B,CAAA,CAAC,EAAE,QAAS;AAAA;AACvD,GACF;AAAA,EACA,CAAC,OACC,CAAA,MAAA,EAIA,EAAE,MAAA,EAAQ,MACV,EAAA;AACA,IAAM,MAAA,EAAE,MAAQ,EAAA,QAAA,EAAa,GAAA,MAAA;AAC7B,IAAO,OAAA,uBAAA,CAAwB,MAAQ,EAAA,MAAA,EAAQ,IAAI,CAAA;AAGnD,IAAA,MAAM,WAAc,GAAA,MAAA,CAAO,OAAQ,CAAA,MAAM,CAAE,CAAA,MAAA;AAAA,MACzC,CAAC,IAAM,EAAA,CAAC,KAAK,KAAK,CAAA,KAChB,UAAU,KACN,CAAA,GAAA;AAAA,QACE,GAAG,IAAA;AAAA,QACH,CAAC,GAAG,GAAG;AAAA,OAET,GAAA,IAAA;AAAA,MACN;AAAC,KACH;AACA,IAAM,MAAA,0BAAA,CAA2B,OAAO,EAAE,GAAG,UAAY,EAAA,GAAG,aAAc,CAAA,CAAA;AAAA;AAE9E,CAAC;;;;"}
|
|
@@ -8,6 +8,7 @@ import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
|
8
8
|
import '../blueprints/EntityHeaderBlueprint.esm.js';
|
|
9
9
|
import '../blueprints/extensionData.esm.js';
|
|
10
10
|
import '../blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
11
|
+
import '../blueprints/EntityIconLinkBlueprint.esm.js';
|
|
11
12
|
import kebabCase from 'lodash/kebabCase';
|
|
12
13
|
|
|
13
14
|
function convertLegacyEntityCardExtension(LegacyExtension, overrides) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertLegacyEntityCardExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityCardExtension.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 { compatWrapper } from '@backstage/core-compat-api';\nimport { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\nimport { EntityCardBlueprint } from '../blueprints';\nimport kebabCase from 'lodash/kebabCase';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityCardExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Card$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityCardBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityCardExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityCardExtension.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 { compatWrapper } from '@backstage/core-compat-api';\nimport { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\nimport { EntityCardBlueprint } from '../blueprints';\nimport kebabCase from 'lodash/kebabCase';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityCardExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Card$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityCardBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0BgB,SAAA,gCAAA,CACd,iBACA,SAIqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,kBAAkB,CAAA;AAC9C,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA;AAAA;AACT;AAEF,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA;AAE7B,EAAA,OAAO,oBAAoB,IAAK,CAAA;AAAA,IAC9B,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO;AAAA;AAC3C,GACD,CAAA;AACH;;;;"}
|
|
@@ -10,6 +10,7 @@ import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
|
10
10
|
import '../blueprints/EntityHeaderBlueprint.esm.js';
|
|
11
11
|
import '../blueprints/extensionData.esm.js';
|
|
12
12
|
import '../blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
13
|
+
import '../blueprints/EntityIconLinkBlueprint.esm.js';
|
|
13
14
|
|
|
14
15
|
function convertLegacyEntityContentExtension(LegacyExtension, overrides) {
|
|
15
16
|
const element = /* @__PURE__ */ jsx(LegacyExtension, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.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 {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n defaultPath?: string;\n defaultTitle?: string;\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,\n defaultTitle: overrides?.defaultTitle ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.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 {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n defaultPath?: string;\n defaultTitle?: string;\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,\n defaultTitle: overrides?.defaultTitle ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAkCgB,SAAA,mCAAA,CACd,iBACA,SAMqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAA,MAAM,UAAa,GAAA,gBAAA;AAAA,IACjB,OAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,qBAAqB,CAAA;AACjD,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA;AAAA;AACT;AAEF,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA;AAE7B,EAAA,OAAO,uBAAuB,IAAK,CAAA;AAAA,IACjC,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,aAAa,SAAW,EAAA,WAAA,IAAe,CAAI,CAAA,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AAAA,MAC3D,YAAc,EAAA,SAAA,EAAW,YAAgB,IAAA,SAAA,CAAU,KAAK,CAAA;AAAA,MACxD,QAAA,EAAU,UAAc,IAAA,qBAAA,CAAsB,UAAU,CAAA;AAAA,MACxD,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO;AAAA;AAC3C,GACD,CAAA;AACH;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { RouteRef, ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { JSX as JSX$1, ReactNode, ComponentType } from 'react';
|
|
5
5
|
import { Entity } from '@backstage/catalog-model';
|
|
6
|
+
import { IconLinkVerticalProps } from '@backstage/core-components';
|
|
6
7
|
import { JsonValue } from '@backstage/types';
|
|
7
8
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
8
9
|
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
@@ -251,6 +252,37 @@ declare const EntityContextMenuItemBlueprint: _backstage_frontend_plugin_api.Ext
|
|
|
251
252
|
};
|
|
252
253
|
}>;
|
|
253
254
|
|
|
255
|
+
/** @alpha */
|
|
256
|
+
declare const EntityIconLinkBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
257
|
+
kind: "entity-icon-link";
|
|
258
|
+
name: undefined;
|
|
259
|
+
params: {
|
|
260
|
+
useProps: () => Omit<IconLinkVerticalProps, "color">;
|
|
261
|
+
filter?: EntityPredicate | ((entity: Entity) => boolean);
|
|
262
|
+
};
|
|
263
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
|
|
264
|
+
optional: true;
|
|
265
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
266
|
+
optional: true;
|
|
267
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => IconLinkVerticalProps, "entity-icon-link-props", {}>;
|
|
268
|
+
inputs: {};
|
|
269
|
+
config: {
|
|
270
|
+
label: string | undefined;
|
|
271
|
+
title: string | undefined;
|
|
272
|
+
filter: EntityPredicate | undefined;
|
|
273
|
+
};
|
|
274
|
+
configInput: {
|
|
275
|
+
filter?: EntityPredicate | undefined;
|
|
276
|
+
label?: string | undefined;
|
|
277
|
+
title?: string | undefined;
|
|
278
|
+
};
|
|
279
|
+
dataRefs: {
|
|
280
|
+
useProps: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => IconLinkVerticalProps, "entity-icon-link-props", {}>;
|
|
281
|
+
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
282
|
+
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
283
|
+
};
|
|
284
|
+
}>;
|
|
285
|
+
|
|
254
286
|
/** @alpha */
|
|
255
287
|
declare function convertLegacyEntityCardExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
256
288
|
name?: string;
|
|
@@ -337,4 +369,4 @@ declare function useEntityPermission(permission: ResourcePermission<'catalog-ent
|
|
|
337
369
|
error?: Error;
|
|
338
370
|
};
|
|
339
371
|
|
|
340
|
-
export { CatalogFilterBlueprint, EntityCardBlueprint, type EntityCardType, EntityContentBlueprint, EntityContentLayoutBlueprint, type EntityContentLayoutProps, EntityContextMenuItemBlueprint, type EntityContextMenuItemParams, EntityHeaderBlueprint, type EntityPredicate, type EntityPredicateExpression, type EntityPredicatePrimitive, type EntityPredicateValue, type UseProps, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, defaultEntityContentGroups, entityPredicateToFilterFunction, isOwnerOf, useEntityPermission };
|
|
372
|
+
export { CatalogFilterBlueprint, EntityCardBlueprint, type EntityCardType, EntityContentBlueprint, EntityContentLayoutBlueprint, type EntityContentLayoutProps, EntityContextMenuItemBlueprint, type EntityContextMenuItemParams, EntityHeaderBlueprint, EntityIconLinkBlueprint, type EntityPredicate, type EntityPredicateExpression, type EntityPredicatePrimitive, type EntityPredicateValue, type UseProps, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, defaultEntityContentGroups, entityPredicateToFilterFunction, isOwnerOf, useEntityPermission };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -5,6 +5,7 @@ export { EntityContentLayoutBlueprint } from './alpha/blueprints/EntityContentLa
|
|
|
5
5
|
export { EntityHeaderBlueprint } from './alpha/blueprints/EntityHeaderBlueprint.esm.js';
|
|
6
6
|
export { defaultEntityContentGroups } from './alpha/blueprints/extensionData.esm.js';
|
|
7
7
|
export { EntityContextMenuItemBlueprint } from './alpha/blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
8
|
+
export { EntityIconLinkBlueprint } from './alpha/blueprints/EntityIconLinkBlueprint.esm.js';
|
|
8
9
|
export { convertLegacyEntityCardExtension } from './alpha/converters/convertLegacyEntityCardExtension.esm.js';
|
|
9
10
|
export { convertLegacyEntityContentExtension } from './alpha/converters/convertLegacyEntityContentExtension.esm.js';
|
|
10
11
|
export { entityPredicateToFilterFunction } from './alpha/predicates/entityPredicateToFilterFunction.esm.js';
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -73,20 +73,20 @@
|
|
|
73
73
|
"test": "backstage-cli package test"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@backstage/catalog-client": "1.10.1
|
|
77
|
-
"@backstage/catalog-model": "1.7.4",
|
|
78
|
-
"@backstage/core-compat-api": "0.4.3
|
|
79
|
-
"@backstage/core-components": "0.17.
|
|
80
|
-
"@backstage/core-plugin-api": "1.10.
|
|
81
|
-
"@backstage/errors": "1.2.7",
|
|
82
|
-
"@backstage/frontend-plugin-api": "0.10.3
|
|
83
|
-
"@backstage/frontend-test-utils": "0.3.3
|
|
84
|
-
"@backstage/integration-react": "1.2.
|
|
85
|
-
"@backstage/plugin-catalog-common": "1.1.4",
|
|
86
|
-
"@backstage/plugin-permission-common": "0.9.0",
|
|
87
|
-
"@backstage/plugin-permission-react": "0.4.
|
|
88
|
-
"@backstage/types": "1.2.1",
|
|
89
|
-
"@backstage/version-bridge": "1.0.11",
|
|
76
|
+
"@backstage/catalog-client": "^1.10.1",
|
|
77
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
78
|
+
"@backstage/core-compat-api": "^0.4.3",
|
|
79
|
+
"@backstage/core-components": "^0.17.3",
|
|
80
|
+
"@backstage/core-plugin-api": "^1.10.8",
|
|
81
|
+
"@backstage/errors": "^1.2.7",
|
|
82
|
+
"@backstage/frontend-plugin-api": "^0.10.3",
|
|
83
|
+
"@backstage/frontend-test-utils": "^0.3.3",
|
|
84
|
+
"@backstage/integration-react": "^1.2.8",
|
|
85
|
+
"@backstage/plugin-catalog-common": "^1.1.4",
|
|
86
|
+
"@backstage/plugin-permission-common": "^0.9.0",
|
|
87
|
+
"@backstage/plugin-permission-react": "^0.4.35",
|
|
88
|
+
"@backstage/types": "^1.2.1",
|
|
89
|
+
"@backstage/version-bridge": "^1.0.11",
|
|
90
90
|
"@material-ui/core": "^4.12.2",
|
|
91
91
|
"@material-ui/icons": "^4.9.1",
|
|
92
92
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"zen-observable": "^0.10.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@backstage/cli": "0.
|
|
104
|
-
"@backstage/core-app-api": "1.17.
|
|
105
|
-
"@backstage/plugin-catalog-common": "1.1.4",
|
|
106
|
-
"@backstage/plugin-scaffolder-common": "1.5.11",
|
|
107
|
-
"@backstage/test-utils": "1.7.
|
|
103
|
+
"@backstage/cli": "^0.33.0",
|
|
104
|
+
"@backstage/core-app-api": "^1.17.1",
|
|
105
|
+
"@backstage/plugin-catalog-common": "^1.1.4",
|
|
106
|
+
"@backstage/plugin-scaffolder-common": "^1.5.11",
|
|
107
|
+
"@backstage/test-utils": "^1.7.9",
|
|
108
108
|
"@testing-library/dom": "^10.0.0",
|
|
109
109
|
"@testing-library/jest-dom": "^6.0.0",
|
|
110
110
|
"@testing-library/react": "^16.0.0",
|