@backstage/plugin-catalog-react 0.0.0-nightly-20240824022004 → 0.0.0-nightly-20240826071828
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,13 +1,13 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20240826071828
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- 5446061: The `/alpha` export no longer export extension creators for the new frontend system, existing usage should be switched to use the equivalent extension blueprint instead. For more information see the [new frontend system 1.30 migration documentation](https://backstage.io/docs/frontend-system/architecture/migrations#130).
|
|
8
8
|
- Updated dependencies
|
|
9
|
-
- @backstage/frontend-plugin-api@0.0.0-nightly-
|
|
10
|
-
- @backstage/core-compat-api@0.0.0-nightly-
|
|
9
|
+
- @backstage/frontend-plugin-api@0.0.0-nightly-20240826071828
|
|
10
|
+
- @backstage/core-compat-api@0.0.0-nightly-20240826071828
|
|
11
11
|
- @backstage/core-components@0.14.10
|
|
12
12
|
- @backstage/core-plugin-api@1.9.3
|
|
13
13
|
- @backstage/integration-react@1.1.30
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -115,15 +115,15 @@ declare const catalogReactTranslationRef: _backstage_core_plugin_api_alpha.Trans
|
|
|
115
115
|
readonly "inspectEntityDialog.title": "Entity Inspector";
|
|
116
116
|
readonly "inspectEntityDialog.closeButtonTitle": "Close";
|
|
117
117
|
readonly "inspectEntityDialog.ancestryPage.title": "Ancestry";
|
|
118
|
-
readonly "inspectEntityDialog.colocatedPage.description": "These are the entities that are colocated with this entity - as in, they originated from the same data source (e.g. came from the same YAML file), or from the same origin (e.g. the originally registered URL).";
|
|
119
118
|
readonly "inspectEntityDialog.colocatedPage.title": "Colocated";
|
|
119
|
+
readonly "inspectEntityDialog.colocatedPage.description": "These are the entities that are colocated with this entity - as in, they originated from the same data source (e.g. came from the same YAML file), or from the same origin (e.g. the originally registered URL).";
|
|
120
120
|
readonly "inspectEntityDialog.colocatedPage.alertNoLocation": "Entity had no location information.";
|
|
121
121
|
readonly "inspectEntityDialog.colocatedPage.alertNoEntity": "There were no other entities on this location.";
|
|
122
|
-
readonly "inspectEntityDialog.jsonPage.description": "This is the raw entity data as received from the catalog, on JSON form.";
|
|
123
122
|
readonly "inspectEntityDialog.jsonPage.title": "Entity as JSON";
|
|
123
|
+
readonly "inspectEntityDialog.jsonPage.description": "This is the raw entity data as received from the catalog, on JSON form.";
|
|
124
124
|
readonly "inspectEntityDialog.overviewPage.title": "Overview";
|
|
125
|
-
readonly "inspectEntityDialog.yamlPage.description": "This is the raw entity data as received from the catalog, on YAML form.";
|
|
126
125
|
readonly "inspectEntityDialog.yamlPage.title": "Entity as YAML";
|
|
126
|
+
readonly "inspectEntityDialog.yamlPage.description": "This is the raw entity data as received from the catalog, on YAML form.";
|
|
127
127
|
readonly "unregisterEntityDialog.title": "Are you sure you want to unregister this entity?";
|
|
128
128
|
readonly "unregisterEntityDialog.cancelButtonTitle": "Cancel";
|
|
129
129
|
readonly "unregisterEntityDialog.deleteButtonTitle": "Delete Entity";
|
|
@@ -133,8 +133,8 @@ declare const catalogReactTranslationRef: _backstage_core_plugin_api_alpha.Trans
|
|
|
133
133
|
readonly "unregisterEntityDialog.bootstrapState.title": "You cannot unregister this entity, since it originates from a protected Backstage configuration (location \"{{location}}\"). If you believe this is in error, please contact the {{appTitle}} integrator.";
|
|
134
134
|
readonly "unregisterEntityDialog.bootstrapState.advancedDescription": "You have the option to delete the entity itself from the catalog. Note that this should only be done if you know that the catalog file has been deleted at, or moved from, its origin location. If that is not the case, the entity will reappear shortly as the next refresh round is performed by the catalog.";
|
|
135
135
|
readonly "unregisterEntityDialog.bootstrapState.advancedOptions": "Advanced Options";
|
|
136
|
-
readonly "unregisterEntityDialog.unregisterState.description": "To undo, just re-register the entity in {{appTitle}}.";
|
|
137
136
|
readonly "unregisterEntityDialog.unregisterState.title": "This action will unregister the following entities:";
|
|
137
|
+
readonly "unregisterEntityDialog.unregisterState.description": "To undo, just re-register the entity in {{appTitle}}.";
|
|
138
138
|
readonly "unregisterEntityDialog.unregisterState.subTitle": "Located at the following location:";
|
|
139
139
|
readonly "unregisterEntityDialog.unregisterState.advancedDescription": "You also have the option to delete the entity itself from the catalog. Note that this should only be done if you know that the catalog file has been deleted at, or moved from, its origin location. If that is not the case, the entity will reappear shortly as the next refresh round is performed by the catalog.";
|
|
140
140
|
readonly "unregisterEntityDialog.unregisterState.advancedOptions": "Advanced Options";
|
|
@@ -14,7 +14,7 @@ function useFacetsEntities({ enabled }) {
|
|
|
14
14
|
const facetsResponse = await catalogApi.getEntityFacets({
|
|
15
15
|
facets: [facet]
|
|
16
16
|
});
|
|
17
|
-
const entityRefs = facetsResponse.facets[facet]
|
|
17
|
+
const entityRefs = facetsResponse.facets[facet]?.map((e) => e.value) ?? [];
|
|
18
18
|
return catalogApi.getEntitiesByRefs({ entityRefs }).then(
|
|
19
19
|
(resp) => resp.items.filter((entity) => entity !== void 0).map((entity) => entity).sort(
|
|
20
20
|
(a, b) => (a.metadata.namespace || "").localeCompare(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFacetsEntities.esm.js","sources":["../../../src/components/EntityOwnerPicker/useFacetsEntities.ts"],"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 */\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { catalogApiRef } from '../../api';\nimport { useState } from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport get from 'lodash/get';\n\ntype FacetsCursor = {\n start: number;\n text: string;\n};\n\ntype FacetsEntitiesResponse = {\n items: Entity[];\n cursor?: string;\n};\n\ntype FacetsInitialRequest = {\n text: string;\n};\n\n/**\n * This hook asynchronously loads the entity owners using the facets endpoint.\n * EntityOwnerPicker uses this hook when mode=\"owners-only\" is passed as prop.\n * All the owners are kept internally in memory and rendered in batches once requested\n * by the frontend. The values returned by this hook are compatible with `useQueryEntities`\n * hook, which is also used by EntityOwnerPicker.\n */\nexport function useFacetsEntities({ enabled }: { enabled: boolean }) {\n const catalogApi = useApi(catalogApiRef);\n\n const [facetsPromise] = useState(async () => {\n if (!enabled) {\n return [];\n }\n const facet = 'relations.ownedBy';\n const facetsResponse = await catalogApi.getEntityFacets({\n facets: [facet],\n });\n const entityRefs = facetsResponse.facets[facet]
|
|
1
|
+
{"version":3,"file":"useFacetsEntities.esm.js","sources":["../../../src/components/EntityOwnerPicker/useFacetsEntities.ts"],"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 */\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsyncFn from 'react-use/esm/useAsyncFn';\nimport { catalogApiRef } from '../../api';\nimport { useState } from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport get from 'lodash/get';\n\ntype FacetsCursor = {\n start: number;\n text: string;\n};\n\ntype FacetsEntitiesResponse = {\n items: Entity[];\n cursor?: string;\n};\n\ntype FacetsInitialRequest = {\n text: string;\n};\n\n/**\n * This hook asynchronously loads the entity owners using the facets endpoint.\n * EntityOwnerPicker uses this hook when mode=\"owners-only\" is passed as prop.\n * All the owners are kept internally in memory and rendered in batches once requested\n * by the frontend. The values returned by this hook are compatible with `useQueryEntities`\n * hook, which is also used by EntityOwnerPicker.\n */\nexport function useFacetsEntities({ enabled }: { enabled: boolean }) {\n const catalogApi = useApi(catalogApiRef);\n\n const [facetsPromise] = useState(async () => {\n if (!enabled) {\n return [];\n }\n const facet = 'relations.ownedBy';\n const facetsResponse = await catalogApi.getEntityFacets({\n facets: [facet],\n });\n const entityRefs = facetsResponse.facets[facet]?.map(e => e.value) ?? [];\n\n return catalogApi\n .getEntitiesByRefs({ entityRefs })\n .then(resp =>\n resp.items\n .filter(entity => entity !== undefined)\n .map(entity => entity as Entity)\n .sort(\n (a, b) =>\n (a.metadata.namespace || '').localeCompare(\n b.metadata.namespace || '',\n 'en-US',\n ) ||\n (\n get(a, 'spec.profile.displayName') ||\n a.metadata.title ||\n a.metadata.name\n ).localeCompare(\n get(b, 'spec.profile.displayName') ||\n b.metadata.title ||\n b.metadata.name,\n 'en-US',\n ) ||\n a.kind.localeCompare(b.kind, 'en-US'),\n ),\n )\n .then(entities => entities)\n .catch(() => []);\n });\n\n return useAsyncFn<\n (\n request: FacetsInitialRequest | FacetsEntitiesResponse,\n options?: { limit?: number },\n ) => Promise<FacetsEntitiesResponse>\n >(\n async (request, options) => {\n const facets = await facetsPromise;\n\n if (!facets) {\n return {\n items: [],\n };\n }\n\n const limit = options?.limit ?? 20;\n\n const { text, start } = decodeCursor(request);\n const filteredRefs = facets.filter(e => filterEntity(text, e));\n const end = start + limit;\n return {\n items: filteredRefs.slice(0, end),\n ...encodeCursor({\n entities: filteredRefs,\n limit: end,\n payload: {\n text,\n start: end,\n },\n }),\n };\n },\n [facetsPromise],\n { loading: true, value: { items: [] } },\n );\n}\n\nfunction decodeCursor(\n request: FacetsInitialRequest | FacetsEntitiesResponse,\n): FacetsCursor {\n if (isFacetsResponse(request) && request.cursor) {\n return JSON.parse(atob(request.cursor));\n }\n return {\n text: (request as FacetsInitialRequest).text || '',\n start: 0,\n };\n}\n\nfunction isFacetsResponse(\n request: FacetsInitialRequest | FacetsEntitiesResponse,\n): request is FacetsEntitiesResponse {\n return !!(request as FacetsEntitiesResponse).cursor;\n}\n\nfunction encodeCursor({\n entities,\n limit,\n payload,\n}: {\n entities: Entity[];\n limit: number;\n payload: { text: string; start: number };\n}) {\n if (entities.length > limit) {\n return { cursor: btoa(JSON.stringify(payload)) };\n }\n return {};\n}\n\nfunction filterEntity(text: string, entity: Entity) {\n const normalizedText = text.trim();\n return (\n entity.kind.includes(normalizedText) ||\n entity.metadata.namespace?.includes(normalizedText) ||\n entity.metadata.name.includes(normalizedText) ||\n entity.metadata.title?.includes(normalizedText) ||\n (get(entity, 'spec.profile.displayName') as unknown as string)?.includes(\n normalizedText,\n )\n );\n}\n"],"names":[],"mappings":";;;;;;AA2CgB,SAAA,iBAAA,CAAkB,EAAE,OAAA,EAAiC,EAAA;AACnE,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AAEvC,EAAA,MAAM,CAAC,aAAa,CAAI,GAAA,QAAA,CAAS,YAAY;AAC3C,IAAA,IAAI,CAAC,OAAS,EAAA;AACZ,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AACA,IAAA,MAAM,KAAQ,GAAA,mBAAA,CAAA;AACd,IAAM,MAAA,cAAA,GAAiB,MAAM,UAAA,CAAW,eAAgB,CAAA;AAAA,MACtD,MAAA,EAAQ,CAAC,KAAK,CAAA;AAAA,KACf,CAAA,CAAA;AACD,IAAM,MAAA,UAAA,GAAa,cAAe,CAAA,MAAA,CAAO,KAAK,CAAA,EAAG,IAAI,CAAK,CAAA,KAAA,CAAA,CAAE,KAAK,CAAA,IAAK,EAAC,CAAA;AAEvE,IAAA,OAAO,UACJ,CAAA,iBAAA,CAAkB,EAAE,UAAA,EAAY,CAChC,CAAA,IAAA;AAAA,MAAK,C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a,MAAc,MAAgB,EAAA;AAClD,EAAM,MAAA,cAAA,GAAiB,KAAK,IAAK,EAAA,CAAA;AACjC,EACE,OAAA,MAAA,CAAO,IAAK,CAAA,QAAA,CAAS,cAAc,CAAA,IACnC,MAAO,CAAA,QAAA,CAAS,SAAW,EAAA,QAAA,CAAS,cAAc,CAAA,IAClD,MAAO,CAAA,QAAA,CAAS,KAAK,QAAS,CAAA,cAAc,CAC5C,IAAA,MAAA,CAAO,QAAS,CAAA,KAAA,EAAO,QAAS,CAAA,cAAc,CAC7C,IAAA,GAAA,CAAI,MAAQ,EAAA,0BAA0B,CAAyB,EAAA,QAAA;AAAA,IAC9D,cAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
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-20240826071828",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@backstage/catalog-client": "^1.6.6",
|
|
60
60
|
"@backstage/catalog-model": "^1.6.0",
|
|
61
|
-
"@backstage/core-compat-api": "^0.0.0-nightly-
|
|
61
|
+
"@backstage/core-compat-api": "^0.0.0-nightly-20240826071828",
|
|
62
62
|
"@backstage/core-components": "^0.14.10",
|
|
63
63
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
64
64
|
"@backstage/errors": "^1.2.4",
|
|
65
|
-
"@backstage/frontend-plugin-api": "^0.0.0-nightly-
|
|
65
|
+
"@backstage/frontend-plugin-api": "^0.0.0-nightly-20240826071828",
|
|
66
66
|
"@backstage/integration-react": "^1.1.30",
|
|
67
67
|
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
68
68
|
"@backstage/plugin-permission-common": "^0.8.1",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@backstage/cli": "^0.27.0",
|
|
87
87
|
"@backstage/core-app-api": "^1.14.2",
|
|
88
|
-
"@backstage/frontend-test-utils": "^0.0.0-nightly-
|
|
88
|
+
"@backstage/frontend-test-utils": "^0.0.0-nightly-20240826071828",
|
|
89
89
|
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
90
90
|
"@backstage/plugin-scaffolder-common": "^1.5.5",
|
|
91
|
-
"@backstage/test-utils": "^0.0.0-nightly-
|
|
91
|
+
"@backstage/test-utils": "^0.0.0-nightly-20240826071828",
|
|
92
92
|
"@testing-library/dom": "^10.0.0",
|
|
93
93
|
"@testing-library/jest-dom": "^6.0.0",
|
|
94
94
|
"@testing-library/react": "^15.0.0",
|