@backstage/plugin-catalog-react 1.18.0-next.3 → 1.18.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
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d47aaa3: Added EntityOrderFilter to sort entities by different fields/columns. This new filter allows users to specify the order in which entities are displayed in the catalog.
|
|
8
|
+
|
|
9
|
+
Example usage:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
EntityOrderFilter,
|
|
14
|
+
useEntityList,
|
|
15
|
+
} from '@backstage/plugin-catalog-react';
|
|
16
|
+
// ...
|
|
17
|
+
const { updateFilters } = useEntityList();
|
|
18
|
+
|
|
19
|
+
// ...
|
|
20
|
+
updateFilters({
|
|
21
|
+
order: new EntityOrderFilter([
|
|
22
|
+
{
|
|
23
|
+
field: 'metadata.name',
|
|
24
|
+
order: 'desc',
|
|
25
|
+
},
|
|
26
|
+
]),
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- 1a003ff: Add `getLocations` method to `CatalogApi` and `CatalogClient`. This method calls the [`GET /locations`](https://backstage.io/docs/features/software-catalog/software-catalog-api/#get-locations) endpoint from the catalog backend.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 2ddbc50: A new `filter` parameter has been added to `EntityContextMenuItemBlueprint` to make it easier to configure which entities a menu item should appear for. The `filter` parameter is a function which accepts an entity and returns a boolean.
|
|
35
|
+
- 6d7f0d5: Fixed an issue causing entities of kind user and group to be empty when an owner was selected
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
- @backstage/frontend-plugin-api@0.10.2
|
|
38
|
+
- @backstage/core-components@0.17.2
|
|
39
|
+
- @backstage/catalog-model@1.7.4
|
|
40
|
+
- @backstage/core-compat-api@0.4.2
|
|
41
|
+
- @backstage/frontend-test-utils@0.3.2
|
|
42
|
+
- @backstage/plugin-permission-common@0.9.0
|
|
43
|
+
- @backstage/core-plugin-api@1.10.7
|
|
44
|
+
- @backstage/catalog-client@1.10.0
|
|
45
|
+
- @backstage/integration-react@1.2.7
|
|
46
|
+
- @backstage/plugin-permission-react@0.4.34
|
|
47
|
+
- @backstage/errors@1.2.7
|
|
48
|
+
- @backstage/types@1.2.1
|
|
49
|
+
- @backstage/version-bridge@1.0.11
|
|
50
|
+
- @backstage/plugin-catalog-common@1.1.4
|
|
51
|
+
|
|
3
52
|
## 1.18.0-next.3
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
|
@@ -4,12 +4,26 @@ import MenuItem from '@material-ui/core/MenuItem';
|
|
|
4
4
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
5
5
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
6
6
|
import { useEntityContextMenu } from '../../hooks/useEntityContextMenu.esm.js';
|
|
7
|
+
import { entityPredicateToFilterFunction } from '../predicates/entityPredicateToFilterFunction.esm.js';
|
|
8
|
+
import { entityFilterFunctionDataRef } from './extensionData.esm.js';
|
|
9
|
+
import { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema.esm.js';
|
|
7
10
|
|
|
8
11
|
const EntityContextMenuItemBlueprint = createExtensionBlueprint({
|
|
9
12
|
kind: "entity-context-menu-item",
|
|
10
13
|
attachTo: { id: "page:catalog/entity", input: "contextMenuItems" },
|
|
11
|
-
output: [
|
|
12
|
-
|
|
14
|
+
output: [
|
|
15
|
+
coreExtensionData.reactElement,
|
|
16
|
+
entityFilterFunctionDataRef.optional()
|
|
17
|
+
],
|
|
18
|
+
dataRefs: {
|
|
19
|
+
filterFunction: entityFilterFunctionDataRef
|
|
20
|
+
},
|
|
21
|
+
config: {
|
|
22
|
+
schema: {
|
|
23
|
+
filter: (z) => createEntityPredicateSchema(z).optional()
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
*factory(params, { node, config }) {
|
|
13
27
|
const loader = async () => {
|
|
14
28
|
const Component = () => {
|
|
15
29
|
const { onMenuClose } = useEntityContextMenu();
|
|
@@ -33,6 +47,17 @@ const EntityContextMenuItemBlueprint = createExtensionBlueprint({
|
|
|
33
47
|
return /* @__PURE__ */ jsx(Component, {});
|
|
34
48
|
};
|
|
35
49
|
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
50
|
+
if (config.filter) {
|
|
51
|
+
yield entityFilterFunctionDataRef(
|
|
52
|
+
entityPredicateToFilterFunction(config.filter)
|
|
53
|
+
);
|
|
54
|
+
} else if (typeof params.filter === "function") {
|
|
55
|
+
yield entityFilterFunctionDataRef(params.filter);
|
|
56
|
+
} else if (params.filter) {
|
|
57
|
+
yield entityFilterFunctionDataRef(
|
|
58
|
+
entityPredicateToFilterFunction(params.filter)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
36
61
|
}
|
|
37
62
|
});
|
|
38
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityContextMenuItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContextMenuItemBlueprint.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 { ReactNode, JSX } from 'react';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { useEntityContextMenu } from '../../hooks/useEntityContextMenu';\
|
|
1
|
+
{"version":3,"file":"EntityContextMenuItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContextMenuItemBlueprint.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 { ReactNode, JSX } from 'react';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { useEntityContextMenu } from '../../hooks/useEntityContextMenu';\nimport {\n EntityPredicate,\n entityPredicateToFilterFunction,\n} from '../predicates';\nimport type { Entity } from '@backstage/catalog-model';\nimport { entityFilterFunctionDataRef } from './extensionData';\nimport { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema';\n/** @alpha */\nexport type UseProps = () =>\n | {\n title: ReactNode;\n href: string;\n disabled?: boolean;\n }\n | {\n title: ReactNode;\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n };\n\n/** @alpha */\nexport type EntityContextMenuItemParams = {\n useProps: UseProps;\n icon: JSX.Element;\n filter?: EntityPredicate | ((entity: Entity) => boolean);\n};\n\n/** @alpha */\nexport const EntityContextMenuItemBlueprint = createExtensionBlueprint({\n kind: 'entity-context-menu-item',\n attachTo: { id: 'page:catalog/entity', input: 'contextMenuItems' },\n output: [\n coreExtensionData.reactElement,\n entityFilterFunctionDataRef.optional(),\n ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n },\n config: {\n schema: {\n filter: z => createEntityPredicateSchema(z).optional(),\n },\n },\n *factory(params: EntityContextMenuItemParams, { node, config }) {\n const loader = async () => {\n const Component = () => {\n const { onMenuClose } = useEntityContextMenu();\n const { title, ...menuItemProps } = params.useProps();\n let handleClick = undefined;\n\n if ('onClick' in menuItemProps) {\n handleClick = () => {\n const result = menuItemProps.onClick();\n if (result && 'then' in result) {\n result.then(onMenuClose, onMenuClose);\n } else {\n onMenuClose();\n }\n };\n }\n\n return (\n <MenuItem {...menuItemProps} onClick={handleClick}>\n <ListItemIcon>{params.icon}</ListItemIcon>\n <ListItemText primary={title} />\n </MenuItem>\n );\n };\n\n return <Component />;\n };\n\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n if (config.filter) {\n yield entityFilterFunctionDataRef(\n entityPredicateToFilterFunction(config.filter),\n );\n } else if (typeof params.filter === 'function') {\n yield entityFilterFunctionDataRef(params.filter);\n } else if (params.filter) {\n yield entityFilterFunctionDataRef(\n entityPredicateToFilterFunction(params.filter),\n );\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAsDO,MAAM,iCAAiC,wBAAyB,CAAA;AAAA,EACrE,IAAM,EAAA,0BAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,qBAAA,EAAuB,OAAO,kBAAmB,EAAA;AAAA,EACjE,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,YAAA;AAAA,IAClB,4BAA4B,QAAS;AAAA,GACvC;AAAA,EACA,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,MAAQ,EAAA,CAAA,CAAA,KAAK,2BAA4B,CAAA,CAAC,EAAE,QAAS;AAAA;AACvD,GACF;AAAA,EACA,CAAC,OAAQ,CAAA,MAAA,EAAqC,EAAE,IAAA,EA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EAAA;AACxB,MAAM,MAAA,2BAAA;AAAA,QACJ,+BAAA,CAAgC,OAAO,MAAM;AAAA,OAC/C;AAAA;AACF;AAEJ,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -229,17 +229,26 @@ type UseProps = () => {
|
|
|
229
229
|
type EntityContextMenuItemParams = {
|
|
230
230
|
useProps: UseProps;
|
|
231
231
|
icon: JSX$1.Element;
|
|
232
|
+
filter?: EntityPredicate | ((entity: Entity) => boolean);
|
|
232
233
|
};
|
|
233
234
|
/** @alpha */
|
|
234
235
|
declare const EntityContextMenuItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
235
236
|
kind: "entity-context-menu-item";
|
|
236
237
|
name: undefined;
|
|
237
238
|
params: EntityContextMenuItemParams;
|
|
238
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}
|
|
239
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
|
|
240
|
+
optional: true;
|
|
241
|
+
}>;
|
|
239
242
|
inputs: {};
|
|
240
|
-
config: {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
config: {
|
|
244
|
+
filter: EntityPredicate | undefined;
|
|
245
|
+
};
|
|
246
|
+
configInput: {
|
|
247
|
+
filter?: EntityPredicate | undefined;
|
|
248
|
+
};
|
|
249
|
+
dataRefs: {
|
|
250
|
+
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
251
|
+
};
|
|
243
252
|
}>;
|
|
244
253
|
|
|
245
254
|
/** @alpha */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-react",
|
|
3
|
-
"version": "1.18.0
|
|
3
|
+
"version": "1.18.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.0
|
|
77
|
-
"@backstage/catalog-model": "1.7.
|
|
78
|
-
"@backstage/core-compat-api": "0.4.2
|
|
79
|
-
"@backstage/core-components": "0.17.2
|
|
80
|
-
"@backstage/core-plugin-api": "1.10.7
|
|
81
|
-
"@backstage/errors": "1.2.7",
|
|
82
|
-
"@backstage/frontend-plugin-api": "0.10.2
|
|
83
|
-
"@backstage/frontend-test-utils": "0.3.2
|
|
84
|
-
"@backstage/integration-react": "1.2.7
|
|
85
|
-
"@backstage/plugin-catalog-common": "1.1.4
|
|
86
|
-
"@backstage/plugin-permission-common": "0.9.0
|
|
87
|
-
"@backstage/plugin-permission-react": "0.4.34
|
|
88
|
-
"@backstage/types": "1.2.1",
|
|
89
|
-
"@backstage/version-bridge": "1.0.11",
|
|
76
|
+
"@backstage/catalog-client": "^1.10.0",
|
|
77
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
78
|
+
"@backstage/core-compat-api": "^0.4.2",
|
|
79
|
+
"@backstage/core-components": "^0.17.2",
|
|
80
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
81
|
+
"@backstage/errors": "^1.2.7",
|
|
82
|
+
"@backstage/frontend-plugin-api": "^0.10.2",
|
|
83
|
+
"@backstage/frontend-test-utils": "^0.3.2",
|
|
84
|
+
"@backstage/integration-react": "^1.2.7",
|
|
85
|
+
"@backstage/plugin-catalog-common": "^1.1.4",
|
|
86
|
+
"@backstage/plugin-permission-common": "^0.9.0",
|
|
87
|
+
"@backstage/plugin-permission-react": "^0.4.34",
|
|
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.32.1
|
|
104
|
-
"@backstage/core-app-api": "1.17.0
|
|
105
|
-
"@backstage/plugin-catalog-common": "1.1.4
|
|
106
|
-
"@backstage/plugin-scaffolder-common": "1.5.11
|
|
107
|
-
"@backstage/test-utils": "1.7.8
|
|
103
|
+
"@backstage/cli": "^0.32.1",
|
|
104
|
+
"@backstage/core-app-api": "^1.17.0",
|
|
105
|
+
"@backstage/plugin-catalog-common": "^1.1.4",
|
|
106
|
+
"@backstage/plugin-scaffolder-common": "^1.5.11",
|
|
107
|
+
"@backstage/test-utils": "^1.7.8",
|
|
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",
|