@backstage/plugin-catalog-react 0.0.0-nightly-20260707031921 → 0.0.0-nightly-20260710031816
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,6 +1,6 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20260710031816
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -16,22 +16,31 @@
|
|
|
16
16
|
|
|
17
17
|
### Patch Changes
|
|
18
18
|
|
|
19
|
+
- 8a500d5: Fixed a regression where `EntityTypePicker`'s `initialFilter` prop was being cleared when used alongside `EntityKindPicker` inside `EntityListProvider`. The type filter is now correctly preserved after the available types load for the selected kind.
|
|
19
20
|
- Updated dependencies
|
|
20
|
-
- @backstage/frontend-plugin-api@0.0.0-nightly-
|
|
21
|
-
- @backstage/ui@0.0.0-nightly-
|
|
22
|
-
- @backstage/core-components@0.0.0-nightly-
|
|
23
|
-
- @backstage/filter-predicates@0.0.0-nightly-
|
|
24
|
-
- @backstage/core-compat-api@0.0.0-nightly-
|
|
25
|
-
- @backstage/core-plugin-api@0.0.0-nightly-
|
|
26
|
-
- @backstage/frontend-test-utils@0.0.0-nightly-
|
|
27
|
-
- @backstage/catalog-client@0.0.0-nightly-
|
|
21
|
+
- @backstage/frontend-plugin-api@0.0.0-nightly-20260710031816
|
|
22
|
+
- @backstage/ui@0.0.0-nightly-20260710031816
|
|
23
|
+
- @backstage/core-components@0.0.0-nightly-20260710031816
|
|
24
|
+
- @backstage/filter-predicates@0.0.0-nightly-20260710031816
|
|
25
|
+
- @backstage/core-compat-api@0.0.0-nightly-20260710031816
|
|
26
|
+
- @backstage/core-plugin-api@0.0.0-nightly-20260710031816
|
|
27
|
+
- @backstage/frontend-test-utils@0.0.0-nightly-20260710031816
|
|
28
|
+
- @backstage/catalog-client@0.0.0-nightly-20260710031816
|
|
28
29
|
- @backstage/catalog-model@1.9.0
|
|
29
30
|
- @backstage/errors@1.3.1
|
|
30
|
-
- @backstage/integration-react@0.0.0-nightly-
|
|
31
|
+
- @backstage/integration-react@0.0.0-nightly-20260710031816
|
|
31
32
|
- @backstage/types@1.2.2
|
|
32
33
|
- @backstage/version-bridge@1.0.12
|
|
33
34
|
- @backstage/plugin-permission-common@0.9.9
|
|
34
|
-
- @backstage/plugin-permission-react@0.0.0-nightly-
|
|
35
|
+
- @backstage/plugin-permission-react@0.0.0-nightly-20260710031816
|
|
36
|
+
|
|
37
|
+
## 3.2.0-next.1
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 8a500d5: Fixed a regression where `EntityTypePicker`'s `initialFilter` prop was being cleared when used alongside `EntityKindPicker` inside `EntityListProvider`. The type filter is now correctly preserved after the available types load for the selected kind.
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @backstage/core-components@0.18.12-next.1
|
|
35
44
|
|
|
36
45
|
## 3.2.0-next.0
|
|
37
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEntityTypeFilter.esm.js","sources":["../../src/hooks/useEntityTypeFilter.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useEffect, useMemo, useRef, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '../api';\nimport { useEntityList } from './useEntityListProvider';\nimport { EntityTypeFilter } from '../filters';\n\n/**\n * A hook built on top of `useEntityList` for enabling selection of valid `spec.type` values\n * based on the selected EntityKindFilter.\n * @public\n */\nexport function useEntityTypeFilter(): {\n loading: boolean;\n error?: Error;\n availableTypes: string[];\n selectedTypes: string[];\n setSelectedTypes: (types: string[]) => void;\n} {\n const catalogApi = useApi(catalogApiRef);\n const {\n filters: { kind: kindFilter, type: typeFilter },\n queryParameters: { type: typeParameter },\n updateFilters,\n } = useEntityList();\n\n const flattenedQueryTypes = useMemo(\n () => [typeParameter].flat().filter(Boolean) as string[],\n [typeParameter],\n );\n\n const [selectedTypes, setSelectedTypes] = useState(\n flattenedQueryTypes.length\n ? flattenedQueryTypes\n : typeFilter?.getTypes() ?? [],\n );\n\n // Set selected types on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (flattenedQueryTypes.length) {\n setSelectedTypes(flattenedQueryTypes);\n }\n }, [flattenedQueryTypes]);\n\n const [availableTypes, setAvailableTypes] = useState<string[]>([]);\n const kind = useMemo(() => kindFilter?.value, [kindFilter]);\n\n // Load all valid spec.type values straight from the catalogApi, paying attention to only the\n // kind filter for a complete list.\n const {\n error,\n loading,\n value: facets,\n } = useAsync(async () => {\n if (kind) {\n const items = await catalogApi\n .getEntityFacets({\n filter: { kind },\n facets: ['spec.type'],\n })\n .then(response => response.facets['spec.type'] || []);\n return items;\n }\n return
|
|
1
|
+
{"version":3,"file":"useEntityTypeFilter.esm.js","sources":["../../src/hooks/useEntityTypeFilter.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useEffect, useMemo, useRef, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '../api';\nimport { useEntityList } from './useEntityListProvider';\nimport { EntityTypeFilter } from '../filters';\n\n/**\n * A hook built on top of `useEntityList` for enabling selection of valid `spec.type` values\n * based on the selected EntityKindFilter.\n * @public\n */\nexport function useEntityTypeFilter(): {\n loading: boolean;\n error?: Error;\n availableTypes: string[];\n selectedTypes: string[];\n setSelectedTypes: (types: string[]) => void;\n} {\n const catalogApi = useApi(catalogApiRef);\n const {\n filters: { kind: kindFilter, type: typeFilter },\n queryParameters: { type: typeParameter },\n updateFilters,\n } = useEntityList();\n\n const flattenedQueryTypes = useMemo(\n () => [typeParameter].flat().filter(Boolean) as string[],\n [typeParameter],\n );\n\n const [selectedTypes, setSelectedTypes] = useState(\n flattenedQueryTypes.length\n ? flattenedQueryTypes\n : typeFilter?.getTypes() ?? [],\n );\n\n // Set selected types on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (flattenedQueryTypes.length) {\n setSelectedTypes(flattenedQueryTypes);\n }\n }, [flattenedQueryTypes]);\n\n const [availableTypes, setAvailableTypes] = useState<string[]>([]);\n const kind = useMemo(() => kindFilter?.value, [kindFilter]);\n\n // Load all valid spec.type values straight from the catalogApi, paying attention to only the\n // kind filter for a complete list.\n const {\n error,\n loading,\n value: facets,\n } = useAsync(async () => {\n if (kind) {\n const items = await catalogApi\n .getEntityFacets({\n filter: { kind },\n facets: ['spec.type'],\n })\n .then(response => response.facets['spec.type'] || []);\n return items;\n }\n return undefined;\n }, [kind, catalogApi]);\n\n const facetsRef = useRef(facets);\n useEffect(() => {\n const oldFacets = facetsRef.current;\n facetsRef.current = facets;\n // Delay processing hook until kind and facets load updates have settled to generate list of types;\n // This prevents resetting the type filter due to saved type value from query params not matching the\n // empty set of type values while values are still being loaded; also only run this hook on changes\n // to facets\n if (loading || !kind || oldFacets === facets || !facets) {\n return;\n }\n\n // Sort by facet count descending, so the most common types appear on top\n const newTypes = [\n ...new Set(\n sortBy(facets, f => -f.count).map(f =>\n f.value.toLocaleLowerCase('en-US'),\n ),\n ),\n ];\n setAvailableTypes(newTypes);\n\n // Update type filter to only valid values when the list of available types has changed\n const stillValidTypes = selectedTypes.filter(value =>\n newTypes.includes(value),\n );\n if (!isEqual(selectedTypes, stillValidTypes)) {\n setSelectedTypes(stillValidTypes);\n }\n }, [loading, kind, selectedTypes, setSelectedTypes, facets]);\n\n useEffect(() => {\n updateFilters({\n type: selectedTypes.length\n ? new EntityTypeFilter(selectedTypes)\n : undefined,\n });\n }, [selectedTypes, updateFilters]);\n\n return {\n loading,\n error,\n availableTypes,\n selectedTypes,\n setSelectedTypes,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AA8BO,SAAS,mBAAA,GAMd;AACA,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAA,MAAM;AAAA,IACJ,OAAA,EAAS,EAAE,IAAA,EAAM,UAAA,EAAY,MAAM,UAAA,EAAW;AAAA,IAC9C,eAAA,EAAiB,EAAE,IAAA,EAAM,aAAA,EAAc;AAAA,IACvC;AAAA,MACE,aAAA,EAAc;AAElB,EAAA,MAAM,mBAAA,GAAsB,OAAA;AAAA,IAC1B,MAAM,CAAC,aAAa,EAAE,IAAA,EAAK,CAAE,OAAO,OAAO,CAAA;AAAA,IAC3C,CAAC,aAAa;AAAA,GAChB;AAEA,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,QAAA;AAAA,IACxC,oBAAoB,MAAA,GAChB,mBAAA,GACA,UAAA,EAAY,QAAA,MAAc;AAAC,GACjC;AAIA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,oBAAoB,MAAA,EAAQ;AAC9B,MAAA,gB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kB,OAAO;AAAA;AACnC;AACF,KACF;AACA,IAAA,iBAAA,CAAkB,QAAQ,CAAA;AAG1B,IAAA,MAAM,kBAAkB,aAAA,CAAc,MAAA;AAAA,MAAO,CAAA,KAAA,KAC3C,QAAA,CAAS,QAAA,CAAS,KAAK;AAAA,KACzB;AACA,IAAA,IAAI,CAAC,OAAA,CAAQ,aAAA,EAAe,eAAe,CAAA,EAAG;AAC5C,MAAA,gBAAA,CAAiB,eAAe,CAAA;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,OAAA,EAAS,MAAM,aAAA,EAAe,gBAAA,EAAkB,MAAM,CAAC,CAAA;AAE3D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,aAAA,CAAc;AAAA,MACZ,MAAM,aAAA,CAAc,MAAA,GAChB,IAAI,gBAAA,CAAiB,aAAa,CAAA,GAClC;AAAA,KACL,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,aAAA,EAAe,aAAa,CAAC,CAAA;AAEjC,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
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-20260710031816",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -73,19 +73,19 @@
|
|
|
73
73
|
"test": "backstage-cli package test"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@backstage/catalog-client": "0.0.0-nightly-
|
|
76
|
+
"@backstage/catalog-client": "0.0.0-nightly-20260710031816",
|
|
77
77
|
"@backstage/catalog-model": "1.9.0",
|
|
78
|
-
"@backstage/core-compat-api": "0.0.0-nightly-
|
|
79
|
-
"@backstage/core-components": "0.0.0-nightly-
|
|
80
|
-
"@backstage/core-plugin-api": "0.0.0-nightly-
|
|
78
|
+
"@backstage/core-compat-api": "0.0.0-nightly-20260710031816",
|
|
79
|
+
"@backstage/core-components": "0.0.0-nightly-20260710031816",
|
|
80
|
+
"@backstage/core-plugin-api": "0.0.0-nightly-20260710031816",
|
|
81
81
|
"@backstage/errors": "1.3.1",
|
|
82
|
-
"@backstage/filter-predicates": "0.0.0-nightly-
|
|
83
|
-
"@backstage/frontend-plugin-api": "0.0.0-nightly-
|
|
84
|
-
"@backstage/integration-react": "0.0.0-nightly-
|
|
82
|
+
"@backstage/filter-predicates": "0.0.0-nightly-20260710031816",
|
|
83
|
+
"@backstage/frontend-plugin-api": "0.0.0-nightly-20260710031816",
|
|
84
|
+
"@backstage/integration-react": "0.0.0-nightly-20260710031816",
|
|
85
85
|
"@backstage/plugin-permission-common": "0.9.9",
|
|
86
|
-
"@backstage/plugin-permission-react": "0.0.0-nightly-
|
|
86
|
+
"@backstage/plugin-permission-react": "0.0.0-nightly-20260710031816",
|
|
87
87
|
"@backstage/types": "1.2.2",
|
|
88
|
-
"@backstage/ui": "0.0.0-nightly-
|
|
88
|
+
"@backstage/ui": "0.0.0-nightly-20260710031816",
|
|
89
89
|
"@backstage/version-bridge": "1.0.12",
|
|
90
90
|
"@material-ui/core": "^4.12.2",
|
|
91
91
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
"zod": "^4.0.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@backstage/cli": "0.0.0-nightly-
|
|
106
|
-
"@backstage/core-app-api": "0.0.0-nightly-
|
|
107
|
-
"@backstage/frontend-test-utils": "0.0.0-nightly-
|
|
105
|
+
"@backstage/cli": "0.0.0-nightly-20260710031816",
|
|
106
|
+
"@backstage/core-app-api": "0.0.0-nightly-20260710031816",
|
|
107
|
+
"@backstage/frontend-test-utils": "0.0.0-nightly-20260710031816",
|
|
108
108
|
"@backstage/plugin-catalog-common": "1.1.10",
|
|
109
109
|
"@backstage/plugin-scaffolder-common": "2.2.1",
|
|
110
|
-
"@backstage/test-utils": "0.0.0-nightly-
|
|
110
|
+
"@backstage/test-utils": "0.0.0-nightly-20260710031816",
|
|
111
111
|
"@testing-library/dom": "^10.0.0",
|
|
112
112
|
"@testing-library/jest-dom": "^6.0.0",
|
|
113
113
|
"@testing-library/react": "^16.0.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"react-test-renderer": "^16.13.1"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
|
-
"@backstage/frontend-test-utils": "0.0.0-nightly-
|
|
123
|
+
"@backstage/frontend-test-utils": "0.0.0-nightly-20260710031816",
|
|
124
124
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
125
125
|
"react": "^17.0.0 || ^18.0.0",
|
|
126
126
|
"react-dom": "^17.0.0 || ^18.0.0",
|