@backstage/plugin-catalog-react 1.12.3-next.2 → 1.12.3
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 +46 -0
- package/alpha/package.json +1 -1
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js +37 -0
- package/dist/alpha/blueprints/EntityCardBlueprint.esm.js.map +1 -0
- package/dist/alpha/blueprints/EntityContentBlueprint.esm.js +53 -0
- package/dist/alpha/blueprints/EntityContentBlueprint.esm.js.map +1 -0
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js +36 -0
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js.map +1 -0
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js +44 -0
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js.map +1 -0
- package/dist/alpha/extensions.esm.js +103 -0
- package/dist/alpha/extensions.esm.js.map +1 -0
- package/dist/alpha.d.ts +98 -6
- package/dist/alpha.esm.js +5 -99
- 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/dist/index.d.ts +31 -31
- package/package.json +16 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.12.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7bd27e1: Deprecate the old pattern of `create*Extension`, and replace it with the equivalent Blueprint implementation instead.
|
|
8
|
+
- 31bfc44: Updated alpha definitions of extension data references.
|
|
9
|
+
- 7ca331c: Correct `EntityDisplayName`'s icon alignment with the text.
|
|
10
|
+
- 9b89b82: Internal refactor to remove unnecessary `routable` prop in the implementation of the `createEntityContentExtension` alpha export.
|
|
11
|
+
- bebd569: Fix extra divider displayed on user list picker component
|
|
12
|
+
- 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`.
|
|
13
|
+
- d001a42: Fix label related accessibility issues with `FavorityEntity`
|
|
14
|
+
- 012e3eb: Entity page extensions created for the new frontend system via the `/alpha` exports will now be enabled by default.
|
|
15
|
+
- 6349099: Added config input type to the extensions
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/frontend-plugin-api@0.7.0
|
|
18
|
+
- @backstage/core-components@0.14.10
|
|
19
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
20
|
+
- @backstage/core-compat-api@0.2.8
|
|
21
|
+
- @backstage/catalog-model@1.6.0
|
|
22
|
+
- @backstage/catalog-client@1.6.6
|
|
23
|
+
- @backstage/core-plugin-api@1.9.3
|
|
24
|
+
- @backstage/errors@1.2.4
|
|
25
|
+
- @backstage/integration-react@1.1.30
|
|
26
|
+
- @backstage/types@1.1.1
|
|
27
|
+
- @backstage/version-bridge@1.0.8
|
|
28
|
+
- @backstage/plugin-catalog-common@1.0.26
|
|
29
|
+
- @backstage/plugin-permission-react@0.4.25
|
|
30
|
+
|
|
31
|
+
## 1.12.3-next.3
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @backstage/frontend-plugin-api@0.7.0-next.3
|
|
37
|
+
- @backstage/catalog-model@1.6.0-next.0
|
|
38
|
+
- @backstage/catalog-client@1.6.6-next.0
|
|
39
|
+
- @backstage/core-components@0.14.10-next.0
|
|
40
|
+
- @backstage/core-plugin-api@1.9.3
|
|
41
|
+
- @backstage/errors@1.2.4
|
|
42
|
+
- @backstage/integration-react@1.1.30-next.0
|
|
43
|
+
- @backstage/types@1.1.1
|
|
44
|
+
- @backstage/version-bridge@1.0.8
|
|
45
|
+
- @backstage/plugin-catalog-common@1.0.26-next.2
|
|
46
|
+
- @backstage/plugin-permission-common@0.8.1-next.1
|
|
47
|
+
- @backstage/plugin-permission-react@0.4.25-next.1
|
|
48
|
+
|
|
3
49
|
## 1.12.3-next.2
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { catalogExtensionData } from '../extensions.esm.js';
|
|
3
|
+
|
|
4
|
+
const EntityCardBlueprint = createExtensionBlueprint({
|
|
5
|
+
kind: "entity-card",
|
|
6
|
+
attachTo: { id: "entity-content:catalog/overview", input: "cards" },
|
|
7
|
+
output: [
|
|
8
|
+
coreExtensionData.reactElement,
|
|
9
|
+
catalogExtensionData.entityFilterFunction.optional(),
|
|
10
|
+
catalogExtensionData.entityFilterExpression.optional()
|
|
11
|
+
],
|
|
12
|
+
dataRefs: {
|
|
13
|
+
filterFunction: catalogExtensionData.entityFilterFunction,
|
|
14
|
+
filterExpression: catalogExtensionData.entityFilterExpression
|
|
15
|
+
},
|
|
16
|
+
config: {
|
|
17
|
+
schema: {
|
|
18
|
+
filter: (z) => z.string().optional()
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
*factory({
|
|
22
|
+
loader,
|
|
23
|
+
filter
|
|
24
|
+
}, { node, config }) {
|
|
25
|
+
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
26
|
+
if (config.filter) {
|
|
27
|
+
yield catalogExtensionData.entityFilterExpression(config.filter);
|
|
28
|
+
} else if (typeof filter === "string") {
|
|
29
|
+
yield catalogExtensionData.entityFilterExpression(filter);
|
|
30
|
+
} else if (typeof filter === "function") {
|
|
31
|
+
yield catalogExtensionData.entityFilterFunction(filter);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export { EntityCardBlueprint };
|
|
37
|
+
//# sourceMappingURL=EntityCardBlueprint.esm.js.map
|
|
@@ -0,0 +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 { catalogExtensionData } from '../extensions';\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 catalogExtensionData.entityFilterFunction.optional(),\n catalogExtensionData.entityFilterExpression.optional(),\n ],\n dataRefs: {\n filterFunction: catalogExtensionData.entityFilterFunction,\n filterExpression: catalogExtensionData.entityFilterExpression,\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 catalogExtensionData.entityFilterFunction.T\n | typeof catalogExtensionData.entityFilterExpression.T;\n },\n { node, config },\n ) {\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n if (config.filter) {\n yield catalogExtensionData.entityFilterExpression(config.filter);\n } else if (typeof filter === 'string') {\n yield catalogExtensionData.entityFilterExpression(filter);\n } else if (typeof filter === 'function') {\n yield catalogExtensionData.entityFilterFunction(filter);\n }\n },\n});\n"],"names":[],"mappings":";;;AA2BO,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,oBAAA,CAAqB,qBAAqB,QAAS,EAAA;AAAA,IACnD,oBAAA,CAAqB,uBAAuB,QAAS,EAAA;AAAA,GACvD;AAAA,EACA,QAAU,EAAA;AAAA,IACR,gBAAgB,oBAAqB,CAAA,oBAAA;AAAA,IACrC,kBAAkB,oBAAqB,CAAA,sBAAA;AAAA,GACzC;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,oBAAA,CAAqB,sBAAuB,CAAA,MAAA,CAAO,MAAM,CAAA,CAAA;AAAA,KACjE,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAM,MAAA,oBAAA,CAAqB,uBAAuB,MAAM,CAAA,CAAA;AAAA,KAC1D,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAM,MAAA,oBAAA,CAAqB,qBAAqB,MAAM,CAAA,CAAA;AAAA,KACxD;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { catalogExtensionData } from '../extensions.esm.js';
|
|
3
|
+
|
|
4
|
+
const EntityContentBlueprint = createExtensionBlueprint({
|
|
5
|
+
kind: "entity-content",
|
|
6
|
+
attachTo: { id: "page:catalog/entity", input: "contents" },
|
|
7
|
+
output: [
|
|
8
|
+
coreExtensionData.reactElement,
|
|
9
|
+
coreExtensionData.routePath,
|
|
10
|
+
catalogExtensionData.entityContentTitle,
|
|
11
|
+
coreExtensionData.routeRef.optional(),
|
|
12
|
+
catalogExtensionData.entityFilterFunction.optional(),
|
|
13
|
+
catalogExtensionData.entityFilterExpression.optional()
|
|
14
|
+
],
|
|
15
|
+
dataRefs: {
|
|
16
|
+
title: catalogExtensionData.entityContentTitle,
|
|
17
|
+
filterFunction: catalogExtensionData.entityFilterFunction,
|
|
18
|
+
filterExpression: catalogExtensionData.entityFilterExpression
|
|
19
|
+
},
|
|
20
|
+
config: {
|
|
21
|
+
schema: {
|
|
22
|
+
path: (z) => z.string().optional(),
|
|
23
|
+
title: (z) => z.string().optional(),
|
|
24
|
+
filter: (z) => z.string().optional()
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
*factory({
|
|
28
|
+
loader,
|
|
29
|
+
defaultPath,
|
|
30
|
+
defaultTitle,
|
|
31
|
+
filter,
|
|
32
|
+
routeRef
|
|
33
|
+
}, { node, config }) {
|
|
34
|
+
const path = config.path ?? defaultPath;
|
|
35
|
+
const title = config.title ?? defaultTitle;
|
|
36
|
+
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
37
|
+
yield coreExtensionData.routePath(path);
|
|
38
|
+
yield catalogExtensionData.entityContentTitle(title);
|
|
39
|
+
if (routeRef) {
|
|
40
|
+
yield coreExtensionData.routeRef(routeRef);
|
|
41
|
+
}
|
|
42
|
+
if (config.filter) {
|
|
43
|
+
yield catalogExtensionData.entityFilterExpression(config.filter);
|
|
44
|
+
} else if (typeof filter === "string") {
|
|
45
|
+
yield catalogExtensionData.entityFilterExpression(filter);
|
|
46
|
+
} else if (typeof filter === "function") {
|
|
47
|
+
yield catalogExtensionData.entityFilterFunction(filter);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { EntityContentBlueprint };
|
|
53
|
+
//# sourceMappingURL=EntityContentBlueprint.esm.js.map
|
|
@@ -0,0 +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 { catalogExtensionData } from '../extensions';\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 catalogExtensionData.entityContentTitle,\n coreExtensionData.routeRef.optional(),\n catalogExtensionData.entityFilterFunction.optional(),\n catalogExtensionData.entityFilterExpression.optional(),\n ],\n dataRefs: {\n title: catalogExtensionData.entityContentTitle,\n filterFunction: catalogExtensionData.entityFilterFunction,\n filterExpression: catalogExtensionData.entityFilterExpression,\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 catalogExtensionData.entityFilterFunction.T\n | typeof catalogExtensionData.entityFilterExpression.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 catalogExtensionData.entityContentTitle(title);\n\n if (routeRef) {\n yield coreExtensionData.routeRef(routeRef);\n }\n\n if (config.filter) {\n yield catalogExtensionData.entityFilterExpression(config.filter);\n } else if (typeof filter === 'string') {\n yield catalogExtensionData.entityFilterExpression(filter);\n } else if (typeof filter === 'function') {\n yield catalogExtensionData.entityFilterFunction(filter);\n }\n },\n});\n"],"names":[],"mappings":";;;AA4BO,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,oBAAqB,CAAA,kBAAA;AAAA,IACrB,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,IACpC,oBAAA,CAAqB,qBAAqB,QAAS,EAAA;AAAA,IACnD,oBAAA,CAAqB,uBAAuB,QAAS,EAAA;AAAA,GACvD;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAO,oBAAqB,CAAA,kBAAA;AAAA,IAC5B,gBAAgB,oBAAqB,CAAA,oBAAA;AAAA,IACrC,kBAAkB,oBAAqB,CAAA,sBAAA;AAAA,GACzC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MAC/B,KAAO,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MAChC,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,WAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,GAUF,EAAA,EAAE,IAAM,EAAA,MAAA,EACR,EAAA;AACA,IAAM,MAAA,IAAA,GAAO,OAAO,IAAQ,IAAA,WAAA,CAAA;AAC5B,IAAM,MAAA,KAAA,GAAQ,OAAO,KAAS,IAAA,YAAA,CAAA;AAE9B,IAAA,MAAM,kBAAkB,YAAa,CAAA,iBAAA,CAAkB,IAAK,CAAA,IAAA,EAAM,MAAM,CAAC,CAAA,CAAA;AAEzE,IAAM,MAAA,iBAAA,CAAkB,UAAU,IAAI,CAAA,CAAA;AAEtC,IAAM,MAAA,oBAAA,CAAqB,mBAAmB,KAAK,CAAA,CAAA;AAEnD,IAAA,IAAI,QAAU,EAAA;AACZ,MAAM,MAAA,iBAAA,CAAkB,SAAS,QAAQ,CAAA,CAAA;AAAA,KAC3C;AAEA,IAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,MAAM,MAAA,oBAAA,CAAqB,sBAAuB,CAAA,MAAA,CAAO,MAAM,CAAA,CAAA;AAAA,KACjE,MAAA,IAAW,OAAO,MAAA,KAAW,QAAU,EAAA;AACrC,MAAM,MAAA,oBAAA,CAAqB,uBAAuB,MAAM,CAAA,CAAA;AAAA,KAC1D,MAAA,IAAW,OAAO,MAAA,KAAW,UAAY,EAAA;AACvC,MAAM,MAAA,oBAAA,CAAqB,qBAAqB,MAAM,CAAA,CAAA;AAAA,KACxD;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { compatWrapper } from '@backstage/core-compat-api';
|
|
2
|
+
import { getComponentData } from '@backstage/core-plugin-api';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { EntityCardBlueprint } from '../blueprints/EntityCardBlueprint.esm.js';
|
|
5
|
+
import '../blueprints/EntityContentBlueprint.esm.js';
|
|
6
|
+
import kebabCase from 'lodash/kebabCase';
|
|
7
|
+
|
|
8
|
+
function convertLegacyEntityCardExtension(LegacyExtension, overrides) {
|
|
9
|
+
const element = /* @__PURE__ */ React.createElement(LegacyExtension, null);
|
|
10
|
+
const extName = getComponentData(element, "core.extensionName");
|
|
11
|
+
if (!extName) {
|
|
12
|
+
throw new Error("Extension has no name");
|
|
13
|
+
}
|
|
14
|
+
const plugin = getComponentData(element, "core.plugin");
|
|
15
|
+
const pluginId = plugin?.getId();
|
|
16
|
+
const match = extName.match(/^Entity(.*)Card$/);
|
|
17
|
+
const infix = match?.[1] ?? extName;
|
|
18
|
+
let name = infix;
|
|
19
|
+
if (pluginId && name.toLocaleLowerCase("en-US").startsWith(pluginId.toLocaleLowerCase("en-US"))) {
|
|
20
|
+
name = name.slice(pluginId.length);
|
|
21
|
+
if (!name) {
|
|
22
|
+
name = void 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
name = name && kebabCase(name);
|
|
26
|
+
return EntityCardBlueprint.make({
|
|
27
|
+
name: overrides?.name ?? name,
|
|
28
|
+
params: {
|
|
29
|
+
filter: overrides?.filter,
|
|
30
|
+
loader: async () => compatWrapper(element)
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { convertLegacyEntityCardExtension };
|
|
36
|
+
//# sourceMappingURL=convertLegacyEntityCardExtension.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityCardExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityCardExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { compatWrapper } from '@backstage/core-compat-api';\nimport { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport React, { ComponentType } from 'react';\nimport { EntityCardBlueprint } from '../blueprints';\nimport kebabCase from 'lodash/kebabCase';\n\n/** @alpha */\nexport function convertLegacyEntityCardExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?:\n | typeof EntityCardBlueprint.dataRefs.filterFunction.T\n | typeof EntityCardBlueprint.dataRefs.filterExpression.T;\n },\n): ExtensionDefinition<any> {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Card$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityCardBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;AAwBgB,SAAA,gCAAA,CACd,iBACA,SAM0B,EAAA;AAC1B,EAAM,MAAA,OAAA,uCAAW,eAAgB,EAAA,IAAA,CAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA,CAAA;AAAA,GACzC;AAEA,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA,CAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,kBAAkB,CAAA,CAAA;AAC9C,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA,CAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA,CAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAAA,GACF;AACA,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA,CAAA;AAE7B,EAAA,OAAO,oBAAoB,IAAK,CAAA;AAAA,IAC9B,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO,CAAA;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
|
|
2
|
+
import { getComponentData } from '@backstage/core-plugin-api';
|
|
3
|
+
import kebabCase from 'lodash/kebabCase';
|
|
4
|
+
import startCase from 'lodash/startCase';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import '../blueprints/EntityCardBlueprint.esm.js';
|
|
7
|
+
import { EntityContentBlueprint } from '../blueprints/EntityContentBlueprint.esm.js';
|
|
8
|
+
|
|
9
|
+
function convertLegacyEntityContentExtension(LegacyExtension, overrides) {
|
|
10
|
+
const element = /* @__PURE__ */ React.createElement(LegacyExtension, null);
|
|
11
|
+
const extName = getComponentData(element, "core.extensionName");
|
|
12
|
+
if (!extName) {
|
|
13
|
+
throw new Error("Extension has no name");
|
|
14
|
+
}
|
|
15
|
+
const mountPoint = getComponentData(
|
|
16
|
+
element,
|
|
17
|
+
"core.mountPoint"
|
|
18
|
+
);
|
|
19
|
+
const plugin = getComponentData(element, "core.plugin");
|
|
20
|
+
const pluginId = plugin?.getId();
|
|
21
|
+
const match = extName.match(/^Entity(.*)Content$/);
|
|
22
|
+
const infix = match?.[1] ?? extName;
|
|
23
|
+
let name = infix;
|
|
24
|
+
if (pluginId && name.toLocaleLowerCase("en-US").startsWith(pluginId.toLocaleLowerCase("en-US"))) {
|
|
25
|
+
name = name.slice(pluginId.length);
|
|
26
|
+
if (!name) {
|
|
27
|
+
name = void 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
name = name && kebabCase(name);
|
|
31
|
+
return EntityContentBlueprint.make({
|
|
32
|
+
name: overrides?.name ?? name,
|
|
33
|
+
params: {
|
|
34
|
+
filter: overrides?.filter,
|
|
35
|
+
defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,
|
|
36
|
+
defaultTitle: overrides?.defaultTitle ?? startCase(infix),
|
|
37
|
+
routeRef: mountPoint && convertLegacyRouteRef(mountPoint),
|
|
38
|
+
loader: async () => compatWrapper(element)
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { convertLegacyEntityContentExtension };
|
|
44
|
+
//# sourceMappingURL=convertLegacyEntityContentExtension.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport React, { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?:\n | typeof EntityContentBlueprint.dataRefs.filterFunction.T\n | typeof EntityContentBlueprint.dataRefs.filterExpression.T;\n defaultPath?: string;\n defaultTitle?: string;\n },\n): ExtensionDefinition<any> {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,\n defaultTitle: overrides?.defaultTitle ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAgCgB,SAAA,mCAAA,CACd,iBACA,SAQ0B,EAAA;AAC1B,EAAM,MAAA,OAAA,uCAAW,eAAgB,EAAA,IAAA,CAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA,CAAA;AAAA,GACzC;AAEA,EAAA,MAAM,UAAa,GAAA,gBAAA;AAAA,IACjB,OAAA;AAAA,IACA,iBAAA;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA,CAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,qBAAqB,CAAA,CAAA;AACjD,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA,CAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA,CAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAAA,GACF;AACA,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA,CAAA;AAE7B,EAAA,OAAO,uBAAuB,IAAK,CAAA;AAAA,IACjC,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,aAAa,SAAW,EAAA,WAAA,IAAe,CAAI,CAAA,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AAAA,MAC3D,YAAc,EAAA,SAAA,EAAW,YAAgB,IAAA,SAAA,CAAU,KAAK,CAAA;AAAA,MACxD,QAAA,EAAU,UAAc,IAAA,qBAAA,CAAsB,UAAU,CAAA;AAAA,MACxD,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO,CAAA;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":"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"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { AnyExtensionInputMap, PortableSchema, ResolvedExtensionInputs,
|
|
3
|
+
import { RouteRef, AnyExtensionInputMap, PortableSchema, ResolvedExtensionInputs, ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
4
7
|
import { Entity } from '@backstage/catalog-model';
|
|
5
8
|
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
6
9
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
@@ -16,6 +19,64 @@ import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/al
|
|
|
16
19
|
*/
|
|
17
20
|
declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @alpha
|
|
24
|
+
* A blueprint for creating cards for the entity pages in the catalog.
|
|
25
|
+
*/
|
|
26
|
+
declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
27
|
+
kind: "entity-card";
|
|
28
|
+
namespace: undefined;
|
|
29
|
+
name: undefined;
|
|
30
|
+
}, {
|
|
31
|
+
loader: () => Promise<JSX.Element>;
|
|
32
|
+
filter?: string | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
33
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
34
|
+
optional: true;
|
|
35
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
36
|
+
optional: true;
|
|
37
|
+
}>, {}, {
|
|
38
|
+
filter: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
filter?: string | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
43
|
+
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @alpha
|
|
48
|
+
* Creates an EntityContent extension.
|
|
49
|
+
*/
|
|
50
|
+
declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
51
|
+
kind: "entity-content";
|
|
52
|
+
namespace: undefined;
|
|
53
|
+
name: undefined;
|
|
54
|
+
}, {
|
|
55
|
+
loader: () => Promise<JSX.Element>;
|
|
56
|
+
defaultPath: string;
|
|
57
|
+
defaultTitle: string;
|
|
58
|
+
routeRef?: RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams> | undefined;
|
|
59
|
+
filter?: string | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
60
|
+
}, _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<React.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
61
|
+
optional: true;
|
|
62
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
63
|
+
optional: true;
|
|
64
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
65
|
+
optional: true;
|
|
66
|
+
}>, {}, {
|
|
67
|
+
path: string | undefined;
|
|
68
|
+
title: string | undefined;
|
|
69
|
+
filter: string | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
filter?: string | undefined;
|
|
72
|
+
title?: string | undefined;
|
|
73
|
+
path?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
title: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}>;
|
|
76
|
+
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
77
|
+
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
78
|
+
}>;
|
|
79
|
+
|
|
19
80
|
/**
|
|
20
81
|
* Utility type to expand type aliases into their equivalent type.
|
|
21
82
|
* @ignore
|
|
@@ -96,13 +157,19 @@ declare const catalogReactTranslationRef: _backstage_core_plugin_api_alpha.Trans
|
|
|
96
157
|
readonly "userListPicker.personalFilter.starredLabel": "Starred";
|
|
97
158
|
}>;
|
|
98
159
|
|
|
99
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* @alpha
|
|
162
|
+
* @deprecated use `dataRefs` property on either {@link EntityCardBlueprint} or {@link EntityContentBlueprint} instead
|
|
163
|
+
*/
|
|
100
164
|
declare const catalogExtensionData: {
|
|
101
165
|
entityContentTitle: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}>;
|
|
102
166
|
entityFilterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
103
167
|
entityFilterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
104
168
|
};
|
|
105
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* @alpha
|
|
171
|
+
* @deprecated use {@link EntityCardBlueprint} instead
|
|
172
|
+
*/
|
|
106
173
|
declare function createEntityCardExtension<TConfig extends {
|
|
107
174
|
filter?: string;
|
|
108
175
|
}, TInputs extends AnyExtensionInputMap>(options: {
|
|
@@ -120,8 +187,15 @@ declare function createEntityCardExtension<TConfig extends {
|
|
|
120
187
|
config: TConfig;
|
|
121
188
|
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
122
189
|
}) => Promise<JSX.Element>;
|
|
123
|
-
}): _backstage_frontend_plugin_api.ExtensionDefinition<TConfig
|
|
124
|
-
|
|
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
|
+
*/
|
|
125
199
|
declare function createEntityContentExtension<TInputs extends AnyExtensionInputMap>(options: {
|
|
126
200
|
namespace?: string;
|
|
127
201
|
name?: string;
|
|
@@ -146,6 +220,24 @@ declare function createEntityContentExtension<TInputs extends AnyExtensionInputM
|
|
|
146
220
|
filter?: string | undefined;
|
|
147
221
|
title?: string | undefined;
|
|
148
222
|
path?: string | undefined;
|
|
223
|
+
}, never, never, {
|
|
224
|
+
kind?: string | undefined;
|
|
225
|
+
namespace?: string | undefined;
|
|
226
|
+
name?: string | undefined;
|
|
149
227
|
}>;
|
|
150
228
|
|
|
151
|
-
|
|
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
|
+
|
|
243
|
+
export { EntityCardBlueprint, EntityContentBlueprint, catalogExtensionData, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, createEntityCardExtension, createEntityContentExtension, isOwnerOf, useEntityPermission };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,103 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { EntityCardBlueprint } from './alpha/blueprints/EntityCardBlueprint.esm.js';
|
|
2
|
+
export { EntityContentBlueprint } from './alpha/blueprints/EntityContentBlueprint.esm.js';
|
|
3
|
+
export { catalogExtensionData, createEntityCardExtension, createEntityContentExtension } from './alpha/extensions.esm.js';
|
|
4
|
+
export { convertLegacyEntityCardExtension } from './alpha/converters/convertLegacyEntityCardExtension.esm.js';
|
|
5
|
+
export { convertLegacyEntityContentExtension } from './alpha/converters/convertLegacyEntityContentExtension.esm.js';
|
|
3
6
|
export { useEntityPermission } from './hooks/useEntityPermission.esm.js';
|
|
4
|
-
import '@backstage/catalog-model';
|
|
5
7
|
export { isOwnerOf } from './utils/isOwnerOf.esm.js';
|
|
6
8
|
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
9
|
//# sourceMappingURL=alpha.esm.js.map
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[
|
|
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/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ApiRef, IconComponent } from '@backstage/core-plugin-api';
|
|
|
6
6
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
7
7
|
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
|
|
8
8
|
import { Observable } from '@backstage/types';
|
|
9
|
-
import
|
|
9
|
+
import React__default, { PropsWithChildren, ReactNode, ComponentProps } from 'react';
|
|
10
10
|
import { LinkProps, InfoCardVariants, TableColumn, TableOptions } from '@backstage/core-components';
|
|
11
11
|
import IconButton from '@material-ui/core/IconButton';
|
|
12
12
|
import { TextFieldProps } from '@material-ui/core/TextField';
|
|
@@ -201,18 +201,18 @@ declare class MockStarredEntitiesApi implements StarredEntitiesApi {
|
|
|
201
201
|
/** @public */
|
|
202
202
|
declare const CatalogFilterLayout: {
|
|
203
203
|
(props: {
|
|
204
|
-
children:
|
|
205
|
-
}):
|
|
204
|
+
children: React__default.ReactNode;
|
|
205
|
+
}): React__default.JSX.Element;
|
|
206
206
|
Filters: (props: {
|
|
207
|
-
children:
|
|
207
|
+
children: React__default.ReactNode;
|
|
208
208
|
options?: {
|
|
209
209
|
drawerBreakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
210
210
|
drawerAnchor?: 'left' | 'right' | 'top' | 'bottom';
|
|
211
211
|
};
|
|
212
|
-
}) =>
|
|
212
|
+
}) => React__default.JSX.Element;
|
|
213
213
|
Content: (props: {
|
|
214
|
-
children:
|
|
215
|
-
}) =>
|
|
214
|
+
children: React__default.ReactNode;
|
|
215
|
+
}) => React__default.JSX.Element;
|
|
216
216
|
};
|
|
217
217
|
|
|
218
218
|
/** @public */
|
|
@@ -249,7 +249,7 @@ type EntityOwnerPickerProps = {
|
|
|
249
249
|
mode?: 'owners-only' | 'all';
|
|
250
250
|
};
|
|
251
251
|
/** @public */
|
|
252
|
-
declare const EntityOwnerPicker: (props?: EntityOwnerPickerProps) =>
|
|
252
|
+
declare const EntityOwnerPicker: (props?: EntityOwnerPickerProps) => React__default.JSX.Element | null;
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
255
|
* Props for default filters.
|
|
@@ -263,7 +263,7 @@ type DefaultFiltersProps = {
|
|
|
263
263
|
initiallySelectedNamespaces?: string[];
|
|
264
264
|
};
|
|
265
265
|
/** @public */
|
|
266
|
-
declare const DefaultFilters: (props: DefaultFiltersProps) =>
|
|
266
|
+
declare const DefaultFilters: (props: DefaultFiltersProps) => React__default.JSX.Element;
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* Props for {@link EntityKindPicker}.
|
|
@@ -280,14 +280,14 @@ interface EntityKindPickerProps {
|
|
|
280
280
|
hidden?: boolean;
|
|
281
281
|
}
|
|
282
282
|
/** @public */
|
|
283
|
-
declare const EntityKindPicker: (props: EntityKindPickerProps) =>
|
|
283
|
+
declare const EntityKindPicker: (props: EntityKindPickerProps) => React__default.JSX.Element | null;
|
|
284
284
|
|
|
285
285
|
/** @public */
|
|
286
286
|
type CatalogReactEntityLifecyclePickerClassKey = 'input';
|
|
287
287
|
/** @public */
|
|
288
288
|
declare const EntityLifecyclePicker: (props: {
|
|
289
289
|
initialFilter?: string[];
|
|
290
|
-
}) =>
|
|
290
|
+
}) => React__default.JSX.Element;
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* The available style class keys for {@link EntityDisplayName}, under the name
|
|
@@ -326,7 +326,7 @@ type EntityRefLinkProps = {
|
|
|
326
326
|
defaultNamespace?: string;
|
|
327
327
|
/** @deprecated This option should no longer be used; presentation is requested through the {@link entityPresentationApiRef} instead */
|
|
328
328
|
title?: string;
|
|
329
|
-
children?:
|
|
329
|
+
children?: React__default.ReactNode;
|
|
330
330
|
hideIcon?: boolean;
|
|
331
331
|
} & Omit<LinkProps, 'to'>;
|
|
332
332
|
/**
|
|
@@ -355,7 +355,7 @@ type EntityRefLinksProps<TRef extends string | CompoundEntityRef | Entity> = {
|
|
|
355
355
|
*
|
|
356
356
|
* @public
|
|
357
357
|
*/
|
|
358
|
-
declare function EntityRefLinks<TRef extends string | CompoundEntityRef | Entity>(props: EntityRefLinksProps<TRef>):
|
|
358
|
+
declare function EntityRefLinks<TRef extends string | CompoundEntityRef | Entity>(props: EntityRefLinksProps<TRef>): React__default.JSX.Element;
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
361
|
* @param defaultNamespace - if set to false then namespace is never omitted,
|
|
@@ -382,7 +382,7 @@ type EntityPeekAheadPopoverProps = PropsWithChildren<{
|
|
|
382
382
|
*
|
|
383
383
|
* @public
|
|
384
384
|
*/
|
|
385
|
-
declare const EntityPeekAheadPopover: (props: EntityPeekAheadPopoverProps) =>
|
|
385
|
+
declare const EntityPeekAheadPopover: (props: EntityPeekAheadPopoverProps) => React__default.JSX.Element;
|
|
386
386
|
|
|
387
387
|
/** @public */
|
|
388
388
|
type CatalogReactEntitySearchBarClassKey = 'searchToolbar' | 'input';
|
|
@@ -390,7 +390,7 @@ type CatalogReactEntitySearchBarClassKey = 'searchToolbar' | 'input';
|
|
|
390
390
|
* Renders search bar for filtering the entity list.
|
|
391
391
|
* @public
|
|
392
392
|
*/
|
|
393
|
-
declare const EntitySearchBar: () =>
|
|
393
|
+
declare const EntitySearchBar: () => React__default.JSX.Element;
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
396
|
* Props for {@link EntityTable}.
|
|
@@ -412,7 +412,7 @@ interface EntityTableProps<T extends Entity> {
|
|
|
412
412
|
* @public
|
|
413
413
|
*/
|
|
414
414
|
declare const EntityTable: {
|
|
415
|
-
<T extends Entity>(props: EntityTableProps<T>):
|
|
415
|
+
<T extends Entity>(props: EntityTableProps<T>): React__default.JSX.Element;
|
|
416
416
|
columns: Readonly<{
|
|
417
417
|
createEntityRefColumn<T_1 extends Entity>(options: {
|
|
418
418
|
defaultKind?: string | undefined;
|
|
@@ -464,7 +464,7 @@ type EntityTagPickerProps = {
|
|
|
464
464
|
showCounts?: boolean;
|
|
465
465
|
};
|
|
466
466
|
/** @public */
|
|
467
|
-
declare const EntityTagPicker: (props: EntityTagPickerProps) =>
|
|
467
|
+
declare const EntityTagPicker: (props: EntityTagPickerProps) => React__default.JSX.Element;
|
|
468
468
|
|
|
469
469
|
/**
|
|
470
470
|
* Props for {@link EntityTypePicker}.
|
|
@@ -476,7 +476,7 @@ interface EntityTypePickerProps {
|
|
|
476
476
|
hidden?: boolean;
|
|
477
477
|
}
|
|
478
478
|
/** @public */
|
|
479
|
-
declare const EntityTypePicker: (props: EntityTypePickerProps) =>
|
|
479
|
+
declare const EntityTypePicker: (props: EntityTypePickerProps) => React__default.JSX.Element | null;
|
|
480
480
|
|
|
481
481
|
/** @public */
|
|
482
482
|
type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
|
|
@@ -487,7 +487,7 @@ type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
|
|
|
487
487
|
* @param props - MaterialUI IconButton props extended by required `entity` prop
|
|
488
488
|
* @public
|
|
489
489
|
*/
|
|
490
|
-
declare const FavoriteEntity: (props: FavoriteEntityProps) =>
|
|
490
|
+
declare const FavoriteEntity: (props: FavoriteEntityProps) => React__default.JSX.Element;
|
|
491
491
|
|
|
492
492
|
/**
|
|
493
493
|
* A dialog that lets users inspect the low level details of their entities.
|
|
@@ -498,7 +498,7 @@ declare function InspectEntityDialog(props: {
|
|
|
498
498
|
open: boolean;
|
|
499
499
|
entity: Entity;
|
|
500
500
|
onClose: () => void;
|
|
501
|
-
}):
|
|
501
|
+
}): React__default.JSX.Element | null;
|
|
502
502
|
|
|
503
503
|
/** @public */
|
|
504
504
|
type UnregisterEntityDialogProps = {
|
|
@@ -508,7 +508,7 @@ type UnregisterEntityDialogProps = {
|
|
|
508
508
|
entity: Entity;
|
|
509
509
|
};
|
|
510
510
|
/** @public */
|
|
511
|
-
declare const UnregisterEntityDialog: (props: UnregisterEntityDialogProps) =>
|
|
511
|
+
declare const UnregisterEntityDialog: (props: UnregisterEntityDialogProps) => React__default.JSX.Element;
|
|
512
512
|
|
|
513
513
|
/** @public */
|
|
514
514
|
type CatalogReactUserListPickerClassKey = 'root' | 'title' | 'listIcon' | 'menuItem' | 'groupWrapper';
|
|
@@ -518,12 +518,12 @@ type UserListPickerProps = {
|
|
|
518
518
|
availableFilters?: UserListFilterKind[];
|
|
519
519
|
};
|
|
520
520
|
/** @public */
|
|
521
|
-
declare const UserListPicker: (props: UserListPickerProps) =>
|
|
521
|
+
declare const UserListPicker: (props: UserListPickerProps) => React__default.JSX.Element;
|
|
522
522
|
|
|
523
523
|
/** @public */
|
|
524
524
|
type CatalogReactEntityProcessingStatusPickerClassKey = 'input';
|
|
525
525
|
/** @public */
|
|
526
|
-
declare const EntityProcessingStatusPicker: () =>
|
|
526
|
+
declare const EntityProcessingStatusPicker: () => React__default.JSX.Element;
|
|
527
527
|
|
|
528
528
|
/** @public */
|
|
529
529
|
type CatalogReactEntityNamespacePickerClassKey = 'input';
|
|
@@ -536,7 +536,7 @@ interface EntityNamespacePickerProps {
|
|
|
536
536
|
initiallySelectedNamespaces?: string[];
|
|
537
537
|
}
|
|
538
538
|
/** @public */
|
|
539
|
-
declare const EntityNamespacePicker: (props: EntityNamespacePickerProps) =>
|
|
539
|
+
declare const EntityNamespacePicker: (props: EntityNamespacePickerProps) => React__default.JSX.Element;
|
|
540
540
|
|
|
541
541
|
/**
|
|
542
542
|
* Filter entities based on Kind.
|
|
@@ -720,7 +720,7 @@ type EntityListContextProps<EntityFilters extends DefaultEntityFilters = Default
|
|
|
720
720
|
* Creates new context for entity listing and filtering.
|
|
721
721
|
* @public
|
|
722
722
|
*/
|
|
723
|
-
declare const EntityListContext:
|
|
723
|
+
declare const EntityListContext: React__default.Context<EntityListContextProps<any> | undefined>;
|
|
724
724
|
/**
|
|
725
725
|
* @public
|
|
726
726
|
*/
|
|
@@ -733,7 +733,7 @@ type EntityListProviderProps = PropsWithChildren<{
|
|
|
733
733
|
* Provides entities and filters for a catalog listing.
|
|
734
734
|
* @public
|
|
735
735
|
*/
|
|
736
|
-
declare const EntityListProvider: <EntityFilters extends DefaultEntityFilters>(props: EntityListProviderProps) =>
|
|
736
|
+
declare const EntityListProvider: <EntityFilters extends DefaultEntityFilters>(props: EntityListProviderProps) => React__default.JSX.Element;
|
|
737
737
|
/**
|
|
738
738
|
* Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
|
|
739
739
|
* @public
|
|
@@ -762,7 +762,7 @@ type EntityAutocompletePickerProps<T extends DefaultEntityFilters = DefaultEntit
|
|
|
762
762
|
/** @public */
|
|
763
763
|
type CatalogReactEntityAutocompletePickerClassKey = 'root' | 'label';
|
|
764
764
|
/** @public */
|
|
765
|
-
declare function EntityAutocompletePicker<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>>(props: EntityAutocompletePickerProps<T, Name>):
|
|
765
|
+
declare function EntityAutocompletePicker<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>>(props: EntityAutocompletePickerProps<T, Name>): React__default.JSX.Element | null;
|
|
766
766
|
|
|
767
767
|
/** @public */
|
|
768
768
|
type MissingAnnotationEmptyStateClassKey = 'code';
|
|
@@ -773,7 +773,7 @@ type MissingAnnotationEmptyStateClassKey = 'code';
|
|
|
773
773
|
declare function MissingAnnotationEmptyState(props: {
|
|
774
774
|
annotation: string | string[];
|
|
775
775
|
readMoreUrl?: string;
|
|
776
|
-
}):
|
|
776
|
+
}): React__default.JSX.Element;
|
|
777
777
|
|
|
778
778
|
/** @public */
|
|
779
779
|
type EntityLoadingStatus<TEntity extends Entity = Entity> = {
|
|
@@ -799,7 +799,7 @@ interface AsyncEntityProviderProps {
|
|
|
799
799
|
*
|
|
800
800
|
* @public
|
|
801
801
|
*/
|
|
802
|
-
declare const AsyncEntityProvider: (props: AsyncEntityProviderProps) =>
|
|
802
|
+
declare const AsyncEntityProvider: (props: AsyncEntityProviderProps) => React__default.JSX.Element;
|
|
803
803
|
/**
|
|
804
804
|
* Properties for the EntityProvider component.
|
|
805
805
|
*
|
|
@@ -814,7 +814,7 @@ interface EntityProviderProps {
|
|
|
814
814
|
*
|
|
815
815
|
* @public
|
|
816
816
|
*/
|
|
817
|
-
declare const EntityProvider: (props: EntityProviderProps) =>
|
|
817
|
+
declare const EntityProvider: (props: EntityProviderProps) => React__default.JSX.Element;
|
|
818
818
|
/**
|
|
819
819
|
* Grab the current entity from the context, throws if the entity has not yet been loaded
|
|
820
820
|
* or is not available.
|
|
@@ -915,7 +915,7 @@ declare function entityRouteParams(entity: Entity): {
|
|
|
915
915
|
/** @public */
|
|
916
916
|
declare function MockEntityListContextProvider<T extends DefaultEntityFilters = DefaultEntityFilters>(props: PropsWithChildren<{
|
|
917
917
|
value?: Partial<EntityListContextProps<T>>;
|
|
918
|
-
}>):
|
|
918
|
+
}>): React__default.JSX.Element;
|
|
919
919
|
|
|
920
920
|
/** @public */
|
|
921
921
|
type CatalogReactComponentsNameToClassKey = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-react",
|
|
3
|
-
"version": "1.12.3
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "A frontend library that helps other Backstage plugins interact with the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -56,16 +56,17 @@
|
|
|
56
56
|
"test": "backstage-cli package test"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@backstage/catalog-client": "^1.6.
|
|
60
|
-
"@backstage/catalog-model": "^1.
|
|
61
|
-
"@backstage/core-
|
|
59
|
+
"@backstage/catalog-client": "^1.6.6",
|
|
60
|
+
"@backstage/catalog-model": "^1.6.0",
|
|
61
|
+
"@backstage/core-compat-api": "^0.2.8",
|
|
62
|
+
"@backstage/core-components": "^0.14.10",
|
|
62
63
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
63
64
|
"@backstage/errors": "^1.2.4",
|
|
64
|
-
"@backstage/frontend-plugin-api": "^0.7.0
|
|
65
|
-
"@backstage/integration-react": "^1.1.30
|
|
66
|
-
"@backstage/plugin-catalog-common": "^1.0.26
|
|
67
|
-
"@backstage/plugin-permission-common": "^0.8.1
|
|
68
|
-
"@backstage/plugin-permission-react": "^0.4.25
|
|
65
|
+
"@backstage/frontend-plugin-api": "^0.7.0",
|
|
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",
|
|
69
70
|
"@backstage/types": "^1.1.1",
|
|
70
71
|
"@backstage/version-bridge": "^1.0.8",
|
|
71
72
|
"@material-ui/core": "^4.12.2",
|
|
@@ -82,11 +83,12 @@
|
|
|
82
83
|
"zen-observable": "^0.10.0"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
|
-
"@backstage/cli": "^0.27.0
|
|
86
|
-
"@backstage/core-app-api": "^1.14.2
|
|
87
|
-
"@backstage/
|
|
88
|
-
"@backstage/plugin-
|
|
89
|
-
"@backstage/
|
|
86
|
+
"@backstage/cli": "^0.27.0",
|
|
87
|
+
"@backstage/core-app-api": "^1.14.2",
|
|
88
|
+
"@backstage/frontend-test-utils": "^0.1.12",
|
|
89
|
+
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
90
|
+
"@backstage/plugin-scaffolder-common": "^1.5.5",
|
|
91
|
+
"@backstage/test-utils": "^1.5.10",
|
|
90
92
|
"@testing-library/dom": "^10.0.0",
|
|
91
93
|
"@testing-library/jest-dom": "^6.0.0",
|
|
92
94
|
"@testing-library/react": "^15.0.0",
|