@backstage/plugin-catalog-react 0.0.0-nightly-20240820021901 → 0.0.0-nightly-20240821021909
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 +21 -10
- package/alpha/package.json +1 -1
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js +8 -8
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js.map +1 -1
- package/dist/alpha/blueprints/EntityContentBlueprint.esm.js +11 -11
- package/dist/alpha/blueprints/EntityContentBlueprint.esm.js.map +1 -1
- package/dist/alpha/blueprints/extensionData.esm.js +12 -0
- package/dist/alpha/blueprints/extensionData.esm.js.map +1 -0
- package/dist/alpha.d.ts +27 -104
- package/dist/alpha.esm.js +2 -3
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/FavoriteEntity/FavoriteEntity.esm.js +9 -8
- package/dist/components/FavoriteEntity/FavoriteEntity.esm.js.map +1 -1
- package/package.json +16 -16
- package/dist/alpha/extensions.esm.js +0 -103
- package/dist/alpha/extensions.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20240821021909
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
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
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/frontend-plugin-api@0.0.0-nightly-20240821021909
|
|
10
|
+
- @backstage/core-compat-api@0.0.0-nightly-20240821021909
|
|
11
|
+
- @backstage/integration-react@1.1.30
|
|
12
|
+
|
|
13
|
+
## 1.12.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
@@ -10,22 +20,23 @@
|
|
|
10
20
|
- 9b89b82: Internal refactor to remove unnecessary `routable` prop in the implementation of the `createEntityContentExtension` alpha export.
|
|
11
21
|
- bebd569: Fix extra divider displayed on user list picker component
|
|
12
22
|
- 519b8e0: Added utilities for converting existing entity card and content extensions to the new frontend system. This is in particular useful when used in combination with the new `convertLegacyPlugin` utility from `@backstage/core-compat-api`.
|
|
23
|
+
- d001a42: Fix label related accessibility issues with `FavorityEntity`
|
|
13
24
|
- 012e3eb: Entity page extensions created for the new frontend system via the `/alpha` exports will now be enabled by default.
|
|
14
25
|
- 6349099: Added config input type to the extensions
|
|
15
26
|
- Updated dependencies
|
|
16
|
-
- @backstage/frontend-plugin-api@0.
|
|
17
|
-
- @backstage/core-components@0.
|
|
18
|
-
- @backstage/plugin-permission-common@0.
|
|
19
|
-
- @backstage/core-compat-api@0.
|
|
20
|
-
- @backstage/catalog-model@
|
|
21
|
-
- @backstage/catalog-client@
|
|
27
|
+
- @backstage/frontend-plugin-api@0.7.0
|
|
28
|
+
- @backstage/core-components@0.14.10
|
|
29
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
30
|
+
- @backstage/core-compat-api@0.2.8
|
|
31
|
+
- @backstage/catalog-model@1.6.0
|
|
32
|
+
- @backstage/catalog-client@1.6.6
|
|
22
33
|
- @backstage/core-plugin-api@1.9.3
|
|
23
34
|
- @backstage/errors@1.2.4
|
|
24
|
-
- @backstage/integration-react@
|
|
35
|
+
- @backstage/integration-react@1.1.30
|
|
25
36
|
- @backstage/types@1.1.1
|
|
26
37
|
- @backstage/version-bridge@1.0.8
|
|
27
|
-
- @backstage/plugin-catalog-common@
|
|
28
|
-
- @backstage/plugin-permission-react@0.
|
|
38
|
+
- @backstage/plugin-catalog-common@1.0.26
|
|
39
|
+
- @backstage/plugin-permission-react@0.4.25
|
|
29
40
|
|
|
30
41
|
## 1.12.3-next.3
|
|
31
42
|
|
package/alpha/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import {
|
|
2
|
+
import { entityFilterFunctionDataRef, entityFilterExpressionDataRef } from './extensionData.esm.js';
|
|
3
3
|
|
|
4
4
|
const EntityCardBlueprint = createExtensionBlueprint({
|
|
5
5
|
kind: "entity-card",
|
|
6
6
|
attachTo: { id: "entity-content:catalog/overview", input: "cards" },
|
|
7
7
|
output: [
|
|
8
8
|
coreExtensionData.reactElement,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
entityFilterFunctionDataRef.optional(),
|
|
10
|
+
entityFilterExpressionDataRef.optional()
|
|
11
11
|
],
|
|
12
12
|
dataRefs: {
|
|
13
|
-
filterFunction:
|
|
14
|
-
filterExpression:
|
|
13
|
+
filterFunction: entityFilterFunctionDataRef,
|
|
14
|
+
filterExpression: entityFilterExpressionDataRef
|
|
15
15
|
},
|
|
16
16
|
config: {
|
|
17
17
|
schema: {
|
|
@@ -24,11 +24,11 @@ const EntityCardBlueprint = createExtensionBlueprint({
|
|
|
24
24
|
}, { node, config }) {
|
|
25
25
|
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
26
26
|
if (config.filter) {
|
|
27
|
-
yield
|
|
27
|
+
yield entityFilterExpressionDataRef(config.filter);
|
|
28
28
|
} else if (typeof filter === "string") {
|
|
29
|
-
yield
|
|
29
|
+
yield entityFilterExpressionDataRef(filter);
|
|
30
30
|
} else if (typeof filter === "function") {
|
|
31
|
-
yield
|
|
31
|
+
yield entityFilterFunctionDataRef(filter);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
});
|
|
@@ -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 {
|
|
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} 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 ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n },\n config: {\n schema: {\n filter: z => z.string().optional(),\n },\n },\n *factory(\n {\n loader,\n filter,\n }: {\n loader: () => Promise<JSX.Element>;\n filter?:\n | typeof entityFilterFunctionDataRef.T\n | typeof entityFilterExpressionDataRef.T;\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});\n"],"names":[],"mappings":";;;AA8BO,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,GACzC;AAAA,EACA,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,2BAAA;AAAA,IAChB,gBAAkB,EAAA,6BAAA;AAAA,GACpB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,MAAQ,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,KACnC;AAAA,GACF;AAAA,EACA,CAAC,OACC,CAAA;AAAA,IACE,MAAA;AAAA,IACA,MAAA;AAAA,GAOF,EAAA,EAAE,IAAM,EAAA,MAAA,EACR,EAAA;AACA,IAAA,MAAM,kBAAkB,YAAa,CAAA,iBAAA,CAAkB,IAAK,CAAA,IAAA,EAAM,MAAM,CAAC,CAAA,CAAA;AAEzE,IAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,MAAM,MAAA,6BAAA,CAA8B,OAAO,MAAM,CAAA,CAAA;AAAA,KACnD,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAA,MAAM,8BAA8B,MAAM,CAAA,CAAA;AAAA,KAC5C,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAA,MAAM,4BAA4B,MAAM,CAAA,CAAA;AAAA,KAC1C;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import {
|
|
2
|
+
import { entityContentTitleDataRef, entityFilterFunctionDataRef, entityFilterExpressionDataRef } from './extensionData.esm.js';
|
|
3
3
|
|
|
4
4
|
const EntityContentBlueprint = createExtensionBlueprint({
|
|
5
5
|
kind: "entity-content",
|
|
@@ -7,15 +7,15 @@ const EntityContentBlueprint = createExtensionBlueprint({
|
|
|
7
7
|
output: [
|
|
8
8
|
coreExtensionData.reactElement,
|
|
9
9
|
coreExtensionData.routePath,
|
|
10
|
-
|
|
10
|
+
entityContentTitleDataRef,
|
|
11
11
|
coreExtensionData.routeRef.optional(),
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
entityFilterFunctionDataRef.optional(),
|
|
13
|
+
entityFilterExpressionDataRef.optional()
|
|
14
14
|
],
|
|
15
15
|
dataRefs: {
|
|
16
|
-
title:
|
|
17
|
-
filterFunction:
|
|
18
|
-
filterExpression:
|
|
16
|
+
title: entityContentTitleDataRef,
|
|
17
|
+
filterFunction: entityFilterFunctionDataRef,
|
|
18
|
+
filterExpression: entityFilterExpressionDataRef
|
|
19
19
|
},
|
|
20
20
|
config: {
|
|
21
21
|
schema: {
|
|
@@ -35,16 +35,16 @@ const EntityContentBlueprint = createExtensionBlueprint({
|
|
|
35
35
|
const title = config.title ?? defaultTitle;
|
|
36
36
|
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
37
37
|
yield coreExtensionData.routePath(path);
|
|
38
|
-
yield
|
|
38
|
+
yield entityContentTitleDataRef(title);
|
|
39
39
|
if (routeRef) {
|
|
40
40
|
yield coreExtensionData.routeRef(routeRef);
|
|
41
41
|
}
|
|
42
42
|
if (config.filter) {
|
|
43
|
-
yield
|
|
43
|
+
yield entityFilterExpressionDataRef(config.filter);
|
|
44
44
|
} else if (typeof filter === "string") {
|
|
45
|
-
yield
|
|
45
|
+
yield entityFilterExpressionDataRef(filter);
|
|
46
46
|
} else if (typeof filter === "function") {
|
|
47
|
-
yield
|
|
47
|
+
yield entityFilterFunctionDataRef(filter);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
@@ -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 {
|
|
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} 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 ],\n dataRefs: {\n title: entityContentTitleDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n },\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z => z.string().optional(),\n },\n },\n *factory(\n {\n loader,\n defaultPath,\n defaultTitle,\n filter,\n routeRef,\n }: {\n loader: () => Promise<JSX.Element>;\n defaultPath: string;\n defaultTitle: 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\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});\n"],"names":[],"mappings":";;;AAgCO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,qBAAA,EAAuB,OAAO,UAAW,EAAA;AAAA,EACzD,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,YAAA;AAAA,IAClB,iBAAkB,CAAA,SAAA;AAAA,IAClB,yBAAA;AAAA,IACA,iBA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AAA,KACnD,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAA,MAAM,8BAA8B,MAAM,CAAA,CAAA;AAAA,KAC5C,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAA,MAAM,4BAA4B,MAAM,CAAA,CAAA;AAAA,KAC1C;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createExtensionDataRef } from '@backstage/frontend-plugin-api';
|
|
2
|
+
|
|
3
|
+
const entityContentTitleDataRef = createExtensionDataRef().with({
|
|
4
|
+
id: "catalog.entity-content-title"
|
|
5
|
+
});
|
|
6
|
+
const entityFilterFunctionDataRef = createExtensionDataRef().with({ id: "catalog.entity-filter-function" });
|
|
7
|
+
const entityFilterExpressionDataRef = createExtensionDataRef().with({
|
|
8
|
+
id: "catalog.entity-filter-expression"
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { entityContentTitleDataRef, entityFilterExpressionDataRef, entityFilterFunctionDataRef };
|
|
12
|
+
//# sourceMappingURL=extensionData.esm.js.map
|
|
@@ -0,0 +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"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA,8BAAA;AACN,CAAC,EAAA;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC,EAAA;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA,kCAAA;AACN,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { RouteRef,
|
|
3
|
+
import { RouteRef, ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ComponentType } from 'react';
|
|
6
6
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
7
7
|
import { Entity } from '@backstage/catalog-model';
|
|
8
|
-
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
9
8
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
9
|
+
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Returns true if the `owner` argument is a direct owner on the `entity` argument.
|
|
@@ -77,30 +77,19 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
77
77
|
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
78
78
|
}>;
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
[K in keyof O]: O[K];
|
|
86
|
-
} : never;
|
|
80
|
+
/** @alpha */
|
|
81
|
+
declare function convertLegacyEntityCardExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
82
|
+
name?: string;
|
|
83
|
+
filter?: typeof EntityCardBlueprint.dataRefs.filterFunction.T | typeof EntityCardBlueprint.dataRefs.filterExpression.T;
|
|
84
|
+
}): ExtensionDefinition<any>;
|
|
87
85
|
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
* context. If you have the entityRef and need concurrent requests, use the
|
|
96
|
-
* `usePermission` hook directly.
|
|
97
|
-
* @alpha
|
|
98
|
-
*/
|
|
99
|
-
declare function useEntityPermission(permission: ResourcePermission<'catalog-entity'>): {
|
|
100
|
-
loading: boolean;
|
|
101
|
-
allowed: boolean;
|
|
102
|
-
error?: Error;
|
|
103
|
-
};
|
|
86
|
+
/** @alpha */
|
|
87
|
+
declare function convertLegacyEntityContentExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
88
|
+
name?: string;
|
|
89
|
+
filter?: typeof EntityContentBlueprint.dataRefs.filterFunction.T | typeof EntityContentBlueprint.dataRefs.filterExpression.T;
|
|
90
|
+
defaultPath?: string;
|
|
91
|
+
defaultTitle?: string;
|
|
92
|
+
}): ExtensionDefinition<any>;
|
|
104
93
|
|
|
105
94
|
/** @alpha */
|
|
106
95
|
declare const catalogReactTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"catalog-react", {
|
|
@@ -158,86 +147,20 @@ declare const catalogReactTranslationRef: _backstage_core_plugin_api_alpha.Trans
|
|
|
158
147
|
}>;
|
|
159
148
|
|
|
160
149
|
/**
|
|
150
|
+
* A thin wrapper around the
|
|
151
|
+
* {@link @backstage/plugin-permission-react#usePermission} hook which uses the
|
|
152
|
+
* current entity in context to make an authorization request for the given
|
|
153
|
+
* {@link @backstage/plugin-catalog-common#CatalogEntityPermission}.
|
|
154
|
+
*
|
|
155
|
+
* Note: this hook blocks the permission request until the entity has loaded in
|
|
156
|
+
* context. If you have the entityRef and need concurrent requests, use the
|
|
157
|
+
* `usePermission` hook directly.
|
|
161
158
|
* @alpha
|
|
162
|
-
* @deprecated use `dataRefs` property on either {@link EntityCardBlueprint} or {@link EntityContentBlueprint} instead
|
|
163
159
|
*/
|
|
164
|
-
declare
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
declare function useEntityPermission(permission: ResourcePermission<'catalog-entity'>): {
|
|
161
|
+
loading: boolean;
|
|
162
|
+
allowed: boolean;
|
|
163
|
+
error?: Error;
|
|
168
164
|
};
|
|
169
|
-
/**
|
|
170
|
-
* @alpha
|
|
171
|
-
* @deprecated use {@link EntityCardBlueprint} instead
|
|
172
|
-
*/
|
|
173
|
-
declare function createEntityCardExtension<TConfig extends {
|
|
174
|
-
filter?: string;
|
|
175
|
-
}, TInputs extends AnyExtensionInputMap>(options: {
|
|
176
|
-
namespace?: string;
|
|
177
|
-
name?: string;
|
|
178
|
-
attachTo?: {
|
|
179
|
-
id: string;
|
|
180
|
-
input: string;
|
|
181
|
-
};
|
|
182
|
-
disabled?: boolean;
|
|
183
|
-
inputs?: TInputs;
|
|
184
|
-
configSchema?: PortableSchema<TConfig>;
|
|
185
|
-
filter?: typeof catalogExtensionData.entityFilterFunction.T | typeof catalogExtensionData.entityFilterExpression.T;
|
|
186
|
-
loader: (options: {
|
|
187
|
-
config: TConfig;
|
|
188
|
-
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
189
|
-
}) => Promise<JSX.Element>;
|
|
190
|
-
}): _backstage_frontend_plugin_api.ExtensionDefinition<TConfig, TConfig, never, never, {
|
|
191
|
-
kind?: string | undefined;
|
|
192
|
-
namespace?: string | undefined;
|
|
193
|
-
name?: string | undefined;
|
|
194
|
-
}>;
|
|
195
|
-
/**
|
|
196
|
-
* @alpha
|
|
197
|
-
* @deprecated use {@link EntityContentBlueprint} instead
|
|
198
|
-
*/
|
|
199
|
-
declare function createEntityContentExtension<TInputs extends AnyExtensionInputMap>(options: {
|
|
200
|
-
namespace?: string;
|
|
201
|
-
name?: string;
|
|
202
|
-
attachTo?: {
|
|
203
|
-
id: string;
|
|
204
|
-
input: string;
|
|
205
|
-
};
|
|
206
|
-
disabled?: boolean;
|
|
207
|
-
inputs?: TInputs;
|
|
208
|
-
routeRef?: RouteRef;
|
|
209
|
-
defaultPath: string;
|
|
210
|
-
defaultTitle: string;
|
|
211
|
-
filter?: typeof catalogExtensionData.entityFilterFunction.T | typeof catalogExtensionData.entityFilterExpression.T;
|
|
212
|
-
loader: (options: {
|
|
213
|
-
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
214
|
-
}) => Promise<JSX.Element>;
|
|
215
|
-
}): _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
216
|
-
title: string;
|
|
217
|
-
path: string;
|
|
218
|
-
filter?: string | undefined;
|
|
219
|
-
}, {
|
|
220
|
-
filter?: string | undefined;
|
|
221
|
-
title?: string | undefined;
|
|
222
|
-
path?: string | undefined;
|
|
223
|
-
}, never, never, {
|
|
224
|
-
kind?: string | undefined;
|
|
225
|
-
namespace?: string | undefined;
|
|
226
|
-
name?: string | undefined;
|
|
227
|
-
}>;
|
|
228
|
-
|
|
229
|
-
/** @alpha */
|
|
230
|
-
declare function convertLegacyEntityCardExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
231
|
-
name?: string;
|
|
232
|
-
filter?: typeof EntityCardBlueprint.dataRefs.filterFunction.T | typeof EntityCardBlueprint.dataRefs.filterExpression.T;
|
|
233
|
-
}): ExtensionDefinition<any>;
|
|
234
|
-
|
|
235
|
-
/** @alpha */
|
|
236
|
-
declare function convertLegacyEntityContentExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
237
|
-
name?: string;
|
|
238
|
-
filter?: typeof EntityContentBlueprint.dataRefs.filterFunction.T | typeof EntityContentBlueprint.dataRefs.filterExpression.T;
|
|
239
|
-
defaultPath?: string;
|
|
240
|
-
defaultTitle?: string;
|
|
241
|
-
}): ExtensionDefinition<any>;
|
|
242
165
|
|
|
243
|
-
export { EntityCardBlueprint, EntityContentBlueprint,
|
|
166
|
+
export { EntityCardBlueprint, EntityContentBlueprint, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, isOwnerOf, useEntityPermission };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export { EntityCardBlueprint } from './alpha/blueprints/EntityCardBlueprint.esm.js';
|
|
2
2
|
export { EntityContentBlueprint } from './alpha/blueprints/EntityContentBlueprint.esm.js';
|
|
3
|
-
export { catalogExtensionData, createEntityCardExtension, createEntityContentExtension } from './alpha/extensions.esm.js';
|
|
4
3
|
export { convertLegacyEntityCardExtension } from './alpha/converters/convertLegacyEntityCardExtension.esm.js';
|
|
5
4
|
export { convertLegacyEntityContentExtension } from './alpha/converters/convertLegacyEntityContentExtension.esm.js';
|
|
6
|
-
export { useEntityPermission } from './hooks/useEntityPermission.esm.js';
|
|
7
|
-
export { isOwnerOf } from './utils/isOwnerOf.esm.js';
|
|
8
5
|
export { catalogReactTranslationRef } from './translation.esm.js';
|
|
6
|
+
export { isOwnerOf } from './utils/isOwnerOf.esm.js';
|
|
7
|
+
export { useEntityPermission } from './hooks/useEntityPermission.esm.js';
|
|
9
8
|
//# sourceMappingURL=alpha.esm.js.map
|
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":";;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
1
2
|
import IconButton from '@material-ui/core/IconButton';
|
|
2
3
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
3
4
|
import { withStyles } from '@material-ui/core/styles';
|
|
@@ -18,21 +19,21 @@ const FavoriteEntity = (props) => {
|
|
|
18
19
|
props.entity
|
|
19
20
|
);
|
|
20
21
|
const { t } = useTranslationRef(catalogReactTranslationRef);
|
|
22
|
+
const title = isStarredEntity ? t("favoriteEntity.removeFromFavorites") : t("favoriteEntity.addToFavorites");
|
|
23
|
+
const id = `favorite-${stringifyEntityRef(props.entity).replace(
|
|
24
|
+
/[^a-zA-Z0-9-_]/g,
|
|
25
|
+
"-"
|
|
26
|
+
)}`;
|
|
21
27
|
return /* @__PURE__ */ React.createElement(
|
|
22
28
|
IconButton,
|
|
23
29
|
{
|
|
24
|
-
"aria-label":
|
|
30
|
+
"aria-label": title,
|
|
31
|
+
id,
|
|
25
32
|
color: "inherit",
|
|
26
33
|
...props,
|
|
27
34
|
onClick: () => toggleStarredEntity()
|
|
28
35
|
},
|
|
29
|
-
/* @__PURE__ */ React.createElement(
|
|
30
|
-
Tooltip,
|
|
31
|
-
{
|
|
32
|
-
title: isStarredEntity ? t("favoriteEntity.removeFromFavorites") : t("favoriteEntity.addToFavorites")
|
|
33
|
-
},
|
|
34
|
-
isStarredEntity ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null)
|
|
35
|
-
)
|
|
36
|
+
/* @__PURE__ */ React.createElement(Tooltip, { id, title }, isStarredEntity ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null))
|
|
36
37
|
);
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoriteEntity.esm.js","sources":["../../../src/components/FavoriteEntity/FavoriteEntity.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { withStyles } from '@material-ui/core/styles';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport React, { ComponentProps } from 'react';\nimport { useStarredEntity } from '../../hooks/useStarredEntity';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type FavoriteEntityProps = ComponentProps<typeof IconButton> & {\n entity: Entity;\n};\n\nconst YellowStar = withStyles({\n root: {\n color: '#f3ba37',\n },\n})(Star);\n\n/**\n * IconButton for showing if a current entity is starred and adding/removing it from the favorite entities\n * @param props - MaterialUI IconButton props extended by required `entity` prop\n * @public\n */\nexport const FavoriteEntity = (props: FavoriteEntityProps) => {\n const { toggleStarredEntity, isStarredEntity } = useStarredEntity(\n props.entity,\n );\n const { t } = useTranslationRef(catalogReactTranslationRef);\n return (\n <IconButton\n aria-label
|
|
1
|
+
{"version":3,"file":"FavoriteEntity.esm.js","sources":["../../../src/components/FavoriteEntity/FavoriteEntity.tsx"],"sourcesContent":["/*\n * Copyright 2020 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, stringifyEntityRef } from '@backstage/catalog-model';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { withStyles } from '@material-ui/core/styles';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport React, { ComponentProps } from 'react';\nimport { useStarredEntity } from '../../hooks/useStarredEntity';\nimport { catalogReactTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type FavoriteEntityProps = ComponentProps<typeof IconButton> & {\n entity: Entity;\n};\n\nconst YellowStar = withStyles({\n root: {\n color: '#f3ba37',\n },\n})(Star);\n\n/**\n * IconButton for showing if a current entity is starred and adding/removing it from the favorite entities\n * @param props - MaterialUI IconButton props extended by required `entity` prop\n * @public\n */\nexport const FavoriteEntity = (props: FavoriteEntityProps) => {\n const { toggleStarredEntity, isStarredEntity } = useStarredEntity(\n props.entity,\n );\n const { t } = useTranslationRef(catalogReactTranslationRef);\n const title = isStarredEntity\n ? t('favoriteEntity.removeFromFavorites')\n : t('favoriteEntity.addToFavorites');\n\n const id = `favorite-${stringifyEntityRef(props.entity).replace(\n /[^a-zA-Z0-9-_]/g,\n '-',\n )}`;\n\n return (\n <IconButton\n aria-label={title}\n id={id}\n color=\"inherit\"\n {...props}\n onClick={() => toggleStarredEntity()}\n >\n <Tooltip id={id} title={title}>\n {isStarredEntity ? <YellowStar /> : <StarBorder />}\n </Tooltip>\n </IconButton>\n );\n};\n"],"names":["Star"],"mappings":";;;;;;;;;;;AAgCA,MAAM,aAAa,UAAW,CAAA;AAAA,EAC5B,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,SAAA;AAAA,GACT;AACF,CAAC,EAAEA,QAAI,CAAA,CAAA;AAOM,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA,EAAE,mBAAqB,EAAA,eAAA,EAAoB,GAAA,gBAAA;AAAA,IAC/C,KAAM,CAAA,MAAA;AAAA,GACR,CAAA;AACA,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,0BAA0B,CAAA,CAAA;AAC1D,EAAA,MAAM,QAAQ,eACV,GAAA,CAAA,CAAE,oCAAoC,CAAA,GACtC,EAAE,+BAA+B,CAAA,CAAA;AAErC,EAAA,MAAM,EAAK,GAAA,CAAA,SAAA,EAAY,kBAAmB,CAAA,KAAA,CAAM,MAAM,CAAE,CAAA,OAAA;AAAA,IACtD,iBAAA;AAAA,IACA,GAAA;AAAA,GACD,CAAA,CAAA,CAAA;AAED,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAY,EAAA,KAAA;AAAA,MACZ,EAAA;AAAA,MACA,KAAM,EAAA,SAAA;AAAA,MACL,GAAG,KAAA;AAAA,MACJ,OAAA,EAAS,MAAM,mBAAoB,EAAA;AAAA,KAAA;AAAA,oBAEnC,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,EAAA,EAAQ,KACd,EAAA,EAAA,eAAA,uCAAmB,UAAW,EAAA,IAAA,CAAA,mBAAM,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,IAAW,CAClD,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
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-20240821021909",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"test": "backstage-cli package test"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@backstage/catalog-client": "^
|
|
60
|
-
"@backstage/catalog-model": "^
|
|
61
|
-
"@backstage/core-compat-api": "^0.0.0-nightly-
|
|
62
|
-
"@backstage/core-components": "^0.
|
|
59
|
+
"@backstage/catalog-client": "^1.6.6",
|
|
60
|
+
"@backstage/catalog-model": "^1.6.0",
|
|
61
|
+
"@backstage/core-compat-api": "^0.0.0-nightly-20240821021909",
|
|
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-
|
|
66
|
-
"@backstage/integration-react": "^
|
|
67
|
-
"@backstage/plugin-catalog-common": "^
|
|
68
|
-
"@backstage/plugin-permission-common": "^0.
|
|
69
|
-
"@backstage/plugin-permission-react": "^0.
|
|
65
|
+
"@backstage/frontend-plugin-api": "^0.0.0-nightly-20240821021909",
|
|
66
|
+
"@backstage/integration-react": "^1.1.30",
|
|
67
|
+
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
68
|
+
"@backstage/plugin-permission-common": "^0.8.1",
|
|
69
|
+
"@backstage/plugin-permission-react": "^0.4.25",
|
|
70
70
|
"@backstage/types": "^1.1.1",
|
|
71
71
|
"@backstage/version-bridge": "^1.0.8",
|
|
72
72
|
"@material-ui/core": "^4.12.2",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"zen-observable": "^0.10.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@backstage/cli": "^0.
|
|
87
|
-
"@backstage/core-app-api": "^
|
|
88
|
-
"@backstage/frontend-test-utils": "^0.0.0-nightly-
|
|
89
|
-
"@backstage/plugin-catalog-common": "^
|
|
90
|
-
"@backstage/plugin-scaffolder-common": "^
|
|
91
|
-
"@backstage/test-utils": "^
|
|
86
|
+
"@backstage/cli": "^0.27.0",
|
|
87
|
+
"@backstage/core-app-api": "^1.14.2",
|
|
88
|
+
"@backstage/frontend-test-utils": "^0.0.0-nightly-20240821021909",
|
|
89
|
+
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
90
|
+
"@backstage/plugin-scaffolder-common": "^1.5.5",
|
|
91
|
+
"@backstage/test-utils": "^1.5.10",
|
|
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",
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createExtensionDataRef, createSchemaFromZod, createExtension, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import React, { lazy } from 'react';
|
|
3
|
-
import '@backstage/catalog-model';
|
|
4
|
-
import '@backstage/plugin-permission-react';
|
|
5
|
-
import '../hooks/useEntity.esm.js';
|
|
6
|
-
export { catalogReactTranslationRef } from '../translation.esm.js';
|
|
7
|
-
|
|
8
|
-
const catalogExtensionData = {
|
|
9
|
-
entityContentTitle: createExtensionDataRef().with({
|
|
10
|
-
id: "catalog.entity-content-title"
|
|
11
|
-
}),
|
|
12
|
-
entityFilterFunction: createExtensionDataRef().with({ id: "catalog.entity-filter-function" }),
|
|
13
|
-
entityFilterExpression: createExtensionDataRef().with({
|
|
14
|
-
id: "catalog.entity-filter-expression"
|
|
15
|
-
})
|
|
16
|
-
};
|
|
17
|
-
function createEntityCardExtension(options) {
|
|
18
|
-
const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
|
|
19
|
-
(z) => z.object({
|
|
20
|
-
filter: z.string().optional()
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
return createExtension({
|
|
24
|
-
kind: "entity-card",
|
|
25
|
-
namespace: options.namespace,
|
|
26
|
-
name: options.name,
|
|
27
|
-
attachTo: options.attachTo ?? {
|
|
28
|
-
id: "entity-content:catalog/overview",
|
|
29
|
-
input: "cards"
|
|
30
|
-
},
|
|
31
|
-
disabled: options.disabled,
|
|
32
|
-
output: {
|
|
33
|
-
element: coreExtensionData.reactElement,
|
|
34
|
-
filterFunction: catalogExtensionData.entityFilterFunction.optional(),
|
|
35
|
-
filterExpression: catalogExtensionData.entityFilterExpression.optional()
|
|
36
|
-
},
|
|
37
|
-
inputs: options.inputs,
|
|
38
|
-
configSchema,
|
|
39
|
-
factory({ config, inputs, node }) {
|
|
40
|
-
const ExtensionComponent = lazy(
|
|
41
|
-
() => options.loader({ inputs, config }).then((element) => ({ default: () => element }))
|
|
42
|
-
);
|
|
43
|
-
return {
|
|
44
|
-
element: /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(ExtensionComponent, null)),
|
|
45
|
-
...mergeFilters({ config, options })
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function createEntityContentExtension(options) {
|
|
51
|
-
return createExtension({
|
|
52
|
-
kind: "entity-content",
|
|
53
|
-
namespace: options.namespace,
|
|
54
|
-
name: options.name,
|
|
55
|
-
attachTo: options.attachTo ?? {
|
|
56
|
-
id: "page:catalog/entity",
|
|
57
|
-
input: "contents"
|
|
58
|
-
},
|
|
59
|
-
disabled: options.disabled,
|
|
60
|
-
output: {
|
|
61
|
-
element: coreExtensionData.reactElement,
|
|
62
|
-
path: coreExtensionData.routePath,
|
|
63
|
-
routeRef: coreExtensionData.routeRef.optional(),
|
|
64
|
-
title: catalogExtensionData.entityContentTitle,
|
|
65
|
-
filterFunction: catalogExtensionData.entityFilterFunction.optional(),
|
|
66
|
-
filterExpression: catalogExtensionData.entityFilterExpression.optional()
|
|
67
|
-
},
|
|
68
|
-
inputs: options.inputs,
|
|
69
|
-
configSchema: createSchemaFromZod(
|
|
70
|
-
(z) => z.object({
|
|
71
|
-
path: z.string().default(options.defaultPath),
|
|
72
|
-
title: z.string().default(options.defaultTitle),
|
|
73
|
-
filter: z.string().optional()
|
|
74
|
-
})
|
|
75
|
-
),
|
|
76
|
-
factory({ config, inputs, node }) {
|
|
77
|
-
const ExtensionComponent = lazy(
|
|
78
|
-
() => options.loader({ inputs }).then((element) => ({ default: () => element }))
|
|
79
|
-
);
|
|
80
|
-
return {
|
|
81
|
-
path: config.path,
|
|
82
|
-
title: config.title,
|
|
83
|
-
routeRef: options.routeRef,
|
|
84
|
-
element: /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(ExtensionComponent, null)),
|
|
85
|
-
...mergeFilters({ config, options })
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function mergeFilters(inputs) {
|
|
91
|
-
const { options, config } = inputs;
|
|
92
|
-
if (config.filter) {
|
|
93
|
-
return { filterExpression: config.filter };
|
|
94
|
-
} else if (typeof options.filter === "string") {
|
|
95
|
-
return { filterExpression: options.filter };
|
|
96
|
-
} else if (typeof options.filter === "function") {
|
|
97
|
-
return { filterFunction: options.filter };
|
|
98
|
-
}
|
|
99
|
-
return {};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export { catalogExtensionData, createEntityCardExtension, createEntityContentExtension };
|
|
103
|
-
//# sourceMappingURL=extensions.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.esm.js","sources":["../../src/alpha/extensions.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 {\n AnyExtensionInputMap,\n ExtensionBoundary,\n PortableSchema,\n ResolvedExtensionInputs,\n RouteRef,\n coreExtensionData,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport React, { lazy } from 'react';\nimport { Entity } from '@backstage/catalog-model';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { Expand } from '../../../../packages/frontend-plugin-api/src/types';\n\nexport { useEntityPermission } from '../hooks/useEntityPermission';\nexport { isOwnerOf } from '../utils';\nexport * from '../translation';\n\n/**\n * @alpha\n * @deprecated use `dataRefs` property on either {@link EntityCardBlueprint} or {@link EntityContentBlueprint} instead\n */\nexport const catalogExtensionData = {\n entityContentTitle: createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n }),\n entityFilterFunction: createExtensionDataRef<\n (entity: Entity) => boolean\n >().with({ id: 'catalog.entity-filter-function' }),\n entityFilterExpression: createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n }),\n};\n\n// TODO: Figure out how to merge with provided config schema\n/**\n * @alpha\n * @deprecated use {@link EntityCardBlueprint} instead\n */\nexport function createEntityCardExtension<\n TConfig extends { filter?: string },\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n configSchema?: PortableSchema<TConfig>;\n filter?:\n | typeof catalogExtensionData.entityFilterFunction.T\n | typeof catalogExtensionData.entityFilterExpression.T;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<JSX.Element>;\n}) {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n filter: z.string().optional(),\n }),\n ) as PortableSchema<TConfig>);\n return createExtension({\n kind: 'entity-card',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? {\n id: 'entity-content:catalog/overview',\n input: 'cards',\n },\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n filterFunction: catalogExtensionData.entityFilterFunction.optional(),\n filterExpression: catalogExtensionData.entityFilterExpression.optional(),\n },\n inputs: options.inputs,\n configSchema,\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ inputs, config })\n .then(element => ({ default: () => element })),\n );\n\n return {\n element: (\n <ExtensionBoundary node={node}>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n ...mergeFilters({ config, options }),\n };\n },\n });\n}\n\n/**\n * @alpha\n * @deprecated use {@link EntityContentBlueprint} instead\n */\nexport function createEntityContentExtension<\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n defaultPath: string;\n defaultTitle: string;\n filter?:\n | typeof catalogExtensionData.entityFilterFunction.T\n | typeof catalogExtensionData.entityFilterExpression.T;\n loader: (options: {\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<JSX.Element>;\n}) {\n return createExtension({\n kind: 'entity-content',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? {\n id: 'page:catalog/entity',\n input: 'contents',\n },\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n title: catalogExtensionData.entityContentTitle,\n filterFunction: catalogExtensionData.entityFilterFunction.optional(),\n filterExpression: catalogExtensionData.entityFilterExpression.optional(),\n },\n inputs: options.inputs,\n configSchema: createSchemaFromZod(z =>\n z.object({\n path: z.string().default(options.defaultPath),\n title: z.string().default(options.defaultTitle),\n filter: z.string().optional(),\n }),\n ),\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ inputs })\n .then(element => ({ default: () => element })),\n );\n\n return {\n path: config.path,\n title: config.title,\n routeRef: options.routeRef,\n element: (\n <ExtensionBoundary node={node}>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n ...mergeFilters({ config, options }),\n };\n },\n });\n}\n\n/**\n * Decides what filter outputs to produce, given some options and config\n */\nfunction mergeFilters(inputs: {\n options: {\n filter?:\n | typeof catalogExtensionData.entityFilterFunction.T\n | typeof catalogExtensionData.entityFilterExpression.T;\n };\n config: {\n filter?: string;\n };\n}): {\n filterFunction?: typeof catalogExtensionData.entityFilterFunction.T;\n filterExpression?: typeof catalogExtensionData.entityFilterExpression.T;\n} {\n const { options, config } = inputs;\n if (config.filter) {\n return { filterExpression: config.filter };\n } else if (typeof options.filter === 'string') {\n return { filterExpression: options.filter };\n } else if (typeof options.filter === 'function') {\n return { filterFunction: options.filter };\n }\n return {};\n}\n"],"names":[],"mappings":";;;;;;;AAwCO,MAAM,oBAAuB,GAAA;AAAA,EAClC,kBAAA,EAAoB,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,IACxD,EAAI,EAAA,8BAAA;AAAA,GACL,CAAA;AAAA,EACD,sBAAsB,sBAEpB,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC,CAAA;AAAA,EACjD,sBAAA,EAAwB,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,IAC5D,EAAI,EAAA,kCAAA;AAAA,GACL,CAAA;AACH,EAAA;AAOO,SAAS,0BAGd,OAcC,EAAA;AACD,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CAAA,CAAA,KACnB,EAAE,MAAO,CAAA;AAAA,MACP,MAAQ,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAS,EAAA;AAAA,KAC7B,CAAA;AAAA,GACH,CAAA;AACN,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,aAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,QAAA,EAAU,QAAQ,QAAY,IAAA;AAAA,MAC5B,EAAI,EAAA,iCAAA;AAAA,MACJ,KAAO,EAAA,OAAA;AAAA,KACT;AAAA,IACA,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,MAC3B,c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